about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/principia/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/games/principia/default.nix')
-rw-r--r--nixpkgs/pkgs/games/principia/default.nix63
1 files changed, 17 insertions, 46 deletions
diff --git a/nixpkgs/pkgs/games/principia/default.nix b/nixpkgs/pkgs/games/principia/default.nix
index 3cf98dada027..e97fc509c5b0 100644
--- a/nixpkgs/pkgs/games/principia/default.nix
+++ b/nixpkgs/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,50 +51,19 @@ 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";
+    mainProgram = "principia";
     homepage = "https://principia-web.se/";
     downloadPage = "https://principia-web.se/download";
     license = licenses.bsd3;
     maintainers = [ maintainers.fgaz ];
     platforms = platforms.linux;
   };
-}
+})