From 492f9c878f5ea8bf05738cc81aed09657deda400 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 12 Nov 2015 03:03:03 +0300 Subject: [PATCH 1/2] binkplayer: init --- .../applications/video/binkplayer/default.nix | 35 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 pkgs/applications/video/binkplayer/default.nix diff --git a/pkgs/applications/video/binkplayer/default.nix b/pkgs/applications/video/binkplayer/default.nix new file mode 100644 index 0000000000000..40357ecd75d90 --- /dev/null +++ b/pkgs/applications/video/binkplayer/default.nix @@ -0,0 +1,35 @@ +{ stdenv, requireFile, p7zip, SDL, openalSoft }: + +let + deps = stdenv.lib.makeLibraryPath [ SDL openalSoft ]; + +in stdenv.mkDerivation { + name = "BinkPlayer"; + + src = requireFile { + url = "http://www.radgametools.com/down/Bink/BinkLinuxPlayer.7z"; + name = "BinkLinuxPlayer.7z"; + sha256 = "04pa2bad81hw5nx6a5zh6ab0rmcdwfqh3ifh5n7fbly90hm9vfwh"; + }; + + buildCommand = '' + mkdir -p $out/bin + cd $out/bin + 7z x $src + chmod +x BinkPlayer + patchelf \ + --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \ + --set-rpath ${deps} \ + BinkPlayer + ''; + + nativeBuildInputs = [ p7zip ]; + + meta = with stdenv.lib; { + description = "Play Bink files (or compiled Bink EXE files) from the command line"; + homepage = "http://www.radgametools.com/bnkmain.htm"; + license = licenses.unfree; + platforms = [ "i686-linux" ]; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dd12387c1cc61..9500a553a4cc4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11013,6 +11013,8 @@ let bibletime = callPackage ../applications/misc/bibletime { }; + binkplayer = callPackage_i686 ../applications/video/binkplayer { }; + bitlbee = callPackage ../applications/networking/instant-messengers/bitlbee { }; bitlbee-plugins = callPackage ../applications/networking/instant-messengers/bitlbee/plugins.nix { }; From 4280ca3c306d4db5b9ca3a0347c162887db764c4 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 12 Nov 2015 03:04:02 +0300 Subject: [PATCH 2/2] nwn: init at 2.0.0.15 --- pkgs/games/nwn/builder.sh | 169 ++++++++++++++++++++++++++++++++ pkgs/games/nwn/default.nix | 93 ++++++++++++++++++ pkgs/games/nwn/launcher.sh | 28 ++++++ pkgs/top-level/all-packages.nix | 6 ++ 4 files changed, 296 insertions(+) create mode 100644 pkgs/games/nwn/builder.sh create mode 100644 pkgs/games/nwn/default.nix create mode 100644 pkgs/games/nwn/launcher.sh diff --git a/pkgs/games/nwn/builder.sh b/pkgs/games/nwn/builder.sh new file mode 100644 index 0000000000000..348a74df09080 --- /dev/null +++ b/pkgs/games/nwn/builder.sh @@ -0,0 +1,169 @@ +source $stdenv/setup + +# Several variables +export CC32="$CC -m32" +export CC64="$CC" +export CC="$CC32" + +# Extract gog setup +ln -s $gogSetup setup.exe +ln -s $gogData1 setup-1.bin +ln -s $gogData2 setup-2.bin +innoextract -e -m setup.exe + +# Extract Game Icons +mkdir icons +icotool -x -p 0 app/gfw_high.ico -o icons + +# Extract Kingmaker Files +unzip $gogmods +7z x KingmakerSetup.exe -xr0\!*PLUGINSDIR* -xr\!*.exe -xr\!*.dat -okingmakertmp + +# Create destination directory +mkdir -p $out/nwn + +# Compile nw* +nwcompile() { + cp -r ${!1} $1 + chmod -R +w $1 + patchShebangs $1 + pushd $1 + eval "$2" + sed -i \ + -e "s|^\$machine = .*|\$machine = \"$system\";|" \ + -e "s|-I/|-I/does-not-exist/|g" \ + -e "s|-L/|-L/does-not-exist/|g" \ + ./$1_install.pl + find -name \*.so -delete + ./$1_install.pl build + find -name \*.so -exec strip -s {} \; + install -m755 $1/$1.so $out/nwn/$1.so + popd +} + +nwcompile nwmovies " + sed -i \ + -e 's|^\$mplayer = .*|\$mplayer = \"\";|' \ + -e 's|^\$plaympeg = .*|\$plaympeg = \"\";|' \ + -e 's|^\$binkplayer = .*|\$binkplayer = \"$binkplayer/bin/BinkPlayer\";|' \ + nwmovies/nwmovies.pl +" +nwcompile nwuser +nwcompile nwmouse "sed -i 's|linux/user.h|sys/user.h|' nwmouse/nwmouse_cookie.c" +nwcompile nwlogger "sed -i 's|linux/user.h|sys/user.h|' nwlogger/nwlogger_cookie.c" + +# Move game files to directory +cp -r app/* $out/nwn + +# Extract Game Clients +tar -zxvf $clientgold -C $out/nwn +tar -zxvf $clienthotu -C $out/nwn + +# Install Kingmaker Files +cp -r kingmakertmp/\$0/* $out/nwn + +# Extract Latest Patch +tar -zxvf $clientpatch -C $out/nwn + +# Check the Installation +pushd $out/nwn +patchShebangs fixinstall +./fixinstall +popd + +# Remove Unneeded Files & Directories +rm -r \ + $out/nwn/SDL-* \ + $out/nwn/*.dll \ + $out/nwn/*.exe \ + $out/nwn/ereg \ + $out/nwn/utils \ + $out/nwn/lib \ + $out/nwn/premium/*.exe \ + $out/nwn/miles/*.dll \ + $out/nwn/fixinstall \ + $out/nwn/nwn \ + $out/nwn/dmclient + +# Install nwmovies Perl script +install -D -m755 nwmovies/nwmovies.pl $out/nwn/nwmovies.pl + +# Install binkplayer binaries +install -D -m755 nwmovies/nwmovies/binklib.so $out/nwn/nwmovies/binklib.so + +# Install libdis binaries for nwmovies +install -D -m755 nwmovies/nwmovies/libdis/libdisasm.so $out/nwn/nwmovies/libdis/libdisasm.so + +# Install 64bit binaries if Arch64 +if [ "$system" = "x86_64-linux" ]; then + install -D -m755 nwuser/nwuser/nwuser64.so $out/nwn/nwuser64.so +fi + +# Install libdis binaries for nwmouse +install -D -m755 nwmouse/nwmouse/libdis/libdisasm.so $out/nwn/nwmouse/libdis/libdisasm.so + +# Install libdis binaries for nwlogger +install -D -m755 nwlogger/nwlogger/libdis/libdisasm.so $out/nwn/nwlogger/libdis/libdisasm.so + +# Copy the original license file +cp app/nwncdkey.ini $out/nwn/nwncdkey.ini + +# Install Cursors +mkdir -p $out/nwn/nwmouse/cursors/ +tar -zxvf nwmouse/nwmouse/cursors.tar.gz -C $out/nwn/nwmouse/cursors/ + +# Patch ELFs +if [ "$system" = "x86_64-linux" ]; then + LD=$(cat $NIX_CC/nix-support/dynamic-linker-m32) +else + LD=$(cat $NIX_CC/nix-support/dynamic-linker) +fi + +find $out/nwn -name \*.so -exec patchelf \ + --set-rpath "$deps" \ + {} \; + +for i in $out/nwn/{nwmain,nwserver}; do + patchelf \ + --set-interpreter "$LD" \ + --set-rpath "$deps" \ + "$i" +done + +# Install Launcher (Client) +mkdir -p $out/bin + +sed \ + -e "s|@out@|$out|g" \ + -e "s|@shell@|$SHELL|" \ + $launcher > $out/bin/nwn +chmod +x $out/bin/nwn + +cat >$out/bin/nwserver <$out/share/applications/nwn.desktop <