Files
gtk3/recipe.sh
T

51 lines
2.1 KiB
Bash

# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
meson setup --prefix=/usr --libdir=/usr/lib --buildtype=release -Dman=false -Dgtk_doc=true -Dman=true -Dbroadway_backend=true build
meson compile -C build
}
_pick() {
local p="$1" f d; shift
for f; do
[ -d "$BPM_WORKDIR"/output_"$p" ] || { echo "Split package $p not found"; exit 1; }
d="$BPM_WORKDIR"/output_"$p"/"${f#$BPM_OUTPUT}"
mkdir -p "$(dirname "$d")"
mv "$f" "$d"
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
done
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package_gtk3() {
meson install -C build --destdir="$BPM_OUTPUT"
# Install BPM hooks
install -Dm644 "$BPM_WORKDIR"/*.bpmhook -t "$BPM_OUTPUT"/var/lib/bpm/hooks/
cd "$BPM_OUTPUT"
# Move demo files into split package
_pick gtk3-demos usr/bin/gtk3-{demo,demo-application,icon-browser,widget-factory}
_pick gtk3-demos usr/share/applications/gtk3-{demo,icon-browser,widget-factory}.desktop
_pick gtk3-demos usr/share/glib-2.0/schemas/org.gtk.{Demo,exampleapp}.gschema.xml
_pick gtk3-demos usr/share/icons/hicolor/*/apps/gtk3-{demo,widget-factory}[-.]*
_pick gtk3-demos usr/share/man/man1/gtk3-{demo,demo-application,icon-browser,widget-factory}.1
# Remove gtk-update-icon-cache binary
rm "$BPM_OUTPUT"/usr/bin/gtk-update-icon-cache
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/gtk3/COPYING
}
package_gtk3-demos() {
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/gtk3/COPYING
}