diff --git a/README.md b/README.md index 2d3032c..d435bed 100644 --- a/README.md +++ b/README.md @@ -34,31 +34,22 @@ A collection of scripts and patches that helps build [mpv](https://mpv.io) with ``` ### Build and install -1. [**MoltenVK**](https://github.com/KhronosGroup/MoltenVK) - :warning: Requires admin password. +1. [**Vulkan Loader**](https://github.com/KhronosGroup/Vulkan-Loader) & [**Vulkan Headers**](https://github.com/KhronosGroup/Vulkan-Headers) ```sh - git -C src clone "https://github.com/KhronosGroup/MoltenVK.git" - ./build-MoltenVK + git -C src clone "https://github.com/KhronosGroup/Vulkan-Loader.git" + git -C src clone "https://github.com/KhronosGroup/Vulkan-Headers.git" + ./build-vulkan ``` -
+2. [**MoltenVK**](https://github.com/KhronosGroup/MoltenVK) - Installed files - - ``` - /usr/local - ├── lib - │   └── libMoltenVK.dylib - └── share - └── vulkan - └── icd.d - └── MoltenVK_icd.json + ```sh + git -C src clone "https://github.com/KhronosGroup/MoltenVK.git" + ./build-MoltenVK ``` -
- -2. [**FreeType**](https://gitlab.freedesktop.org/freetype/freetype) & [**HarfBuzz**](https://github.com/harfbuzz/harfbuzz) +3. [**FreeType**](https://gitlab.freedesktop.org/freetype/freetype) & [**HarfBuzz**](https://github.com/harfbuzz/harfbuzz) ```sh git -C src clone "https://gitlab.freedesktop.org/freetype/freetype.git" @@ -68,28 +59,28 @@ A collection of scripts and patches that helps build [mpv](https://mpv.io) with ./build-FreeType ``` -3. [**libass**](https://github.com/libass/libass) +4. [**libass**](https://github.com/libass/libass) ```sh git -C src clone "https://github.com/libass/libass.git" ./build-libass ``` -4. [**libplacebo**](https://code.videolan.org/videolan/libplacebo) +5. [**libplacebo**](https://code.videolan.org/videolan/libplacebo) ```sh git -C src clone --recursive "https://code.videolan.org/videolan/libplacebo.git" ./build-libplacebo ``` -5. [**FFmpeg**](https://git.ffmpeg.org/ffmpeg.git) +6. [**FFmpeg**](https://git.ffmpeg.org/ffmpeg.git) ```sh git -C src clone "https://git.ffmpeg.org/ffmpeg.git" ./build-FFmpeg ``` -6. [**mpv**](https://github.com/mpv-player/mpv) +7. [**mpv**](https://github.com/mpv-player/mpv) ```sh git -C src clone "https://github.com/mpv-player/mpv.git" @@ -97,7 +88,7 @@ A collection of scripts and patches that helps build [mpv](https://mpv.io) with ./build-mpv ``` -7. Add binaries to your `$PATH`: +8. Add binaries to your `$PATH`: ```sh cd ~/.local/bin diff --git a/build-FFmpeg b/build-FFmpeg index 324c7da..3c491d8 100755 --- a/build-FFmpeg +++ b/build-FFmpeg @@ -15,6 +15,7 @@ import_local_pkg freetype import_local_pkg harfbuzz import_local_pkg libass import_local_pkg libplacebo +import_local_pkg vulkan cd "${srcdir}" diff --git a/build-MoltenVK b/build-MoltenVK index e40f41f..a4c1b04 100755 --- a/build-MoltenVK +++ b/build-MoltenVK @@ -6,7 +6,8 @@ cd "$(dirname "$0")" set -a; source build.env; set +a -prefix="/usr/local" +pkgname="moltenvk" +pkgdir="${PKGPREFIX:-/opt/local}/${pkgname}" srcdir="src/MoltenVK" builddir="$(realpath "${srcdir}")/Package/Latest/MoltenVK/dylib/macOS" @@ -14,19 +15,18 @@ cd "${srcdir}" ./fetchDependencies \ --macos \ - --v-headers-root "$(brew --prefix vulkan-headers)" + --v-headers-root "${PKGPREFIX:-/opt/local}/vulkan" make macos MVK_CONFIG_LOG_LEVEL=2 -sed -i '' "s/\\.\\/libMoltenVK/${prefix//\//\\\/}\\/lib\\/libMoltenVK/" "${builddir}"/MoltenVK_icd.json +sed -i '' "s/\\.\\/libMoltenVK/${pkgdir//\//\\\/}\\/lib\\/libMoltenVK/" "${builddir}"/MoltenVK_icd.json cat "${builddir}"/MoltenVK_icd.json -sudo rm -f "${prefix}"/lib/libMoltenVK.dylib -sudo rm -f "${prefix}"/share/vulkan/icd.d/MoltenVK_icd.json +rm -rf "${pkgdir}" -sudo mkdir -p "${prefix}"/lib "${prefix}"/share/vulkan/icd.d -sudo install -vm755 "${builddir}"/libMoltenVK.dylib "${prefix}"/lib -sudo install -vm644 "${builddir}"/MoltenVK_icd.json "${prefix}"/share/vulkan/icd.d +mkdir -p "${pkgdir}"/lib "${pkgdir}"/share/vulkan/icd.d +install -vm755 "${builddir}"/libMoltenVK.dylib "${pkgdir}"/lib +install -vm644 "${builddir}"/MoltenVK_icd.json "${pkgdir}"/share/vulkan/icd.d rm -rf ~/.swiftpm diff --git a/build-libplacebo b/build-libplacebo index d58676a..7644435 100755 --- a/build-libplacebo +++ b/build-libplacebo @@ -5,12 +5,15 @@ # cd "$(dirname "$0")" set -a; source build.env; set +a +source utils/pkg-import pkgname="libplacebo" pkgdir="${PKGPREFIX:-/opt/local}/${pkgname}" srcdir="src/libplacebo" builddir="${TMPDIR:-/tmp}/build.${pkgname}" +import_local_pkg vulkan + rm -rf "${builddir}" meson setup "${builddir}" "${srcdir}" \ @@ -19,7 +22,7 @@ meson setup "${builddir}" "${srcdir}" \ -Dbuildtype=release \ -Db_lto=true \ -Db_lto_mode=thin \ - -Dvulkan-registry="$(brew --prefix vulkan-headers)/share/vulkan/registry/vk.xml" \ + -Dvulkan-registry="${PKGPREFIX:-/opt/local}/vulkan/share/vulkan/registry/vk.xml" \ -Dvulkan=enabled \ -Dshaderc=enabled \ -Dlcms=enabled \ diff --git a/build-mpv b/build-mpv index ea5a95e..475ba4e 100755 --- a/build-mpv +++ b/build-mpv @@ -17,6 +17,7 @@ import_local_pkg freetype import_local_pkg harfbuzz import_local_pkg libass import_local_pkg libplacebo +import_local_pkg vulkan import_homebrew_pkg libarchive diff --git a/build-vulkan b/build-vulkan new file mode 100755 index 0000000..c1bf69e --- /dev/null +++ b/build-vulkan @@ -0,0 +1,50 @@ +#!/usr/bin/env bash -e +# +# Vulkan Headers +# https://github.com/KhronosGroup/Vulkan-Headers.git +# +# Vulkan Loader +# https://github.com/KhronosGroup/Vulkan-Loader.git +# +cd "$(dirname "$0")" +set -a; source build.env; set +a + +pkgname="vulkan" +pkgdir="${PKGPREFIX:-/opt/local}/${pkgname}" +builddir="${TMPDIR:-/tmp}/build.${pkgname}" +headerssrcdir="src/Vulkan-Headers" +loadersrcdir="src/Vulkan-Loader" +libpath="${pkgdir}/lib/libvulkan.1.dylib" + +rm -rf "${builddir}" "${pkgdir}" + +cmake \ + -B "${builddir}" \ + -S "${headerssrcdir}" \ + -GNinja \ + -DCMAKE_INSTALL_PREFIX="${pkgdir}" \ + -DCMAKE_BUILD_TYPE=Release + +cmake --build "${builddir}" +cmake --install "${builddir}" + +rm -rf "${builddir}" + +cmake \ + -B "${builddir}" \ + -S "${loadersrcdir}" \ + -GNinja \ + -DCMAKE_INSTALL_PREFIX="${pkgdir}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ + -DCMAKE_MACOSX_RPATH=OFF \ + -DVULKAN_HEADERS_INSTALL_DIR="${pkgdir}" \ + -DFALLBACK_DATA_DIRS="${PKGPREFIX:-/opt/local}/moltenvk/share:/usr/local/share" + +cmake --build "${builddir}" +cmake --install "${builddir}" +install_name_tool -id "${libpath}" "${libpath}" + +rm -rf "${builddir}" + +# vi:set ts=2 sw=2 et: diff --git a/homebrew/runtime.txt b/homebrew/runtime.txt index 08fb6ad..dca9bd1 100644 --- a/homebrew/runtime.txt +++ b/homebrew/runtime.txt @@ -12,7 +12,6 @@ opus shaderc svt-av1 uchardet -vulkan-loader x264 x265 xxhash