shipwright: fix dev builds

Fallback to empty string for GIT_COMMIT_TAG (this is the behavior of the
CMake as well).
https://github.com/HarbourMasters/Shipwright/blob/1b6dc13491460462f3a04e56b8fe1a28ada5d2a3/CMakeLists.txt#L68-L70

Grab --port-ver from the CMake cache instead of passing
finalAttrs.version. For tagged releases that works fine but the game
expects the --port-ver to match the CMake project version even for dev
builds so failing to do this will result in the game failing to boot
since it thinks there's a version mismatch between the executable and
the OTR in the derivation.

Author: Sirius902
This commit is contained in:
qubitnano
2025-04-20 11:42:02 -04:00
parent 10218c015d
commit 10d91c0f2f
+3 -2
View File
@@ -124,7 +124,7 @@ stdenv.mkDerivation (finalAttrs: {
cd $out
git branch --show-current > GIT_BRANCH
git rev-parse --short=7 HEAD > GIT_COMMIT_HASH
git describe --tags --abbrev=0 --exact-match HEAD > GIT_COMMIT_TAG
(git describe --tags --abbrev=0 --exact-match HEAD 2>/dev/null || echo "") > GIT_COMMIT_TAG
rm -rf .git
'';
};
@@ -213,10 +213,11 @@ stdenv.mkDerivation (finalAttrs: {
'';
postBuild = ''
port_ver=$(grep CMAKE_PROJECT_VERSION: "$PWD/CMakeCache.txt" | cut -d= -f2)
cp ${gamecontrollerdb}/gamecontrollerdb.txt gamecontrollerdb.txt
mv ../libultraship/src/graphic/Fast3D/shaders ../soh/assets/custom
pushd ../OTRExporter
python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out --norom --xml-root ../soh/assets/xml --custom-assets-path ../soh/assets/custom --custom-otr-file soh.otr --port-ver ${finalAttrs.version}
python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out --norom --xml-root ../soh/assets/xml --custom-assets-path ../soh/assets/custom --custom-otr-file soh.otr --port-ver $port_ver
popd
'';