FFmpeg-Builds/scripts.d/45-vulkan.sh

57 lines
1.6 KiB
Bash
Raw Normal View History

2020-09-07 15:40:37 +00:00
#!/bin/bash
2021-04-05 06:47:23 +00:00
LOADER_REPO="https://github.com/KhronosGroup/Vulkan-Loader.git"
LOADER_COMMIT="7ea01c139ffc7c33cd12bd258c1bc8bf530c6d2d"
2020-09-07 15:40:37 +00:00
ffbuild_enabled() {
# The various graphics systems(xcb, xlib, wayland, ...) need figured out first
[[ $TARGET == linux* ]] && return -1
2020-09-07 15:40:37 +00:00
return 0
}
ffbuild_dockerstage() {
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/vulkan,dst=/patches run_stage /stage.sh"
2020-09-07 15:40:37 +00:00
}
ffbuild_dockerbuild() {
2021-04-05 06:47:23 +00:00
git clone "$LOADER_REPO" loader
git -C loader checkout "$LOADER_COMMIT"
2020-09-07 15:40:37 +00:00
for patch in /patches/*.patch; do
2021-04-05 06:47:23 +00:00
echo "Applying $patch"
git -C loader am -3 < "$patch"
done
2020-09-07 19:32:38 +00:00
HEADERS_REPO="$(grep -A10 'name.*:.*Vulkan-Headers' loader/scripts/known_good.json | grep url | head -n1 | cut -d'"' -f4)"
HEADERS_COMMIT="$(grep -A10 'name.*:.*Vulkan-Headers' loader/scripts/known_good.json | grep commit | head -n1 | cut -d'"' -f4)"
git-mini-clone "$HEADERS_REPO" "$HEADERS_COMMIT" headers
cd headers
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" ..
make -j$(nproc)
make install
cd ../../loader
mkdir build && cd build
2021-04-05 00:20:36 +00:00
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_TESTS=OFF -DBUILD_STATIC_LOADER=ON ..
2020-09-07 19:32:38 +00:00
make -j$(nproc)
make install
ln -s libvulkan-1.a /opt/ffbuild/lib/libvulkan.a
2020-09-07 15:40:37 +00:00
}
ffbuild_configure() {
echo --enable-vulkan
}
ffbuild_unconfigure() {
echo --disable-vulkan
}