summary refs log tree commit diff
path: root/pkgs/games/openmw
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/games/openmw
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/games/openmw')
-rw-r--r--pkgs/games/openmw/default.nix47
-rw-r--r--pkgs/games/openmw/tes3mp.nix190
2 files changed, 153 insertions, 84 deletions
diff --git a/pkgs/games/openmw/default.nix b/pkgs/games/openmw/default.nix
index 22f3ea8d6ad..8e6ed3cdb82 100644
--- a/pkgs/games/openmw/default.nix
+++ b/pkgs/games/openmw/default.nix
@@ -1,16 +1,32 @@
-{ stdenv, mkDerivationWith, fetchFromGitHub, qtbase, openscenegraph, mygui, bullet, ffmpeg_3
-, boost, cmake, SDL2, unshield, openal, libXt, pkgconfig }:
+{ lib
+, mkDerivation
+, fetchFromGitHub
+, cmake
+, pkg-config
+, openscenegraph
+, mygui
+, bullet
+, ffmpeg
+, boost
+, SDL2
+, unshield
+, openal
+, libXt
+}:
 
 let
   openscenegraph_ = openscenegraph.overrideDerivation (self: {
     src = fetchFromGitHub {
       owner = "OpenMW";
       repo = "osg";
+      # commit does not exist on any branch on the target repository
       rev = "1556cd7966ebc1c80b6626988d2b25fb43a744cf";
       sha256 = "0d74hijzmj82nx3jkv5qmr3pkgvplra0b8fbjx1y3vmzxamb0axd";
     };
   });
-in mkDerivationWith stdenv.mkDerivation rec {
+
+in
+mkDerivation rec {
   version = "0.46.0";
   pname = "openmw";
 
@@ -21,20 +37,33 @@ in mkDerivationWith stdenv.mkDerivation rec {
     sha256 = "0rm32zsmxvr6b0jjihfj543skhicbw5kg6shjx312clhlm035w2x";
   };
 
-  enableParallelBuilding = true;
+  nativeBuildInputs = [ cmake pkg-config ];
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ cmake boost ffmpeg_3 bullet mygui openscenegraph_ SDL2 unshield openal libXt qtbase ];
+  buildInputs = [
+    SDL2
+    boost
+    bullet
+    ffmpeg
+    libXt
+    mygui
+    openal
+    openscenegraph_
+    unshield
+  ];
 
   cmakeFlags = [
     "-DDESIRED_QT_VERSION:INT=5"
+    # as of 0.46, openmw is broken with GLVND
+    "-DOpenGL_GL_PREFERENCE=LEGACY"
   ];
 
-  meta = with stdenv.lib; {
+  dontWrapQtApps = true;
+
+  meta = with lib; {
     description = "An unofficial open source engine reimplementation of the game Morrowind";
     homepage = "http://openmw.org";
-    license = licenses.gpl3;
-    platforms = platforms.linux;
+    license = licenses.gpl3Plus;
     maintainers = with maintainers; [ abbradar ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/games/openmw/tes3mp.nix b/pkgs/games/openmw/tes3mp.nix
index df332c0e5bf..72b698ceb73 100644
--- a/pkgs/games/openmw/tes3mp.nix
+++ b/pkgs/games/openmw/tes3mp.nix
@@ -1,94 +1,134 @@
-{ stdenv, cmake, openmw, fetchFromGitHub, luajit, makeWrapper, mygui }:
+{ lib
+, stdenv
+, cmake
+, openmw
+, fetchFromGitHub
+, formats
+, luajit
+, makeWrapper
+, symlinkJoin
+, mygui
+, crudini
+}:
 
 # revisions are taken from https://github.com/GrimKriegor/TES3MP-deploy
 
 let
-  # TES3MP_STABLE_VERSION_FILE
-  compatHash = "292536439eeda58becdb7e441fe2e61ebb74529e";
-  rakNet = fetchFromGitHub {
-    owner = "TES3MP";
-    repo = "CrabNet";
-    # usually fixed:
-    # https://github.com/GrimKriegor/TES3MP-deploy/blob/d2a4a5d3acb64b16d9b8ca85906780aeea8d311b/tes3mp-deploy.sh#L589
-    rev = "4eeeaad2f6c11aeb82070df35169694b4fb7b04b";
-    sha256 = "0p0li9l1i5lcliswm5w9jql0zff9i6fwhiq0bl130m4i7vpr4cr3";
-  };
-  rakNetLibrary = stdenv.mkDerivation {
-    name = "RakNetLibrary";
-    src = rakNet;
+  # raknet could also be split into dev and lib outputs
+  raknet = stdenv.mkDerivation {
+    pname = "raknet";
+    version = "unstable-2018-07-14";
+
+    src = fetchFromGitHub {
+      owner = "TES3MP";
+      repo = "CrabNet";
+      # usually fixed:
+      # https://github.com/GrimKriegor/TES3MP-deploy/blob/d2a4a5d3acb64b16d9b8ca85906780aeea8d311b/tes3mp-deploy.sh#L589
+      rev = "4eeeaad2f6c11aeb82070df35169694b4fb7b04b";
+      sha256 = "0p0li9l1i5lcliswm5w9jql0zff9i6fwhiq0bl130m4i7vpr4cr3";
+    };
+
     nativeBuildInputs = [ cmake ];
+
     installPhase = ''
-      install -Dm755 lib/libRakNetLibStatic.a $out/lib/libRakNetLibStatic.a
+      install -Dm555 lib/libRakNetLibStatic.a $out/lib/libRakNetLibStatic.a
     '';
   };
-  coreScripts = fetchFromGitHub {
-    owner = "TES3MP";
-    repo = "CoreScripts";
-    # usually latest in stable branch (e.g. 0.7.0)
-    rev = "24aae91d9ddad38cdb3b0e0a13af59f142803e94";
-    sha256 = "1rfmxxr9ircfagdpbdrzl26msdhx1i3g974cblbv69078cradfh3";
+
+  coreScripts = stdenv.mkDerivation {
+    pname = "corescripts";
+    version = "unstable-2020-07-27";
+
+    src = fetchFromGitHub {
+      owner = "TES3MP";
+      repo = "CoreScripts";
+      # usually latest in stable branch (e.g. 0.7.1)
+      rev = "3c2d31595344db586d8585db0ef1fc0da89898a0";
+      sha256 = "sha256-m/pt2Et58HOMc1xqllGf4hjPLXNcc14+X0h84ouZDeg=";
+    };
+
+    buildCommand = ''
+      dir=$out/share/openmw-tes3mp
+      mkdir -p $dir
+      cp -r $src $dir/CoreScripts
+    '';
   };
-  # https://github.com/TES3MP/openmw-tes3mp/issues/555
-  mygui_ = mygui.overrideAttrs (oldAttrs: rec {
-    version = "3.2.2";
+
+  # build an unwrapped version so we don't have to rebuild it all over again in
+  # case the scripts or wrapper scripts change.
+  unwrapped = openmw.overrideAttrs (oldAttrs: rec {
+    pname = "openmw-tes3mp-unwrapped";
+    version = "unstable-2020-08-07";
 
     src = fetchFromGitHub {
-      owner = "MyGUI";
-      repo = "mygui";
-      rev = "MyGUI${version}";
-      sha256 = "1wk7jmwm55rhlqqcyvqsxdmwvl70bysl9azh4kd9n57qlmgk3zmw";
+      owner = "TES3MP";
+      repo = "openmw-tes3mp";
+      # usually latest in stable branch (e.g. 0.7.1)
+      rev = "ce5df6d18546e37aac9746d99c00d27a7f34b00d";
+      sha256 = "sha256-xLslShNA6rVFl9kt6BNGDpSYMpO25jBTCteLJoSTXdg=";
+    };
+
+    nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ makeWrapper ];
+
+    buildInputs = oldAttrs.buildInputs ++ [ luajit ];
+
+    cmakeFlags = oldAttrs.cmakeFlags ++ [
+      "-DBUILD_OPENCS=OFF"
+      "-DRakNet_INCLUDES=${raknet.src}/include"
+      "-DRakNet_LIBRARY_RELEASE=${raknet}/lib/libRakNetLibStatic.a"
+      "-DRakNet_LIBRARY_DEBUG=${raknet}/lib/libRakNetLibStatic.a"
+    ];
+
+    # https://github.com/TES3MP/openmw-tes3mp/issues/552
+    patches = [ ./tes3mp.patch ];
+
+    NIX_CFLAGS_COMPILE = "-fpermissive";
+
+    preConfigure = ''
+      substituteInPlace files/version.in \
+        --subst-var-by OPENMW_VERSION_COMMITHASH ${src.rev}
+    '';
+
+    # move everything that we wrap out of the way
+    postInstall = ''
+      mkdir -p $out/libexec
+      mv $out/bin/tes3mp-* $out/libexec
+    '';
+
+    meta = with lib; {
+      description = "Multiplayer for TES3:Morrowind based on OpenMW";
+      homepage = "https://tes3mp.com/";
+      license = licenses.gpl3Only;
+      maintainers = with maintainers; [ peterhoeg ];
+      platforms = [ "x86_64-linux" "i686-linux" ];
     };
   });
-in openmw.overrideAttrs (oldAttrs: rec {
-  version = "2019-11-19";
-  name = "openmw-tes3mp-${version}";
-
-  src = fetchFromGitHub {
-    owner = "TES3MP";
-    repo = "openmw-tes3mp";
-    # usually latest in stable branch (e.g. 0.7.0)
-    rev = "ad9ee80641a3e22d0780daca051df7f4e90f3615";
-    sha256 = "03a1vldiv5lk7yq6lhicx3qz8hjfxhind2dj0w9lg5839ljyk6jv";
+
+  cfgFile = (formats.ini { }).generate "tes3mp-server.cfg" {
+    Plugins.home = "${coreScripts}/share/openmw-tes3mp/CoreScripts";
   };
 
-  nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ makeWrapper ];
-  buildInputs = [ luajit mygui_ ] ++ oldAttrs.buildInputs;
-
-  cmakeFlags = oldAttrs.cmakeFlags ++ [
-    "-DBUILD_OPENCS=OFF"
-    "-DRakNet_INCLUDES=${rakNet}/include"
-    "-DRakNet_LIBRARY_RELEASE=${rakNetLibrary}/lib/libRakNetLibStatic.a"
-    "-DRakNet_LIBRARY_DEBUG=${rakNetLibrary}/lib/libRakNetLibStatic.a"
-  ];
-
-  # https://github.com/TES3MP/openmw-tes3mp/issues/552
-  patches = [
-    ./tes3mp.patch
-  ];
-  NIX_CFLAGS_COMPILE = "-fpermissive";
-
-  preConfigure = ''
-    substituteInPlace files/version.in \
-      --subst-var-by OPENMW_VERSION_COMMITHASH ${compatHash}
-  '';
+in
+symlinkJoin rec {
+  name = "openmw-tes3mp-${unwrapped.version}";
+  inherit (unwrapped) version meta;
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  paths = [ unwrapped ];
+
+  # crudini --merge will create the file if it doesn't exist
+  postBuild = ''
+    mkdir -p $out/bin
 
-  postInstall = ''
-    # components/process/processinvoker.cpp: path.prepend(QLatin1String("./"))
-    wrapProgram $out/bin/tes3mp-browser \
+    dir=\''${XDG_CONFIG_HOME:-\$HOME/.config}/openmw
+
+    makeWrapper ${unwrapped}/libexec/tes3mp-browser $out/bin/tes3mp-browser \
       --run "cd $out/bin"
-    wrapProgram $out/bin/tes3mp-server \
-      --run "mkdir -p ~/.config/openmw" \
-      --run "cd ~/.config/openmw" \
-      --run "[ -d CoreScripts ] || cp --no-preserve=mode -r ${coreScripts} CoreScripts" \
-      --run "[ -f tes3mp-server.cfg ] || echo \"[Plugins] home = \$HOME/.config/openmw/CoreScripts\" > tes3mp-server.cfg" \
+
+    makeWrapper ${unwrapped}/libexec/tes3mp-server $out/bin/tes3mp-server \
+      --run "mkdir -p $dir" \
+      --run "${crudini}/bin/crudini --merge $dir/${cfgFile.name} < ${cfgFile}" \
       --run "cd $out/bin"
   '';
-
-  meta = with stdenv.lib; {
-    description = "Multiplayer for TES3:Morrowind based on OpenMW";
-    homepage = "https://tes3mp.com/";
-    license = licenses.gpl3;
-    platforms = [ "x86_64-linux" "i686-linux" ];
-    maintainers = with maintainers; [ gnidorah ];
-  };
-})
+}