principia: init at unstable-2023-03-21

This commit is contained in:
Francesco Gazzetta 2023-03-17 15:19:00 +01:00
parent ba18b89aa3
commit 920be30f43
2 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,98 @@
{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, pkg-config
, curl
, freetype
, glew
, gtk2
, libGL
, libjpeg
, libpng
, SDL2
, SDL2_gfx
, SDL2_image
, SDL2_mixer
, SDL2_ttf
}:
stdenv.mkDerivation {
pname = "principia";
version = "unstable-2023-03-21";
src = fetchFromGitHub {
owner = "Bithack";
repo = "principia";
rev = "af2cfda21b6ce4c0725700e2a01b0597a97dbeff";
hash = "sha256-jBWdXzbPpk23elHcs5sWkxXfkekj+aa24VvEHzid8KE=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
buildInputs = [
curl
freetype
glew
gtk2
libGL
libjpeg
libpng
SDL2
SDL2_gfx
SDL2_image
SDL2_mixer
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" ];
meta = with lib; {
description = "Physics-based sandbox game";
homepage = "https://principia-web.se/";
downloadPage = "https://principia-web.se/download";
license = licenses.bsd3;
maintainers = [ maintainers.fgaz ];
platforms = platforms.linux;
};
}

View File

@ -35810,6 +35810,8 @@ with pkgs;
planetary_annihilation = callPackage ../games/planetaryannihilation { };
principia = callPackage ../games/principia { };
prismlauncher-qt5 = libsForQt5.callPackage ../games/prismlauncher { };
prismlauncher = qt6Packages.callPackage ../games/prismlauncher { };