2016-05-07 02:43:24 +02:00
|
|
|
{ stdenv, lib, fetchurl, cmake, curl, glew, makeWrapper, mesa, SDL2,
|
2014-06-27 18:21:17 +02:00
|
|
|
SDL2_image, unzip, wget, zlib, withOpenal ? true, openal ? null }:
|
|
|
|
|
|
|
|
assert withOpenal -> openal != null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "openspades-${version}";
|
|
|
|
version = "0.0.12";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/yvt/openspades/archive/v${version}.tar.gz";
|
|
|
|
sha256 = "1aa848cck8qrp67ha9vrkzm3k24r2aiv1v4dxla6pi22rw98yxzm";
|
|
|
|
};
|
|
|
|
|
2016-03-01 14:31:33 +01:00
|
|
|
# https://github.com/yvt/openspades/issues/354
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Sources/Client/Client_Input.cpp --replace "isnan(" "std::isnan("
|
|
|
|
substituteInPlace Sources/Client/Corpse.cpp --replace "isnan(" "std::isnan("
|
2016-06-19 10:18:30 +02:00
|
|
|
substituteInPlace Sources/Draw/SWMapRenderer.cpp \
|
|
|
|
--replace "isnan(" "std::isnan(" --replace "isinf(" "std::isinf("
|
|
|
|
sed '1i#include <cmath>' -i Sources/Client/{Player,Client_Input,Corpse}.cpp \
|
|
|
|
-i Sources/Draw/SWMapRenderer.cpp
|
2016-06-23 12:07:57 +02:00
|
|
|
sed '1i#include <math.h>' -i Sources/Draw/SWFeatureLevel.h
|
2016-03-01 14:31:33 +01:00
|
|
|
'';
|
|
|
|
|
2016-08-25 23:11:27 +02:00
|
|
|
nativeBuildInputs =
|
2014-06-27 18:21:17 +02:00
|
|
|
[ cmake curl glew makeWrapper mesa SDL2 SDL2_image unzip wget zlib ]
|
2016-05-07 02:43:24 +02:00
|
|
|
++ lib.optional withOpenal openal;
|
2014-06-27 18:21:17 +02:00
|
|
|
|
2016-08-25 23:11:27 +02:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DOPENSPADES_INSTALL_BINARY=bin"
|
|
|
|
"-DOPENSPADES_RESOURCES=NO"
|
|
|
|
];
|
2014-06-27 18:21:17 +02:00
|
|
|
|
2014-08-26 11:48:02 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
devPack = fetchurl {
|
|
|
|
url = "http://yvt.jp/files/programs/osppaks/DevPaks27.zip";
|
|
|
|
sha256 = "05y7wldg70v5ys41fm0c8kipyspn524z4pglwr3p8h0gfz9n52v6";
|
|
|
|
};
|
|
|
|
|
|
|
|
preBuild = ''
|
2016-05-07 10:58:17 +02:00
|
|
|
unzip -u -o $devPack -d Resources/DevPak
|
2014-08-26 11:48:02 +02:00
|
|
|
'';
|
|
|
|
|
2016-05-07 02:43:24 +02:00
|
|
|
NIX_CFLAGS_LINK = lib.optional withOpenal "-lopenal";
|
2014-06-27 18:21:17 +02:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2014-08-24 16:21:08 +02:00
|
|
|
description = "A compatible client of Ace of Spades 0.75";
|
2014-06-27 18:21:17 +02:00
|
|
|
homepage = "https://github.com/yvt/openspades/";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|