-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
rtfm: init at 0.2.2 #244326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rtfm: init at 0.2.2 #244326
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| { stdenv | ||
| , lib | ||
| , fetchFromGitHub | ||
| , crystal | ||
| , wrapGAppsHook4 | ||
| , gobject-introspection | ||
| , desktopToDarwinBundle | ||
| , webkitgtk_6_0 | ||
| , sqlite | ||
| , gi-crystal | ||
| , libadwaita | ||
| , gtk4 | ||
| , pango | ||
| }: | ||
| let | ||
| gtk4' = gtk4.override { x11Support = true; }; | ||
| pango' = pango.override { withIntrospection = true; }; | ||
| in | ||
| crystal.buildCrystalPackage rec { | ||
| pname = "rtfm"; | ||
| version = "0.2.2"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "hugopl"; | ||
| repo = "rtfm"; | ||
| rev = "v${version}"; | ||
| name = "rtfm"; | ||
| hash = "sha256-SmQq3hG94oV346dHtqTHC0xE4cWB3rspD3XXu+mSI8Q="; | ||
| }; | ||
|
|
||
| patches = [ | ||
| # 1) fixed gi-crystal binding generator command | ||
| # 2) removed `-v` arg to `cp` command to prevent build failure due to stdout buffer overflow | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can fix that upstream. |
||
| # 3) added commands to build gschemas and update icon-cache | ||
| ./patches/make.patch | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually distros run these command for any packages that install files on specific dirs used by these commands. |
||
|
|
||
| # fixed docset path and gi libs directory names | ||
| ./patches/friendly-docs-path.patch | ||
|
|
||
| # added chmod +w for copied docs to prevent error: | ||
| # `Error opening file with mode 'wb': '.../style.css': Permission denied` | ||
| ./patches/enable-write-permissions.patch | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain this error? why does it happen? So I can fix it upstream too.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It happens because |
||
| ]; | ||
|
|
||
| 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/" | ||
| ''; | ||
|
|
||
| shardsFile = ./shards.nix; | ||
|
|
||
| nativeBuildInputs = [ | ||
| wrapGAppsHook4 | ||
| gobject-introspection | ||
| gi-crystal | ||
| ] ++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ]; | ||
|
|
||
| buildInputs = [ | ||
| webkitgtk_6_0 | ||
| sqlite | ||
| libadwaita | ||
| gtk4' | ||
| pango' | ||
| ]; | ||
|
|
||
| buildTargets = [ "configure" "rtfm" "docsets" ]; | ||
|
|
||
| preBuild = '' | ||
| mkdir gtk-doc/ | ||
|
|
||
| for file in "${gtk4'.devdoc}"/share/doc/*; do | ||
| ln -s "$file" "gtk-doc/$(basename "$file")" | ||
| done | ||
|
|
||
| for file in "${pango'.devdoc}"/share/doc/*; do | ||
| ln -s "$file" "gtk-doc/$(basename "$file")" | ||
| done | ||
|
|
||
| for file in "${libadwaita.devdoc}"/share/doc/*; do | ||
| ln -s "$file" "gtk-doc/$(basename "$file")" | ||
| done | ||
| ''; | ||
|
|
||
| meta = with lib; { | ||
|
||
| description = "Dash/docset reader with built in documentation for Crystal and GTK APIs"; | ||
| homepage = "https://github.com/hugopl/rtfm/"; | ||
| license = licenses.mit; | ||
| maintainers = with maintainers; [ sund3RRR ]; | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- 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 | ||
| @@ -44,6 +44,7 @@ | ||
| real_dest = @html_dest.join(dest || source) | ||
| Dir.mkdir_p(Path.new(real_dest).dirname) | ||
| File.copy(original, real_dest) | ||
| + File.chmod(real_dest, 0o600) | ||
| dest || source | ||
| end | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- 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) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- a/Makefile 2023-07-17 17:18:28.000000000 +0300 | ||
| +++ b/Makefile 2023-07-19 12:13:44.627168135 +0300 | ||
| @@ -4,8 +4,7 @@ | ||
| all: configure .WAIT rtfm docsets | ||
|
|
||
| configure: | ||
| - shards install | ||
| - ./bin/gi-crystal | ||
| + gi-crystal | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why you guys don't use the gi-crystal that the project depends on? Do you guys have a gi-crystal nix package? if so, why?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I packed Shortly, nix collects crystal dependencies in separated derivations, then creates a symlimks on it in lib/ directory of project. I am creating a patch when packing So,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Jumping into the convo here... How about copying the WDYT? Is it feasible?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is exactly what I did when packing I think that's better, don't you?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I mean is to copy the output of WDYT?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm sorry but I don't understand what's the difference. If we want to make it work without patching mkdir lib/gi-crystal
cp -r ${gi-crystal}/* lib/gi-crystal
mkdir bin/
mv lib/gi-crystal/bin/gi-crystal bin/
chmod +w lib/gi-crystal/src/autoI think it is just unnecessary steps to be done on each package requires gi-crystal. And even if we do that, we still have to patch this to remove WDYT?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the issue to do that all the time. I prefer that than patching the src. But anyway, I was just passing by here thinking to provides new ideas, but I see that you already studied the question so I won't bother. I never used gi-crystal this is the reason why I might be wrong too.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks for suggesting solutions to this problem. Patching sources was the reason why I didn't want to pack Speaking of using gi-crystal, I understand the steps involved in implementing your idea. But others may not realize that you need to copy the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok... sad but ok. It's weird that it needs to write in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you guys are re-doing what shards already does, but at a package level. I mean... if derivations means a packaged code. |
||
|
|
||
| rtfm: | ||
| shards build --release -s rtfm | ||
| @@ -29,13 +28,15 @@ | ||
| install -D -m644 data/io.github.hugopl.rtfm.gschema.xml $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/io.github.hugopl.rtfm.gschema.xml | ||
| # docsets | ||
| mkdir -p $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ | ||
| - cp -rv data/Crystal.docset $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ | ||
| - cp -rv data/Gtk4.docset $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ | ||
| + cp -r data/Crystal.docset $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ | ||
| + cp -r data/Gtk4.docset $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this change upstream at hugopl/rtfm@8833114 |
||
| # License | ||
| install -D -m0644 LICENSE $(DESTDIR)$(PREFIX)/share/licenses/rtfm/LICENSE | ||
| # 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't add this upstream or it will break ArchLinux package. |
||
|
|
||
| uninstall: | ||
| rm -f $(DESTDIR)$(PREFIX)/bin/rtfm | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| db = { | ||
| url = "https://github.com/crystal-lang/crystal-db.git"; | ||
| rev = "v0.12.0"; | ||
| sha256 = "1in8w2dz7nlhqgc9l6b3pi6f944m29nhbg3p5j40qzvsrr8lqaj7"; | ||
| }; | ||
| fzy = { | ||
| url = "https://github.com/hugopl/fzy.git"; | ||
| rev = "v0.5.5"; | ||
| sha256 = "1zk95m43ymx9ilwr6iw9l44nkmp4sas28ib0dkr07hkhgrkw68sv"; | ||
| }; | ||
| gio = { | ||
| url = "https://github.com/hugopl/gio.cr.git"; | ||
| rev = "v0.1.0"; | ||
| sha256 = "0vj35bi64d4hni18nrl8fmms306a0gl4zlxpf3aq08lh0sbwzhd8"; | ||
| }; | ||
| gtk4 = { | ||
| url = "https://github.com/hugopl/gtk4.cr.git"; | ||
| rev = "v0.15.0"; | ||
| sha256 = "100j5k4sfc2dpj3nplzjcaxw1bwy3hsy5cw93asg00kda9h8dbb1"; | ||
| }; | ||
| harfbuzz = { | ||
| url = "https://github.com/hugopl/harfbuzz.cr.git"; | ||
| rev = "v0.2.0"; | ||
| sha256 = "06wgqxwyib5416yp53j2iwcbr3bl4jjxb1flm7z103l365par694"; | ||
| }; | ||
| libadwaita = { | ||
| url = "https://github.com/geopjr/libadwaita.cr.git"; | ||
| rev = "23ce21d6400af7563ede0b53deea6d1f77436985"; | ||
| sha256 = "09jz6r0yp4qsm47qcknzgkjxavr5j3dkxf2yjbw0jkaz1an58pfw"; | ||
| }; | ||
| pango = { | ||
| url = "https://github.com/hugopl/pango.cr.git"; | ||
| rev = "v0.2.0"; | ||
| sha256 = "0dl3qrhi2ybylmvzx1x5gsznp2pcdkc50waxrljxwnf5avn8ixsf"; | ||
| }; | ||
| sqlite3 = { | ||
| url = "https://github.com/crystal-lang/crystal-sqlite3.git"; | ||
| rev = "v0.20.0"; | ||
| sha256 = "0mqy6rc26i0sf2fdllbbzdhbd1d35npmpqqjz0b1n1vrzrm6fg05"; | ||
| }; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.