Files
mesa-demos/source.sh
T
2026-05-23 22:14:40 +03:00

61 lines
2.2 KiB
Bash

# This is the source.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 prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
# Patch from fedora
patch -Np1 -i "$BPM_WORKDIR"/mesa-demos-system-data.patch
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
meson setup build --prefix=/usr -Dgles1=disabled -Dosmesa=disabled -Dwith-system-data-files=true
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_mesa-demos() {
meson install -C build --destdir="$BPM_OUTPUT"
cd "$BPM_OUTPUT"
# Move mesa utilities into split package
_pick mesa-utils usr/bin/eglinfo
_pick mesa-utils usr/bin/eglgears_*
_pick mesa-utils usr/bin/eglkms
_pick mesa-utils usr/bin/egltri_*
_pick mesa-utils usr/bin/peglgears
_pick mesa-utils usr/bin/xeglgears
_pick mesa-utils usr/bin/xeglthreads
_pick mesa-utils usr/bin/es2_info
_pick mesa-utils usr/bin/es2gears_*
_pick mesa-utils usr/bin/es2tri
_pick mesa-utils usr/bin/glxinfo
_pick mesa-utils usr/bin/glxgears
_pick mesa-utils usr/bin/vkgears
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/mesa-demos/LICENSE
}
package_mesa-utils() {
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/mesa-utils/LICENSE
}