diff options
author | ambrop7@gmail.com <Ambroz Bizjak> | 2014-06-18 23:18:53 +0200 |
---|---|---|
committer | ambrop7@gmail.com <Ambroz Bizjak> | 2014-06-19 18:02:12 +0200 |
commit | 7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1 (patch) | |
tree | d956d43cd1808b70e43658d542126e958febbfb1 /pkgs/games/0ad | |
parent | edcad57434dc1ac3ea384e11c8bc88a834f18876 (diff) | |
download | nixpkgs-7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1.tar nixpkgs-7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1.tar.gz nixpkgs-7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1.tar.bz2 nixpkgs-7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1.tar.lz nixpkgs-7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1.tar.xz nixpkgs-7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1.tar.zst nixpkgs-7dbcc9a6eecb0b3a7ac410c0c5158e5696f083d1.zip |
Add 0 A.D.
Diffstat (limited to 'pkgs/games/0ad')
-rw-r--r-- | pkgs/games/0ad/data.nix | 19 | ||||
-rw-r--r-- | pkgs/games/0ad/default.nix | 120 |
2 files changed, 139 insertions, 0 deletions
diff --git a/pkgs/games/0ad/data.nix b/pkgs/games/0ad/data.nix new file mode 100644 index 00000000000..6f3c85183da --- /dev/null +++ b/pkgs/games/0ad/data.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchurl, version, releaseType }: + +stdenv.mkDerivation rec { + name = "0ad-data-${version}"; + + src = fetchurl { + url = "http://releases.wildfiregames.com/0ad-${version}-${releaseType}-unix-data.tar.xz"; + sha256 = "0f16d41e81d7349fb16490f3abbfd38bcb3f2b89648355b2b281c5045ddafadc"; + }; + + patchPhase = '' + rm binaries/data/tools/fontbuilder/fonts/*.txt + ''; + + installPhase = '' + mkdir -p $out/share/0ad + cp -r binaries/data/* $out/share/0ad/ + ''; +} diff --git a/pkgs/games/0ad/default.nix b/pkgs/games/0ad/default.nix new file mode 100644 index 00000000000..efbd59dbbe3 --- /dev/null +++ b/pkgs/games/0ad/default.nix @@ -0,0 +1,120 @@ +{ stdenv, stdenvType, callPackage, fetchurl, python27 +, pkgconfig, spidermonkey_24, boost, icu, libxml2, libpng +, libjpeg, zlib, curl, libogg, libvorbis, enet, miniupnpc +, openalSoft, mesa, xproto, libX11, libXcursor, nspr, SDL +, gloox, nvidia-texture-tools +, withEditor ? true, wxGTK ? null +}: + +assert withEditor -> wxGTK != null; + +let + version = "0.0.16"; + + releaseType = "alpha"; + + zeroadData = callPackage ./data.nix { inherit version releaseType; }; + + archForPremake = + if stdenv.lib.hasPrefix "x86_64-" stdenvType then "x64" else + if stdenv.lib.hasPrefix "i686-" stdenvType then "x32" else "ERROR"; + +in +stdenv.mkDerivation rec { + name = "0ad-${version}"; + + src = fetchurl { + url = "http://releases.wildfiregames.com/0ad-${version}-${releaseType}-unix-build.tar.xz"; + sha256 = "cb965ef7e292bc3a2f1f598a9695e16ff4d786398f384a1ec7d5f9bfe2626de5"; + }; + + buildInputs = [ + zeroadData python27 pkgconfig spidermonkey_24 boost icu + libxml2 libpng libjpeg zlib curl libogg libvorbis enet + miniupnpc openalSoft mesa xproto libX11 libXcursor nspr + SDL gloox nvidia-texture-tools + ] ++ stdenv.lib.optional withEditor wxGTK; + + NIX_CFLAGS_COMPILE = [ + "-I${xproto}/include/X11" + "-I${libX11}/include/X11" + "-I${libXcursor}/include/X11" + ]; + + configurePhase = '' + # Delete shipped libraries which we don't need. + rm -rf libraries/source/{enet,miniupnpc,nvtt,spidermonkey} + + # Build shipped premake. + make -C build/premake/premake4/build/gmake.unix + + # Run premake. + pushd build/premake + ./premake4/bin/release/premake4 \ + --file="premake4.lua" \ + --outpath="../workspaces/gcc/" \ + --platform=${archForPremake} \ + --os=linux \ + --with-system-nvtt \ + --with-system-enet \ + --with-system-miniupnpc \ + --with-system-mozjs24 \ + ${ if withEditor then "--atlas" else "" } \ + --collada \ + --bindir="$out"/bin \ + --libdir="$out"/lib/0ad \ + --datadir="$out"/share/0ad \ + gmake + popd + ''; + + buildPhase = '' + # Build bundled fcollada. + make -C libraries/source/fcollada/src + + # Build 0ad. + make -C build/workspaces/gcc verbose=1 + ''; + + installPhase = '' + # Copy executables. + mkdir -p "$out"/bin + cp binaries/system/pyrogenesis "$out"/bin/ + ((${ toString withEditor })) && cp binaries/system/ActorEditor "$out"/bin/ + + # Copy l10n data. + mkdir -p "$out"/share/0ad + cp -r binaries/data/l10n "$out"/share/0ad/ + + # Copy libraries. + mkdir -p "$out"/lib/0ad + cp binaries/system/libCollada.so "$out"/lib/0ad/ + ((${ toString withEditor })) && cp binaries/system/libAtlasUI.so "$out"/lib/0ad/ + + # Create links to data files. + ln -s -t "$out"/share/0ad "${zeroadData}"/share/0ad/* + + # Copy icon. + mkdir -p "$out"/share/icons + cp build/resources/0ad.png "$out"/share/icons/ + + # Copy/fix desktop item. + mkdir -p "$out"/share/applications + while read LINE; do + if [[ $LINE = "Exec=0ad" ]]; then + echo "Exec=$out/bin/pyrogenesis" + elif [[ $LINE = "Icon=0ad" ]]; then + echo "Icon=$out/share/icons/0ad.png" + else + echo "$LINE" + fi + done <build/resources/0ad.desktop >"$out"/share/applications/0ad.desktop + ''; + + meta = { + description = "A free, open-source game of ancient warfare"; + homepage = "http://wildfiregames.com/0ad/"; + license = [ "GPLv2" "LGPLv2.1" "MIT" "CC BY-SA 3.0" "zlib" ]; + platforms = [ "x86_64-linux" "i686-linux" ]; + }; +} |