diff options
author | sternenseemann <sternenseemann@systemli.org> | 2021-10-17 14:29:11 +0200 |
---|---|---|
committer | sterni <sternenseemann@systemli.org> | 2021-11-13 18:49:45 +0100 |
commit | 4e50d99934fe6cd137738763ce045f4916c5e9ab (patch) | |
tree | 302c2fd1daf16faf5e84448476b5b16145b72524 /pkgs | |
parent | d37d84bdcae7d248e8fe638a0289d1bf216adbd2 (diff) |
soldat-unstable: build using CMake
This will be the build system going forward, so it seems sensible to
support it right away. There's no neat way to use the system
GameNetworkingSockets upstream yet, so we add a hack for now.
Proactively decrease platforms to Linux only since the CMake doesn't
quite use GNUInstallDirs on Darwin and Windows unfortunately.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/games/soldat-unstable/default.nix | 58 | ||||
-rw-r--r-- | pkgs/games/soldat-unstable/gamenetworkingsockets-no-external.patch | 14 |
2 files changed, 33 insertions, 39 deletions
diff --git a/pkgs/games/soldat-unstable/default.nix b/pkgs/games/soldat-unstable/default.nix index 69fc90dff845..b3ae3b58cfe7 100644 --- a/pkgs/games/soldat-unstable/default.nix +++ b/pkgs/games/soldat-unstable/default.nix @@ -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 = "0r39d1394q7kabsgq6vpdlzwsajxafsg23i0r273nggfvs3m805z"; }; - 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 = [ + "-DADD_ASSETS=OFF" # 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}/soldat/$(basename "$p")" @@ -97,8 +79,6 @@ stdenv.mkDerivation rec { --add-flags "-fs_userpath \"$configDir\"" \ --add-flags "-fs_basepath \"${base}/share/soldat\"" 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 = [ "x86_64-linux" "i686-linux" ]; # portability currently mainly limited by fpc # in nixpkgs which doesn't work on darwin, # aarch64 and arm support should be possible: diff --git a/pkgs/games/soldat-unstable/gamenetworkingsockets-no-external.patch b/pkgs/games/soldat-unstable/gamenetworkingsockets-no-external.patch new file mode 100644 index 000000000000..629ca6c67518 --- /dev/null +++ b/pkgs/games/soldat-unstable/gamenetworkingsockets-no-external.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1084048..1ea4c84 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -143,7 +143,8 @@ if(BUILD_CLIENT OR BUILD_SERVER) + file(WRITE ${PROJECT_BINARY_DIR}/bin/steam_appid.txt "638490") + else() + # GameNetworkingSockets +- add_subdirectory(shared/libs/GameNetworkingSockets) ++ # add_subdirectory(shared/libs/GameNetworkingSockets) ++ find_package(GameNetworkingSockets REQUIRED) + endif() + endif() + |