diff --git a/pkgs/development/libraries/gtk/2.x.nix b/pkgs/development/libraries/gtk/2.x.nix index f1a53390467a..8bef9d92f5fa 100644 --- a/pkgs/development/libraries/gtk/2.x.nix +++ b/pkgs/development/libraries/gtk/2.x.nix @@ -25,9 +25,12 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - setupHook = ./setup-hook.sh; + setupHooks = [ + ./gtk2-clean-immodules-cache.sh + ./drop-icon-theme-cache.sh + ]; - nativeBuildInputs = [ setupHook perl pkgconfig gettext gobject-introspection ]; + nativeBuildInputs = [ setupHooks perl pkgconfig gettext gobject-introspection ]; patches = [ ./2.0-immodules.cache.patch diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index 069007179ac1..49e562ef80bc 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -49,7 +49,10 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" ]; outputBin = "dev"; - setupHook = ./gtk3-setup-hook.sh; + setupHooks = [ + ./gtk3-clean-immodules-cache.sh + ./drop-icon-theme-cache.sh + ]; src = fetchurl { url = "mirror://gnome/sources/gtk+/${stdenv.lib.versions.majorMinor version}/gtk+-${version}.tar.xz"; @@ -108,7 +111,7 @@ stdenv.mkDerivation rec { pkgconfig python3 sassc - setupHook + setupHooks ]; buildInputs = [ diff --git a/pkgs/development/libraries/gtk/gtk3-setup-hook.sh b/pkgs/development/libraries/gtk/drop-icon-theme-cache.sh similarity index 74% rename from pkgs/development/libraries/gtk/gtk3-setup-hook.sh rename to pkgs/development/libraries/gtk/drop-icon-theme-cache.sh index 5a0eea0fc285..8f2cb8a334ae 100644 --- a/pkgs/development/libraries/gtk/gtk3-setup-hook.sh +++ b/pkgs/development/libraries/gtk/drop-icon-theme-cache.sh @@ -1,15 +1,5 @@ # shellcheck shell=bash -fixupOutputHooks+=(_gtk3CleanComments) - -# Clean comments that link to generator of the file -_gtk3CleanComments() { - local f="${prefix:?}/lib/gtk-3.0/3.0.0/immodules.cache" - if [ -f "$f" ]; then - sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f" - fi -} - # Packages often run gtk-update-icon-cache to include their icons in themes’ icon cache. # However, since each package is installed to its own prefix, the files will only collide. dropIconThemeCache() { diff --git a/pkgs/development/libraries/gtk/setup-hook.sh b/pkgs/development/libraries/gtk/gtk2-clean-immodules-cache.sh similarity index 72% rename from pkgs/development/libraries/gtk/setup-hook.sh rename to pkgs/development/libraries/gtk/gtk2-clean-immodules-cache.sh index c2b0ab502db7..dde991fd27cd 100644 --- a/pkgs/development/libraries/gtk/setup-hook.sh +++ b/pkgs/development/libraries/gtk/gtk2-clean-immodules-cache.sh @@ -1,8 +1,10 @@ +# shellcheck shell=bash + fixupOutputHooks+=(_gtk2CleanComments) # Clean comments that link to generator of the file _gtk2CleanComments() { - local f="$prefix/lib/gtk-2.0/2.10.0/immodules.cache" + local f="${prefix:?}/lib/gtk-2.0/2.10.0/immodules.cache" if [ -f "$f" ]; then sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f" fi diff --git a/pkgs/development/libraries/gtk/gtk3-clean-immodules-cache.sh b/pkgs/development/libraries/gtk/gtk3-clean-immodules-cache.sh new file mode 100644 index 000000000000..d2d5287831a0 --- /dev/null +++ b/pkgs/development/libraries/gtk/gtk3-clean-immodules-cache.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +fixupOutputHooks+=(_gtk3CleanComments) + +# Clean comments that link to generator of the file +_gtk3CleanComments() { + local f="${prefix:?}/lib/gtk-3.0/3.0.0/immodules.cache" + if [ -f "$f" ]; then + sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f" + fi +}