principia: unstable-2023-03-21 -> 2024.02.29

Diff: af2cfda21b...2024.02.29
This commit is contained in:
Francesco Gazzetta 2024-03-05 10:51:44 +01:00
parent bdf4fdca87
commit f4785feb60

View file

@ -1,13 +1,14 @@
{ lib { lib
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, autoreconfHook , cmake
, pkg-config , pkg-config
, wrapGAppsHook
, curl , curl
, freetype , freetype
, glew , glew
, gtk2 , gtk3
, libGL , libGL
, libjpeg , libjpeg
, libpng , libpng
@ -18,27 +19,28 @@
, SDL2_ttf , SDL2_ttf
}: }:
stdenv.mkDerivation { stdenv.mkDerivation (finalAttrs: {
pname = "principia"; pname = "principia";
version = "unstable-2023-03-21"; version = "2024.02.29";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "Bithack"; owner = "Bithack";
repo = "principia"; repo = "principia";
rev = "af2cfda21b6ce4c0725700e2a01b0597a97dbeff"; rev = finalAttrs.version;
hash = "sha256-jBWdXzbPpk23elHcs5sWkxXfkekj+aa24VvEHzid8KE="; hash = "sha256-L37H261IGCcH2K7RhX8iTdHRkle83vKhgpyssRmSKN0=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
autoreconfHook cmake
pkg-config pkg-config
wrapGAppsHook
]; ];
buildInputs = [ buildInputs = [
curl curl
freetype freetype
glew glew
gtk2 gtk3
libGL libGL
libjpeg libjpeg
libpng libpng
@ -49,45 +51,13 @@ stdenv.mkDerivation {
SDL2_ttf SDL2_ttf
]; ];
preAutoreconf = '' cmakeFlags = [
cd build-linux # Remove when https://github.com/NixOS/nixpkgs/issues/144170 is fixed
''; (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
];
# 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" ];
meta = with lib; { meta = with lib; {
changelog = "https://principia-web.se/wiki/Changelog#${lib.replaceStrings ["."] ["-"] finalAttrs.version}";
description = "Physics-based sandbox game"; description = "Physics-based sandbox game";
homepage = "https://principia-web.se/"; homepage = "https://principia-web.se/";
downloadPage = "https://principia-web.se/download"; downloadPage = "https://principia-web.se/download";
@ -95,4 +65,4 @@ stdenv.mkDerivation {
maintainers = [ maintainers.fgaz ]; maintainers = [ maintainers.fgaz ];
platforms = platforms.linux; platforms = platforms.linux;
}; };
} })