Skip to content

Commit e48c88d

Browse files
committed
make xcframework bundle
1 parent 84fc677 commit e48c88d

21 files changed

Lines changed: 314 additions & 243 deletions

.github/workflows/opus.yml

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,17 @@ jobs:
4141
ls | awk -F ' ' '{printf "echo %s\n echo -------------\ngit -C %s log -n 1 | cat\n",$0,$0}' | bash > ../tvos-src-log.md
4242
- name: do compile macos libs
4343
run: |
44-
cd macos
45-
./compile-any.sh build ${{ env.LIB_NAME }}
46-
./compile-any.sh lipo ${{ env.LIB_NAME }}
44+
./macos/compile-any.sh -a 'arm64 x86_64' -c build -l ${{ env.LIB_NAME }}
4745
- name: do compile ios libs
4846
run: |
49-
cd ios
50-
./compile-any.sh build ${{ env.LIB_NAME }}
51-
./compile-any.sh lipo ${{ env.LIB_NAME }}
47+
./ios/compile-any.sh -a 'arm64 x86_64_simulator' -c build -l ${{ env.LIB_NAME }}
5248
- name: do compile tvos libs
5349
run: |
54-
cd tvos
55-
./compile-any.sh build ${{ env.LIB_NAME }}
56-
./compile-any.sh lipo ${{ env.LIB_NAME }}
57-
- name: Zip macos libs
50+
./tvos/compile-any.sh -a 'arm64 arm64_simulator' -c build -l ${{ env.LIB_NAME }}
51+
- name: Zip apple xcframework
5852
run: |
59-
cd build/product/macos/universal
60-
zip -rq macos-universal.zip ./*
61-
- name: Zip ios libs
62-
run: |
63-
cd build/product/ios/universal
64-
zip -rq ios-universal.zip ./*
65-
- name: Zip tvos libs
66-
run: |
67-
cd build/product/tvos/universal
68-
zip -rq tvos-universal.zip ./*
53+
cd build/product/xcframework
54+
zip -rq apple-xcframework.zip ./*
6955
- name: Create Release
7056
id: create_release
7157
uses: actions/create-release@v1
@@ -76,32 +62,14 @@ jobs:
7662
release_name: ${{ env.LIB_NAME }}-${{ env.RELEASE_VERSION }}
7763
draft: false
7864
prerelease: false
79-
- name: Upload macos Release Asset
80-
uses: actions/upload-release-asset@v1
81-
env:
82-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83-
with:
84-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
85-
asset_path: build/product/macos/universal/macos-universal.zip
86-
asset_name: "${{ env.LIB_NAME }}-macos-universal-${{ env.RELEASE_VERSION }}.zip"
87-
asset_content_type: application/zip
88-
- name: Upload ios Release Asset
89-
uses: actions/upload-release-asset@v1
90-
env:
91-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92-
with:
93-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
94-
asset_path: build/product/ios/universal/ios-universal.zip
95-
asset_name: "${{ env.LIB_NAME }}-ios-universal-${{ env.RELEASE_VERSION }}.zip"
96-
asset_content_type: application/zip
97-
- name: Upload tvos Release Asset
65+
- name: Upload Apple Plat Release Asset
9866
uses: actions/upload-release-asset@v1
9967
env:
10068
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10169
with:
10270
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
103-
asset_path: build/product/tvos/universal/tvos-universal.zip
104-
asset_name: "${{ env.LIB_NAME }}-tvos-universal-${{ env.RELEASE_VERSION }}.zip"
71+
asset_path: build/product/apple-xcframework.zip
72+
asset_name: "${{ env.LIB_NAME }}-apple-xcframework-${{ env.RELEASE_VERSION }}.zip"
10573
asset_content_type: application/zip
10674
- name: Upload macos src md
10775
uses: actions/upload-release-asset@v1

apple/compile-any.sh

Lines changed: 76 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,79 +16,120 @@
1616
#
1717
#
1818

19-
PLAT=$1
20-
CMD=$2
21-
LIBS=$3
22-
ARCH=$4
23-
OPTS=$5
24-
2519
set -e
2620

2721
# 当前脚本所在目录
2822
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2923
cd "$THIS_DIR"
3024

31-
function usage() {
32-
echo " useage:"
33-
echo " $0 [ios|macos|tvos] [build|rebuild|lipo|clean] [all|ffmpeg|libyuv|openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg] [arm64|x86_64|all] [opts...]"
25+
function usage()
26+
{
27+
cat << EOF
28+
usage: ./apple/compile-any.sh [options]
29+
30+
compile ijkplayer using libs for iOS and macOS and tvOS,such as libass、ffmpeg...
31+
32+
OPTIONS:
33+
-h Show some help
34+
-p Specify platform (ios,macos,tvos)
35+
-c Specify cmd (build,clean,rebuild,lipo) rebuild=clean+build
36+
-a Specify archs (x86_64,arm64,x86_64_simulator,arm64_simulator,all) all="x86_64,arm64,x86_64_simulator,arm64_simulator"
37+
-l Specify which libs need 'cmd' (all|libyuv|openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg)
38+
-d Enable debug mode (disable by default)
39+
-t Force number of cores to be used
40+
EOF
3441
}
3542

36-
if [[ "$PLAT" != 'ios' && "$PLAT" != 'macos' && "$PLAT" != 'tvos' ]]; then
37-
echo "plat must be: [ios|macos|tvos]"
38-
usage
43+
while getopts "hp:c:a:l:dt:" opt
44+
do
45+
#echo "opt:$opt,OPTIND:[$OPTIND],OPTARG:[$OPTARG]"
46+
case $opt in
47+
h)
48+
usage
49+
;;
50+
p)
51+
XC_PLAT="$OPTARG"
52+
if [[ "$XC_PLAT" != 'ios' && "$XC_PLAT" != 'macos' && "$XC_PLAT" != 'tvos' ]]; then
53+
echo "plat must be: [ios|macos|tvos]"
54+
exit 1
55+
fi
56+
;;
57+
c)
58+
XC_CMD="$OPTARG"
59+
;;
60+
a)
61+
XC_ALL_ARCHS="$OPTARG"
62+
;;
63+
l)
64+
LIBS="$OPTARG"
65+
;;
66+
d)
67+
XC_DEBUG='debug'
68+
;;
69+
t)
70+
XC_THREAD="$OPTARG"
71+
;;
72+
esac
73+
done
74+
75+
shift $((OPTIND-1))
76+
77+
if [[ -z "$XC_THREAD" ]];then
78+
XC_THREAD=$(sysctl -n machdep.cpu.thread_count)
79+
echo "support thread count:$XC_THREAD"
80+
fi
81+
82+
if [[ -z "$XC_CMD" ]];then
83+
echo "cmd can't be nil. use -c specify cmd"
3984
exit 1
4085
fi
4186

42-
source 'init-env.sh'
87+
if [[ -z "$LIBS" ]];then
88+
echo "libs can't be nil. use -l specify libs"
89+
exit 1
90+
fi
4391

44-
init_plat_env $PLAT
92+
export XC_THREAD
93+
export XC_PLAT
94+
export XC_CMD
95+
export XC_DEBUG
4596

46-
if [[ -z "$LIBS" || "$LIBS" == "all" ]]; then
97+
if [[ "$LIBS" == "all" ]]; then
4798
list='compile-cfgs/list.txt'
4899
#use plat list
49-
if [[ -f "compile-cfgs/list_${PLAT}.txt" ]]; then
50-
list="compile-cfgs/list_${PLAT}.txt"
100+
if [[ -f "compile-cfgs/list_${XC_PLAT}.txt" ]]; then
101+
list="compile-cfgs/list_${XC_PLAT}.txt"
51102
fi
52103
LIBS=$(cat $list)
53104
fi
54105

55-
if [[ -z "$ARCH" || "$ARCH" == 'all' ]]; then
56-
ARCH="$XC_ALL_ARCHS"
57-
fi
58-
59-
if [[ -z "$CMD" ]]; then
60-
echo "cmd must be: [build|rebuild|lipo|clean]"
61-
usage
62-
exit 1
63-
fi
64-
65-
66-
export XC_CMD="$CMD"
67-
export XC_TARGET_ARCHS="$ARCH"
68-
export XC_OPTS="$OPTS"
69106
export XC_VENDOR_LIBS="$LIBS"
107+
export XC_ALL_ARCHS
70108

109+
source 'init-env.sh'
110+
init_plat_env
71111

72112
echo '------------------------------------------'
73113
echo "XC_PLAT : [$XC_PLAT]"
74114
echo "XC_CMD : [$XC_CMD]"
75115
echo "XC_VENDOR_LIBS : [$XC_VENDOR_LIBS]"
76-
echo "XC_TARGET_ARCHS : [$ARCH]"
77-
echo "XC_OPTS : [$XC_OPTS]"
116+
echo "XC_ALL_ARCHS : [$XC_ALL_ARCHS]"
117+
echo "XC_DEBUG : [$XC_DEBUG]"
78118
echo "XC_FORCE_CROSS : [$XC_FORCE_CROSS]"
119+
echo "XC_THREAD : [$XC_THREAD]"
79120
echo '------------------------------------------'
80121

81122
START_STMP=$(date +%s)
82123
# 循环编译所有的库
83124
for lib in $LIBS
84125
do
85-
echo "===[$CMD $lib]===================="
126+
echo "===[$XC_CMD $lib]===================="
86127
source compile-cfgs/"$lib"
87128

88129
./do-compile/any.sh
89130
if [[ $? -eq 0 ]];then
90131
echo "🎉 Congrats"
91-
echo "🚀 ${LIB_NAME} successfully $CMD."
132+
echo "🚀 ${LIB_NAME} successfully $XC_CMD."
92133
echo
93134
fi
94135
echo "===================================="

apple/compile-cfgs/list_ios.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
libyuv openssl opus dav1d ffmpeg
1+
openssl opus dav1d dvdread freetype fribidi harfbuzz unibreak ass ffmpeg

apple/compile-cfgs/meson-crossfiles/x86_64-ios.meson renamed to apple/compile-cfgs/meson-crossfiles/x86_64-ios-simulator.meson

File renamed without changes.

0 commit comments

Comments
 (0)