From a73b134de52bd0eb922ce63993f736956d96cf2b Mon Sep 17 00:00:00 2001 From: sund3RRR Date: Sat, 20 Apr 2024 11:08:43 +0300 Subject: [PATCH] rtfm: 0.2.4 -> 0.4.1 --- pkgs/applications/misc/rtfm/default.nix | 26 ++++++------- .../enable-write-permissions.patch | 4 +- pkgs/applications/misc/rtfm/make.patch | 39 +++++++++++++++++++ .../rtfm/patches/friendly-docs-path.patch | 11 ------ .../applications/misc/rtfm/patches/make.patch | 21 ---------- pkgs/applications/misc/rtfm/shards.nix | 20 +++++----- 6 files changed, 63 insertions(+), 58 deletions(-) rename pkgs/applications/misc/rtfm/{patches => }/enable-write-permissions.patch (60%) create mode 100644 pkgs/applications/misc/rtfm/make.patch delete mode 100644 pkgs/applications/misc/rtfm/patches/friendly-docs-path.patch delete mode 100644 pkgs/applications/misc/rtfm/patches/make.patch diff --git a/pkgs/applications/misc/rtfm/default.nix b/pkgs/applications/misc/rtfm/default.nix index 9eb97113c37b..133bede81ae0 100644 --- a/pkgs/applications/misc/rtfm/default.nix +++ b/pkgs/applications/misc/rtfm/default.nix @@ -7,10 +7,10 @@ , desktopToDarwinBundle , webkitgtk_6_0 , sqlite -, gi-crystal , libadwaita , gtk4 , pango +, substituteAll }: let gtk4' = gtk4.override { x11Support = true; }; @@ -18,42 +18,40 @@ let in crystal.buildCrystalPackage rec { pname = "rtfm"; - version = "0.2.4"; + version = "0.4.1"; src = fetchFromGitHub { owner = "hugopl"; repo = "rtfm"; rev = "v${version}"; name = "rtfm"; - hash = "sha256-IfI7jYM1bsrCq2NiANv/SWkCjPyT/HYUofJMUYy0Sbk="; + hash = "sha256-cloaGlHjtwrjuPGzAG55B58w307R+TO+MixAWTw2ags="; }; patches = [ # 1) fixed gi-crystal binding generator command - # 2) removed `-v` arg to `cp` command to prevent build failure due to stdout buffer overflow + # 2) fixed docset generator command # 3) added commands to build gschemas and update icon-cache - ./patches/make.patch - - # fixed docset path and gi libs directory names - ./patches/friendly-docs-path.patch - + (substituteAll { + src = ./make.patch; + inherit crystal; + }) # added chmod +w for copied docs to prevent error: # `Error opening file with mode 'wb': '.../style.css': Permission denied` - ./patches/enable-write-permissions.patch + ./enable-write-permissions.patch ]; postPatch = '' - substituteInPlace Makefile \ - --replace "crystal run src/create_crystal_docset.cr" "crystal src/create_crystal_docset.cr ${crystal}/share/doc/crystal/api/" \ - --replace "crystal run src/create_gtk_docset.cr" "crystal src/create_gtk_docset.cr gtk-doc/" + substituteInPlace src/doc2dash/create_gtk_docset.cr \ + --replace-fail 'basedir = Path.new("/usr/share/doc")' 'basedir = Path.new(ARGV[0]? || "gtk-docs")' ''; shardsFile = ./shards.nix; + copyShardDeps = true; nativeBuildInputs = [ wrapGAppsHook4 gobject-introspection - gi-crystal ] ++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ]; buildInputs = [ diff --git a/pkgs/applications/misc/rtfm/patches/enable-write-permissions.patch b/pkgs/applications/misc/rtfm/enable-write-permissions.patch similarity index 60% rename from pkgs/applications/misc/rtfm/patches/enable-write-permissions.patch rename to pkgs/applications/misc/rtfm/enable-write-permissions.patch index efdabce08351..8023d647f782 100644 --- a/pkgs/applications/misc/rtfm/patches/enable-write-permissions.patch +++ b/pkgs/applications/misc/rtfm/enable-write-permissions.patch @@ -1,5 +1,5 @@ ---- a/src/doc2dash/doc_set_builder.cr 2023-07-19 14:00:06.864770147 +0300 -+++ b/src/doc2dash/doc_set_builder.cr 2023-07-19 13:59:35.440707740 +0300 +--- a/src/doc2dash/docset_builder.cr 2024-04-20 10:45:32.000673168 +0300 ++++ b/src/doc2dash/docset_builder.cr 2024-04-20 10:45:56.072895349 +0300 @@ -44,6 +44,7 @@ real_dest = @html_dest.join(dest || source) Dir.mkdir_p(Path.new(real_dest).dirname) diff --git a/pkgs/applications/misc/rtfm/make.patch b/pkgs/applications/misc/rtfm/make.patch new file mode 100644 index 000000000000..40f327193deb --- /dev/null +++ b/pkgs/applications/misc/rtfm/make.patch @@ -0,0 +1,39 @@ +--- a/Makefile 2024-04-20 10:28:36.697545022 +0300 ++++ b/Makefile 2024-04-20 10:37:55.591657540 +0300 +@@ -7,8 +7,10 @@ + shards build --debug -Dpreview_mt + + configure: +- shards install +- ./bin/gi-crystal ++ mkdir bin/ ++ cd lib/gi-crystal && shards build -Dpreview_mt --release --no-debug ++ cd ../.. ++ cp lib/gi-crystal/bin/gi-crystal bin/ && ./bin/gi-crystal + + rtfm: + shards build --release -Dpreview_mt rtfm +@@ -16,10 +18,10 @@ + docsets: crystal-docset gtk-docset + + crystal-docset: +- crystal run src/doc2dash/create_crystal_docset.cr ++ crystal src/doc2dash/create_crystal_docset.cr "@crystal@/share/doc/crystal/api" + + gtk-docset: +- crystal run src/doc2dash/create_gtk_docset.cr ++ crystal src/doc2dash/create_gtk_docset.cr "gtk-doc/" + + test: crystal-docset gtk-docset + crystal spec +@@ -28,8 +30,10 @@ + install -D -m 0755 bin/rtfm $(DESTDIR)$(PREFIX)/bin/rtfm + install -D -m 0644 data/io.github.hugopl.rtfm.desktop $(DESTDIR)$(PREFIX)/share/applications/io.github.hugopl.rtfm.desktop + install -D -m 0644 data/icons/hicolor/scalable/apps/io.github.hugopl.rtfm.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/io.github.hugopl.rtfm.svg ++ gtk4-update-icon-cache --ignore-theme-index $(PREFIX)/share/icons/hicolor + # Settings schema + install -D -m644 data/io.github.hugopl.rtfm.gschema.xml $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/io.github.hugopl.rtfm.gschema.xml ++ glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas + # docsets + mkdir -p $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ + cp -r data/Crystal.docset $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ diff --git a/pkgs/applications/misc/rtfm/patches/friendly-docs-path.patch b/pkgs/applications/misc/rtfm/patches/friendly-docs-path.patch deleted file mode 100644 index cecbeb750b30..000000000000 --- a/pkgs/applications/misc/rtfm/patches/friendly-docs-path.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/create_gtk_docset.cr 2023-07-17 14:28:04.882620660 +0300 -+++ b/src/create_gtk_docset.cr 2023-07-17 14:27:09.660643747 +0300 -@@ -136,7 +136,7 @@ - end - - def find_modules : Array(Path) -- basedir = Path.new("/usr/share/doc") -+ basedir = Path.new(ARGV[0]? || "gtk-docs") - MODULES.compact_map do |mod| - print "#{mod.ljust(20, '.')}" - mod_dir = basedir.join(mod) diff --git a/pkgs/applications/misc/rtfm/patches/make.patch b/pkgs/applications/misc/rtfm/patches/make.patch deleted file mode 100644 index 51b95575cd0d..000000000000 --- a/pkgs/applications/misc/rtfm/patches/make.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/Makefile 2023-12-07 23:37:38.984501858 +0300 -+++ b/Makefile 2023-12-07 23:47:52.884456064 +0300 -@@ -4,8 +4,7 @@ - all: configure .WAIT rtfm docsets - - configure: -- shards install -- ./bin/gi-crystal -+ gi-crystal - - rtfm: - shards build --release -s rtfm -@@ -36,6 +35,8 @@ - # Changelog - install -D -m0644 CHANGELOG.md $(DESTDIR)$(PREFIX)/share/doc/rtfm/CHANGELOG.md - gzip -9fn $(DESTDIR)$(PREFIX)/share/doc/rtfm/CHANGELOG.md -+ gtk4-update-icon-cache --ignore-theme-index $(PREFIX)/share/icons/hicolor -+ glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas - - uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/rtfm diff --git a/pkgs/applications/misc/rtfm/shards.nix b/pkgs/applications/misc/rtfm/shards.nix index 0a7ce34cda62..79a2eeb2f0db 100644 --- a/pkgs/applications/misc/rtfm/shards.nix +++ b/pkgs/applications/misc/rtfm/shards.nix @@ -6,18 +6,18 @@ }; fzy = { url = "https://github.com/hugopl/fzy.git"; - rev = "v0.5.5"; - sha256 = "1zk95m43ymx9ilwr6iw9l44nkmp4sas28ib0dkr07hkhgrkw68sv"; + rev = "6c2395bcdea1889969d0d08c16163c276fe4e473"; + sha256 = "0vpradafkwckfsq7wqrgkpsli7bfmgc27d38q06l1jzq0z0j92rw"; }; - gio = { - url = "https://github.com/hugopl/gio.cr.git"; - rev = "v0.2.1"; - sha256 = "0vl5lpvhhdi9pvyl12smag0i3dwj1jjz1zzilc8ai0wjrnbnwlxs"; + 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.16.0"; - sha256 = "1bnnfy07246vwbjfwhziv2yw1g52pzhhrr25660fp3qcnw8q513w"; + rev = "v0.16.1"; + sha256 = "1cqkbh072y70l8g0p040vf50k920p32ry1larnwn9mqabd74jwaj"; }; harfbuzz = { url = "https://github.com/hugopl/harfbuzz.cr.git"; @@ -31,8 +31,8 @@ }; pango = { url = "https://github.com/hugopl/pango.cr.git"; - rev = "v0.3.0"; - sha256 = "1dg5bcbq11zww4xh68dq4ivnsz89yqsnxz81ggp4j9c9d6dhx0m4"; + rev = "v0.3.1"; + sha256 = "0xlf127flimnll875mcq92q7xsi975rrgdpcpmnrwllhdhfx9qmv"; }; sqlite3 = { url = "https://github.com/crystal-lang/crystal-sqlite3.git";