diff options
author | Doron Behar <doron.behar@gmail.com> | 2022-04-27 23:30:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 23:30:37 +0300 |
commit | 40d287cfd7b929ee51725b7511813fc1cc950b43 (patch) | |
tree | b473fb8bdaf674ebed3184314494ddbfb64efc67 /pkgs/build-support | |
parent | 2d8612d4c3977214bc017c64fc73591e3593b334 (diff) | |
parent | f8cc8ff5755528d9a73671481ba3d6fb00f4e8d5 (diff) |
Merge pull request #164163 from ncfavier/gapps-binary-wrapper
Diffstat (limited to 'pkgs/build-support')
3 files changed, 19 insertions, 16 deletions
diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper.sh index 986be5b9e1137..7123f100c1755 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper.sh @@ -33,6 +33,8 @@ assertExecutable() { # To troubleshoot a binary wrapper after you compiled it, # use the `strings` command or open the binary file in a text editor. makeWrapper() { + local NIX_CFLAGS_COMPILE NIX_CFLAGS_LINK + unset NIX_CFLAGS_COMPILE NIX_CFLAGS_LINK local original="$1" local wrapper="$2" shift 2 diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix index d0ea088bf71e8..8c10f67c152ce 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -1,7 +1,7 @@ { stdenv , lib , makeSetupHook -, makeWrapper +, makeBinaryWrapper , gobject-introspection , isGraphical ? true , gtk3 @@ -34,7 +34,7 @@ makeSetupHook { ] ++ [ # We use the wrapProgram function. - makeWrapper + makeBinaryWrapper ]; substitutions = { passthru.tests = let @@ -59,8 +59,8 @@ makeSetupHook { tested = basic; in testLib.runTest "basic-contains-dconf" ( testLib.skip stdenv.isDarwin '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GIO_EXTRA_MODULES=" "${dconf.lib}/lib/gio/modules"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GIO_EXTRA_MODULES=" "${dconf.lib}/lib/gio/modules"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GIO_EXTRA_MODULES" "${dconf.lib}/lib/gio/modules"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GIO_EXTRA_MODULES" "${dconf.lib}/lib/gio/modules"} '' ); @@ -98,8 +98,8 @@ makeSetupHook { typelib-user-has-gi-typelib-path = let tested = typelib-user; in testLib.runTest "typelib-user-has-gi-typelib-path" '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-Mahjong}/lib/girepository-1.0"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-Mahjong}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH" "${typelib-Mahjong}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-Mahjong}/lib/girepository-1.0"} ''; # Simple derivation containing a gobject-introspection typelib in lib output. @@ -143,8 +143,8 @@ makeSetupHook { typelib-multiout-user-has-gi-typelib-path = let tested = typelib-multiout-user; in testLib.runTest "typelib-multiout-user-has-gi-typelib-path" '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-Bechamel.lib}/lib/girepository-1.0"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-Bechamel.lib}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH" "${typelib-Bechamel.lib}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-Bechamel.lib}/lib/girepository-1.0"} ''; # Simple derivation that contains a typelib as well as a program using it. @@ -169,8 +169,8 @@ makeSetupHook { typelib-self-user-has-gi-typelib-path = let tested = typelib-self-user; in testLib.runTest "typelib-self-user-has-gi-typelib-path" '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH=" "${typelib-self-user}/lib/girepository-1.0"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH=" "${typelib-self-user}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GI_TYPELIB_PATH" "${typelib-self-user}/lib/girepository-1.0"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-self-user}/lib/girepository-1.0"} ''; }; }; diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix index 1757bdbbe2500..42866c3419ddf 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/tests/lib.nix @@ -1,5 +1,4 @@ -{ runCommand -}: +{ lib, runCommand }: rec { runTest = name: body: runCommand name { } '' @@ -19,12 +18,14 @@ rec { ''; expectSomeLineContainingYInFileXToMentionZ = file: filter: expected: '' - if ! cat "${file}" | grep "${filter}"; then - ${fail "The file “${file}” should include a line containing “${filter}”."} + file=${lib.escapeShellArg file} filter=${lib.escapeShellArg filter} expected=${lib.escapeShellArg expected} + + if ! grep --text --quiet "$filter" "$file"; then + ${fail "The file “$file” should include a line containing “$filter”."} fi - if ! cat "${file}" | grep "${filter}" | grep ${expected}; then - ${fail "The file “${file}” should include a line containing “${filter}” that also contains “${expected}”."} + if ! grep --text "$filter" "$file" | grep --text --quiet "$expected"; then + ${fail "The file “$file” should include a line containing “$filter” that also contains “$expected”."} fi ''; } |