diff --git a/libs/ios/media_kit_libs_ios_audio/ios/Makefile b/libs/ios/media_kit_libs_ios_audio/ios/Makefile index 0f311588b..d867fd5e6 100644 --- a/libs/ios/media_kit_libs_ios_audio/ios/Makefile +++ b/libs/ios/media_kit_libs_ios_audio/ios/Makefile @@ -1,4 +1,4 @@ -all: Frameworks/*.xcframework +all: Frameworks/*.xcframework Frameworks/.symlinks MPV_XCFRAMEWORKS_VERSION=v0.5.1 MPV_XCFRAMEWORKS_SHA256SUM=3160b4e747f928c90fc9efd3208225a2bbebe2afe21d460165eb2f29fb0596f7 @@ -23,6 +23,11 @@ Frameworks/*.xcframework: .cache/xcframeworks/libmpv-xcframeworks-ios-universal. tar -xvf .cache/xcframeworks/libmpv-xcframeworks-ios-universal.tar.gz --strip-components 1 -C Frameworks touch Frameworks/*.xcframework +Frameworks/.symlinks: Frameworks/*.xcframework + rm -rf Frameworks/.symlinks + mkdir -p Frameworks/.symlinks/mpv + sh create_framework_symlinks.sh Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv + .PHONY: clean clean: rm -rf .cache diff --git a/libs/ios/media_kit_libs_ios_audio/ios/create_framework_symlinks.sh b/libs/ios/media_kit_libs_ios_audio/ios/create_framework_symlinks.sh new file mode 100644 index 000000000..9255c0dd5 --- /dev/null +++ b/libs/ios/media_kit_libs_ios_audio/ios/create_framework_symlinks.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# `create_framework_symlinks.sh` is duplicated across: +# - `media_kit_libs_ios_audio` +# - `media_kit_libs_ios_video` +# - `media_kit_libs_macos_audio` +# - `media_kit_libs_macos_video` + +set -e +set -u + +SRC_DIR="$1" +SYMLINKS_DIR="$2" + +# Computes the relative path between two given paths +# +# Example: +# ``` +# relpath Frameworks/Mpv.xcframework/ios-arm64 Frameworks/.symlinks/mpv +# ../../Mpv.xcframework/ios-arm64 +# ``` +# +# Source: https://stackoverflow.com/a/14914070 +relpath() { + [ $# -ge 1 ] && [ $# -le 2 ] || return 1 + current="${2:+"$1"}" + target="${2:-"$1"}" + [ "$target" != . ] || target=/ + target="/${target##/}" + [ "$current" != . ] || current=/ + current="${current:="/"}" + current="/${current##/}" + appendix="${target##/}" + relative='' + while appendix="${target#"$current"/}" + [ "$current" != '/' ] && [ "$appendix" = "$target" ]; do + if [ "$current" = "$appendix" ]; then + relative="${relative:-.}" + echo "${relative#/}" + return 0 + fi + current="${current%/*}" + relative="$relative${relative:+/}.." + done + relative="$relative${relative:+${appendix:+/}}${appendix#/}" + echo "$relative" +} + +# Create symbolic links from a given source directory to a destination directory +# for a specific framework +# +# Example: +# ``` +# create_framework_symlinks Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv +# Frameworks/.symlinks/mpv/ios -> ../../Mpv.xcframework/ios-arm64 +# Frameworks/.symlinks/mpv/ios-simulator -> ../../Mpv.xcframework/ios-arm64_x86_64-simulator +# ``` +create_framework_symlinks() { + SRC_DIR="$1" + SYMLINKS_DIR="$2" + + find "${SRC_DIR}" -depth 1 -type d | while read SRC; do + SLUG="$(basename "${SRC}")" + NAME="$(echo "${SLUG}" | cut -d '-' -f 1 -f 3)" + + SRC_RELATIVE="$(relpath "${SYMLINKS_DIR}" "${SRC}")" + + ln -s "${SRC_RELATIVE}" "${SYMLINKS_DIR}/${NAME}" + done +} + +create_framework_symlinks "${SRC_DIR}" "${SYMLINKS_DIR}" diff --git a/libs/ios/media_kit_libs_ios_video/ios/Makefile b/libs/ios/media_kit_libs_ios_video/ios/Makefile index 44b799684..02d8e6e2f 100644 --- a/libs/ios/media_kit_libs_ios_video/ios/Makefile +++ b/libs/ios/media_kit_libs_ios_video/ios/Makefile @@ -1,4 +1,4 @@ -all: Frameworks/*.xcframework +all: Frameworks/*.xcframework Frameworks/.symlinks MPV_XCFRAMEWORKS_VERSION=v0.5.1 MPV_XCFRAMEWORKS_SHA256SUM=a6c7cd6aec15c29ffef8f70ef0eedabaa10d9691832ec9bdccac1277ab23736f @@ -23,6 +23,11 @@ Frameworks/*.xcframework: .cache/xcframeworks/libmpv-xcframeworks-ios-universal. tar -xvf .cache/xcframeworks/libmpv-xcframeworks-ios-universal.tar.gz --strip-components 1 -C Frameworks touch Frameworks/*.xcframework +Frameworks/.symlinks: Frameworks/*.xcframework + rm -rf Frameworks/.symlinks + mkdir -p Frameworks/.symlinks/mpv + sh create_framework_symlinks.sh Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv + .PHONY: clean clean: rm -rf .cache diff --git a/libs/ios/media_kit_libs_ios_video/ios/create_framework_symlinks.sh b/libs/ios/media_kit_libs_ios_video/ios/create_framework_symlinks.sh new file mode 100644 index 000000000..9255c0dd5 --- /dev/null +++ b/libs/ios/media_kit_libs_ios_video/ios/create_framework_symlinks.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# `create_framework_symlinks.sh` is duplicated across: +# - `media_kit_libs_ios_audio` +# - `media_kit_libs_ios_video` +# - `media_kit_libs_macos_audio` +# - `media_kit_libs_macos_video` + +set -e +set -u + +SRC_DIR="$1" +SYMLINKS_DIR="$2" + +# Computes the relative path between two given paths +# +# Example: +# ``` +# relpath Frameworks/Mpv.xcframework/ios-arm64 Frameworks/.symlinks/mpv +# ../../Mpv.xcframework/ios-arm64 +# ``` +# +# Source: https://stackoverflow.com/a/14914070 +relpath() { + [ $# -ge 1 ] && [ $# -le 2 ] || return 1 + current="${2:+"$1"}" + target="${2:-"$1"}" + [ "$target" != . ] || target=/ + target="/${target##/}" + [ "$current" != . ] || current=/ + current="${current:="/"}" + current="/${current##/}" + appendix="${target##/}" + relative='' + while appendix="${target#"$current"/}" + [ "$current" != '/' ] && [ "$appendix" = "$target" ]; do + if [ "$current" = "$appendix" ]; then + relative="${relative:-.}" + echo "${relative#/}" + return 0 + fi + current="${current%/*}" + relative="$relative${relative:+/}.." + done + relative="$relative${relative:+${appendix:+/}}${appendix#/}" + echo "$relative" +} + +# Create symbolic links from a given source directory to a destination directory +# for a specific framework +# +# Example: +# ``` +# create_framework_symlinks Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv +# Frameworks/.symlinks/mpv/ios -> ../../Mpv.xcframework/ios-arm64 +# Frameworks/.symlinks/mpv/ios-simulator -> ../../Mpv.xcframework/ios-arm64_x86_64-simulator +# ``` +create_framework_symlinks() { + SRC_DIR="$1" + SYMLINKS_DIR="$2" + + find "${SRC_DIR}" -depth 1 -type d | while read SRC; do + SLUG="$(basename "${SRC}")" + NAME="$(echo "${SLUG}" | cut -d '-' -f 1 -f 3)" + + SRC_RELATIVE="$(relpath "${SYMLINKS_DIR}" "${SRC}")" + + ln -s "${SRC_RELATIVE}" "${SYMLINKS_DIR}/${NAME}" + done +} + +create_framework_symlinks "${SRC_DIR}" "${SYMLINKS_DIR}" diff --git a/libs/macos/media_kit_libs_macos_audio/macos/Makefile b/libs/macos/media_kit_libs_macos_audio/macos/Makefile index 74e8ce95e..e915ea7a1 100644 --- a/libs/macos/media_kit_libs_macos_audio/macos/Makefile +++ b/libs/macos/media_kit_libs_macos_audio/macos/Makefile @@ -1,4 +1,4 @@ -all: Frameworks/*.xcframework +all: Frameworks/*.xcframework Frameworks/.symlinks MPV_XCFRAMEWORKS_VERSION=v0.5.1 MPV_XCFRAMEWORKS_SHA256SUM=2dd65f4afc5031e22794a5b583cf56f8e6b4e901d2d811cf5c8a0dd1d083c08f @@ -23,6 +23,11 @@ Frameworks/*.xcframework: .cache/xcframeworks/libmpv-xcframeworks-macos-universa tar -xvf .cache/xcframeworks/libmpv-xcframeworks-macos-universal.tar.gz --strip-components 1 -C Frameworks touch Frameworks/*.xcframework +Frameworks/.symlinks: Frameworks/*.xcframework + rm -rf Frameworks/.symlinks + mkdir -p Frameworks/.symlinks/mpv + sh create_framework_symlinks.sh Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv + .PHONY: clean clean: rm -rf .cache diff --git a/libs/macos/media_kit_libs_macos_audio/macos/create_framework_symlinks.sh b/libs/macos/media_kit_libs_macos_audio/macos/create_framework_symlinks.sh new file mode 100644 index 000000000..9255c0dd5 --- /dev/null +++ b/libs/macos/media_kit_libs_macos_audio/macos/create_framework_symlinks.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# `create_framework_symlinks.sh` is duplicated across: +# - `media_kit_libs_ios_audio` +# - `media_kit_libs_ios_video` +# - `media_kit_libs_macos_audio` +# - `media_kit_libs_macos_video` + +set -e +set -u + +SRC_DIR="$1" +SYMLINKS_DIR="$2" + +# Computes the relative path between two given paths +# +# Example: +# ``` +# relpath Frameworks/Mpv.xcframework/ios-arm64 Frameworks/.symlinks/mpv +# ../../Mpv.xcframework/ios-arm64 +# ``` +# +# Source: https://stackoverflow.com/a/14914070 +relpath() { + [ $# -ge 1 ] && [ $# -le 2 ] || return 1 + current="${2:+"$1"}" + target="${2:-"$1"}" + [ "$target" != . ] || target=/ + target="/${target##/}" + [ "$current" != . ] || current=/ + current="${current:="/"}" + current="/${current##/}" + appendix="${target##/}" + relative='' + while appendix="${target#"$current"/}" + [ "$current" != '/' ] && [ "$appendix" = "$target" ]; do + if [ "$current" = "$appendix" ]; then + relative="${relative:-.}" + echo "${relative#/}" + return 0 + fi + current="${current%/*}" + relative="$relative${relative:+/}.." + done + relative="$relative${relative:+${appendix:+/}}${appendix#/}" + echo "$relative" +} + +# Create symbolic links from a given source directory to a destination directory +# for a specific framework +# +# Example: +# ``` +# create_framework_symlinks Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv +# Frameworks/.symlinks/mpv/ios -> ../../Mpv.xcframework/ios-arm64 +# Frameworks/.symlinks/mpv/ios-simulator -> ../../Mpv.xcframework/ios-arm64_x86_64-simulator +# ``` +create_framework_symlinks() { + SRC_DIR="$1" + SYMLINKS_DIR="$2" + + find "${SRC_DIR}" -depth 1 -type d | while read SRC; do + SLUG="$(basename "${SRC}")" + NAME="$(echo "${SLUG}" | cut -d '-' -f 1 -f 3)" + + SRC_RELATIVE="$(relpath "${SYMLINKS_DIR}" "${SRC}")" + + ln -s "${SRC_RELATIVE}" "${SYMLINKS_DIR}/${NAME}" + done +} + +create_framework_symlinks "${SRC_DIR}" "${SYMLINKS_DIR}" diff --git a/libs/macos/media_kit_libs_macos_video/macos/Makefile b/libs/macos/media_kit_libs_macos_video/macos/Makefile index 8b6fa1ce4..e7d552ec6 100644 --- a/libs/macos/media_kit_libs_macos_video/macos/Makefile +++ b/libs/macos/media_kit_libs_macos_video/macos/Makefile @@ -1,4 +1,4 @@ -all: Frameworks/*.xcframework +all: Frameworks/*.xcframework Frameworks/.symlinks MPV_XCFRAMEWORKS_VERSION=v0.5.1 MPV_XCFRAMEWORKS_SHA256SUM=c36cced892588399d9268d3e514e0bca871ef09f0e04cef8078e9f172a8caadb @@ -23,6 +23,11 @@ Frameworks/*.xcframework: .cache/xcframeworks/libmpv-xcframeworks-macos-universa tar -xvf .cache/xcframeworks/libmpv-xcframeworks-macos-universal.tar.gz --strip-components 1 -C Frameworks touch Frameworks/*.xcframework +Frameworks/.symlinks: Frameworks/*.xcframework + rm -rf Frameworks/.symlinks + mkdir -p Frameworks/.symlinks/mpv + sh create_framework_symlinks.sh Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv + .PHONY: clean clean: rm -rf .cache diff --git a/libs/macos/media_kit_libs_macos_video/macos/create_framework_symlinks.sh b/libs/macos/media_kit_libs_macos_video/macos/create_framework_symlinks.sh new file mode 100644 index 000000000..9255c0dd5 --- /dev/null +++ b/libs/macos/media_kit_libs_macos_video/macos/create_framework_symlinks.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# `create_framework_symlinks.sh` is duplicated across: +# - `media_kit_libs_ios_audio` +# - `media_kit_libs_ios_video` +# - `media_kit_libs_macos_audio` +# - `media_kit_libs_macos_video` + +set -e +set -u + +SRC_DIR="$1" +SYMLINKS_DIR="$2" + +# Computes the relative path between two given paths +# +# Example: +# ``` +# relpath Frameworks/Mpv.xcframework/ios-arm64 Frameworks/.symlinks/mpv +# ../../Mpv.xcframework/ios-arm64 +# ``` +# +# Source: https://stackoverflow.com/a/14914070 +relpath() { + [ $# -ge 1 ] && [ $# -le 2 ] || return 1 + current="${2:+"$1"}" + target="${2:-"$1"}" + [ "$target" != . ] || target=/ + target="/${target##/}" + [ "$current" != . ] || current=/ + current="${current:="/"}" + current="/${current##/}" + appendix="${target##/}" + relative='' + while appendix="${target#"$current"/}" + [ "$current" != '/' ] && [ "$appendix" = "$target" ]; do + if [ "$current" = "$appendix" ]; then + relative="${relative:-.}" + echo "${relative#/}" + return 0 + fi + current="${current%/*}" + relative="$relative${relative:+/}.." + done + relative="$relative${relative:+${appendix:+/}}${appendix#/}" + echo "$relative" +} + +# Create symbolic links from a given source directory to a destination directory +# for a specific framework +# +# Example: +# ``` +# create_framework_symlinks Frameworks/Mpv.xcframework Frameworks/.symlinks/mpv +# Frameworks/.symlinks/mpv/ios -> ../../Mpv.xcframework/ios-arm64 +# Frameworks/.symlinks/mpv/ios-simulator -> ../../Mpv.xcframework/ios-arm64_x86_64-simulator +# ``` +create_framework_symlinks() { + SRC_DIR="$1" + SYMLINKS_DIR="$2" + + find "${SRC_DIR}" -depth 1 -type d | while read SRC; do + SLUG="$(basename "${SRC}")" + NAME="$(echo "${SLUG}" | cut -d '-' -f 1 -f 3)" + + SRC_RELATIVE="$(relpath "${SYMLINKS_DIR}" "${SRC}")" + + ln -s "${SRC_RELATIVE}" "${SYMLINKS_DIR}/${NAME}" + done +} + +create_framework_symlinks "${SRC_DIR}" "${SYMLINKS_DIR}" diff --git a/media_kit_native_event_loop/ios/media_kit_native_event_loop.podspec b/media_kit_native_event_loop/ios/media_kit_native_event_loop.podspec index 66689d836..867f31496 100644 --- a/media_kit_native_event_loop/ios/media_kit_native_event_loop.podspec +++ b/media_kit_native_event_loop/ios/media_kit_native_event_loop.podspec @@ -31,8 +31,8 @@ Pod::Spec.new do |s| if mku.libs_found # Define paths to frameworks dir - framework_search_paths_iphoneos = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/Mpv.xcframework/ios-arm64', mku.libs_package) - framework_search_paths_iphonesimulator = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/Mpv.xcframework/ios-arm64_x86_64-simulator', mku.libs_package) + framework_search_paths_iphoneos = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/.symlinks/mpv/ios', mku.libs_package) + framework_search_paths_iphonesimulator = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/.symlinks/mpv/ios-simulator', mku.libs_package) s.source_files = 'Classes/**/*' s.platform = :ios, '9.0' diff --git a/media_kit_native_event_loop/macos/media_kit_native_event_loop.podspec b/media_kit_native_event_loop/macos/media_kit_native_event_loop.podspec index a60b64381..665adb4e8 100644 --- a/media_kit_native_event_loop/macos/media_kit_native_event_loop.podspec +++ b/media_kit_native_event_loop/macos/media_kit_native_event_loop.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| if mku.libs_found # Define paths to frameworks dir - framework_search_paths_macosx = sprintf('$(PROJECT_DIR)/../Flutter/ephemeral/.symlinks/plugins/%s/macos/Frameworks/Mpv.xcframework/macos-arm64_x86_64', mku.libs_package) + framework_search_paths_macosx = sprintf('$(PROJECT_DIR)/../Flutter/ephemeral/.symlinks/plugins/%s/macos/Frameworks/.symlinks/mpv/macos', mku.libs_package) s.source_files = 'Classes/**/*' s.platform = :osx, '10.9' diff --git a/media_kit_video/ios/media_kit_video.podspec b/media_kit_video/ios/media_kit_video.podspec index ce03aeacc..81b6e0719 100644 --- a/media_kit_video/ios/media_kit_video.podspec +++ b/media_kit_video/ios/media_kit_video.podspec @@ -29,8 +29,8 @@ Pod::Spec.new do |s| if mku.libs_found # Define paths to frameworks dir - framework_search_paths_iphoneos = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/Mpv.xcframework/ios-arm64', mku.libs_package) - framework_search_paths_iphonesimulator = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/Mpv.xcframework/ios-arm64_x86_64-simulator', mku.libs_package) + framework_search_paths_iphoneos = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/.symlinks/mpv/ios', mku.libs_package) + framework_search_paths_iphonesimulator = sprintf('$(PROJECT_DIR)/../.symlinks/plugins/%s/ios/Frameworks/.symlinks/mpv/ios-simulator', mku.libs_package) s.source_files = 'Classes/plugin/**/*.swift', 'Headers/**/*.h' s.pod_target_xcconfig = { diff --git a/media_kit_video/macos/media_kit_video.podspec b/media_kit_video/macos/media_kit_video.podspec index fb90338ca..15c3a9ca0 100644 --- a/media_kit_video/macos/media_kit_video.podspec +++ b/media_kit_video/macos/media_kit_video.podspec @@ -29,7 +29,7 @@ Pod::Spec.new do |s| if mku.libs_found # Define paths to frameworks dir - framework_search_paths_macosx = sprintf('$(PROJECT_DIR)/../Flutter/ephemeral/.symlinks/plugins/%s/macos/Frameworks/Mpv.xcframework/macos-arm64_x86_64', mku.libs_package) + framework_search_paths_macosx = sprintf('$(PROJECT_DIR)/../Flutter/ephemeral/.symlinks/plugins/%s/macos/Frameworks/.symlinks/mpv/macos', mku.libs_package) s.source_files = 'Classes/plugin/**/*.swift', 'Headers/**/*.h' s.pod_target_xcconfig = {