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

writeC: fix finding of libraries #56203

Merged
merged 1 commit into from Apr 21, 2019
Merged

writeC: fix finding of libraries #56203

merged 1 commit into from Apr 21, 2019

Conversation

Lassulus
Copy link
Member

Motivation for this change

fix external libraries support in writers.writeC.

Sadly the tests are missing, since I don't know how to write a c program with an external library. help would be very appreciated.

@matthewbauer
Copy link
Member

Shouldn't these use stdenv? Not everything uses pkg-config and that's why we have an elaborate system of setup-hooks to handle these.

I am still a little skeptical that these belong in all-packages.nix. They aren't packages and they also aren't used by any other packages in all-packages.nix. That's not to say that they aren't useful, just out of scope for Nixpkgs. Can't they go in a separate repo?

@Lassulus
Copy link
Member Author

I don't really know how to use stdenv in this case, would be very happy for an example.

apart from that, I'm not obliged to let these stay inside of nixpkgs, but the nix lib functions and nixos are also part of the nixpkgs repository. I'm not really sure where the differentiation of "part of nixpkgs" should be made. For now, I want people to use it inside a shell.nix easily without to much hassle. IMHO they don't do any harm inside of nixpkgs and the amount of code/code-changes is quite small. But if someone wants them removed I won't complain.

@Mic92
Copy link
Member

Mic92 commented Feb 23, 2019

cc @lheckemann

@Profpatsch
Copy link
Member

I am still a little skeptical that these belong in all-packages.nix. They aren't packages and they also aren't used by any other packages in all-packages.nix.

We expose everything from build-support in pkgs, so this is fine.

@Profpatsch Profpatsch merged commit ea9161e into NixOS:master Apr 21, 2019
"$(pkgs.pkgconfig}/bin/pkg-config --cflags --libs ${
concatMapStringsSep " " (lib: escapeShellArg (builtins.parseDrvName lib.name).name) (libraries)
"$(pkg-config --cflags --libs ${
concatMapStringsSep " " (pkg: "$(find ${escapeShellArg pkg}/lib/pkgsconfig -name \*.pc -exec basename {} \;)") libraries
Copy link
Member

Choose a reason for hiding this comment

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

Should this not be pkgconfig instead of pkgsconfig?

Copy link
Member

Choose a reason for hiding this comment

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

yes.

Copy link
Member

Choose a reason for hiding this comment

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

argh, @Lassulus, did you even test it? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought I did, but seems I made some mistake :/
Nevertheless, it would be very cool, if we had automated tests for writeC with libraries. Since I'm a C noob, I couldn't come up with a trivial example for a C program with a library.

Copy link
Member

@Mic92 Mic92 Apr 23, 2019

Choose a reason for hiding this comment

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

You can use this one for testing: https://wiki.archlinux.org/index.php/Desktop_notifications#C
Only needs glib in buildInputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants