
The script is used to install dependencies that are needed both for the CI image and the gnome os system extension. To avoid installing dependencies in an environment where they are already satisfied, they should be guarded by an appropriate check, most commonly pkgconf. Right now these checks are straight-forward: - if a dependency is not in the base image, it will be built when building the CI image - if a dependency is not in GNOME OS, it will be built when building the GNOME OS system extension However we will soon add another caller of the script, when allowing to export a system extension from our development toolboxes to the host. That case is trickier, as the dependency *is* satisfied by the build environment (because it is based on the CI image), but it will still be needed by the exported system extension. To account for that case, add a pkgconf wrapper that only searches in PKG_CONFIG_DIRS in the specified destdirs. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4075>
89 lines
1.6 KiB
Bash
Executable File
89 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
usage() {
|
|
cat <<-EOF
|
|
Usage: $(basename $0) [OPTION…]
|
|
|
|
Install common dependencies to a base image or system extension
|
|
|
|
Options:
|
|
--libdir=DIR Setup the projects with a different libdir
|
|
--destdir=DIR Install the project to DIR, can be used
|
|
several times to install to multiple destdirs
|
|
|
|
-h, --help Display this help
|
|
|
|
EOF
|
|
}
|
|
|
|
pkgconf() {
|
|
local PKG_CONFIG_DIRS=(
|
|
/usr/lib64/pkgconfig
|
|
/usr/lib/pkgconfig
|
|
/usr/share/pkgconfig
|
|
)
|
|
|
|
local search_dirs=()
|
|
for destdir in "${DESTDIRS[@]}"; do
|
|
search_dirs+=( "${PKG_CONFIG_DIRS[@]/#/$destdir}" )
|
|
done
|
|
|
|
ENV=(PKG_CONFIG_PATH=$(echo "${search_dirs[@]}" | tr ' ' :))
|
|
|
|
env "${ENV[@]}" pkgconf --env-only "$@"
|
|
}
|
|
|
|
TEMP=$(getopt \
|
|
--name=$(basename $0) \
|
|
--options='h' \
|
|
--longoptions='libdir:' \
|
|
--longoptions='destdir:' \
|
|
--longoptions='help' \
|
|
-- "$@")
|
|
|
|
eval set -- "$TEMP"
|
|
unset TEMP
|
|
|
|
OPTIONS=()
|
|
DESTDIRS=()
|
|
|
|
while true; do
|
|
case "$1" in
|
|
--libdir)
|
|
OPTIONS+=( --libdir=$2 )
|
|
shift 2
|
|
;;
|
|
|
|
--destdir)
|
|
DESTDIRS+=( $2 )
|
|
shift 2
|
|
;;
|
|
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
|
|
--)
|
|
shift
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
[[ ${#DESTDIRS[@]} == 0 ]] && DESTDIRS+=( / )
|
|
OPTIONS+=( "${DESTDIRS[@]/#/--destdir=}" )
|
|
|
|
SCRIPTS_DIR="$(dirname $0)"
|
|
|
|
## Add necessary dependencies here, for example
|
|
# if ! pkgconf --atleast-version 1.23.0 wayland-server
|
|
# then
|
|
# ./$SCRIPTS_DIR/install-meson-project.sh \
|
|
# "${OPTIONS[@]}" \
|
|
# https://gitlab.freedesktop.org/wayland/wayland.git \
|
|
# 1.23.0
|
|
# fi
|