Files
intel-media-sdk/recipe.sh
T
2026-07-09 16:41:56 +03:00

71 lines
2.5 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 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 -Np1 -i "$BPM_WORKDIR"/020-intel-media-sdk-libcttmetrics-static-only.patch
patch -Np1 -i "$BPM_WORKDIR"/030-intel-media-sdk-gcc13-fix.patch
patch -Np1 -i "$BPM_WORKDIR"/040-intel-media-sdk-gcc15-fix.patch
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_ALL=ON \
-DBUILD_TOOLS=ON \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DENABLE_ITT=OFF \
-DENABLE_OPENCL=OFF \
-DENABLE_WAYLAND=ON \
-DENABLE_X11_DRI3=ON \
-DMFX_APPS_DIR="/usr/lib/mfx" \
-Wno-dev
cmake --build build
}
# The check function is executed in the source directory
# This function is used to run tests to verify the package has been compiled correctly
check() {
ctest --test-dir build --output-on-failure
}
_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_intel-media-sdk() {
DESTDIR="$BPM_OUTPUT" cmake --install build
# Move file
mv "$BPM_OUTPUT"/usr/lib/libcttmetrics.a "$BPM_OUTPUT"/usr/lib/mfx/samples/libcttmetrics.a
cd "$BPM_OUTPUT"
# Move libmfx files into split package
_pick libmfx usr/include/mfx
_pick libmfx usr/lib/libmfx.so*
_pick libmfx usr/lib/pkgconfig/{,lib}mfx.pc
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/intel-media-sdk/LICENSE
}
package_libmfx() {
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/libmfx/LICENSE
}