about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-03-08 15:58:01 +0100
committerGitHub <noreply@github.com>2024-03-08 15:58:01 +0100
commit72e837bd5a474d98ecf5ca043623554ae0fa13d9 (patch)
tree2f296e4fcd867eca2c1749a8fd9567b6cad4b3ae
parentd41de375cb00c09f62f1da4f3e52c0c246716137 (diff)
parentf4785feb600247a01c3dc51c0dc7283ba7725e6a (diff)
downloadnixlib-72e837bd5a474d98ecf5ca043623554ae0fa13d9.tar
nixlib-72e837bd5a474d98ecf5ca043623554ae0fa13d9.tar.gz
nixlib-72e837bd5a474d98ecf5ca043623554ae0fa13d9.tar.bz2
nixlib-72e837bd5a474d98ecf5ca043623554ae0fa13d9.tar.lz
nixlib-72e837bd5a474d98ecf5ca043623554ae0fa13d9.tar.xz
nixlib-72e837bd5a474d98ecf5ca043623554ae0fa13d9.tar.zst
nixlib-72e837bd5a474d98ecf5ca043623554ae0fa13d9.zip
Merge pull request #293513 from fgaz/principia/2024.02.29
-rw-r--r--pkgs/games/principia/default.nix62
1 files changed, 16 insertions, 46 deletions
diff --git a/pkgs/games/principia/default.nix b/pkgs/games/principia/default.nix
index 3cf98dada027..5074b3582c3e 100644
--- a/pkgs/games/principia/default.nix
+++ b/pkgs/games/principia/default.nix
@@ -1,13 +1,14 @@
 { lib
 , stdenv
 , fetchFromGitHub
-, autoreconfHook
+, cmake
 , pkg-config
+, wrapGAppsHook
 
 , curl
 , freetype
 , glew
-, gtk2
+, gtk3
 , libGL
 , libjpeg
 , libpng
@@ -18,27 +19,28 @@
 , SDL2_ttf
 }:
 
-stdenv.mkDerivation {
+stdenv.mkDerivation (finalAttrs: {
   pname = "principia";
-  version = "unstable-2023-03-21";
+  version = "2024.02.29";
 
   src = fetchFromGitHub {
     owner = "Bithack";
     repo = "principia";
-    rev = "af2cfda21b6ce4c0725700e2a01b0597a97dbeff";
-    hash = "sha256-jBWdXzbPpk23elHcs5sWkxXfkekj+aa24VvEHzid8KE=";
+    rev = finalAttrs.version;
+    hash = "sha256-L37H261IGCcH2K7RhX8iTdHRkle83vKhgpyssRmSKN0=";
   };
 
   nativeBuildInputs = [
-    autoreconfHook
+    cmake
     pkg-config
+    wrapGAppsHook
   ];
 
   buildInputs = [
     curl
     freetype
     glew
-    gtk2
+    gtk3
     libGL
     libjpeg
     libpng
@@ -49,45 +51,13 @@ stdenv.mkDerivation {
     SDL2_ttf
   ];
 
-  preAutoreconf = ''
-    cd build-linux
-  '';
-
-  # Since we bypass the "build-linux/go" wrapper script so we can use nixpkgs'
-  # autotools/make integration, set the release flags manually.
-  # https://github.com/Bithack/principia/issues/98
-  preBuild = ''
-    RELEASE_SHARED="-ffast-math -DNDEBUG=1 -s -fomit-frame-pointer -fvisibility=hidden -fdata-sections -ffunction-sections"
-    makeFlagsArray+=(
-      CFLAGS="$RELEASE_SHARED -O1"
-      CXXFLAGS="$RELEASE_SHARED -O2 -fvisibility-inlines-hidden -fno-rtti"
-      LDFLAGS="-Wl,-O,-s,--gc-sections"
-    )
-  '';
-
-  # `make install` only installs the binary, and the binary looks for data
-  # files in its same directory, so we override installPhase, install the
-  # binary in $out/share, and link to it from $out/bin
-  installPhase = ''
-    runHook preInstall
-
-    mkdir -p $out/bin
-    mkdir -p $out/share/principia
-    install -Dm755 principia $out/share/principia/principia
-    ln -s $out/share/principia/principia $out/bin/principia
-
-    cp -r --dereference data-pc data-shared $out/share/principia/
-    install -Dm644 principia.desktop $out/share/applications/principia.desktop
-    install -Dm644 principia-url-handler.desktop $out/share/applications/principia-url-handler.desktop
-    install -Dm644 principia.png $out/share/pixmaps/principia.png
-
-    runHook postInstall
-  '';
-
-  # The actual binary is here, see comment above installPhase
-  stripDebugList = [ "share/principia" ];
+  cmakeFlags = [
+    # Remove when https://github.com/NixOS/nixpkgs/issues/144170 is fixed
+    (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
+  ];
 
   meta = with lib; {
+    changelog = "https://principia-web.se/wiki/Changelog#${lib.replaceStrings ["."] ["-"] finalAttrs.version}";
     description = "Physics-based sandbox game";
     homepage = "https://principia-web.se/";
     downloadPage = "https://principia-web.se/download";
@@ -95,4 +65,4 @@ stdenv.mkDerivation {
     maintainers = [ maintainers.fgaz ];
     platforms = platforms.linux;
   };
-}
+})