From 1173897ec5b0832d2093b68b8988544332461914 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 3 May 2025 11:30:32 +0200 Subject: [PATCH 1/7] openclonk: cleanup --- pkgs/by-name/op/openclonk/package.nix | 61 +++++++++++++++------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/pkgs/by-name/op/openclonk/package.nix b/pkgs/by-name/op/openclonk/package.nix index aec87ac14830f..373be399769df 100644 --- a/pkgs/by-name/op/openclonk/package.nix +++ b/pkgs/by-name/op/openclonk/package.nix @@ -1,27 +1,36 @@ { lib, stdenv, + + # sources fetchurl, fetchFromGitHub, fetchDebianPatch, + + # nativeBuildInputs cmake, pkg-config, - SDL2, - libvorbis, - libogg, - libjpeg, - libpng, + + gcc-unwrapped, + + # buildInputs + curl, + freealut, freetype, glew, - tinyxml, - openal, + libb2, libepoxy, - curl, - freealut, + libjpeg, + libogg, + libpng, + libvorbis, + openal, readline, - libb2, - gcc-unwrapped, - enableSoundtrack ? false, # Enable the "Open Clonk Soundtrack - Explorers Journey" by David Oerther + SDL2, + tinyxml, + + # Enable the "Open Clonk Soundtrack - Explorers Journey" by David Oerther + enableSoundtrack ? false, }: let @@ -53,11 +62,9 @@ stdenv.mkDerivation { enableParallelInstalling = false; - postInstall = - '''' - + lib.optionalString enableSoundtrack '' - ln -sv ${soundtrack_src} $out/share/games/openclonk/Music.ocg - ''; + postInstall = lib.optionalString enableSoundtrack '' + ln -sv ${soundtrack_src} $out/share/games/openclonk/Music.ocg + ''; nativeBuildInputs = [ cmake @@ -65,20 +72,20 @@ stdenv.mkDerivation { ]; buildInputs = [ - SDL2 - libvorbis - libogg - libjpeg - libpng + curl + freealut freetype glew - tinyxml - openal - freealut + libb2 libepoxy - curl + libjpeg + libogg + libpng + libvorbis + openal readline - libb2 + SDL2 + tinyxml ]; cmakeFlags = [ From 3a2b29685533af75e754f2cbdd5631c00089856e Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 3 May 2025 11:36:26 +0200 Subject: [PATCH 2/7] openclonk: fix build cmake complained about not finding X11_LIBRARIES, which is fixed by providing libXrandr. Adding ninja fixes the installPhase which fails randomly. There is a hack in upstream's CMakeLists.txt file that reads: USES_TERMINAL # Hack: prevent parallel execution (for ninja), c4group tends to fail otherwise This only works with ninja, though. Also enable parallel install phase again, since this seems to work with ninja now. This also fixes the build for aarch64-linux. --- pkgs/by-name/op/openclonk/package.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/op/openclonk/package.nix b/pkgs/by-name/op/openclonk/package.nix index 373be399769df..3da07ca1be7f0 100644 --- a/pkgs/by-name/op/openclonk/package.nix +++ b/pkgs/by-name/op/openclonk/package.nix @@ -9,6 +9,7 @@ # nativeBuildInputs cmake, + ninja, pkg-config, gcc-unwrapped, @@ -24,6 +25,7 @@ libogg, libpng, libvorbis, + libXrandr, openal, readline, SDL2, @@ -60,14 +62,13 @@ stdenv.mkDerivation { }) ]; - enableParallelInstalling = false; - postInstall = lib.optionalString enableSoundtrack '' ln -sv ${soundtrack_src} $out/share/games/openclonk/Music.ocg ''; nativeBuildInputs = [ cmake + ninja pkg-config ]; @@ -82,6 +83,7 @@ stdenv.mkDerivation { libogg libpng libvorbis + libXrandr openal readline SDL2 @@ -101,9 +103,6 @@ stdenv.mkDerivation { license = if enableSoundtrack then licenses.unfreeRedistributable else licenses.isc; mainProgram = "openclonk"; maintainers = [ ]; - platforms = [ - "x86_64-linux" - "i686-linux" - ]; + platforms = lib.platforms.linux; }; } From 04e1cd780ead351327def20f3a760375461c5ffa Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 3 May 2025 12:32:45 +0200 Subject: [PATCH 3/7] openclonk: unstable-2023-10-30 -> 9.0-unstable-2025-01-11 This fixes the game at run-time. --- pkgs/by-name/op/openclonk/package.nix | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/op/openclonk/package.nix b/pkgs/by-name/op/openclonk/package.nix index 3da07ca1be7f0..92d9ada39a5b3 100644 --- a/pkgs/by-name/op/openclonk/package.nix +++ b/pkgs/by-name/op/openclonk/package.nix @@ -42,14 +42,14 @@ let }; in stdenv.mkDerivation { - version = "unstable-2023-10-30"; + version = "9.0-unstable-2025-01-11"; pname = "openclonk"; src = fetchFromGitHub { owner = "openclonk"; repo = "openclonk"; - rev = "5275334a11ef7c23ce809f35d6b443abd91b415f"; - sha256 = "14x5b2rh739156l4072rbsnv9n862jz1zafi6ng158ja5fwl16l2"; + rev = "db975b4a887883f4413d1ce3181f303d83ee0ab5"; + hash = "sha256-Vt7umsfe2TVZAeKJOXCi2ZCbSv6wAotuMflS7ii7Y/E="; }; patches = [ @@ -62,9 +62,14 @@ stdenv.mkDerivation { }) ]; - postInstall = lib.optionalString enableSoundtrack '' - ln -sv ${soundtrack_src} $out/share/games/openclonk/Music.ocg - ''; + postInstall = + '' + mv $out/games/openclonk $out/bin + rm -r $out/games + '' + + lib.optionalString enableSoundtrack '' + ln -sv ${soundtrack_src} $out/share/games/openclonk/Music.ocg + ''; nativeBuildInputs = [ cmake From 9e83b2af85afed151219dc8c4b210012352fa075 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 3 May 2025 12:37:19 +0200 Subject: [PATCH 4/7] openclonk: remove cmakeFlags for gcc-unwrapped Works without them, too. --- pkgs/by-name/op/openclonk/package.nix | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pkgs/by-name/op/openclonk/package.nix b/pkgs/by-name/op/openclonk/package.nix index 92d9ada39a5b3..4d8961fff82a4 100644 --- a/pkgs/by-name/op/openclonk/package.nix +++ b/pkgs/by-name/op/openclonk/package.nix @@ -12,8 +12,6 @@ ninja, pkg-config, - gcc-unwrapped, - # buildInputs curl, freealut, @@ -95,11 +93,6 @@ stdenv.mkDerivation { tinyxml ]; - cmakeFlags = [ - "-DCMAKE_AR=${gcc-unwrapped}/bin/gcc-ar" - "-DCMAKE_RANLIB=${gcc-unwrapped}/bin/gcc-ranlib" - ]; - cmakeBuildType = "RelWithDebInfo"; meta = with lib; { From ed76a25afe81d33fddc06a45721bc50a19366442 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 3 May 2025 12:08:59 +0200 Subject: [PATCH 5/7] openclonk: modernize --- pkgs/by-name/op/openclonk/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/op/openclonk/package.nix b/pkgs/by-name/op/openclonk/package.nix index 4d8961fff82a4..40e2293e418bf 100644 --- a/pkgs/by-name/op/openclonk/package.nix +++ b/pkgs/by-name/op/openclonk/package.nix @@ -36,7 +36,7 @@ let soundtrack_src = fetchurl { url = "http://www.openclonk.org/download/Music.ocg"; - sha256 = "1ckj0dlpp5zsnkbb5qxxfxpkiq76jj2fgj91fyf3ll7n0gbwcgw5"; + hash = "sha256-Mye6pl1eSgEQ/vOLfDsdHDjp2ljb3euGKBr7s36+2W4="; }; in stdenv.mkDerivation { @@ -95,10 +95,10 @@ stdenv.mkDerivation { cmakeBuildType = "RelWithDebInfo"; - meta = with lib; { + meta = { description = "Free multiplayer action game in which you control clonks, small but witty and nimble humanoid beings"; homepage = "https://www.openclonk.org"; - license = if enableSoundtrack then licenses.unfreeRedistributable else licenses.isc; + license = with lib.licenses; if enableSoundtrack then unfreeRedistributable else isc; mainProgram = "openclonk"; maintainers = [ ]; platforms = lib.platforms.linux; From 0022de84c1e399796cbf1dcfc6069f60aee2c69f Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 3 May 2025 12:15:58 +0200 Subject: [PATCH 6/7] openclonk: fix license The ISC license always applies, the unfree part only is added additionally. --- pkgs/by-name/op/openclonk/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/op/openclonk/package.nix b/pkgs/by-name/op/openclonk/package.nix index 40e2293e418bf..44b40bc062bc6 100644 --- a/pkgs/by-name/op/openclonk/package.nix +++ b/pkgs/by-name/op/openclonk/package.nix @@ -98,7 +98,7 @@ stdenv.mkDerivation { meta = { description = "Free multiplayer action game in which you control clonks, small but witty and nimble humanoid beings"; homepage = "https://www.openclonk.org"; - license = with lib.licenses; if enableSoundtrack then unfreeRedistributable else isc; + license = with lib.licenses; [ isc ] ++ lib.optional enableSoundtrack unfreeRedistributable; mainProgram = "openclonk"; maintainers = [ ]; platforms = lib.platforms.linux; From 18abb047dfbc7d8da061be10b8fde187eac24100 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 3 May 2025 12:19:18 +0200 Subject: [PATCH 7/7] openclonk: adopt --- pkgs/by-name/op/openclonk/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/op/openclonk/package.nix b/pkgs/by-name/op/openclonk/package.nix index 44b40bc062bc6..0626cf4980868 100644 --- a/pkgs/by-name/op/openclonk/package.nix +++ b/pkgs/by-name/op/openclonk/package.nix @@ -100,7 +100,7 @@ stdenv.mkDerivation { homepage = "https://www.openclonk.org"; license = with lib.licenses; [ isc ] ++ lib.optional enableSoundtrack unfreeRedistributable; mainProgram = "openclonk"; - maintainers = [ ]; + maintainers = with lib.maintainers; [ wolfgangwalther ]; platforms = lib.platforms.linux; }; }