forked from media-kit/media-kit
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(darwin): symlinks for FRAMEWORK_SEARCH_PATHS
Using symbolic links for `FRAMEWORK_SEARCH_PATHS` allows to not depend on variable count of architectures included in `media_kit_libs_***`. Example: `macos-arm64_x86_64` or `macos_arm64`.
- Loading branch information
Showing
12 changed files
with
318 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
libs/ios/media_kit_libs_ios_audio/ios/create_framework_symlinks.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
libs/ios/media_kit_libs_ios_video/ios/create_framework_symlinks.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
libs/macos/media_kit_libs_macos_audio/macos/create_framework_symlinks.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
libs/macos/media_kit_libs_macos_video/macos/create_framework_symlinks.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.