Skip to content
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

swappy: Init at 1.2.1 #81116

Merged
merged 1 commit into from
Sep 28, 2020
Merged

swappy: Init at 1.2.1 #81116

merged 1 commit into from
Sep 28, 2020

Conversation

matthiasbeyer
Copy link
Contributor

WIP because waiting for

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10 labels Feb 26, 2020
sha256 = "08r9hmhzzb5ac4g6zwm7w05n99v0hl2h0w4d8i694hg4pyjxb95y";
};

buildInputs = [ meson ninja pkgconfig cmake scdoc gio-sharp libnotify gtk pango cairo wayland];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So upstream said:

gio-sharp does not exist in Arch.

Are you sure gio-sharp is absolutely needed? How come he hasn't said so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get errors without it, e.g.:

../src/pixbuf.c:3:10: fatal error: gio/gunixoutputstream.h: No such file or directory
    3 | #include <gio/gunixoutputstream.h>

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of glib2 on Arch. Somehow it compiles fine on Arch without specifying the lib explicitly. I just pushed a fix in the meson build file.

buildInputs = [ meson ninja pkgconfig cmake scdoc gio-sharp libnotify gtk pango cairo wayland];

meta = {
homepage = https://github.com/jtheoof/swappy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
homepage = https://github.com/jtheoof/swappy;
homepage = "https://github.com/jtheoof/swappy";

};

buildInputs = [ meson ninja pkgconfig cmake scdoc gio-sharp libnotify gtk pango cairo wayland];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for jtheoof/swappy#10 , try to add (untested):

  nativeBuildInputs = [ glibc.dev ];

Source: https://linux.die.net/man/3/clock_gettime + nix-locate unistd.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not work:

../src/buffer.c: In function 'randname':
../src/buffer.c:12:3: error: implicit declaration of function 'clock_gettime' [-Werror=implicit-function-declaration]
   12 |   clock_gettime(CLOCK_REALTIME, &ts);
      |   ^~~~~~~~~~~~~
../src/buffer.c:12:17: error: 'CLOCK_REALTIME' undeclared (first use in this function)
   12 |   clock_gettime(CLOCK_REALTIME, &ts);
      |                 ^~~~~~~~~~~~~~
../src/buffer.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
../src/buffer.c: In function 'create_shm_file':
../src/buffer.c:45:7: error: implicit declaration of function 'ftruncate'; did you mean 'strncat'? [-Werror=implicit-function-declaration]
   45 |   if (ftruncate(fd, size) < 0) {
      |       ^~~~~~~~~
      |       strncat
cc1: all warnings being treated as errors

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fixed now too.

@jtheoof
Copy link

jtheoof commented May 17, 2020

The latest build from master should compile better. Let me know if you're still having issues. Any help is appreciated too, I don't have NixOS installed.

@bbigras
Copy link
Contributor

bbigras commented Jun 21, 2020

1.0.0 is out. https://github.com/jtheoof/swappy/releases

@matthiasbeyer don't hesitate to say if you don't have the time for this PR anymore. One of us could pick it up.

@matthiasbeyer
Copy link
Contributor Author

No, I'm fine. I pushed an update to 1.0.0, but it still fails to compile because of gio and I'm failing to find a fix.

@jtheoof
Copy link

jtheoof commented Jun 21, 2020

Can't really help you, I don't have nixOS installed. On Arch, gio.h is part of glib2.

nativeBuildInputs = [ glibc.dev ];

buildInputs = [ meson ninja pkgconfig cmake scdoc gio-sharp libnotify gtk pango cairo wayland];

Copy link
Contributor

@bbigras bbigras Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds with this change:

Suggested change
preConfigure = ''
sed -i "s#gio/gunixoutputstream.h#gio-unix-2.0/gio/gunixoutputstream.h#" src/pixbuf.c
'';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe there's a way to add ${glib.dev}/include/gio-unix-2.0 to the include path.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use:

  mesonFlags = [
    # TODO: https://github.com/NixOS/nixpkgs/issues/36468
    "-Dc_args=-I${glib.dev}/include/gio-unix-2.0"
  ];

and you can remove the nativeBuildInputs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you can remove gio-sharp.

@jtheoof
Copy link

jtheoof commented Jun 26, 2020

There was a recent patch in swappy: jtheoof/swappy#42 that changes slightly how gio is found during meson configuration. It might help you a little.

@bbigras
Copy link
Contributor

bbigras commented Jun 26, 2020

jtheoof/swappy@606ce38 has the same problem.

@bbigras
Copy link
Contributor

bbigras commented Jul 5, 2020

@matthiasbeyer friendly ping

@matthiasbeyer
Copy link
Contributor Author

Not sure what I should do here.

@bbigras
Copy link
Contributor

bbigras commented Jul 6, 2020

try adding:

  mesonFlags = [
    # TODO: https://github.com/NixOS/nixpkgs/issues/36468
    "-Dc_args=-I${glib.dev}/include/gio-unix-2.0"
  ];

You can check the URL for more info.

@matthiasbeyer
Copy link
Contributor Author

Fixed thanks to @bbigras and #36468 and also updated to release 1.2.0.

@matthiasbeyer matthiasbeyer changed the title WIP: swappy: Init at 2020-02-26 swappy: Init at 1.2.0 Jul 6, 2020

nativeBuildInputs = [ glibc.dev ];

buildInputs = [ meson ninja pkgconfig cmake scdoc gio-sharp libnotify gtk pango cairo wayland];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build time only dependencies are declared in nativeBuildInputs
https://nixos.org/nixpkgs/manual/#reviewing-contributions-new-packages

So I guess at least: meson, ninja, pkgconfig, cmake. Not sure about the others.

and it looks like "glibc.dev" can be removed;

@@ -2235,6 +2235,8 @@ in

bash-supergenpass = callPackage ../tools/security/bash-supergenpass { };

swappy = callPackage ../applications/misc/swappy { gtk = gtk3; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flameshot, a similar tool is in pkgs/tools/misc/flameshot. Not sure if it's important.


meta = {
homepage = "https://github.com/jtheoof/swappy";
description = "A Wayland native snapshot editing tool, inspired by Snappy on macOS ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe remove the whitespace at the end

@bbigras
Copy link
Contributor

bbigras commented Jul 12, 2020

it seems gio-sharp can be removed too.

I was able to build using:

  nativeBuildInputs = [ glib meson ninja pkgconfig cmake scdoc ];
  buildInputs = [ cairo pango gtk libnotify wayland glib ];
  strictDeps = true;

Not sure why I need glib in both places.

@bbigras
Copy link
Contributor

bbigras commented Jul 21, 2020

@matthiasbeyer friendly ping

@matthiasbeyer
Copy link
Contributor Author

With your suggested change:

[16/18] Compiling C object 'swappy@exe/src_pixbuf.c.o'.o'.ppy.c.o'.
FAILED: swappy@exe/src_pixbuf.c.o
/nix/store/1kn7fi3hhi33jms3113riyzwyn2yqpqd-gcc-wrapper-9.2.0/bin/cc -Iswappy@exe -I. -I.. -I../include -Ires -I/nix/store/a92yhf0icjl9lh553s4qjchdsm8lyzsy-cairo-1.16.0-dev/include/cairo -I/nix/store/1zlkr4x0bvxw3mn65chw9v3b48n8jh52-freetype-2.10.1-dev/include/freetype2 -I/nix/store/1zlkr4x0bvxw3mn65chw9v3b48n8jh52-freetype-2.10.1-dev/include -I/nix/store/5ad0cyv6lxpkk2m1prcrasdp2pysz73q-glib-2.62.4-dev/include -I/nix/store/5ad0cyv6lxpkk2m1prcrasdp2pysz73q-glib-2.62.4-dev/include/glib-2.0 -I/nix/store/vwvjrh97byihk40gwl26f0lnb3w405cv-glib-2.62.4/lib/glib-2.0/include -I/nix/store/sm843466f7cvhf1b804jjlay1nv7fyq0-pango-1.44.7-dev/include/pango-1.0 -I/nix/store/70yjv9sr9mhf75bliwmmxgyr37mx9lac-harfbuzz-2.6.4-dev/include/harfbuzz -I/nix/store/i5yw4gdhknqahzhkaqjfbgc9ydb2885w-gtk+3-3.24.13-dev/include/gtk-3.0 -I/nix/store/vmm5hrcbqrb7b605dnir17qbiz85x17n-atk-2.34.1-dev/include/atk-1.0 -I/nix/store/4w16ai3cx8sp7av9kc432w34r4fpdmfp-gdk-pixbuf-2.40.0-dev/include/gdk-pixbuf-2.0 -I/nix/store/i1mssjnbih9czf12fcda1883pvkirgss-libnotify-0.7.8-dev/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Werror -std=c11 -Wno-unused-parameter -DHAVE_LIBNOTIFY -MD -MQ 'swappy@exe/src_pixbuf.c.o' -MF 'swappy@exe/src_pixbuf.c.o.d' -o 'swappy@exe/src_pixbuf.c.o' -c ../src/pixbuf.c
../src/pixbuf.c:4:10: fatal error: gio/gunixoutputstream.h: No such file or directory
    4 | #include <gio/gunixoutputstream.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[17/18] Compiling C object 'swappy@exe/src_render.c.o'.
ninja: build stopped: subcommand failed.
builder for '/nix/store/v3frm48zb0pp5j2r74g1sh0h5s1maacg-swappy-1.0.0.drv' failed with exit code 1
error: build of '/nix/store/v3frm48zb0pp5j2r74g1sh0h5s1maacg-swappy-1.0.0.drv' faile

@bbigras
Copy link
Contributor

bbigras commented Jul 25, 2020

@GrahamcOfBorg build swappy

@bbigras
Copy link
Contributor

bbigras commented Jul 25, 2020

Reviewed points
  • package path fits guidelines
  • package name fits guidelines
  • package version fits guidelines
  • package build on x86_64
  • executables tested on x86_64
  • meta.description is set and fits guidelines
  • meta.license fits upstream license
  • meta.platforms is set
  • meta.maintainers is set
  • build time only dependencies are declared in nativeBuildInputs
  • source is fetched using the appropriate function
  • phases are respected
  • patches that are remotely available are fetched with fetchpatch
Possible improvements
Comments

Other reviewers might want to double check nativeBuildInputs as i'm not an expert on that.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/230

@blaggacao
Copy link
Contributor

Just noticed v1.2.1 was cut 14 days ago.
https://github.com/jtheoof/swappy/tree/v1.2.1

Not meaning to block anything.

@bbigras
Copy link
Contributor

bbigras commented Aug 9, 2020

@matthiasbeyer friendly ping

@matthiasbeyer matthiasbeyer changed the title swappy: Init at 1.2.0 swappy: Init at 1.2.1 Aug 9, 2020
@jonringer
Copy link
Contributor

since this is the first time it's been packaged, I think it should be a single commit. I don't see much value in having 5 commits.

@bbigras
Copy link
Contributor

bbigras commented Aug 19, 2020

@matthiasbeyer friendly ping. Can we get this in the release please?

@matthiasbeyer
Copy link
Contributor Author

Sure, what's missing from your point of view?

@bbigras
Copy link
Contributor

bbigras commented Aug 19, 2020

I already approved but maybe Jon's meta suggestion and squash the commits and it will be good to go.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
@bbigras
Copy link
Contributor

bbigras commented Sep 7, 2020

@jonringer can you merge this please?

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/219

@berbiche
Copy link
Member

Friendly ping @jonringer since two weeks have passed since the last one.

I'm looking forward to using this new tool in my workflow.

It would also be great if this package was backported to the 20.09 release (unless the window is closed?).

@bbigras
Copy link
Contributor

bbigras commented Sep 28, 2020

@marsam help merge this please. Jon must be pretty busy these days.

@marsam marsam merged commit 692f58d into NixOS:master Sep 28, 2020
@bbigras
Copy link
Contributor

bbigras commented Sep 28, 2020

Thank you very much 😄

@matthiasbeyer matthiasbeyer deleted the add-swappy branch September 28, 2020 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants