mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-05 13:23:17 +00:00
Merge pull request #164163 from ncfavier/gapps-binary-wrapper
This commit is contained in:
commit
40d287cfd7
@ -3,7 +3,7 @@
|
|||||||
, libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu
|
, libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu
|
||||||
, libICE
|
, libICE
|
||||||
, vimPlugins
|
, vimPlugins
|
||||||
, makeWrapper, makeBinaryWrapper
|
, makeWrapper
|
||||||
, wrapGAppsHook
|
, wrapGAppsHook
|
||||||
, runtimeShell
|
, runtimeShell
|
||||||
|
|
||||||
@ -133,9 +133,7 @@ in stdenv.mkDerivation rec {
|
|||||||
++ lib.optional wrapPythonDrv makeWrapper
|
++ lib.optional wrapPythonDrv makeWrapper
|
||||||
++ lib.optional nlsSupport gettext
|
++ lib.optional nlsSupport gettext
|
||||||
++ lib.optional perlSupport perl
|
++ lib.optional perlSupport perl
|
||||||
# Make the inner wrapper binary to avoid double wrapping issues with wrapPythonDrv
|
++ lib.optional (guiSupport == "gtk3") wrapGAppsHook
|
||||||
# (https://github.com/NixOS/nixpkgs/pull/164163)
|
|
||||||
++ lib.optional (guiSupport == "gtk3") (wrapGAppsHook.override { makeWrapper = makeBinaryWrapper; })
|
|
||||||
;
|
;
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
@ -33,6 +33,8 @@ assertExecutable() {
|
|||||||
# To troubleshoot a binary wrapper after you compiled it,
|
# To troubleshoot a binary wrapper after you compiled it,
|
||||||
# use the `strings` command or open the binary file in a text editor.
|
# use the `strings` command or open the binary file in a text editor.
|
||||||
makeWrapper() {
|
makeWrapper() {
|
||||||
|
local NIX_CFLAGS_COMPILE NIX_CFLAGS_LINK
|
||||||
|
unset NIX_CFLAGS_COMPILE NIX_CFLAGS_LINK
|
||||||
local original="$1"
|
local original="$1"
|
||||||
local wrapper="$2"
|
local wrapper="$2"
|
||||||
shift 2
|
shift 2
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
, lib
|
, lib
|
||||||
, makeSetupHook
|
, makeSetupHook
|
||||||
, makeWrapper
|
, makeBinaryWrapper
|
||||||
, gobject-introspection
|
, gobject-introspection
|
||||||
, isGraphical ? true
|
, isGraphical ? true
|
||||||
, gtk3
|
, gtk3
|
||||||
@ -34,7 +34,7 @@ makeSetupHook {
|
|||||||
] ++ [
|
] ++ [
|
||||||
|
|
||||||
# We use the wrapProgram function.
|
# We use the wrapProgram function.
|
||||||
makeWrapper
|
makeBinaryWrapper
|
||||||
];
|
];
|
||||||
substitutions = {
|
substitutions = {
|
||||||
passthru.tests = let
|
passthru.tests = let
|
||||||
@ -59,8 +59,8 @@ makeSetupHook {
|
|||||||
tested = basic;
|
tested = basic;
|
||||||
in testLib.runTest "basic-contains-dconf" (
|
in testLib.runTest "basic-contains-dconf" (
|
||||||
testLib.skip stdenv.isDarwin ''
|
testLib.skip stdenv.isDarwin ''
|
||||||
${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "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"}
|
${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GIO_EXTRA_MODULES" "${dconf.lib}/lib/gio/modules"}
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ makeSetupHook {
|
|||||||
typelib-user-has-gi-typelib-path = let
|
typelib-user-has-gi-typelib-path = let
|
||||||
tested = typelib-user;
|
tested = typelib-user;
|
||||||
in testLib.runTest "typelib-user-has-gi-typelib-path" ''
|
in testLib.runTest "typelib-user-has-gi-typelib-path" ''
|
||||||
${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "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"}
|
${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-Mahjong}/lib/girepository-1.0"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Simple derivation containing a gobject-introspection typelib in lib output.
|
# Simple derivation containing a gobject-introspection typelib in lib output.
|
||||||
@ -143,8 +143,8 @@ makeSetupHook {
|
|||||||
typelib-multiout-user-has-gi-typelib-path = let
|
typelib-multiout-user-has-gi-typelib-path = let
|
||||||
tested = typelib-multiout-user;
|
tested = typelib-multiout-user;
|
||||||
in testLib.runTest "typelib-multiout-user-has-gi-typelib-path" ''
|
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}/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}/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.
|
# 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
|
typelib-self-user-has-gi-typelib-path = let
|
||||||
tested = typelib-self-user;
|
tested = typelib-self-user;
|
||||||
in testLib.runTest "typelib-self-user-has-gi-typelib-path" ''
|
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}/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}/libexec/bar" "GI_TYPELIB_PATH" "${typelib-self-user}/lib/girepository-1.0"}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{ runCommand
|
{ lib, runCommand }:
|
||||||
}:
|
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
runTest = name: body: runCommand name { } ''
|
runTest = name: body: runCommand name { } ''
|
||||||
@ -19,12 +18,14 @@ rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
expectSomeLineContainingYInFileXToMentionZ = file: filter: expected: ''
|
expectSomeLineContainingYInFileXToMentionZ = file: filter: expected: ''
|
||||||
if ! cat "${file}" | grep "${filter}"; then
|
file=${lib.escapeShellArg file} filter=${lib.escapeShellArg filter} expected=${lib.escapeShellArg expected}
|
||||||
${fail "The file “${file}” should include a line containing “${filter}”."}
|
|
||||||
|
if ! grep --text --quiet "$filter" "$file"; then
|
||||||
|
${fail "The file “$file” should include a line containing “$filter”."}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! cat "${file}" | grep "${filter}" | grep ${expected}; then
|
if ! grep --text "$filter" "$file" | grep --text --quiet "$expected"; then
|
||||||
${fail "The file “${file}” should include a line containing “${filter}” that also contains “${expected}”."}
|
${fail "The file “$file” should include a line containing “$filter” that also contains “$expected”."}
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user