Commit 18d8d775 authored by lucasew's avatar lucasew
Browse files

collision: fix build



Signed-off-by: default avatarlucasew <lucas59356@gmail.com>
parent e61cccb2
Loading
Loading
Loading
Loading
+28 −4
Original line number Diff line number Diff line
@@ -4,8 +4,9 @@
, crystal
, wrapGAppsHook4
, desktopToDarwinBundle
, gi-crystal
, gobject-introspection
, gnome
, python3
, libadwaita
, openssl
, libxml2
@@ -16,6 +17,7 @@
, crystal2nix
, writeShellScript
}:

crystal.buildCrystalPackage rec {
  pname = "Collision";
  version = "3.8.0";
@@ -26,17 +28,35 @@ crystal.buildCrystalPackage rec {
    rev = "v${version}";
    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"];

@@ -45,6 +65,10 @@ 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"; })
+0 −20
Original line number Diff line number Diff line
--- 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:
 No newline at end of file