mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-17 14:19:58 +03:00
Merge pull request #293513 from fgaz/principia/2024.02.29
This commit is contained in:
commit
72e837bd5a
@ -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;
|
||||
};
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user