diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 1940e3c..83eb4a5 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@v3
- name: Install requirements
- run: brew install go meson ninja
+ run: brew install go meson ninja nasm
- name: Print tool versions
run: make tool-versions
@@ -41,40 +41,58 @@ jobs:
VERSION=${{ steps.version.outputs.version }}
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_ios-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_macos-amd64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_macos-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_macos-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-full.tar.gz
+ make build/output/libmpv-libs_${VERSION}_macos-universal-video-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-full.tar.gz
+ make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-full.tar.gz
+ make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-full.tar.gz
+ make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-full.tar.gz
+ make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-encodersgpl.tar.gz
make build/output/debug.zip
- name: Upload artifacts
diff --git a/.tool-versions b/.tool-versions
index 49f5635..b0f7437 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,8 +1,10 @@
clang 14.0.3
-cmake 3.27.4
+cmake 3.27.5
golang 1.21.0
-macos 13.5.1
+macos 13.5.2
make 3.81
meson 1.2.1
+nasm 2.16.01
ninja 1.11.1
+python3 3.11.5
xcode 14.3.1
diff --git a/LICENSE.txt b/LICENSE.txt
index 6e60437..21bdbf1 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,3 +1,5 @@
+For the "default" and "full" flavors, the following license applies:
+
MIT License
Copyright (c) 2023 birros
@@ -19,3 +21,20 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+
+For the "encodersgpl" flavor, the following license applies:
+
+Copyright (C) 2023 moffatman
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
diff --git a/Makefile b/Makefile
index 8172e56..b96190c 100644
--- a/Makefile
+++ b/Makefile
@@ -56,49 +56,68 @@ all: \
${OUTPUT_DIR}/debug.zip \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_ios-arm64-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_ios-arm64-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_ios-arm64-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_ios-arm64-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_ios-arm64-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_ios-arm64-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-amd64-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-amd64-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-amd64-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-amd64-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-amd64-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-amd64-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-arm64-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-arm64-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-arm64-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-arm64-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-arm64-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-arm64-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-universal-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-universal-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-universal-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-universal-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-universal-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_iossimulator-universal-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-amd64-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-amd64-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-amd64-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-amd64-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-amd64-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-amd64-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-arm64-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-arm64-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-arm64-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-arm64-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-arm64-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-arm64-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-universal-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-universal-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-universal-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-universal-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-universal-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-libs_${VERSION}_macos-universal-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_ios-universal-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_ios-universal-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_ios-universal-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_ios-universal-video-default.tar.gz \
${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_ios-universal-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_ios-universal-video-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_macos-universal-audio-default.tar.gz \
${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_macos-universal-audio-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_macos-universal-audio-encodersgpl.tar.gz \
${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_macos-universal-video-default.tar.gz \
- ${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_macos-universal-video-full.tar.gz
+ ${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_macos-universal-video-full.tar.gz \
+ ${OUTPUT_DIR}/libmpv-xcframeworks_${VERSION}_macos-universal-video-encodersgpl.tar.gz
${OUTPUT_DIR}/debug.zip: \
${INTERMEDIATE_DIR}/tool-versions.lock \
$$(foreach OS,ios iossimulator macos, \
$$(foreach ARCH,amd64 arm64, \
$$(foreach VARIANT,audio video, \
- $$(foreach FLAVOR,default full, \
+ $$(foreach FLAVOR,default full encodersgpl, \
$$(if $$(filter-out ios-amd64, $${OS}-$${ARCH}), \
${INTERMEDIATE_DIR}/ffmpeg_$${OS}-$${ARCH}-$${VARIANT}-$${FLAVOR} \
+ ${INTERMEDIATE_DIR}/fftools-ffi_$${OS}-$${ARCH}-$${VARIANT}-$${FLAVOR} \
${INTERMEDIATE_DIR}/mpv_$${OS}-$${ARCH}-$${VARIANT} \
) \
) \
@@ -173,7 +192,7 @@ ${LINKS_DIR}:
rm -rf ${TARGET_DIR}
env \
- BINARIES="meson ninja cmake" \
+ BINARIES="meson ninja cmake nasm" \
OUTPUT_DIR=${TARGET_OUTPUT_DIR} \
sh ${PROJECT_DIR}/scripts/links/build.sh
@@ -257,8 +276,8 @@ ${INTERMEDIATE_DIR}/dav1d_%: \
rm -rf ${TARGET_TMP_DIR}
-# libressl_-
-${INTERMEDIATE_DIR}/libressl_%: \
+# mbedtls_-
+${INTERMEDIATE_DIR}/mbedtls_%: \
${DOWNLOADS_DIR} \
${PKGCONFIG_DIR}
@@ -283,7 +302,7 @@ ${INTERMEDIATE_DIR}/libressl_%: \
env -i \
PATH=${SANDBOX_PATH} \
ARCHIVE_FILE=${ARCHIVE_FILE} \
- TARGET_DIR=${TARGET_SRC_DIR} \
+ TARGET_DIR=${TARGET_SRC_DIR}/subprojects/${TARGET_PKGNAME} \
sh ${PROJECT_DIR}/scripts/extract/build.sh
env -i \
@@ -341,10 +360,18 @@ ${INTERMEDIATE_DIR}/libxml2_%: \
${INTERMEDIATE_DIR}/ffmpeg_%: \
${DOWNLOADS_DIR} \
${PKGCONFIG_DIR} \
- ${INTERMEDIATE_DIR}/libressl_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ${INTERMEDIATE_DIR}/mbedtls_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ $$(if $$(filter encodersgpl, $$(word 4,$$(subst -, ,$$*))), \
+ ${INTERMEDIATE_DIR}/libvorbis_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ${INTERMEDIATE_DIR}/libogg_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ) \
$$(if $$(filter video, $$(word 3,$$(subst -, ,$$*))), \
${INTERMEDIATE_DIR}/dav1d_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
${INTERMEDIATE_DIR}/libxml2_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ $$(if $$(filter encodersgpl, $$(word 4,$$(subst -, ,$$*))), \
+ ${INTERMEDIATE_DIR}/libvpx_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ${INTERMEDIATE_DIR}/libx264_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ) \
)
@echo "\033[32mRULE\033[0m $@"
@@ -681,11 +708,273 @@ ${INTERMEDIATE_DIR}/mpv_%: \
rm -rf ${TARGET_TMP_DIR}
+# fftools-ffi_--
+${INTERMEDIATE_DIR}/fftools-ffi_%: \
+ ${DOWNLOADS_DIR} \
+ ${PKGCONFIG_DIR} \
+ ${INTERMEDIATE_DIR}/ffmpeg_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*))-$$(word 3,$$(subst -, ,$$*))-default
+
+ @echo "\033[32mRULE\033[0m $@"
+
+ $(eval TARGET_DIR=$@)
+ $(eval TARGET_PATTERN=$*)
+ $(eval TARGET_DEPS=$+)
+ $(eval TARGET_NAME=$(notdir ${TARGET_DIR}))
+ $(eval TARGET_PKGNAME=$(firstword $(subst _${TARGET_PATTERN}, ,${TARGET_NAME})))
+ $(eval TARGET_TMP_DIR=${TMP_DIR}/${TARGET_NAME})
+ $(eval TARGET_SRC_DIR=${TARGET_TMP_DIR}/src/${TARGET_PKGNAME})
+ $(eval TARGET_OUTPUT_DIR=${PROJECT_DIR}/${TARGET_DIR})
+
+ $(eval ARCHIVE_FILE=$(firstword $(wildcard ${DOWNLOADS_DIR}/${TARGET_PKGNAME}-*.tar.*)))
+
+ $(eval TARGET_OS=$(word 1, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_ARCH=$(word 2, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_VARIANT=$(word 3, $(subst -, ,${TARGET_PATTERN})))
+
+ $(eval TARGET_PKGS_DEPS=$(foreach DEP,${TARGET_DEPS}, \
+ $(if $(findstring downloads,${DEP}),, \
+ $(if $(findstring pkg-config,${DEP}),, \
+ ${DEP}))))
+ $(eval PKG_CONFIG_PATH_LIST=$(foreach DEP,${TARGET_PKGS_DEPS},${PROJECT_DIR}/${DEP}/lib/pkgconfig))
+ $(eval PKG_CONFIG_PATH=$(subst ${SPACE},${COLON},${PKG_CONFIG_PATH_LIST}))
+
+ rm -rf ${TARGET_TMP_DIR} ${TARGET_DIR}
+ mkdir -p ${TARGET_TMP_DIR}
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ ARCHIVE_FILE=${ARCHIVE_FILE} \
+ TARGET_DIR=${TARGET_SRC_DIR} \
+ sh ${PROJECT_DIR}/scripts/extract/build.sh
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ PROJECT_DIR=${PROJECT_DIR} \
+ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \
+ OS=${TARGET_OS} \
+ ARCH=${TARGET_ARCH} \
+ VARIANT=${TARGET_VARIANT} \
+ SRC_DIR=${TARGET_SRC_DIR} \
+ OUTPUT_DIR=${TARGET_OUTPUT_DIR} \
+ sh ${PROJECT_DIR}/scripts/${TARGET_PKGNAME}/build.sh
+
+ rm -rf ${TARGET_TMP_DIR}
+
+# libogg_--
+${INTERMEDIATE_DIR}/libogg_%: \
+ ${DOWNLOADS_DIR} \
+ ${PKGCONFIG_DIR}
+
+ @echo "\033[32mRULE\033[0m $@"
+
+ $(eval TARGET_DIR=$@)
+ $(eval TARGET_PATTERN=$*)
+ $(eval TARGET_DEPS=$+)
+ $(eval TARGET_NAME=$(notdir ${TARGET_DIR}))
+ $(eval TARGET_PKGNAME=$(firstword $(subst _${TARGET_PATTERN}, ,${TARGET_NAME})))
+ $(eval TARGET_TMP_DIR=${TMP_DIR}/${TARGET_NAME})
+ $(eval TARGET_SRC_DIR=${TARGET_TMP_DIR}/src/${TARGET_PKGNAME})
+ $(eval TARGET_OUTPUT_DIR=${PROJECT_DIR}/${TARGET_DIR})
+
+ $(eval ARCHIVE_FILE=$(firstword $(wildcard ${DOWNLOADS_DIR}/${TARGET_PKGNAME}-*.tar.*)))
+
+ $(eval TARGET_OS=$(word 1, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_ARCH=$(word 2, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_VARIANT=$(word 3, $(subst -, ,${TARGET_PATTERN})))
+
+ $(eval TARGET_PKGS_DEPS=$(foreach DEP,${TARGET_DEPS}, \
+ $(if $(findstring downloads,${DEP}),, \
+ $(if $(findstring pkg-config,${DEP}),, \
+ ${DEP}))))
+ $(eval PKG_CONFIG_PATH_LIST=$(foreach DEP,${TARGET_PKGS_DEPS},${PROJECT_DIR}/${DEP}/lib/pkgconfig))
+ $(eval PKG_CONFIG_PATH=$(subst ${SPACE},${COLON},${PKG_CONFIG_PATH_LIST}))
+
+ rm -rf ${TARGET_TMP_DIR} ${TARGET_DIR}
+ mkdir -p ${TARGET_TMP_DIR}
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ ARCHIVE_FILE=${ARCHIVE_FILE} \
+ TARGET_DIR=${TARGET_SRC_DIR} \
+ sh ${PROJECT_DIR}/scripts/extract/build.sh
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ PROJECT_DIR=${PROJECT_DIR} \
+ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \
+ OS=${TARGET_OS} \
+ ARCH=${TARGET_ARCH} \
+ VARIANT=${TARGET_VARIANT} \
+ SRC_DIR=${TARGET_SRC_DIR} \
+ OUTPUT_DIR=${TARGET_OUTPUT_DIR} \
+ sh ${PROJECT_DIR}/scripts/${TARGET_PKGNAME}/build.sh
+
+ rm -rf ${TARGET_TMP_DIR}
+
+# libvorbis_--
+${INTERMEDIATE_DIR}/libvorbis_%: \
+ ${DOWNLOADS_DIR} \
+ ${PKGCONFIG_DIR} \
+ ${INTERMEDIATE_DIR}/libogg_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*))
+
+ @echo "\033[32mRULE\033[0m $@"
+
+ $(eval TARGET_DIR=$@)
+ $(eval TARGET_PATTERN=$*)
+ $(eval TARGET_DEPS=$+)
+ $(eval TARGET_NAME=$(notdir ${TARGET_DIR}))
+ $(eval TARGET_PKGNAME=$(firstword $(subst _${TARGET_PATTERN}, ,${TARGET_NAME})))
+ $(eval TARGET_TMP_DIR=${TMP_DIR}/${TARGET_NAME})
+ $(eval TARGET_SRC_DIR=${TARGET_TMP_DIR}/src/${TARGET_PKGNAME})
+ $(eval TARGET_OUTPUT_DIR=${PROJECT_DIR}/${TARGET_DIR})
+
+ $(eval ARCHIVE_FILE=$(firstword $(wildcard ${DOWNLOADS_DIR}/${TARGET_PKGNAME}-*.tar.*)))
+
+ $(eval TARGET_OS=$(word 1, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_ARCH=$(word 2, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_VARIANT=$(word 3, $(subst -, ,${TARGET_PATTERN})))
+
+ $(eval TARGET_PKGS_DEPS=$(foreach DEP,${TARGET_DEPS}, \
+ $(if $(findstring downloads,${DEP}),, \
+ $(if $(findstring pkg-config,${DEP}),, \
+ ${DEP}))))
+ $(eval PKG_CONFIG_PATH_LIST=$(foreach DEP,${TARGET_PKGS_DEPS},${PROJECT_DIR}/${DEP}/lib/pkgconfig))
+ $(eval PKG_CONFIG_PATH=$(subst ${SPACE},${COLON},${PKG_CONFIG_PATH_LIST}))
+
+ rm -rf ${TARGET_TMP_DIR} ${TARGET_DIR}
+ mkdir -p ${TARGET_TMP_DIR}
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ ARCHIVE_FILE=${ARCHIVE_FILE} \
+ TARGET_DIR=${TARGET_SRC_DIR} \
+ sh ${PROJECT_DIR}/scripts/extract/build.sh
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ PROJECT_DIR=${PROJECT_DIR} \
+ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \
+ OS=${TARGET_OS} \
+ ARCH=${TARGET_ARCH} \
+ VARIANT=${TARGET_VARIANT} \
+ SRC_DIR=${TARGET_SRC_DIR} \
+ OUTPUT_DIR=${TARGET_OUTPUT_DIR} \
+ sh ${PROJECT_DIR}/scripts/${TARGET_PKGNAME}/build.sh
+
+ rm -rf x${TARGET_TMP_DIR}
+
+# libvpx_--
+${INTERMEDIATE_DIR}/libvpx_%: \
+ ${DOWNLOADS_DIR} \
+ ${PKGCONFIG_DIR}
+
+ @echo "\033[32mRULE\033[0m $@"
+
+ $(eval TARGET_DIR=$@)
+ $(eval TARGET_PATTERN=$*)
+ $(eval TARGET_DEPS=$+)
+ $(eval TARGET_NAME=$(notdir ${TARGET_DIR}))
+ $(eval TARGET_PKGNAME=$(firstword $(subst _${TARGET_PATTERN}, ,${TARGET_NAME})))
+ $(eval TARGET_TMP_DIR=${TMP_DIR}/${TARGET_NAME})
+ $(eval TARGET_SRC_DIR=${TARGET_TMP_DIR}/src/${TARGET_PKGNAME})
+ $(eval TARGET_OUTPUT_DIR=${PROJECT_DIR}/${TARGET_DIR})
+
+ $(eval ARCHIVE_FILE=$(firstword $(wildcard ${DOWNLOADS_DIR}/${TARGET_PKGNAME}-*.tar.*)))
+
+ $(eval TARGET_OS=$(word 1, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_ARCH=$(word 2, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_VARIANT=$(word 3, $(subst -, ,${TARGET_PATTERN})))
+
+ $(eval TARGET_PKGS_DEPS=$(foreach DEP,${TARGET_DEPS}, \
+ $(if $(findstring downloads,${DEP}),, \
+ $(if $(findstring pkg-config,${DEP}),, \
+ ${DEP}))))
+ $(eval PKG_CONFIG_PATH_LIST=$(foreach DEP,${TARGET_PKGS_DEPS},${PROJECT_DIR}/${DEP}/lib/pkgconfig))
+ $(eval PKG_CONFIG_PATH=$(subst ${SPACE},${COLON},${PKG_CONFIG_PATH_LIST}))
+
+ rm -rf ${TARGET_TMP_DIR} ${TARGET_DIR}
+ mkdir -p ${TARGET_TMP_DIR}
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ ARCHIVE_FILE=${ARCHIVE_FILE} \
+ TARGET_DIR=${TARGET_SRC_DIR} \
+ sh ${PROJECT_DIR}/scripts/extract/build.sh
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ PROJECT_DIR=${PROJECT_DIR} \
+ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \
+ OS=${TARGET_OS} \
+ ARCH=${TARGET_ARCH} \
+ VARIANT=${TARGET_VARIANT} \
+ SRC_DIR=${TARGET_SRC_DIR} \
+ OUTPUT_DIR=${TARGET_OUTPUT_DIR} \
+ sh ${PROJECT_DIR}/scripts/${TARGET_PKGNAME}/build.sh
+
+ rm -rf ${TARGET_TMP_DIR}
+
+# libx264_--
+${INTERMEDIATE_DIR}/libx264_%: \
+ ${DOWNLOADS_DIR} \
+ ${PKGCONFIG_DIR}
+
+ @echo "\033[32mRULE\033[0m $@"
+
+ $(eval TARGET_DIR=$@)
+ $(eval TARGET_PATTERN=$*)
+ $(eval TARGET_DEPS=$+)
+ $(eval TARGET_NAME=$(notdir ${TARGET_DIR}))
+ $(eval TARGET_PKGNAME=$(firstword $(subst _${TARGET_PATTERN}, ,${TARGET_NAME})))
+ $(eval TARGET_TMP_DIR=${TMP_DIR}/${TARGET_NAME})
+ $(eval TARGET_SRC_DIR=${TARGET_TMP_DIR}/src/${TARGET_PKGNAME})
+ $(eval TARGET_OUTPUT_DIR=${PROJECT_DIR}/${TARGET_DIR})
+
+ $(eval ARCHIVE_FILE=$(firstword $(wildcard ${DOWNLOADS_DIR}/${TARGET_PKGNAME}-*.tar.*)))
+
+ $(eval TARGET_OS=$(word 1, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_ARCH=$(word 2, $(subst -, ,${TARGET_PATTERN})))
+ $(eval TARGET_VARIANT=$(word 3, $(subst -, ,${TARGET_PATTERN})))
+
+ $(eval TARGET_PKGS_DEPS=$(foreach DEP,${TARGET_DEPS}, \
+ $(if $(findstring downloads,${DEP}),, \
+ $(if $(findstring pkg-config,${DEP}),, \
+ ${DEP}))))
+ $(eval PKG_CONFIG_PATH_LIST=$(foreach DEP,${TARGET_PKGS_DEPS},${PROJECT_DIR}/${DEP}/lib/pkgconfig))
+ $(eval PKG_CONFIG_PATH=$(subst ${SPACE},${COLON},${PKG_CONFIG_PATH_LIST}))
+
+ rm -rf ${TARGET_TMP_DIR} ${TARGET_DIR}
+ mkdir -p ${TARGET_TMP_DIR}
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ ARCHIVE_FILE=${ARCHIVE_FILE} \
+ TARGET_DIR=${TARGET_SRC_DIR} \
+ sh ${PROJECT_DIR}/scripts/extract/build.sh
+
+ env -i \
+ PATH=${SANDBOX_PATH} \
+ PROJECT_DIR=${PROJECT_DIR} \
+ PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \
+ OS=${TARGET_OS} \
+ ARCH=${TARGET_ARCH} \
+ VARIANT=${TARGET_VARIANT} \
+ SRC_DIR=${TARGET_SRC_DIR} \
+ OUTPUT_DIR=${TARGET_OUTPUT_DIR} \
+ sh ${PROJECT_DIR}/scripts/${TARGET_PKGNAME}/build.sh
+
+ rm -rf ${TARGET_TMP_DIR}
+
# libs-arch_---
${INTERMEDIATE_DIR}/libs-arch_%: \
${INTERMEDIATE_DIR}/mpv_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*))-$$(word 3,$$(subst -, ,$$*)) \
${INTERMEDIATE_DIR}/ffmpeg_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*))-$$(word 3,$$(subst -, ,$$*))-$$(word 4,$$(subst -, ,$$*)) \
- ${INTERMEDIATE_DIR}/libressl_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ${INTERMEDIATE_DIR}/mbedtls_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ $$(if $$(filter encodersgpl, $$(word 4,$$(subst -, ,$$*))), \
+ ${INTERMEDIATE_DIR}/fftools-ffi_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*))-$$(word 3,$$(subst -, ,$$*)) \
+ ${INTERMEDIATE_DIR}/libvorbis_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ${INTERMEDIATE_DIR}/libogg_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ) \
$$(if $$(filter video, $$(word 3,$$(subst -, ,$$*))), \
${INTERMEDIATE_DIR}/dav1d_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
${INTERMEDIATE_DIR}/libxml2_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
@@ -694,6 +983,10 @@ ${INTERMEDIATE_DIR}/libs-arch_%: \
${INTERMEDIATE_DIR}/harfbuzz_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
${INTERMEDIATE_DIR}/fribidi_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
${INTERMEDIATE_DIR}/freetype_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ $$(if $$(filter encodersgpl, $$(word 4,$$(subst -, ,$$*))), \
+ ${INTERMEDIATE_DIR}/libvpx_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ${INTERMEDIATE_DIR}/libx264_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
+ ) \
)
@echo "\033[32mRULE\033[0m $@"
@@ -881,24 +1174,6 @@ ${OUTPUT_DIR}/libmpv-%.tar.gz: \
mv ${TARGET_OUTPUT_FILE} ${TARGET_FILE}
rm -rf ${TARGET_TMP_DIR}
-.PHONY: update-downloads-lock
-update-downloads-lock:
- $(eval DEPS= \
- pkg-config \
- mpv \
- uchardet \
- libass \
- freetype \
- harfbuzz \
- fribidi \
- ffmpeg \
- libressl \
- libxml2 \
- dav1d \
- )
-
- go run cmd/update-downloads-lock/main.go ${DEPS} > downloads.lock
-
.PHONY: tool-versions
tool-versions:
go run cmd/tool-versions/main.go
diff --git a/README.md b/README.md
index aee3ce7..7cc4763 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
Provides builds of [libmpv](https://github.com/mpv-player/mpv) for macOS & iOS,
used by [media_kit](https://github.com/alexmercerind/media_kit), compatible
-with commercial use.
+with commercial use for playback, and GPL use for encoding.
Heavily inspired by [Homebrew](https://github.com/Homebrew/brew) and
[IINA](https://github.com/iina/iina).
@@ -15,24 +15,34 @@ $ VERSION=v0.0.1 make
$ ls build/output
libmpv-libs_v0.0.1_ios-arm64-audio-default.tar.gz
libmpv-libs_v0.0.1_ios-arm64-audio-full.tar.gz
+libmpv-libs_v0.0.1_ios-arm64-audio-encodersgpl.tar.gz
libmpv-libs_v0.0.1_ios-arm64-video-default.tar.gz
libmpv-libs_v0.0.1_ios-arm64-video-full.tar.gz
+libmpv-libs_v0.0.1_ios-arm64-video-encodersgpl.tar.gz
libmpv-libs_v0.0.1_iossimulator-universal-audio-default.tar.gz
libmpv-libs_v0.0.1_iossimulator-universal-audio-full.tar.gz
+libmpv-libs_v0.0.1_iossimulator-universal-audio-encodersgpl.tar.gz
libmpv-libs_v0.0.1_iossimulator-universal-video-default.tar.gz
libmpv-libs_v0.0.1_iossimulator-universal-video-full.tar.gz
+libmpv-libs_v0.0.1_iossimulator-universal-video-encodersgpl.tar.gz
libmpv-libs_v0.0.1_macos-universal-audio-default.tar.gz
libmpv-libs_v0.0.1_macos-universal-audio-full.tar.gz
+libmpv-libs_v0.0.1_macos-universal-audio-encodersgpl.tar.gz
libmpv-libs_v0.0.1_macos-universal-video-default.tar.gz
libmpv-libs_v0.0.1_macos-universal-video-full.tar.gz
+libmpv-libs_v0.0.1_macos-universal-video-encodersgpl.tar.gz
libmpv-xcframeworks_v0.0.1_ios-universal-audio-default.tar.gz
libmpv-xcframeworks_v0.0.1_ios-universal-audio-full.tar.gz
+libmpv-xcframeworks_v0.0.1_ios-universal-audio-encodersgpl.tar.gz
libmpv-xcframeworks_v0.0.1_ios-universal-video-default.tar.gz
libmpv-xcframeworks_v0.0.1_ios-universal-video-full.tar.gz
+libmpv-xcframeworks_v0.0.1_ios-universal-video-encodersgpl.tar.gz
libmpv-xcframeworks_v0.0.1_macos-universal-audio-default.tar.gz
libmpv-xcframeworks_v0.0.1_macos-universal-audio-full.tar.gz
+libmpv-xcframeworks_v0.0.1_macos-universal-audio-encodersgpl.tar.gz
libmpv-xcframeworks_v0.0.1_macos-universal-video-default.tar.gz
libmpv-xcframeworks_v0.0.1_macos-universal-video-full.tar.gz
+libmpv-xcframeworks_v0.0.1_macos-universal-video-encodersgpl.tar.gz
```
## Naming convention
@@ -41,14 +51,19 @@ libmpv-xcframeworks_v0.0.1_macos-universal-video-full.tar.gz
libmpv-__---.tar.gz
```
-| Component | Notes | Value |
-| ----------- | ------------------------------- | ------------------------ |
-| **format** | Output format of built files | libs, xcframeworks |
-| **version** | Semantic version | v0.0.1, … |
-| **os** | Operating system | ios, iossimulator, macos |
-| **arch** | Architecture | arm64, amd64, universal |
-| **variant** | Usage context | audio, video |
-| **flavor** | Number of available decoders, … | default, full |
+| Component | Notes | Value |
+| ----------- | ------------------------------- | -------------------------- |
+| **format** | Output format of built files | libs, xcframeworks |
+| **version** | Semantic version | v0.0.1, … |
+| **os** | Operating system | ios, iossimulator, macos |
+| **arch** | Architecture | arm64, amd64, universal |
+| **variant** | Usage context | audio, video |
+| **flavor** | Available decoders and encoders | default, full, encodersgpl |
+
+Inclusion:
+
+- Variants: $audio \subset video$
+- Flavors: $audio \subset full \subset encodersgpl$
## Minimum versions
@@ -95,27 +110,73 @@ libmpv-__---.tar.gz
```mermaid
flowchart LR
-
-A(mpv) --> B(ffmpeg)
-A(mpv) -.-> C(libass)
-A(mpv) -.-> D(uchardet)
-
-B -.-> H(dav1d)
-B -.-> I(libressl)
-B -.-> J(libxml2)
-
-C --> E(freetype)
-C --> F(harfbuzz)
-C --> G(fribidi)
-
-E -.-> F
+ subgraph legend[Legend]
+ direction TB
+ subgraph links
+ P(node):::decoders -- "required" --> Q(node):::decoders
+ R(node):::decoders -. "optional" .-> S(node):::decoders
+ end
+
+ subgraph variants
+ T(audio & video):::decoders
+ U{{video only}}:::decoders
+ end
+
+ subgraph flavors
+ V(default, full):::decoders
+ W(encodersgpl):::encoders
+ end
+ end
+
+ subgraph content[ ]
+ direction LR
+ A(mpv):::decoders -.-> B{{uchardet}}:::decoders
+ A -.-> C{{libass}}:::decoders
+ A --> D(ffmpeg):::decoders
+
+ E(fftools-ffi):::encoders --> D
+
+ %% libass
+ C --> F{{fribidi}}:::decoders
+ C --> G{{harfbuzz}}:::decoders
+ C --> H{{freetype}}:::decoders
+ H -.-> G
+
+ %% ffmpeg
+ D -.-> I(mbedtls):::decoders
+ D -.-> J{{dav1d}}:::decoders
+ D -.-> K{{libxml2}}:::decoders
+ D -.-> L(libvorbis):::encoders
+ D -.-> M{{libvpx}}:::encoders
+ D -.-> N{{libx264}}:::encoders
+ L --> O(libogg):::encoders
+ end
+
+ classDef decoders stroke:#888
+ classDef encoders stroke:#14a,stroke-width:3px
+ classDef legend fill:transparent,stroke:#8882
+ classDef content fill:transparent,stroke:transparent
+ classDef card fill:transparent,stroke:#888a
+
+ legend:::legend
+ content:::content
+ links:::card
+ variants:::card
+ flavors:::card
```
+- [**mpv**](https://github.com/mpv-player/mpv): A free (as in freedom) media
+ player for the command line. It supports a wide variety of media file formats,
+ audio and video codecs, and subtitle types
+
- [**ffmpeg**](https://ffmpeg.org): A cross-platform solution for converting,
streaming, and recording audio and video, with support for a wide range of
codecs and formats
-- **[libass](https://github.com/libass/libass)(optional)**: A library for rendering
+- [**fftools-ffi**](https://github.com/moffatman/fftools-ffi): FFmpeg's
+ command-line interface exposed as a shared library for FFI usage
+
+- [**libass**](https://github.com/libass/libass): A library for rendering
subtitles in videos, with support for advanced text formatting and positioning
features (made optional with a patch)
@@ -131,22 +192,36 @@ E -.-> F
and laying out text in multiple languages and scripts, with support for
advanced typography features such as ligatures and kerning
-- **[dav1d](https://code.videolan.org/videolan/dav1d) (optional)**: A library
- for cross-platform AV1 decoding
+- [**dav1d**](https://code.videolan.org/videolan/dav1d): A library for
+ cross-platform AV1 decoding
+
+- [**libogg**](https://github.com/xiph/ogg): Reference implementation of the Ogg
+ media container
+
+- [**libvorbis**](https://github.com/xiph/vorbis): Reference implementation of
+ the Ogg Vorbis audio format
+
+- [**libvpx**](https://gitlab.freedesktop.org/gstreamer/meson-ports/libvpx):
+ Reference implementation of the VP8 and VP9 video formats
-- **[libressl](https://www.libressl.org/) (optional)**: A fork of OpenSSL that
- aims to provide a more secure and auditable implementation of the SSL/TLS
- protocols
+- [**libx264**](https://www.videolan.org/developers/x264.html): Free software
+ library for encoding video streams into the H.264/MPEG-4 AVC compression
+ format
-- **[libxml2](http://xmlsoft.org/) (optional)**: A library for processing XML
- data, used by ffmpeg to support the Dash protocol
+- [**mbedtls**](https://www.libressl.org/): An open source, portable, easy to
+ use, readable and flexible TLS library
-- **[uchardet](https://www.freedesktop.org/wiki/Software/uchardet/)
- (optional)**: A C++ port of the Universal Character Encoding Detector (used by
- Mozilla Firefox and Thunderbird) for detecting the encoding of input text
+- [**libxml2**](http://xmlsoft.org/): A library for processing XML data, used by
+ ffmpeg to support the Dash protocol
+
+- [**uchardet**](https://www.freedesktop.org/wiki/Software/uchardet/): A C++
+ port of the Universal Character Encoding Detector (used by Mozilla Firefox
+ and Thunderbird) for detecting the encoding of input text
## Commercial use
+### Default, Full flavors
+
| Dependency | Licence | Commercial use |
| ---------- | ------------------------------------------------------ | :------------: |
| mpv | LGPL-2.1 (`-Dgpl=false`) | ✅ |
@@ -155,19 +230,39 @@ E -.-> F
| freetype | FreeType | ✅ |
| harfbuzz | MIT | ✅ |
| fribidi | LGPL-2.1 | ✅ |
-| libressl | Apache-1.0, BSD-4-Clause, ISC, public domain | ✅ |
+| mbedtls | Apache 2.0 | ✅ |
| uchardet | MPL-1.1, GPL-2, LGPL-2.1 | ✅ |
| libxml2 | MIT | ✅ |
| dav1d | BSD-2-clause | ✅ |
+### Encoders-GPL flavor
+
+| Dependency | Licence | Commercial use |
+| ----------- | ------------------------------------ | :------------: |
+| mpv | LGPL-2.1 (`-Dgpl=false`) | ✅ |
+| ffmpeg | GPL-2.1 (`--enable-nonfree` omitted) | ❌ |
+| libass | ISC | ✅ |
+| freetype | FreeType | ✅ |
+| harfbuzz | MIT | ✅ |
+| fribidi | LGPL-2.1 | ✅ |
+| mbedtls | Apache 2.0 | ✅ |
+| uchardet | MPL-1.1, GPL-2, LGPL-2.1 | ✅ |
+| libxml2 | MIT | ✅ |
+| dav1d | BSD-2-clause | ✅ |
+| fftools-ffi | LGPL-2.1 | ✅ |
+| libx264 | GPL-2.0+ | ❌ |
+| libvpx | BSD-3-clause | ✅ |
+| libvorbis | BSD-3-clause | ✅ |
+| libogg | BSD-3-clause | ✅ |
+
## Notes
- Some dependencies, which are not needed at the moment, may be added in the
future:
- [**libbluray**](https://code.videolan.org/videolan/libbluray): A library for
- reading and parsing Blu-ray discs, with support for advanced features such as
- BD-J menus and seamless branching
+ reading and parsing Blu-ray discs, with support for advanced features such
+ as BD-J menus and seamless branching
- [**libarchive**](https://github.com/libarchive/libarchive): A library for
reading various archive formats, including tar and zip, with support for
@@ -235,3 +330,4 @@ solution was to:
- https://github.com/ldwardx/mpv-build-mac-iOS
- https://github.com/birros/godot_tl/tree/ca2fc4151bd8141241151dd6e29768608600473a/toolchains
- https://github.com/Vargol/ffmpeg-apple-arm64-build
+- https://github.com/arthenica/ffmpeg-kit
diff --git a/cmd/update-downloads-lock/main.go b/cmd/update-downloads-lock/main.go
deleted file mode 100644
index 48f769d..0000000
--- a/cmd/update-downloads-lock/main.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package main
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "log"
- "os"
- "os/exec"
- "strings"
-
- "github.com/media-kit/libmpv-darwin-build/pkg/lock"
- "gopkg.in/yaml.v3"
-)
-
-func main() {
- log.SetFlags(log.Lshortfile)
-
- packages := os.Args[1:]
- lock, err := newLock(packages...)
- if err != nil {
- log.Fatal(err)
- }
-
- text, err := marshalLock(lock)
- if err != nil {
- log.Fatal(err)
- }
-
- fmt.Println(text)
-}
-
-func newLock(packages ...string) (lock.Lock, error) {
- var lock lock.Lock = lock.Lock{}
-
- for _, name := range packages {
- dep, err := newDep(name)
- if err != nil {
- return nil, fmt.Errorf("newLock: %w", err)
- }
-
- if name == "libressl" {
- dep.URL = strings.Replace(
- dep.URL,
- "https://ftp.openbsd.org",
- "https://cdn.openbsd.org",
- 1,
- )
- }
-
- lock[name] = *dep
- }
-
- return lock, nil
-}
-
-func newDep(packageName string) (*lock.Dep, error) {
- info, err := brewInfo(packageName)
- if err != nil {
- return nil, fmt.Errorf("newDep: %w", err)
- }
-
- dep := depFromBrewInfo(info)
- return dep, nil
-}
-
-func brewInfo(packageName string) (*brewInfoResponse, error) {
- out, err := exec.Command("brew", "info", "--json", packageName).Output()
- if err != nil {
- return nil, fmt.Errorf("brewInfo: %w", err)
- }
-
- var resp []brewInfoResponse
- err = json.Unmarshal(out, &resp)
- if err != nil {
- return nil, fmt.Errorf("brewInfo: %w", err)
- }
-
- if len(resp) != 1 {
- return nil, fmt.Errorf("brewInfo: not found")
- }
-
- info := resp[0]
-
- if info.Name != packageName {
- return nil, fmt.Errorf(
- "brewInfo: %s: %s != %s", packageName, packageName, info.Name,
- )
- }
-
- return &info, nil
-}
-
-type brewInfoResponse struct {
- Name string `json:"name"`
- Versions struct {
- Stable string `json:"stable"`
- } `json:"versions"`
- Urls struct {
- Stable struct {
- URL string `json:"url"`
- Checksum string `json:"checksum"`
- } `json:"stable"`
- } `json:"urls"`
-}
-
-func depFromBrewInfo(info *brewInfoResponse) *lock.Dep {
- return &lock.Dep{
- Version: info.Versions.Stable,
- URL: info.Urls.Stable.URL,
- Sha256: info.Urls.Stable.Checksum,
- }
-}
-
-func marshalLock(lock lock.Lock) (string, error) {
- var buf bytes.Buffer
- e := yaml.NewEncoder(&buf)
- e.SetIndent(2)
-
- e.Encode(lock)
- err := e.Close()
- if err != nil {
- return "", fmt.Errorf("marshalLock: %w", err)
- }
-
- text := string(buf.Bytes())
-
- return text, nil
-}
diff --git a/cross-files/ios-arm64.ini b/cross-files/ios-arm64.ini
index 9be13c2..e9b146c 100644
--- a/cross-files/ios-arm64.ini
+++ b/cross-files/ios-arm64.ini
@@ -23,3 +23,6 @@ c_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/
cpp_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk', '-miphoneos-version-min=9.0']
objc_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk', '-miphoneos-version-min=9.0']
objcpp_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk', '-miphoneos-version-min=9.0']
+
+[properties]
+cmake_osx_sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'
diff --git a/cross-files/iossimulator-amd64.ini b/cross-files/iossimulator-amd64.ini
index e296b78..462c831 100644
--- a/cross-files/iossimulator-amd64.ini
+++ b/cross-files/iossimulator-amd64.ini
@@ -23,3 +23,6 @@ c_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents
cpp_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk', '-miphoneos-version-min=9.0']
objc_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk', '-miphoneos-version-min=9.0']
objcpp_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk', '-miphoneos-version-min=9.0']
+
+[properties]
+cmake_osx_sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'
diff --git a/cross-files/iossimulator-arm64.ini b/cross-files/iossimulator-arm64.ini
index f269130..a4bd31b 100644
--- a/cross-files/iossimulator-arm64.ini
+++ b/cross-files/iossimulator-arm64.ini
@@ -23,3 +23,6 @@ c_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/
cpp_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk', '-miphoneos-version-min=12.0']
objc_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk', '-miphoneos-version-min=12.0']
objcpp_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk', '-miphoneos-version-min=12.0']
+
+[properties]
+cmake_osx_sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'
diff --git a/cross-files/macos-amd64.ini b/cross-files/macos-amd64.ini
index e7a0de4..833b5de 100644
--- a/cross-files/macos-amd64.ini
+++ b/cross-files/macos-amd64.ini
@@ -23,3 +23,6 @@ c_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents
cpp_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk', '-mmacosx-version-min=10.9']
objc_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk', '-mmacosx-version-min=10.9']
objcpp_link_args = ['-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk', '-mmacosx-version-min=10.9']
+
+[properties]
+cmake_osx_sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
diff --git a/cross-files/macos-arm64.ini b/cross-files/macos-arm64.ini
index d1ae4b8..3617015 100644
--- a/cross-files/macos-arm64.ini
+++ b/cross-files/macos-arm64.ini
@@ -23,3 +23,6 @@ c_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/
cpp_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk', '-mmacosx-version-min=10.9']
objc_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk', '-mmacosx-version-min=10.9']
objcpp_link_args = ['-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk', '-mmacosx-version-min=10.9']
+
+[properties]
+cmake_osx_sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
diff --git a/downloads.lock b/downloads.lock
index cab86c9..3e3bd1e 100644
--- a/downloads.lock
+++ b/downloads.lock
@@ -6,6 +6,10 @@ ffmpeg:
version: "6.0"
url: https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz
sha256: 57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082
+fftools-ffi:
+ version: "106d5813"
+ url: https://github.com/moffatman/fftools-ffi/archive/106d58138071eba66c7d814f6573029c712cd597.tar.gz
+ sha256: 4577bb410978f5026270390aa65ebf0307250f3f5b0adf5353e060a5a3f4ee25
freetype:
version: 2.13.2
url: https://downloads.sourceforge.net/project/freetype/freetype2/2.13.2/freetype-2.13.2.tar.xz
@@ -22,14 +26,30 @@ libass:
version: 0.17.1
url: https://github.com/libass/libass/releases/download/0.17.1/libass-0.17.1.tar.xz
sha256: f0da0bbfba476c16ae3e1cfd862256d30915911f7abaa1b16ce62ee653192784
-libressl:
- version: 3.7.3
- url: https://cdn.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.3.tar.gz
- sha256: 7948c856a90c825bd7268b6f85674a8dcd254bae42e221781b24e3f8dc335db3
+libogg:
+ version: 1.3.5
+ url: https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz
+ sha256: 0eb4b4b9420a0f51db142ba3f9c64b333f826532dc0f48c6410ae51f4799b664
+libvorbis:
+ version: 1.3.7
+ url: https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz
+ sha256: 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab
+libvpx:
+ version: 1.13.0+1
+ url: https://gitlab.freedesktop.org/gstreamer/meson-ports/libvpx/-/archive/90d26fac0d895969a82cd873ad36e39737104c44/libvpx-v1.13.0.tar.gz
+ sha256: 4f872ad2709d17b848b3588231495e432c42b9263731b9121fa210a3c5a893ff
+libx264:
+ version: "a8b68ebf"
+ url: https://code.videolan.org/videolan/x264/-/archive/a8b68ebfaa68621b5ac8907610d3335971839d52/libx264-a8b68ebfaa68621b5ac8907610d3335971839d52.tar.gz
+ sha256: 164688b63f11a6e4f6d945057fc5c57d5eefb97973d0029fb0303744e10839ff
libxml2:
version: 2.11.5
url: https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.5.tar.xz
sha256: 3727b078c360ec69fa869de14bd6f75d7ee8d36987b071e6928d4720a28df3a6
+mbedtls:
+ version: 3.4.1
+ url: https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v3.4.1.tar.gz
+ sha256: a420fcf7103e54e775c383e3751729b8fb2dcd087f6165befd13f28315f754f5
mpv:
version: 0.36.0
url: https://github.com/mpv-player/mpv/archive/refs/tags/v0.36.0.tar.gz
@@ -42,4 +62,3 @@ uchardet:
version: 0.0.8
url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.8.tar.xz
sha256: e97a60cfc00a1c147a674b097bb1422abd9fa78a2d9ce3f3fdcc2e78a34ac5f0
-
diff --git a/pkg/tool-versions/tool-versions.go b/pkg/tool-versions/tool-versions.go
index a704c32..1011f5c 100644
--- a/pkg/tool-versions/tool-versions.go
+++ b/pkg/tool-versions/tool-versions.go
@@ -24,14 +24,16 @@ func BuildToolVersions() (versions.VersionsMap, error) {
}
var toolVersionsCMDs = map[string]string{
- "clang": "clang --version | head -n1 | cut -d ' ' -f 4",
- "cmake": "cmake --version | head -n1 | cut -d ' ' -f 3",
- "golang": "go version | cut -d ' ' -f 3 | sed 's/go//g'",
- "macos": "sw_vers -productVersion",
- "make": "make --version | head -n1 | cut -d ' ' -f 3",
- "meson": "meson --version",
- "ninja": "ninja --version",
- "xcode": "xcodebuild -version | head -n1 | cut -d ' ' -f 2",
+ "clang": "clang --version | head -n1 | cut -d ' ' -f 4",
+ "cmake": "cmake --version | head -n1 | cut -d ' ' -f 3",
+ "golang": "go version | cut -d ' ' -f 3 | sed 's/go//g'",
+ "macos": "sw_vers -productVersion",
+ "make": "make --version | head -n1 | cut -d ' ' -f 3",
+ "meson": "meson --version",
+ "nasm": "nasm -v | cut -d ' ' -f 3",
+ "ninja": "ninja --version",
+ "python3": "python3 --version | cut -d ' ' -f 2",
+ "xcode": "xcodebuild -version | head -n1 | cut -d ' ' -f 2",
}
func shellCommand(cmd string) (string, error) {
diff --git a/scripts/ffmpeg/meson.build b/scripts/ffmpeg/meson.build
index 16d3b0a..aa3831e 100644
--- a/scripts/ffmpeg/meson.build
+++ b/scripts/ffmpeg/meson.build
@@ -46,7 +46,8 @@ common_options = [
'--enable-network',
'--enable-pthreads',
'--enable-pic',
- '--enable-libtls', # tls support (libressl)
+ '--enable-mbedtls', # tls support (mbedtls)
+ '--enable-version3',
'--enable-safe-bitstream-reader',
'--enable-stripping',
'--enable-avcodec',
@@ -282,6 +283,20 @@ video_full_options = [
'--enable-decoder=h264',
]
+audio_encodersgpl_options = [
+ '--enable-encoders',
+ '--enable-muxers',
+ '--enable-filters',
+ '--enable-libvorbis',
+ # TODO: If audio_encoders is going to exist as its own package, be smarter about what encoders to include
+]
+
+video_encodersgpl_options = [
+ '--enable-libvpx',
+ '--enable-libx264',
+ '--enable-gpl'
+]
+
# disable all option
options = disable_all_options
@@ -303,6 +318,13 @@ elif flavor == 'full'
if variant == 'video'
options += video_full_options
endif
+elif flavor == 'encodersgpl'
+ options += audio_full_options
+ options += audio_encodersgpl_options
+ if variant == 'video'
+ options += video_full_options
+ options += video_encodersgpl_options
+ endif
endif
p = mod.add_project('configure',
@@ -333,14 +355,16 @@ p = mod.add_project('configure',
verbose: true,
)
-libavfilter_dep = p.dependency('libavfilter')
-libswscale_dep = p.dependency('libswscale')
-libavcodec_dep = p.dependency('libavcodec')
-libavformat_dep = p.dependency('libavformat')
-libswresample_dep = p.dependency('libswresample')
+libavfilter_dep = p.dependency('avfilter')
+libswscale_dep = p.dependency('swscale')
+libavcodec_dep = p.dependency('avcodec')
+libavformat_dep = p.dependency('avformat')
+libavutil_dep = p.dependency('avutil')
+libswresample_dep = p.dependency('swresample')
meson.override_dependency('libavfilter', libavfilter_dep)
meson.override_dependency('libswscale', libswscale_dep)
meson.override_dependency('libavcodec', libavcodec_dep)
meson.override_dependency('libavformat', libavformat_dep)
+meson.override_dependency('libavutil', libavutil_dep)
meson.override_dependency('libswresample', libswresample_dep)
diff --git a/scripts/ffmpeg/meson.options b/scripts/ffmpeg/meson.options
index d92686c..a48d1db 100644
--- a/scripts/ffmpeg/meson.options
+++ b/scripts/ffmpeg/meson.options
@@ -1,2 +1,2 @@
option('variant', type : 'combo', choices : ['audio', 'video'])
-option('flavor', type : 'combo', choices : ['default', 'full'])
+option('flavor', type : 'combo', choices : ['default', 'full', 'encodersgpl'])
diff --git a/scripts/fftools-ffi/build.sh b/scripts/fftools-ffi/build.sh
new file mode 100644
index 0000000..4079379
--- /dev/null
+++ b/scripts/fftools-ffi/build.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e # exit immediately if a command exits with a non-zero status
+set -u # treat unset variables as an error
+
+cd ${SRC_DIR}
+
+meson setup build \
+ --cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
+ --prefix="${OUTPUT_DIR}" |
+ tee configure.log
+
+meson compile -C build
+meson install -C build
diff --git a/scripts/frameworks/ios/build-ios.sh b/scripts/frameworks/ios/build-ios.sh
index e709a13..95032a4 100755
--- a/scripts/frameworks/ios/build-ios.sh
+++ b/scripts/frameworks/ios/build-ios.sh
@@ -15,6 +15,11 @@ find ${DEPS} -name "*.dylib" -type f | while read DYLIB; do
# framework dir
FRAMEWORK_DIR="${OUTPUT_DIR}/${FRAMEWORK_NAME}.framework"
+ if [ -d $FRAMEWORK_DIR ]; then
+ # Duplicated framework because of versioned dylibs, just skip
+ continue
+ fi
+
# determine archs
ARCHS=$(lipo -archs "${DYLIB}")
diff --git a/scripts/frameworks/macos/build-macos.sh b/scripts/frameworks/macos/build-macos.sh
index a323f13..af5873f 100755
--- a/scripts/frameworks/macos/build-macos.sh
+++ b/scripts/frameworks/macos/build-macos.sh
@@ -16,6 +16,11 @@ find ${DEPS} -name "*.dylib" -type f | while read DYLIB; do
# framework dir
FRAMEWORK_DIR="${OUTPUT_DIR}/${FRAMEWORK_NAME}.framework"
+ if [ -d $FRAMEWORK_DIR ]; then
+ # Duplicated framework because of versioned dylibs, just skip
+ continue
+ fi
+
# determine archs
ARCHS=$(lipo -archs "${DYLIB}")
diff --git a/scripts/libogg/build.sh b/scripts/libogg/build.sh
new file mode 100644
index 0000000..ca5dafa
--- /dev/null
+++ b/scripts/libogg/build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e # exit immediately if a command exits with a non-zero status
+set -u # treat unset variables as an error
+
+cd ${SRC_DIR}
+
+cp ${PROJECT_DIR}/scripts/libogg/meson.* .
+
+meson setup build \
+ --cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
+ --prefix="${OUTPUT_DIR}" |
+ tee configure.log
+
+meson compile -C build libogg
+meson install -C build
diff --git a/scripts/libressl/meson.build b/scripts/libogg/meson.build
similarity index 58%
rename from scripts/libressl/meson.build
rename to scripts/libogg/meson.build
index 915ee5b..4316649 100644
--- a/scripts/libressl/meson.build
+++ b/scripts/libogg/meson.build
@@ -1,6 +1,6 @@
# https://mesonbuild.com/External-Project-module.html
-project('libressl', 'c')
+project('libogg', 'c')
mod = import('unstable-external_project')
@@ -9,11 +9,9 @@ p = mod.add_project('configure',
'--prefix=@PREFIX@',
'--disable-static',
'--enable-shared',
- '--disable-dependency-tracking',
- '--disable-silent-rules',
],
verbose: true,
)
-libressl_dep = p.dependency('libressl')
-meson.override_dependency('libressl', libressl_dep)
+libogg_dep = p.dependency('libogg')
+meson.override_dependency('libogg', libogg_dep)
diff --git a/scripts/libressl/build.sh b/scripts/libressl/build.sh
deleted file mode 100644
index 0e6341c..0000000
--- a/scripts/libressl/build.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-set -e # exit immediately if a command exits with a non-zero status
-set -u # treat unset variables as an error
-
-cd ${SRC_DIR}
-
-cp ${PROJECT_DIR}/scripts/libressl/meson.build ./meson.build
-meson setup build \
- --cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
- --prefix="${OUTPUT_DIR}"
-
-meson compile -C build libressl
-
-# fix file permissions
-chmod 755 build/dist"${OUTPUT_DIR}"/lib/*
-
-# manual install to preserve symlinks (meson install -C build)
-mkdir -p "${OUTPUT_DIR}"
-cp -R build/dist"${OUTPUT_DIR}"/* "${OUTPUT_DIR}"/
diff --git a/scripts/libs-arch/relink-dylibs.sh b/scripts/libs-arch/relink-dylibs.sh
index 899554f..4891ee0 100755
--- a/scripts/libs-arch/relink-dylibs.sh
+++ b/scripts/libs-arch/relink-dylibs.sh
@@ -28,7 +28,7 @@ relink_dylibs() {
grep " name " |
cut -d " " -f11 |
tail -n +2 |
- grep "$SOURCE_PREFIX" |
+ grep -E "$SOURCE_PREFIX|^lib" | # libmbedtls emitted without absolute path for some reason
while read DEP; do
DEPNAME=$(basename $DEP)
diff --git a/scripts/libvorbis/build.sh b/scripts/libvorbis/build.sh
new file mode 100644
index 0000000..8fbb30e
--- /dev/null
+++ b/scripts/libvorbis/build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e # exit immediately if a command exits with a non-zero status
+set -u # treat unset variables as an error
+
+cd ${SRC_DIR}
+
+cp ${PROJECT_DIR}/scripts/libvorbis/meson.* .
+
+meson setup build \
+ --cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
+ --prefix="${OUTPUT_DIR}" |
+ tee configure.log
+
+meson compile -C build libvorbis
+meson install -C build
diff --git a/scripts/libvorbis/meson.build b/scripts/libvorbis/meson.build
new file mode 100644
index 0000000..094d16a
--- /dev/null
+++ b/scripts/libvorbis/meson.build
@@ -0,0 +1,17 @@
+# https://mesonbuild.com/External-Project-module.html
+
+project('libvorbis', 'c')
+
+mod = import('unstable-external_project')
+
+p = mod.add_project('configure',
+ configure_options : [
+ '--prefix=@PREFIX@',
+ '--disable-static',
+ '--enable-shared',
+ ],
+ verbose: true,
+)
+
+libvorbis_dep = p.dependency('libvorbis')
+meson.override_dependency('libvorbis', libvorbis_dep)
diff --git a/scripts/libvpx/build.sh b/scripts/libvpx/build.sh
new file mode 100644
index 0000000..afda111
--- /dev/null
+++ b/scripts/libvpx/build.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e # exit immediately if a command exits with a non-zero status
+set -u # treat unset variables as an error
+
+cd ${SRC_DIR}
+
+meson setup build \
+ --cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
+ --prefix="${OUTPUT_DIR}" \
+ -Ddefault_library=shared |
+ tee configure.log
+
+meson compile -C build
+meson install -C build
diff --git a/scripts/libx264/build.sh b/scripts/libx264/build.sh
new file mode 100644
index 0000000..43f14f9
--- /dev/null
+++ b/scripts/libx264/build.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -e # exit immediately if a command exits with a non-zero status
+set -u # treat unset variables as an error
+
+cd ${SRC_DIR}
+
+cp ${PROJECT_DIR}/scripts/libx264/meson.* .
+
+# Fix building for arm64
+sed -i '' 's/\-arch arm64//g' configure
+
+meson setup build \
+ --cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
+ --prefix="${OUTPUT_DIR}" \
+ -Ddefault_library=shared |
+ tee configure.log
+
+meson compile -C build libx264
+meson install -C build
diff --git a/scripts/libx264/meson.build b/scripts/libx264/meson.build
new file mode 100644
index 0000000..bcb26c5
--- /dev/null
+++ b/scripts/libx264/meson.build
@@ -0,0 +1,23 @@
+# https://mesonbuild.com/External-Project-module.html
+
+project('libx264', 'c')
+
+mod = import('unstable-external_project')
+
+c_args = get_option('c_args')
+
+p = mod.add_project('configure',
+ configure_options : [
+ '--prefix=@PREFIX@',
+ '--disable-static',
+ '--enable-shared',
+ '--disable-cli'
+ ],
+ env: {
+ 'ASFLAGS': host_machine.cpu() == 'amd64' ? '' : ' '.join(c_args)
+ },
+ verbose: true,
+)
+
+libx264_dep = p.dependency('libx264')
+meson.override_dependency('libx264', libx264_dep)
diff --git a/scripts/mbedtls/build.sh b/scripts/mbedtls/build.sh
new file mode 100644
index 0000000..05efd94
--- /dev/null
+++ b/scripts/mbedtls/build.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -e # exit immediately if a command exits with a non-zero status
+set -u # treat unset variables as an error
+
+cd ${SRC_DIR}
+
+# cross build with meson
+cp ${PROJECT_DIR}/scripts/mbedtls/meson.build ./meson.build
+meson setup build_cross \
+ --cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
+ --prefix="${OUTPUT_DIR}"
+meson compile -C build_cross mbedtls
+
+# manually create output
+## create output layout
+mkdir -p dist/{include,lib}
+mkdir -p dist/include/{mbedtls,psa}
+mkdir -p dist/lib/pkgconfig
+## install headers
+cp -R subprojects/mbedtls/include/mbedtls/*.h dist/include/mbedtls
+cp -R subprojects/mbedtls/include/psa/*.h dist/include/psa
+## install libs
+find . -type f -name '*.dylib' -exec sh -c 'mv {} dist/lib' \;
+## install pkgconfig file
+cp ${PROJECT_DIR}/scripts/mbedtls/mbedtls.pc.in dist/lib/pkgconfig/mbedtls.pc
+sed -i '' 's|${PREFIX}|'${OUTPUT_DIR}'|g' dist/lib/pkgconfig/mbedtls.pc
+
+# manual install
+mkdir -p "${OUTPUT_DIR}"
+cp -R dist/* "${OUTPUT_DIR}"/
diff --git a/scripts/mbedtls/mbedtls.pc.in b/scripts/mbedtls/mbedtls.pc.in
new file mode 100644
index 0000000..fede917
--- /dev/null
+++ b/scripts/mbedtls/mbedtls.pc.in
@@ -0,0 +1,10 @@
+prefix="${PREFIX}"
+exec_prefix=${prefix}
+includedir="${prefix}/include"
+libdir="${prefix}/lib"
+
+Name: mbedtls
+Description: cryptographic library
+Version: unknown
+Libs: -L"${libdir}" -lmbedtls -lmbedcrypto -lmbedx509
+Cflags: -I"${includedir}"
diff --git a/scripts/mbedtls/meson.build b/scripts/mbedtls/meson.build
new file mode 100644
index 0000000..640c8d1
--- /dev/null
+++ b/scripts/mbedtls/meson.build
@@ -0,0 +1,28 @@
+# https://mesonbuild.com/External-Project-module.html
+
+project('mbedtls', 'c')
+
+cmake = import('cmake')
+
+cpu = host_machine.cpu()
+if cpu == 'amd64'
+ arch = 'x86_64'
+elif cpu == 'arm64'
+ arch = 'arm64'
+endif
+
+options = cmake.subproject_options()
+options.add_cmake_defines({
+ 'CMAKE_OSX_ARCHITECTURES': arch,
+ 'CMAKE_OSX_SYSROOT': meson.get_cross_property('cmake_osx_sysroot'),
+ 'USE_STATIC_MBEDTLS_LIBRARY': false,
+ 'USE_SHARED_MBEDTLS_LIBRARY': true,
+ 'LINK_WITH_PTHREAD': true,
+})
+
+mbedtls = cmake.subproject('mbedtls',
+ options: options,
+)
+
+mbedtls_dep = mbedtls.dependency('mbedtls')
+meson.override_dependency('mbedtls', mbedtls_dep)
diff --git a/scripts/uchardet/build.sh b/scripts/uchardet/build.sh
index 5dd0087..c407333 100644
--- a/scripts/uchardet/build.sh
+++ b/scripts/uchardet/build.sh
@@ -12,6 +12,7 @@ meson setup build_cross \
--prefix="${OUTPUT_DIR}"
meson compile -C build_cross uchardet
+# TODO: don't build twice, see what's done for mbetls
# native build with cmake
cmake ./subprojects/uchardet \
-B build_native \
diff --git a/scripts/uchardet/meson.build b/scripts/uchardet/meson.build
index 28684d4..a7ca18a 100644
--- a/scripts/uchardet/meson.build
+++ b/scripts/uchardet/meson.build
@@ -4,8 +4,17 @@ project('uchardet', 'c', 'cpp')
cmake = import('cmake')
+cpu = host_machine.cpu()
+if cpu == 'amd64'
+ arch = 'x86_64'
+elif cpu == 'arm64'
+ arch = 'arm64'
+endif
+
options = cmake.subproject_options()
options.add_cmake_defines({
+ 'CMAKE_OSX_ARCHITECTURES': arch,
+ 'CMAKE_OSX_SYSROOT': meson.get_cross_property('cmake_osx_sysroot'),
'BUILD_STATIC': false,
})