@ -1,6 +1,6 @@
{ lib , stdenv , fetchFromGitHub , fpc , zip , makeWrapper
, SDL2 , freetype , physfs , openal , gamenetworkingsockets
, xorg , autoPatchelfHook
, xorg , autoPatchelfHook , cmake
} :
let
@ -49,45 +49,27 @@ stdenv.mkDerivation rec {
sha256 = " 0 r 3 9 d 1 3 9 4 q 7 k a b s g q 6 v p d l z w s a j x a f s g 2 3 i 0 r 2 7 3 n g g f v s 3 m 8 0 5 z " ;
} ;
nativeBuildInputs = [ fpc makeWrapper autoPatchelfHook ] ;
patches = [
# Don't build GameNetworkingSockets as an ExternalProject,
# see https://github.com/Soldat/soldat/issues/73
./gamenetworkingsockets-no-external.patch
] ;
buildInputs = [ SDL2 freetype physfs openal gamenetworkingsockets ] ;
runtimeDependencies = [ xorg . libX11 ] ;
buildPhase = ''
runHook preBuild
mkdir - p client/build server/build
# build .so from stb headers
pushd client/libs/stb
make
popd
# build client
pushd client
make mode = release
popd
nativeBuildInputs = [ fpc makeWrapper autoPatchelfHook cmake ] ;
# build server
pushd server
make mode = release
popd
cmakeFlags = [
" - D A D D _ A S S E T S = O F F " # We provide base's smods via nix
] ;
runHook postBuild
'' ;
installPhase = ''
runHook preInstall
install - Dm644 client/libs/stb/libstb.so - t $ out/lib
install - Dm755 client/build/soldat_ * $ out/bin/soldat
install - Dm755 server/build/soldatserver_ * $ out/bin/soldatserver
buildInputs = [ SDL2 freetype physfs openal gamenetworkingsockets ] ;
# TODO(@sternenseemann): set proper rpath via cmake, so we don't need autoPatchelfHook
runtimeDependencies = [ xorg . libX11 ] ;
# make sure soldat{,server} find their game archive,
# let them write their state and configuration files
# to $XDG_CONFIG_HOME/soldat/soldat{,server} unless
# the user specifies otherwise.
# make sure soldat{,server} find their game archive,
# let them write their state and configuration files
# to $XDG_CONFIG_HOME/soldat/soldat{,server} unless
# the user specifies otherwise.
postInstall = ''
for p in $ out/bin/soldatserver $ out/bin/soldat ; do
configDir = " \' ' ${ XDG_CONFIG_HOME : - \ $ HOME/.config } / s o l d a t / $ ( b a s e n a m e " $ p " ) "
@ -97,8 +79,6 @@ stdenv.mkDerivation rec {
- - add-flags " - f s _ u s e r p a t h \" $ c o n f i g D i r \" " \
- - add-flags " - f s _ b a s e p a t h \" ${ base } / s h a r e / s o l d a t \" "
done
runHook postInstall
'' ;
meta = with lib ; {
@ -106,7 +86,7 @@ stdenv.mkDerivation rec {
license = [ licenses . mit base . meta . license ] ;
inherit ( src . meta ) homepage ;
maintainers = [ maintainers . sternenseemann ] ;
platforms = platforms . x86_64 ++ platforms . i686 ;
platforms = [ " x 8 6 _ 6 4 - l i n u x " " i 6 8 6 - l i n u x " ] ;
# portability currently mainly limited by fpc
# in nixpkgs which doesn't work on darwin,
# aarch64 and arm support should be possible: