Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit e0eb57b

Browse files
committed
allow disabling bitcode in ios and tvos, fixes #614
1 parent fd719cd commit e0eb57b

File tree

6 files changed

+45
-12
lines changed

6 files changed

+45
-12
lines changed

ios.sh

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ while [ ! $# -eq 0 ]; do
7171

7272
skip_library "${SKIP_LIBRARY}"
7373
;;
74+
--no-bitcode)
75+
export NO_BITCODE="1"
76+
;;
7477
--no-framework)
7578
NO_FRAMEWORK="1"
7679
;;

scripts/apple/ffmpeg.sh

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ x86-64-mac-catalyst)
9898
;;
9999
esac
100100

101+
if [ ! -z $NO_BITCODE ]; then
102+
BITCODE_FLAGS=""
103+
fi
104+
101105
CONFIGURE_POSTFIX=""
102106
HIGH_PRIORITY_LDFLAGS=""
103107

scripts/function-ios.sh

+14-6
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ libraries are created under the prebuilt folder.\n"
5555
display_help_gpl_libraries
5656
display_help_custom_libraries
5757
if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then
58-
display_help_advanced_options " --no-framework\t\tdo not build xcframework bundles [no]"
58+
display_help_advanced_options " --no-framework\t\tdo not build xcframework bundles [no]" " --no-bitcode\t\t\tdo not enable bitcode in bundles [no]"
5959
else
60-
display_help_advanced_options " --no-framework\t\tdo not build framework bundles [no]"
60+
display_help_advanced_options " --no-framework\t\tdo not build framework bundles [no]" " --no-bitcode\t\t\tdo not enable bitcode in bundles [no]"
6161
fi
6262
}
6363

@@ -105,16 +105,19 @@ get_common_cflags() {
105105
fi
106106

107107
local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)"
108+
if [ -z $NO_BITCODE ]; then
109+
local BITCODE_FLAGS="-fembed-bitcode"
110+
fi
108111

109112
case ${ARCH} in
110113
i386 | x86-64 | arm64-simulator)
111114
echo "-fstrict-aliasing -DIOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
112115
;;
113116
*-mac-catalyst)
114-
echo "-fstrict-aliasing -fembed-bitcode -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
117+
echo "-fstrict-aliasing ${BITCODE_FLAGS} -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
115118
;;
116119
*)
117-
echo "-fstrict-aliasing -fembed-bitcode -DIOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
120+
echo "-fstrict-aliasing ${BITCODE_FLAGS} -DIOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
118121
;;
119122
esac
120123
}
@@ -278,7 +281,9 @@ get_cxxflags() {
278281
local BITCODE_FLAGS=""
279282
case ${ARCH} in
280283
armv7 | armv7s | arm64 | arm64e | *-mac-catalyst)
281-
local BITCODE_FLAGS="-fembed-bitcode"
284+
if [ -z $NO_BITCODE ]; then
285+
local BITCODE_FLAGS="-fembed-bitcode"
286+
fi
282287
;;
283288
esac
284289

@@ -384,12 +389,15 @@ get_ldflags() {
384389
local OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}"
385390
fi
386391
local COMMON_FLAGS=$(get_common_ldflags)
392+
if [ -z $NO_BITCODE ]; then
393+
local BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode"
394+
fi
387395

388396
case $1 in
389397
ffmpeg-kit)
390398
case ${ARCH} in
391399
armv7 | armv7s | arm64 | arm64e | *-mac-catalyst)
392-
echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} -fembed-bitcode -Wc,-fembed-bitcode ${OPTIMIZATION_FLAGS}"
400+
echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} ${BITCODE_FLAGS} ${OPTIMIZATION_FLAGS}"
393401
;;
394402
*)
395403
echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} ${OPTIMIZATION_FLAGS}"

scripts/function-tvos.sh

+18-6
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ set explicitly. When compilation ends, libraries are created under the prebuilt
4343
display_help_gpl_libraries
4444
display_help_custom_libraries
4545
if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then
46-
display_help_advanced_options " --no-framework\t\tdo not build xcframework bundles [no]"
46+
display_help_advanced_options " --no-framework\t\tdo not build xcframework bundles [no]" " --no-bitcode\t\t\tdo not enable bitcode in bundles [no]"
4747
else
48-
display_help_advanced_options " --no-framework\t\tdo not build framework bundles [no]"
48+
display_help_advanced_options " --no-framework\t\tdo not build framework bundles [no]" " --no-bitcode\t\t\tdo not enable bitcode in bundles [no]"
4949
fi
5050
}
5151

@@ -79,10 +79,13 @@ get_common_cflags() {
7979
fi
8080

8181
local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)"
82+
if [ -z $NO_BITCODE ]; then
83+
local BITCODE_FLAGS="-fembed-bitcode"
84+
fi
8285

8386
case ${ARCH} in
8487
arm64)
85-
echo "-fstrict-aliasing -fembed-bitcode -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
88+
echo "-fstrict-aliasing ${BITCODE_FLAGS} -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
8689
;;
8790
x86-64 | arm64-simulator)
8891
echo "-fstrict-aliasing -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}"
@@ -254,7 +257,9 @@ get_cxxflags() {
254257
local BITCODE_FLAGS=""
255258
case ${ARCH} in
256259
arm64)
257-
local BITCODE_FLAGS="-fembed-bitcode"
260+
if [ -z $NO_BITCODE ]; then
261+
local BITCODE_FLAGS="-fembed-bitcode"
262+
fi
258263
;;
259264
esac
260265

@@ -320,9 +325,13 @@ get_size_optimization_ldflags() {
320325
}
321326

322327
get_arch_specific_ldflags() {
328+
if [ -z $NO_BITCODE ]; then
329+
local BITCODE_FLAGS="-fembed-bitcode"
330+
fi
331+
323332
case ${ARCH} in
324333
arm64)
325-
echo "-arch arm64 -march=armv8-a+crc+crypto -fembed-bitcode"
334+
echo "-arch arm64 -march=armv8-a+crc+crypto ${BITCODE_FLAGS}"
326335
;;
327336
arm64-simulator)
328337
echo "-arch arm64 -march=armv8-a+crc+crypto"
@@ -342,12 +351,15 @@ get_ldflags() {
342351
local OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}"
343352
fi
344353
local COMMON_FLAGS=$(get_common_ldflags)
354+
if [ -z $NO_BITCODE ]; then
355+
local BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode"
356+
fi
345357

346358
case $1 in
347359
ffmpeg-kit)
348360
case ${ARCH} in
349361
arm64)
350-
echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} -fembed-bitcode -Wc,-fembed-bitcode ${OPTIMIZATION_FLAGS}"
362+
echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} ${BITCODE_FLAGS} ${OPTIMIZATION_FLAGS}"
351363
;;
352364
*)
353365
echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} ${OPTIMIZATION_FLAGS}"

scripts/function.sh

+3
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,9 @@ display_help_advanced_options() {
927927
if [ -n "$1" ]; then
928928
echo -e "$1"
929929
fi
930+
if [ -n "$2" ]; then
931+
echo -e "$2"
932+
fi
930933
echo -e ""
931934
}
932935

tvos.sh

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ while [ ! $# -eq 0 ]; do
7171

7272
skip_library "${SKIP_LIBRARY}"
7373
;;
74+
--no-bitcode)
75+
export NO_BITCODE="1"
76+
;;
7477
--no-framework)
7578
NO_FRAMEWORK="1"
7679
;;

0 commit comments

Comments
 (0)