Skip to content

Commit 45693de

Browse files
committed
toppler: modernize derivation
1 parent ce22aab commit 45693de

File tree

1 file changed

+37
-13
lines changed

1 file changed

+37
-13
lines changed

pkgs/by-name/to/toppler/package.nix

+37-13
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
lib,
33
stdenv,
44
fetchFromGitLab,
5+
nix-update-script,
6+
writableTmpDirAsHomeHook,
57

8+
buildPackages,
69
pkg-config,
710
gettext,
811
povray,
912
imagemagick,
1013
gimp,
1114

12-
SDL2,
15+
sdl2-compat,
1316
SDL2_mixer,
1417
SDL2_image,
1518
libpng,
@@ -27,19 +30,31 @@ stdenv.mkDerivation (finalAttrs: {
2730
hash = "sha256-ecEaELu52Nmov/BD9VzcUw6wyWeHJcsKQkEzTnaW330=";
2831
};
2932

33+
strictDeps = true;
34+
enableParallelBuilding = true;
35+
36+
depsBuildBuild = [
37+
buildPackages.stdenv.cc
38+
pkg-config
39+
sdl2-compat
40+
SDL2_image
41+
libpng
42+
zlib
43+
];
44+
3045
nativeBuildInputs = [
3146
pkg-config
3247
gettext
3348
povray
3449
imagemagick
3550
gimp
51+
# GIMP needs a writable home
52+
writableTmpDirAsHomeHook
3653
];
3754

3855
buildInputs = [
39-
SDL2
56+
sdl2-compat
4057
SDL2_mixer
41-
SDL2_image
42-
libpng
4358
zlib
4459
];
4560

@@ -48,20 +63,29 @@ stdenv.mkDerivation (finalAttrs: {
4863
./gcc14.patch
4964
];
5065

51-
# GIMP needs a writable home
66+
makeFlags = [
67+
"CXX_NATIVE=$(CXX_FOR_BUILD)"
68+
"PKG_CONFIG_NATIVE=$(PKG_CONFIG_FOR_BUILD)"
69+
"PREFIX=${placeholder "out"}"
70+
];
71+
5272
preBuild = ''
53-
export HOME=$(mktemp -d)
73+
# The `$` is escaped in `makeFlags` so using it for these parameters results in infinite recursion
74+
makeFlagsArray+=(CXX=$CXX PKG_CONFIG=$PKG_CONFIG);
5475
'';
5576

56-
makeFlags = [ "PREFIX=$(out)" ];
57-
58-
hardeningDisable = [ "format" ];
77+
passthru.updateScript = nix-update-script { };
5978

60-
meta = with lib; {
79+
meta = {
6180
description = "Jump and run game, reimplementation of Tower Toppler/Nebulus";
6281
homepage = "https://gitlab.com/roever/toppler";
63-
license = licenses.gpl2Plus;
64-
maintainers = with maintainers; [ fgaz ];
65-
platforms = platforms.all;
82+
license = with lib.licenses; [
83+
gpl2Plus
84+
# Makefile
85+
gpl3Plus
86+
];
87+
maintainers = with lib.maintainers; [ fgaz ];
88+
platforms = lib.platforms.all;
89+
mainProgram = "toppler";
6690
};
6791
})

0 commit comments

Comments
 (0)