about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gtk/hooks/clean-immodules-cache.sh
blob: 0868a4a391011b447a733060904002cc623d7a7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# shellcheck shell=bash

fixupOutputHooks+=(_gtkCleanImmodulesCache)

# Clean comments that link to generator of the file
_gtkCleanImmodulesCache() {
    # gtk_module_path is where the modules are installed
    # https://gitlab.gnome.org/GNOME/gtk/-/blob/3.24.24/gtk/gtkmodules.c#L68
    # gtk_binary_version can be retrived with:
    # pkg-config --variable=gtk_binary_version gtk+-3.0
    local f="${prefix:?}/lib/@gtk_module_path@/@gtk_binary_version@/immodules.cache"
    if [ -f "$f" ]; then
        sed 's|Created by .*bin/gtk-query-|Created by bin/gtk-query-|' -i "$f"
    fi
}