1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 04:02:10 +00:00

openmw-tes3mp: 0.7.0-alpha -> 2019-06-09

Closes #64587.

abbradar: clarify source of CrabNet revision.
This commit is contained in:
gnidorah 2019-07-18 19:51:46 +03:00 committed by Nikolay Amiantov
parent 3670450fc6
commit 32e72ad896

View file

@ -1,102 +1,77 @@
{ stdenv, fetchFromGitHub, qtbase, openscenegraph, mygui, bullet, ffmpeg, boost, cmake, SDL2, unshield, openal
, libXt, writeScriptBin, makeWrapper, ncurses, libGL, luajit }:
{ stdenv, cmake, openmw, fetchFromGitHub, luajit, makeWrapper }:
# revisions are taken from https://github.com/GrimKriegor/TES3MP-deploy
let
version = "0.7.0-alpha";
TES3MP = fetchFromGitHub {
owner = "TES3MP";
repo = "openmw-tes3mp";
rev = version;
sha256 = "012f50f9jd29qcdww2vk4habg6pmxvxl0q6rrjq8xchb0566712q";
};
CallFF = fetchFromGitHub {
owner = "Koncord";
repo = "CallFF";
rev = "da94b59ffe95d45bf98b9264e3d1279c9f6ebb6b";
sha256 = "10wgiqmknh0av968c6r74n5n2izxsx8qawfrab57kkmj9h0zp0pm";
};
CrabNet = fetchFromGitHub {
# TES3MP_STABLE_VERSION_FILE
compatHash = "292536439eeda58becdb7e441fe2e61ebb74529e";
rakNet = fetchFromGitHub {
owner = "TES3MP";
repo = "CrabNet";
rev = "ab1306050fe0f5b0f9c4f56893a79e56a9459567";
sha256 = "03q76pjv9mdi7w832b23q1mj4r2wb0hsnh4kpvwai607g04l0pp0";
# usually fixed:
# https://github.com/GrimKriegor/TES3MP-deploy/blob/d2a4a5d3acb64b16d9b8ca85906780aeea8d311b/tes3mp-deploy.sh#L589
rev = "4eeeaad2f6c11aeb82070df35169694b4fb7b04b";
sha256 = "0p0li9l1i5lcliswm5w9jql0zff9i6fwhiq0bl130m4i7vpr4cr3";
};
CoreScripts = fetchFromGitHub {
rakNetLibrary = stdenv.mkDerivation {
name = "RakNetLibrary";
src = rakNet;
nativeBuildInputs = [ cmake ];
installPhase = ''
install -Dm755 lib/libRakNetLibStatic.a $out/lib/libRakNetLibStatic.a
'';
};
coreScripts = fetchFromGitHub {
owner = "TES3MP";
repo = "CoreScripts";
rev = "1e9f69f98051b2639b18203f989ffbd0a4b427ea";
sha256 = "03ysi7rh0k78kv4slvmkxpymxvdpr8b6hwr1lvjdgq7rq0ljy0lg";
# usually latest master
rev = "71e15fa3b1d5131b6607ba1589f41c06672ce376";
sha256 = "1kwii8rpsxjmz4dh06wb0qaix17hq5s1qsvysv6n6209vlclfxjg";
};
fakegit = writeScriptBin "git" ''
#! ${stdenv.shell}
'';
in stdenv.mkDerivation rec {
inherit version;
name = "tes3mp-${version}";
in openmw.overrideAttrs (oldAttrs: rec {
version = "2019-06-09";
name = "openmw-tes3mp-${version}";
src = fetchFromGitHub {
owner = "GrimKriegor";
repo = "TES3MP-deploy";
rev = "1dd78a3e2cf9f4fe85bf7ca9c393251968a9c325";
sha256 = "1bp9c4kds9q0xhbn4sxb7n0f6rvb45gzx7ljdgc56wz4j5rfi3xn";
owner = "TES3MP";
repo = "openmw-tes3mp";
# usually latest in stable branch (e.g. 0.7.0)
rev = "01804af100785bc2c162d568258d9662012627a3";
sha256 = "0j99v9vvmic0bqw3y4550k1dy058lwvs9s9qcjmxh1wkqkvrpdnp";
};
dontUseCmakeConfigure = true;
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ makeWrapper ];
buildInputs = oldAttrs.buildInputs ++ [ luajit ];
nativeBuildInputs = [ cmake makeWrapper fakegit ];
buildInputs = [ boost ffmpeg qtbase bullet mygui openscenegraph SDL2 unshield openal libXt
ncurses libGL luajit ];
cmakeFlags = oldAttrs.cmakeFlags ++ [
"-DBUILD_OPENCS=OFF"
"-DRakNet_INCLUDES=${rakNet}/include"
"-DRakNet_LIBRARY_RELEASE=${rakNetLibrary}/lib/libRakNetLibStatic.a"
"-DRakNet_LIBRARY_DEBUG=${rakNetLibrary}/lib/libRakNetLibStatic.a"
];
buildPhase = ''
mkdir dependencies keepers
cp --no-preserve=mode -r ${TES3MP} code
cp --no-preserve=mode -r ${CallFF} dependencies/callff
cp --no-preserve=mode -r ${CrabNet} dependencies/raknet
cp --no-preserve=mode -r ${CoreScripts} keepers/CoreScripts
substituteInPlace tes3mp-deploy.sh \
--replace "-DBUILD_OPENCS=OFF" "-DBUILD_OPENCS=OFF -DCMAKE_INSTALL_PREFIX=$out"
patchShebangs tes3mp-deploy.sh
echo y | ./tes3mp-deploy.sh -i -c $NIX_BUILD_CORES
preConfigure = ''
substituteInPlace files/version.in \
--subst-var-by OPENMW_VERSION_COMMITHASH ${compatHash}
'';
installPhase = ''
prefix=$out/opt/tes3mp
mkdir -p $prefix/build $out/etc/openmw $out/bin
for i in build/*; do
if [ -f "$i" ] && [ -x "$i" ]; then
mv "$i" $prefix/build
fi
done
mv build/resources $prefix/build
mv build/{settings-default.cfg,openmw.cfg,gamecontrollerdb.txt} $out/etc/openmw
mv keepers $prefix
mv build/tes3mp-credits.md $prefix/build
mv -f $prefix/keepers/version $prefix/build/resources
for i in tes3mp.sh tes3mp-browser.sh tes3mp-server.sh
do
bin="$out/bin/''${i%.sh}"
mv $i $bin
substituteInPlace $bin \
--replace build/ $prefix/build/
chmod +x $bin
done
ln -s $prefix/keepers/*.cfg $out/etc/openmw/
postInstall = ''
# components/process/processinvoker.cpp: path.prepend(QLatin1String("./"))
wrapProgram $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 $prefix/keepers/CoreScripts ." \
--run "[ -f tes3mp-server.cfg ] || echo \"[Plugins] home = \$HOME/.config/openmw/CoreScripts\" > tes3mp-server.cfg"
--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" \
--run "cd $out/bin"
'';
meta = with stdenv.lib; {
description = "Multiplayer for TES3:Morrowind based on OpenMW";
homepage = "https://tes3mp.com/";
homepage = https://tes3mp.com/;
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ gnidorah ];
};
}
})