Merge pull request #3020 from ambrop72/0ad

Add 0 A.D.
This commit is contained in:
Michael Raskin 2014-06-30 10:30:41 +04:00
commit 89a7cc92a2
5 changed files with 217 additions and 0 deletions

View File

@ -0,0 +1,32 @@
{ stdenv, fetchurl
, zlibSupport ? true, zlib ? null
, sslSupport ? true, openssl ? null
, idnSupport ? true, libidn ? null
}:
assert zlibSupport -> zlib != null;
assert sslSupport -> openssl != null;
assert idnSupport -> libidn != null;
let
version = "1.0.10";
in
stdenv.mkDerivation rec {
name = "gloox-${version}";
src = fetchurl {
url = "http://camaya.net/download/gloox-${version}.tar.bz2";
sha256 = "300e756af97d43f3f70f1e68e4d4c7129d587dface61633f50d2c490876f58a3";
};
buildInputs = [ ]
++ stdenv.lib.optional zlibSupport zlib
++ stdenv.lib.optional sslSupport openssl
++ stdenv.lib.optional idnSupport libidn;
meta = {
description = "A portable high-level Jabber/XMPP library for C++";
homepage = "http://camaya.net/gloox";
license = [ "GPLv3" ];
};
}

View File

@ -0,0 +1,41 @@
{ stdenv, fetchsvn, cmake, libpng, ilmbase, libtiff, zlib, libjpeg
, mesa, libX11
}:
stdenv.mkDerivation rec {
# No support yet for cg, cuda, glew, glut, openexr.
name = "nvidia-texture-tools";
src = fetchsvn {
url = "http://nvidia-texture-tools.googlecode.com/svn/trunk";
rev = "1388";
sha256 = "0pwxqx5l16nqidzm6mwd3rd4gbbknkz6q8cxnvf7sggjpbcvm2d6";
};
buildInputs = [ cmake libpng ilmbase libtiff zlib libjpeg mesa libX11 ];
patchPhase = ''
# Fix build due to missing dependnecies.
echo 'target_link_libraries(bc7 nvmath)' >> src/nvtt/bc7/CMakeLists.txt
echo 'target_link_libraries(bc6h nvmath)' >> src/nvtt/bc6h/CMakeLists.txt
# Make a recently added pure virtual function just virtual,
# to keep compatibility.
sed -i 's/virtual void endImage() = 0;/virtual void endImage() {}/' src/nvtt/nvtt.h
# Fix building shared libraries.
sed -i 's/SET(NVIMAGE_SHARED TRUE)/SET(NVIMAGE_SHARED TRUE)\nSET(NVTHREAD_SHARED TRUE)/' CMakeLists.txt
'';
cmakeFlags = [
"-DNVTT_SHARED=TRUE"
];
meta = {
description = "A set of cuda-enabled texture tools and compressors";
homepage = "http://developer.nvidia.com/object/texture_tools.html";
license = "MIT";
platforms = stdenv.lib.platforms.linux;
};
}

19
pkgs/games/0ad/data.nix Normal file
View File

@ -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/
'';
}

120
pkgs/games/0ad/default.nix Normal file
View File

@ -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" ];
};
}

View File

@ -4654,6 +4654,8 @@ let
glog = callPackage ../development/libraries/glog { };
gloox = callPackage ../development/libraries/gloox { };
glpk = callPackage ../development/libraries/glpk { };
glsurf = callPackage ../applications/science/math/glsurf {
@ -5744,6 +5746,8 @@ let
ntrack = callPackage ../development/libraries/ntrack { };
nvidia-texture-tools = callPackage ../development/libraries/nvidia-texture-tools { };
ode = builderDefsPackage (import ../development/libraries/ode) { };
ogre = callPackage ../development/libraries/ogre {};
@ -10387,6 +10391,7 @@ let
keen4 = callPackage ../games/keen4 { };
zeroad = callPackage ../games/0ad { };
### DESKTOP ENVIRONMENTS