Merge pull request #312290 from lucasew/20240516-fix-collision

collision: fix build, update
This commit is contained in:
Weijia Wang
2024-05-19 00:51:16 +02:00
committed by GitHub
4 changed files with 70 additions and 38 deletions
+47 -6
View File
@@ -4,34 +4,59 @@
, crystal
, wrapGAppsHook4
, desktopToDarwinBundle
, gi-crystal
, gobject-introspection
, gnome
, python3
, libadwaita
, openssl
, libxml2
, pkg-config
, gitUpdater
, _experimental-update-script-combinators
, runCommand
, crystal2nix
, writeShellScript
}:
crystal.buildCrystalPackage rec {
pname = "Collision";
version = "3.6.0";
version = "3.8.0";
src = fetchFromGitHub {
owner = "GeopJr";
repo = "Collision";
rev = "v${version}";
hash = "sha256-Qxe4ILDdfYfxu95EvKRTvkAOgDIZDiLymBlZouBWn0M=";
hash = "sha256-Bo/u0UYM/N7tLqdCs2OU5pdj2s9LXPooSR1PCGk9dSc=";
};
patches = [ ./make.patch ];
postPatch = ''
substituteInPlace Makefile \
--replace-fail 'gtk-update-icon-cache $(PREFIX)/share/icons/hicolor' 'true'
'';
shardsFile = ./shards.nix;
copyShardDeps = true;
preBuild = ''
cd lib/gi-crystal && shards build -Dpreview_mt --release --no-debug
cd ../.. && mkdir bin/ && cp lib/gi-crystal/bin/gi-crystal bin/
'';
# Crystal compiler has a strange issue with OpenSSL. The project will not compile due to
# main_module:(.text+0x6f0): undefined reference to `SSL_library_init'
# There is an explanation for this https://danilafe.com/blog/crystal_nix_revisited/
# Shortly, adding pkg-config to buildInputs along with openssl fixes the issue.
nativeBuildInputs = [ wrapGAppsHook4 pkg-config gobject-introspection gi-crystal ]
nativeBuildInputs = [ wrapGAppsHook4 pkg-config gobject-introspection ]
++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ];
buildInputs = [ libadwaita openssl libxml2 ];
buildInputs = [
libadwaita
openssl
libxml2
gnome.nautilus-python
python3.pkgs.pygobject3
];
buildTargets = ["bindings" "build"];
@@ -40,6 +65,22 @@ crystal.buildCrystalPackage rec {
installTargets = ["desktop" "install"];
postInstall = ''
install -Dm555 ./nautilus-extension/collision-extension.py -t $out/share/nautilus-python/extensions
'';
passthru = {
updateScript = _experimental-update-script-combinators.sequence [
(gitUpdater { rev-prefix = "v"; })
(_experimental-update-script-combinators.copyAttrOutputToFile "collision.shardLock" ./shard.lock)
{ command = [ (writeShellScript "update-lock" "cd $1; ${lib.getExe crystal2nix}") ./. ]; supportedFeatures = [ "silent" ]; }
{ command = [ "rm" ./shard.lock ]; supportedFeatures = [ "silent" ]; }
];
shardLock = runCommand "shard.lock" { inherit src; } ''
cp $src/shard.lock $out
'';
};
meta = with lib; {
description = "Check hashes for your files";
homepage = "https://github.com/GeopJr/Collision";
@@ -1,20 +0,0 @@
--- a/Makefile 2023-07-09 10:49:31.064190374 +0300
+++ b/Makefile 2023-07-19 11:19:37.415480179 +0300
@@ -6,7 +6,7 @@
all: desktop bindings build
bindings:
- ./bin/gi-crystal || $(CRYSTAL_LOCATION)shards install && ./bin/gi-crystal
+ gi-crystal
build:
COLLISION_LOCALE_LOCATION="$(PREFIX)$(LOCALE_LOCATION)" $(CRYSTAL_LOCATION)shards build -Dpreview_mt --release --no-debug
@@ -43,7 +43,7 @@
install -D -m 0644 data/dev.geopjr.Collision.desktop $(PREFIX)/share/applications/dev.geopjr.Collision.desktop
install -D -m 0644 data/icons/dev.geopjr.Collision.svg $(PREFIX)/share/icons/hicolor/scalable/apps/dev.geopjr.Collision.svg
install -D -m 0644 data/icons/dev.geopjr.Collision-symbolic.svg $(PREFIX)/share/icons/hicolor/symbolic/apps/dev.geopjr.Collision-symbolic.svg
- gtk-update-icon-cache $(PREFIX)/share/icons/hicolor
+ gtk4-update-icon-cache --ignore-theme-index $(PREFIX)/share/icons/hicolor
glib-compile-schemas $(PREFIX)/share/glib-2.0/schemas/
uninstall:
+15 -10
View File
@@ -1,18 +1,23 @@
{
blake3 = {
url = "https://github.com/geopjr/blake3.cr.git";
rev = "v1.3.0";
sha256 = "0pc3h7b5gfkmxlw708qaqjfzjvv5ig3iwxxainq6pwfhpff4a5wd";
};
gettext = {
url = "https://github.com/geopjr/gettext.cr.git";
rev = "v1.0.0";
sha256 = "1y27m4170rr4532j56grzhwbz8hj6z7j3zfkd0jnfwnsxclks1kc";
};
gio = {
url = "https://github.com/hugopl/gio.cr.git";
rev = "v0.1.0";
sha256 = "0vj35bi64d4hni18nrl8fmms306a0gl4zlxpf3aq08lh0sbwzhd8";
gi-crystal = {
url = "https://github.com/hugopl/gi-crystal.git";
rev = "v0.22.2";
sha256 = "0bpa1f8iaf97z2kbgjc7nc8km7nd7bppiwna319lm2hvm8m5pw15";
};
gtk4 = {
url = "https://github.com/hugopl/gtk4.cr.git";
rev = "v0.15.0";
sha256 = "100j5k4sfc2dpj3nplzjcaxw1bwy3hsy5cw93asg00kda9h8dbb1";
rev = "v0.16.1";
sha256 = "1cqkbh072y70l8g0p040vf50k920p32ry1larnwn9mqabd74jwaj";
};
harfbuzz = {
url = "https://github.com/hugopl/harfbuzz.cr.git";
@@ -26,12 +31,12 @@
};
non-blocking-spawn = {
url = "https://github.com/geopjr/non-blocking-spawn.git";
rev = "v1.0.5";
sha256 = "139gr87zlw0k9kf6pf9k2d88aa9x3kcnfg34qpbqrwsrck7708za";
rev = "v1.1.0";
sha256 = "1h43gskannylaai4dz2sjb6rds2h6slm1krg88inan12silhp66c";
};
pango = {
url = "https://github.com/hugopl/pango.cr.git";
rev = "v0.2.0";
sha256 = "0dl3qrhi2ybylmvzx1x5gsznp2pcdkc50waxrljxwnf5avn8ixsf";
rev = "v0.3.1";
sha256 = "0xlf127flimnll875mcq92q7xsi975rrgdpcpmnrwllhdhfx9qmv";
};
}
@@ -2,16 +2,17 @@
, fetchFromGitHub
, crystal
, gobject-introspection
, gitUpdater
}:
crystal.buildCrystalPackage rec {
pname = "gi-crystal";
version = "0.21.0";
version = "0.22.2";
src = fetchFromGitHub {
owner = "hugopl";
repo = "gi-crystal";
rev = "v${version}";
hash = "sha256-hL+4MvJn1z9UKCtyvU4zzIxOwRyYQ3Qt4qRb5F0J+sg=";
hash = "sha256-JfBbKqobikpTGMryeO86zZ46EbOHybem+Cc5FZEL6i4=";
};
# Make sure gi-crystal picks up the name of the so or dylib and not the leading nix store path
@@ -33,6 +34,11 @@ crystal.buildCrystalPackage rec {
runHook postInstall
'';
passthru = {
updateScript = gitUpdater { rev-prefix = "v"; };
};
meta = with lib; {
description = "GI Crystal is a binding generator used to generate Crystal bindings for GObject based libraries using GObject Introspection.";
homepage = "https://github.com/hugopl/gi-crystal";