From a5d874935e307fb3e354c06e1b9a518f7441fbeb Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 21 Oct 2019 23:18:42 +0200 Subject: [PATCH 1/3] writers: fix writeC libraries detection --- pkgs/build-support/writers/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 8dbe0dbdbd0..2cd4f1af022 100644 --- a/pkgs/build-support/writers/default.nix +++ b/pkgs/build-support/writers/default.nix @@ -92,13 +92,15 @@ rec { PATH=${makeBinPath [ pkgs.binutils-unwrapped pkgs.coreutils + pkgs.findutils pkgs.gcc pkgs.pkgconfig ]} + export PKG_CONFIG_PATH=${concatMapStringsSep ":" (pkg: "${pkg}/lib/pkgconfig") libraries} gcc \ ${optionalString (libraries != []) "$(pkg-config --cflags --libs ${ - concatMapStringsSep " " (pkg: "$(find ${escapeShellArg pkg}/lib/pkgsconfig -name \*.pc -exec basename {} \;)") libraries + concatMapStringsSep " " (pkg: "$(find ${escapeShellArg pkg}/lib/pkgconfig -name \\*.pc)") libraries })" } \ -O \ From e7cccb74ee04c1283eb5f2c5c7f6ce9bb96731e9 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 21 Oct 2019 23:20:25 +0200 Subject: [PATCH 2/3] writers test: fix python2 linter errors --- pkgs/build-support/writers/test.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/build-support/writers/test.nix b/pkgs/build-support/writers/test.nix index d7c347a559e..d854b552c53 100644 --- a/pkgs/build-support/writers/test.nix +++ b/pkgs/build-support/writers/test.nix @@ -49,9 +49,11 @@ let python2 = writePython2Bin "test_writers" { libraries = [ python2Packages.enum ]; } '' from enum import Enum + class Test(Enum): a = "success" + print Test.a ''; @@ -112,9 +114,11 @@ let python2 = writePython2 "test_python2" { libraries = [ python2Packages.enum ]; } '' from enum import Enum + class Test(Enum): a = "success" + print Test.a ''; From 6d807882ad2ffa9aef07b75b8db40aead0e9bc61 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 21 Oct 2019 23:20:46 +0200 Subject: [PATCH 3/3] writers test: use writeC with library for testing --- pkgs/build-support/writers/test.nix | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/writers/test.nix b/pkgs/build-support/writers/test.nix index d854b552c53..3cd0a080ae8 100644 --- a/pkgs/build-support/writers/test.nix +++ b/pkgs/build-support/writers/test.nix @@ -1,4 +1,16 @@ -{ stdenv, lib, runCommand, haskellPackages, nodePackages, perlPackages, python2Packages, python3Packages, writers, writeText }: +{ + glib, + haskellPackages, + lib, + nodePackages, + perlPackages, + python2Packages, + python3Packages, + runCommand, + stdenv, + writers, + writeText +}: with writers; let @@ -72,9 +84,19 @@ let if [[ "test" == "test" ]]; then echo "success"; fi ''; - c = writeC "test_c" { libraries = [ ]; } '' + c = writeC "test_c" { libraries = [ glib.dev ]; } '' + #include #include int main() { + GApplication *application = g_application_new ("hello.world", G_APPLICATION_FLAGS_NONE); + g_application_register (application, NULL, NULL); + GNotification *notification = g_notification_new ("Hello world!"); + g_notification_set_body (notification, "This is an example notification."); + GIcon *icon = g_themed_icon_new ("dialog-information"); + g_notification_set_icon (notification, icon); + g_object_unref (icon); + g_object_unref (notification); + g_object_unref (application); printf("success\n"); return 0; }