From 7fc7502db516a54d8104656401f0c2abf90cf781 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 4 Jan 2016 15:23:47 +0300 Subject: [PATCH 1/4] ioquake3: 1.36 -> 20151228 Renamed from `quake3game` --- pkgs/games/quake3/game/botlib.patch | 51 --------------------------- pkgs/games/quake3/game/default.nix | 43 ---------------------- pkgs/games/quake3/game/exit.patch | 12 ------- pkgs/games/quake3/ioquake/default.nix | 38 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 7 ++-- 5 files changed, 42 insertions(+), 109 deletions(-) delete mode 100644 pkgs/games/quake3/game/botlib.patch delete mode 100644 pkgs/games/quake3/game/default.nix delete mode 100644 pkgs/games/quake3/game/exit.patch create mode 100644 pkgs/games/quake3/ioquake/default.nix diff --git a/pkgs/games/quake3/game/botlib.patch b/pkgs/games/quake3/game/botlib.patch deleted file mode 100644 index 82e2c781101..00000000000 --- a/pkgs/games/quake3/game/botlib.patch +++ /dev/null @@ -1,51 +0,0 @@ -Retrieved from https://bugzilla.icculus.org/show_bug.cgi?id=4331, -removed path prefix. - - -- nckx - -PATCH: Bots don't work on 64 bit Intel CPU's - -botlib abuses strcpy (source and dest overlap), and the strcpy function for 64 -bit intel CPU's in the latest glibc, does not like this causing the bots to not -load. - -The attached patch fixes this. - -Note this patch should be credited to: Andreas Bierfert (andreas.bierfert at -lowlatency.de) - -See: http://bugzilla.redhat.com/show_bug.cgi?id=526338 - -diff -up quake3-1.36/code/botlib/l_precomp.c~ quake3-1.36/code/botlib/l_precomp.c ---- code/botlib/l_precomp.c~ 2009-04-27 08:42:37.000000000 +0200 -+++ code/botlib/l_precomp.c 2009-11-03 21:03:08.000000000 +0100 -@@ -948,7 +948,7 @@ void PC_ConvertPath(char *path) - if ((*ptr == '\\' || *ptr == '/') && - (*(ptr+1) == '\\' || *(ptr+1) == '/')) - { -- strcpy(ptr, ptr+1); -+ memmove(ptr, ptr+1, strlen(ptr)); - } //end if - else - { -diff -up quake3-1.36/code/botlib/l_script.c~ quake3-1.36/code/botlib/l_script.c ---- code/botlib/l_script.c~ 2009-04-27 08:42:37.000000000 +0200 -+++ code/botlib/l_script.c 2009-11-03 21:06:11.000000000 +0100 -@@ -1118,7 +1118,7 @@ void StripDoubleQuotes(char *string) - { - if (*string == '\"') - { -- strcpy(string, string+1); -+ memmove(string, string+1, strlen(string)); - } //end if - if (string[strlen(string)-1] == '\"') - { -@@ -1135,7 +1135,7 @@ void StripSingleQuotes(char *string) - { - if (*string == '\'') - { -- strcpy(string, string+1); -+ memmove(string, string+1, strlen(string)); - } //end if - if (string[strlen(string)-1] == '\'') - { diff --git a/pkgs/games/quake3/game/default.nix b/pkgs/games/quake3/game/default.nix deleted file mode 100644 index 2ad922834d3..00000000000 --- a/pkgs/games/quake3/game/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ lib, stdenv, fetchurl, xlibsWrapper, SDL, mesa, openal, gcc46 }: - -stdenv.mkDerivation { - name = "ioquake3-1.36"; - - src = fetchurl { - url = http://ioquake3.org/files/1.36/ioquake3-1.36.tar.bz2; # calls itself "1.34-rc3" - sha256 = "008vah60z0n9h1qp373xbqvhwfbyywbbhd1np0h0yw66g0qzchzv"; - }; - - patchFlags = "-p0"; - - patches = [ - # Fix for compiling on gcc 4.2. - (fetchurl { - url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/games-fps/quake3/files/quake3-1.34_rc3-gcc42.patch?rev=1.1"; - sha256 = "06c9lxfczcby5q29pim231mr2wdkvbv36xp9zbxp9vk0dfs8rv9x"; - }) - - # Do an exit() instead of _exit(). This is nice for gcov. - # Upstream also seems to do this. - ./exit.patch - - # No bots on amd64 without this patch. - ./botlib.patch - ]; - - buildInputs = [ xlibsWrapper SDL mesa openal gcc46 ]; - - # Fix building on GCC 4.6. - NIX_CFLAGS_COMPILE = "-Wno-error"; - - preInstall = '' - mkdir -p $out/baseq3 - installTargets=copyfiles - installFlags="COPYDIR=$out" - ''; - - meta = { - platforms = lib.platforms.linux; - maintainers = [ lib.maintainers.eelco ]; - }; -} diff --git a/pkgs/games/quake3/game/exit.patch b/pkgs/games/quake3/game/exit.patch deleted file mode 100644 index 82785167a78..00000000000 --- a/pkgs/games/quake3/game/exit.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ru -x '*~' ioquake3_1.34-rc3-orig//code/unix/unix_main.c ioquake3_1.34-rc3//code/unix/unix_main.c ---- code/unix/unix_main.c 2006-11-28 23:05:25.000000000 +0100 -+++ code/unix/unix_main.c 2011-01-10 12:43:51.000000000 +0100 -@@ -341,7 +341,7 @@ - void Sys_Exit( int ex ) { - Sys_ConsoleInputShutdown(); - --#ifdef NDEBUG // regular behavior -+#if 0 - - // We can't do this - // as long as GL DLL's keep installing with atexit... diff --git a/pkgs/games/quake3/ioquake/default.nix b/pkgs/games/quake3/ioquake/default.nix new file mode 100644 index 00000000000..f9f4b21546f --- /dev/null +++ b/pkgs/games/quake3/ioquake/default.nix @@ -0,0 +1,38 @@ +{ lib, stdenv, fetchgit, xlibsWrapper, SDL2, mesa, openalSoft +, curl, speex, opusfile, libogg, libopus, libjpeg, mumble, freetype +}: + +stdenv.mkDerivation { + name = "ioquake3-git-20151228"; + + src = fetchgit { + url = "https://github.com/ioquake/ioq3"; + rev = "fe619680f8fa9794906fc82a9c8c6113770696e6"; + sha256 = "5462441df63eebee6f8ed19a8326de5f874dad31e124d37f73d3bab1cd656a87"; + }; + + buildInputs = [ xlibsWrapper SDL2 mesa openalSoft curl speex opusfile libogg libopus libjpeg freetype mumble ]; + + NIX_CFLAGS_COMPILE = [ "-I${SDL2}/include/SDL2" "-I${opusfile}/include/opus" "-I${libopus}/include/opus" ]; + NIX_CFLAGS_LINK = [ "-lSDL2" ]; + + enableParallelBuilding = true; + + makeFlags = [ "USE_INTERNAL_LIBS=0" "USE_FREETYPE=1" "USE_OPENAL_DLOPEN=0" "USE_CURL_DLOPEN=0" ]; + + installTargets = [ "copyfiles" ]; + + installFlags = [ "COPYDIR=$(out)" ]; + + preInstall = '' + mkdir -p $out/baseq3 + ''; + + meta = { + homepage = http://ioquake3.org/; + description = "First person shooter engine based on the Quake 3: Arena and Quake 3: Team Arena"; + license = lib.licenses.gpl2; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.eelco lib.maintainers.abbradar ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f009f818e9f..9540c0a99cc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14257,15 +14257,15 @@ let qqwing = callPackage ../games/qqwing { }; quake3demo = callPackage ../games/quake3/wrapper { - name = "quake3-demo-${quake3game.name}"; + name = "quake3-demo-${ioquake3.name}"; description = "Demo of Quake 3 Arena, a classic first-person shooter"; - game = quake3game; + game = ioquake3; paks = [quake3demodata]; }; quake3demodata = callPackage ../games/quake3/demo { }; - quake3game = callPackage ../games/quake3/game { }; + ioquake3 = callPackage ../games/quake3/ioquake { }; quantumminigolf = callPackage ../games/quantumminigolf {}; @@ -15906,6 +15906,7 @@ aliases = with self; rec { saneFrontends = sane-frontends; # added 2016-01-02 btrfsProgs = btrfs-progs; # added 2016-01-03 aircrackng = aircrack-ng; # added 2016-01-14 + quake3game = ioquake3; # added 2016-01-14 }; tweakAlias = _n: alias: with lib; From 2852696c2e6339c35e03c8629da15a8547e12368 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 4 Jan 2016 15:26:32 +0300 Subject: [PATCH 2/4] quake3pointrelease: init at 1.32b-3 --- pkgs/games/quake3/content/pointrelease.nix | 28 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/games/quake3/content/pointrelease.nix diff --git a/pkgs/games/quake3/content/pointrelease.nix b/pkgs/games/quake3/content/pointrelease.nix new file mode 100644 index 00000000000..04da5811d99 --- /dev/null +++ b/pkgs/games/quake3/content/pointrelease.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchurl }: + +let + version = "1.32b-3"; +in stdenv.mkDerivation { + name = "quake3-pointrelease-${version}"; + + src = fetchurl { + url = "http://ftp.gwdg.de/pub/misc/ftp.idsoftware.com/idstuff/quake3/linux/linuxq3apoint-${version}.x86.run"; + sha256 = "11piyksfqyxwl9mpgbc71w9sacsh4d3cdsgia0cy0dbbap2k4qf3"; + }; + + buildCommand = '' + sh $src --tar xf + + mkdir -p $out/baseq3 + cp baseq3/*.pk3 $out/baseq3 + ''; + + preferLocalBuild = true; + + meta = with stdenv.lib; { + description = "Quake 3 Arena point release"; + license = licenses.unfreeRedistributable; + platforms = platforms.all; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9540c0a99cc..655242182f5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14265,6 +14265,8 @@ let quake3demodata = callPackage ../games/quake3/demo { }; + quake3pointrelease = callPackage ../games/quake3/content/pointrelease.nix { }; + ioquake3 = callPackage ../games/quake3/ioquake { }; quantumminigolf = callPackage ../games/quantumminigolf {}; From 6b447a3c9bbee41389052d6fa9e08a53d8447656 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 4 Jan 2016 15:27:19 +0300 Subject: [PATCH 3/4] quake3demodata: split from point release, cleanup --- pkgs/games/quake3/content/demo.nix | 28 ++++++++++++++++++++++++++++ pkgs/games/quake3/demo/builder.sh | 9 --------- pkgs/games/quake3/demo/default.nix | 24 ------------------------ pkgs/top-level/all-packages.nix | 4 ++-- 4 files changed, 30 insertions(+), 35 deletions(-) create mode 100644 pkgs/games/quake3/content/demo.nix delete mode 100644 pkgs/games/quake3/demo/builder.sh delete mode 100644 pkgs/games/quake3/demo/default.nix diff --git a/pkgs/games/quake3/content/demo.nix b/pkgs/games/quake3/content/demo.nix new file mode 100644 index 00000000000..2b4e69f0086 --- /dev/null +++ b/pkgs/games/quake3/content/demo.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchurl }: + +let + version = "1.11-6"; +in stdenv.mkDerivation { + name = "quake3-demodata-${version}"; + + src = fetchurl { + url = "http://ftp.gwdg.de/pub/misc/ftp.idsoftware.com/idstuff/quake3/linux/linuxq3ademo-${version}.x86.gz.sh"; + sha256 = "1v54a1hx1bczk9hgn9qhx8vixsy7xn7wj2pylhfjsybfkgvf7pk4"; + }; + + buildCommand = '' + tail -n +165 $src | tar xfz - + + mkdir -p $out/baseq3 + cp demoq3/*.pk3 $out/baseq3 + ''; + + preferLocalBuild = true; + + meta = with stdenv.lib; { + description = "Quake 3 Arena demo content"; + license = licenses.unfreeRedistributable; + platforms = platforms.all; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/games/quake3/demo/builder.sh b/pkgs/games/quake3/demo/builder.sh deleted file mode 100644 index 40b0a547243..00000000000 --- a/pkgs/games/quake3/demo/builder.sh +++ /dev/null @@ -1,9 +0,0 @@ -source $stdenv/setup - -tail -n +165 $demo | tar xvfz - -chmod -R +w . -tail -n +175 $update | tar xvfz - -chmod -R +w . - -mkdir -p $out/baseq3 -cp demoq3/*.pk3 baseq3/*.pk3 $out/baseq3 diff --git a/pkgs/games/quake3/demo/default.nix b/pkgs/games/quake3/demo/default.nix deleted file mode 100644 index a25a7caa8c1..00000000000 --- a/pkgs/games/quake3/demo/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{stdenv, fetchurl}: - -stdenv.mkDerivation { - name = "quake3demo-1.11-6"; - builder = ./builder.sh; - - # This is needed for pak0.pk3. - demo = fetchurl { - url = http://tarballs.nixos.org/linuxq3ademo-1.11-6.x86.gz.sh; - sha256 = "1v54a1hx1bczk9hgn9qhx8vixsy7xn7wj2pylhfjsybfkgvf7pk4"; - }; - - # This is needed for the additional pak?.pk3 files. - update = fetchurl { - url = http://tarballs.nixos.org/linuxq3apoint-1.31.x86.run; - sha256 = "1kp689452zb8jhd67ghisz2055pqxy9awz4vi0hq5qmp7xrp1x58"; - }; - - # Don't rebuild if the inputs change, since the output is guaranteed - # to be this value. - outputHashMode = "recursive"; - outputHashAlgo = "sha256"; - outputHash = "00453c43a4jnlbm9w9ws1hdi28hkl63xnxbnbqml25h35ckhzs90"; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 655242182f5..c5e6b1e9a45 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14260,10 +14260,10 @@ let name = "quake3-demo-${ioquake3.name}"; description = "Demo of Quake 3 Arena, a classic first-person shooter"; game = ioquake3; - paks = [quake3demodata]; + paks = [ quake3pointrelease quake3demodata ]; }; - quake3demodata = callPackage ../games/quake3/demo { }; + quake3demodata = callPackage ../games/quake3/content/demo.nix { }; quake3pointrelease = callPackage ../games/quake3/content/pointrelease.nix { }; From 5981fc4b6f24f9ffb46558dfee7b12ba2c935935 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 4 Jan 2016 15:36:49 +0300 Subject: [PATCH 4/4] quake3wrapper: split from quake3demo, make a function and fix multiple paks --- pkgs/games/quake3/wrapper/builder.sh | 4 ++-- pkgs/games/quake3/wrapper/default.nix | 14 +++++++++++--- pkgs/top-level/all-packages.nix | 7 ++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/pkgs/games/quake3/wrapper/builder.sh b/pkgs/games/quake3/wrapper/builder.sh index 6b5bd7450c5..d5115baa7e6 100644 --- a/pkgs/games/quake3/wrapper/builder.sh +++ b/pkgs/games/quake3/wrapper/builder.sh @@ -2,8 +2,8 @@ source $stdenv/setup mkdir -p $out/baseq3 for i in $paks; do - if test -d "$paks/baseq3"; then - ln -s $paks/baseq3/* $out/baseq3/ + if test -d "$i/baseq3"; then + ln -s "$i/baseq3"/* $out/baseq3/ fi done diff --git a/pkgs/games/quake3/wrapper/default.nix b/pkgs/games/quake3/wrapper/default.nix index f9e2e864f19..ae0387ad290 100644 --- a/pkgs/games/quake3/wrapper/default.nix +++ b/pkgs/games/quake3/wrapper/default.nix @@ -1,13 +1,21 @@ -{stdenv, fetchurl, game, paks, mesa, name, description, makeWrapper}: +{ stdenv, fetchurl, mesa, ioquake3, makeWrapper }: + +{ paks, name ? (stdenv.lib.head paks).name, description ? "" }: stdenv.mkDerivation { + name = "${name}-${ioquake3.name}"; + builder = ./builder.sh; - buildInputs = [makeWrapper]; + nativeBuildInputs = [ makeWrapper ]; - inherit game paks mesa name; + inherit paks mesa; + + game = ioquake3; gcc = stdenv.cc.cc; + + preferLocalBuild = true; meta = { inherit description; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c5e6b1e9a45..8a07b7d2a98 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14256,10 +14256,11 @@ let qqwing = callPackage ../games/qqwing { }; - quake3demo = callPackage ../games/quake3/wrapper { - name = "quake3-demo-${ioquake3.name}"; + quake3wrapper = callPackage ../games/quake3/wrapper { }; + + quake3demo = quake3wrapper { + name = "quake3-demo-${lib.getVersion quake3demodata}"; description = "Demo of Quake 3 Arena, a classic first-person shooter"; - game = ioquake3; paks = [ quake3pointrelease quake3demodata ]; };