ja2-stracciatella: clean up and modernize

This commit is contained in:
TomaSajt
2025-01-31 15:56:05 +01:00
committed by Alyssa Ross
parent 882709bee7
commit 6f5506cd28
+20 -13
View File
@@ -15,10 +15,9 @@
}:
let
stringTheoryUrl = "https://github.com/zrax/string_theory/archive/3.1.tar.gz";
stringTheory = fetchurl {
url = stringTheoryUrl;
sha256 = "1flq26kkvx2m1yd38ldcq2k046yqw07jahms8a6614m924bmbv41";
url = "https://github.com/zrax/string_theory/archive/3.1.tar.gz";
hash = "sha256-gexVFxGpkmCMQrpCJQ/g2BsCpsCsUTSaD1X0PacRmLo=";
};
in
stdenv.mkDerivation rec {
@@ -28,8 +27,8 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "ja2-stracciatella";
repo = "ja2-stracciatella";
rev = "v${version}";
sha256 = "0m6rvgkba29jy3yq5hs1sn26mwrjl6mamqnv4plrid5fqaivhn6j";
tag = "v${version}";
hash = "sha256-0li4o8KutJjpJdviqqqhMvNqhNVBw4L98DIJtebb2VQ=";
};
patches = [
@@ -37,6 +36,14 @@ stdenv.mkDerivation rec {
./dont-use-vendored-sdl2.patch
];
postPatch = ''
# Patch dependencies that are usually loaded by url
substituteInPlace dependencies/lib-string_theory/builder/CMakeLists.txt.in \
--replace-fail ${stringTheory.url} file://${stringTheory}
'';
strictDeps = true;
nativeBuildInputs = [
cmake
python3
@@ -64,26 +71,26 @@ stdenv.mkDerivation rec {
hash = "sha256-zkctR16QIjCTiDmrhFqPPOThbPwsm0T0nlnCekkXNN8=";
};
preConfigure = ''
# Patch dependencies that are usually loaded by url
substituteInPlace dependencies/lib-string_theory/builder/CMakeLists.txt.in \
--replace ${stringTheoryUrl} file://${stringTheory}
cmakeFlagsArray+=("-DLOCAL_RAPIDJSON_LIB=OFF" "-DLOCAL_GTEST_LIB=OFF" "-DEXTRA_DATA_DIR=$out/share/ja2")
'';
cmakeFlags = [
(lib.cmakeBool "LOCAL_RAPIDJSON_LIB" false)
(lib.cmakeBool "LOCAL_GTEST_LIB" false)
(lib.cmakeFeature "EXTRA_DATA_DIR" "${placeholder "out"}/share/ja2")
];
# error: 'uint64_t' does not name a type
# gcc13 and above don't automatically include cstdint
env.CXXFLAGS = "-include cstdint";
doInstallCheck = true;
installCheckPhase = ''
HOME=/tmp $out/bin/ja2 -unittests
HOME=$(mktemp -d) $out/bin/ja2 -unittests
'';
meta = {
description = "Jagged Alliance 2, with community fixes";
license = "SFI Source Code license agreement";
homepage = "https://ja2-stracciatella.github.io/";
maintainers = [ ];
};
}