├── .github ├── FUNDING.yml └── workflows │ └── build.yml ├── .gitignore ├── .sf ├── .travis.yml ├── README.md ├── build-ffmpeg-iOS-framework.sh ├── build-ffmpeg-tvos.sh └── build-ffmpeg.sh /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [kewlbear] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: macOS-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | - name: build 13 | run: ./build-ffmpeg.sh 2>.stderr 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | scratch* 2 | thin* 3 | fat* 4 | FFmpeg.framework 5 | FFmpeg-* 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /.sf: -------------------------------------------------------------------------------- 1 | U2FsdGVkX1963CBvqs0HeUSGVyB5D9h3ZGt59hEumxSseCqcFaPYkWuVfH2Z7AAp 2 | IKSrSFVBJyjmOFCp0atyz43YHXRfNyxRr3+Y7fKAyTnkEnI+XZVl9GLCLAndeyiX 3 | 76V9+YomXl8VXJF7GJoa/37HMbFJ2XniDCsxsPuQm51lkhRUDqU9/g91x3WcQgWN 4 | TpJv1YFg8tL1Dsf82b+zvQ+VhDcbTOcB+BKhHe+MYyR7p13caN20j7hbzvxGXFsV 5 | tjugHZuIhg8EbrDdSP0vAhqgKt7NoW3Enino54/EVjX8VysuP4B3Z9Hi24dWccJf 6 | 9WxsTkoaAFPCPXkv5GZ95W73p41G1zPFh5kOHwnli7Kvb6IKSQq/yrfTf5SOTUox 7 | 85JAYk3pCPqVSA/v5i6z1e11382jdAszNA8+B916gjK84YRFAkYB40Y+BHvsrqHW 8 | 9XL0o6u0BZmUkx+hx78IrwmIewqbq2+6lU+vOTFWevl1pYHQIm8x3IwazM275zu/ 9 | e4Rth3sDGiELASjW+LZs2+PwchL7uyxGmlF/YuHJDePWWEl18Hk8lVBebjiY1DqA 10 | ZpaC9VdHpuioK5JxBcZktqw18hVR8hkVQpJUT0PokkEsEf2+oeymY6LgFbnIrO8/ 11 | SwBgqjHHRKwbzrLok3cRUiC+gxNWjHi+x+W/QVG4l4On/bsCT/EAxiF+Q+p1U7OC 12 | 4YkxNF7A2l1PcNk+PAhy4VyHfOtidcGeRomHj5DiS98QQJCLUaVE4kmVrF1wDYlO 13 | pc9qKtyvhFGz/eEpXmLV9gzHD3S7pKdBU0NAU8wVeeaGOGyX9ISpztQlvEWlPyEQ 14 | ke4M+Pj1CfOQxFc5rX6EoztI+qHogEUcBD9FBYtFswBAcSG9kYhIuORR44LPB6yF 15 | m98e+PfyXGVLGI5GFNV1Sw== 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | 3 | script: ./build-ffmpeg.sh 2>.stderr 4 | 5 | env: 6 | global: 7 | - secure: "POoeB0wNaIPKORu8solBfDwSbgk6bsxSJpVWqVawledYiZHnYLXUDzDawoKOXzjJ1oQQiluZWCmv+RXDA9gthTNrH08fuUEvsUHBr7sgHqaOskEbKN/s2962FLy4FRZdQyZFkrrzNcqnc3xaxgF5ZyjRewtB0JioaOSAPEH8ALc=" 8 | - TARBALL=ffmpeg-ios-$TRAVIS_BRANCH.tar.bz2 9 | 10 | after_success: 11 | - tar cjf $TARBALL FFmpeg-iOS .stderr scratch/*/config.log ffmpeg*/LICENSE.md ffmpeg*/COPYING.* README.md 12 | - openssl aes-256-cbc -k "$secret" -in .sf -d -a -out id_sf 13 | - chmod 600 id_sf 14 | - scp -i id_sf -o 'StrictHostKeyChecking no' $TARBALL koolbear@frs.sourceforge.net:/home/frs/project/ffmpeg-ios 15 | 16 | after_failure: cat .stderr 17 | 18 | osx_image: xcode8.3 19 | 20 | sudo: false 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FFmpeg iOS build script 2 | 3 | See the following repository for Swift package, .xcframeworks and more: 4 | 5 | https://github.com/kewlbear/FFmpeg-iOS 6 | 7 | [![Build Status](https://travis-ci.org/kewlbear/FFmpeg-iOS-build-script.svg?branch=master)](https://travis-ci.org/kewlbear/FFmpeg-iOS-build-script) 8 | 9 | This is a shell script to build FFmpeg libraries for iOS and tvOS apps. 10 | 11 | Tested with: 12 | 13 | * FFmpeg 4.3.1 14 | * Xcode 12.2 15 | 16 | ## Requirements 17 | 18 | * https://github.com/libav/gas-preprocessor 19 | * yasm 1.2.0 20 | 21 | ## Usage 22 | 23 | Use build-ffmpeg-tvos.sh for tvOS. 24 | 25 | * To build everything: 26 | 27 | ./build-ffmpeg.sh 28 | 29 | * To build arm64 libraries: 30 | 31 | ./build-ffmpeg.sh arm64 32 | 33 | * To build fat libraries for armv7 and x86_64 (64-bit simulator): 34 | 35 | ./build-ffmpeg.sh armv7 x86_64 36 | 37 | * To build fat libraries from separately built thin libraries: 38 | 39 | ./build-ffmpeg.sh lipo 40 | 41 | ## Download 42 | 43 | You can download a binary for FFmpeg 4.3.1 release at https://downloads.sourceforge.net/project/ffmpeg-ios/ffmpeg-ios-master.tar.bz2 44 | 45 | ## External libraries 46 | 47 | You should link your app with 48 | 49 | * libz.dylib 50 | * libbz2.dylib 51 | * libiconv.dylib 52 | -------------------------------------------------------------------------------- /build-ffmpeg-iOS-framework.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # directories 4 | SCRATCH=`pwd`/"scratch" 5 | ARCHS="arm64 armv7 i386 x86_64" 6 | 7 | FFMPEG_VERSION="3.4" 8 | export FFMPEG_VERSION 9 | HEADER_SUFFIX=".h" 10 | CURRENT_FOLDER=`pwd` 11 | FRAMEWORK_NAME="FFmpeg" 12 | FRAMEWORK_EXT=".framework" 13 | FRAMEWORK="$FRAMEWORK_NAME$FRAMEWORK_EXT" 14 | BUILD_FOLDER="$CURRENT_FOLDER/FFmpeg-iOS" 15 | BUILD_THIN_FOLDER="$CURRENT_FOLDER/thin" 16 | BUILD_INCLUDE_FOLDER="$BUILD_FOLDER/include" 17 | BUILD_LIB_FOLDER="$BUILD_FOLDER/lib" 18 | OUTPUT_FOLDER="$CURRENT_FOLDER/$FRAMEWORK" 19 | OUTPUT_INFO_PLIST_FILE="$OUTPUT_FOLDER/Info.plist" 20 | OUTPUT_HEADER_FOLDER="$OUTPUT_FOLDER/Headers" 21 | OUTPUT_UMBRELLA_HEADER="$OUTPUT_HEADER_FOLDER/ffmpeg.h" 22 | OUTPUT_MODULES_FOLDER="$OUTPUT_FOLDER/Modules" 23 | OUTPUT_MODULES_FILE="$OUTPUT_MODULES_FOLDER/module.modulemap" 24 | VERSION_NEW_NAME="Version.h" 25 | BUNDLE_ID="org.ffmpeg.FFmpeg" 26 | 27 | function CreateFramework() { 28 | rm -rf $OUTPUT_FOLDER 29 | mkdir -p $OUTPUT_HEADER_FOLDER $OUTPUT_MODULES_FOLDER 30 | } 31 | 32 | function CompileSource() { 33 | ./build-ffmpeg.sh $ARCHS 34 | ./build-ffmpeg.sh lipo 35 | } 36 | 37 | function MergeStaticLibrary() { 38 | local files="" 39 | 40 | for ARCH in $ARCHS; do 41 | folder="$SCRATCH/$ARCH" 42 | name="$FRAMEWORK_NAME$ARCH.a" 43 | ar cru $name $(find $folder -name "*.o") 44 | files="$files $name" 45 | done 46 | 47 | lipo -create $files -output FFmpeg 48 | 49 | for file in $files; do 50 | rm -rf $file 51 | done 52 | mv $FRAMEWORK_NAME $OUTPUT_FOLDER 53 | } 54 | 55 | function RenameHeader() { 56 | local include_folder="$(pwd)/FFmpeg-iOS/include" 57 | local need_replace_version_folder="" 58 | for folder in "$include_folder"/*; do 59 | local folder_name=`basename $folder` 60 | local verstion_file_name="$folder_name$VERSION_NEW_NAME" 61 | for header in "$folder"/*; do 62 | local header_name=`basename $header` 63 | 64 | local dst_name=$header_name 65 | if [ $header_name == "version.h" ]; then 66 | dst_name=$verstion_file_name 67 | fi 68 | 69 | local dst_folder=$OUTPUT_HEADER_FOLDER 70 | local file_name="$folder/$header_name" 71 | local dst_file_name="$dst_folder/$dst_name" 72 | cp $file_name $dst_file_name 73 | find "$dst_folder" -name "$dst_name" -type f -exec sed -i '' "s/\"version.h\"/\"$verstion_file_name\"/g" {} \; 74 | done 75 | need_replace_version_folder="$need_replace_version_folder $folder_name" 76 | done 77 | 78 | for folder_name in $need_replace_version_folder; do 79 | local verstion_file_name="$folder_name$VERSION_NEW_NAME" 80 | find $OUTPUT_HEADER_FOLDER -type f -exec sed -i '' "s/\"$folder_name\/version.h\"/\"$verstion_file_name\"/g" {} \; 81 | done 82 | find $OUTPUT_HEADER_FOLDER -type f -exec sed -i '' "s/libavformat\///g" {} \; 83 | find $OUTPUT_HEADER_FOLDER -type f -exec sed -i '' "s/libavutil\///g" {} \; 84 | find $OUTPUT_HEADER_FOLDER -type f -exec sed -i '' "s/libavcodec\///g" {} \; 85 | } 86 | 87 | # COPY MISSING inttypes.h 88 | function CopyInttype() { 89 | local file="$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/inttypes.h" 90 | cp $file $OUTPUT_HEADER_FOLDER 91 | find $OUTPUT_HEADER_FOLDER -type f -exec sed -i '' "s//\"inttypes.h\"/g" {} \; 92 | } 93 | 94 | function CreateModulemapAndUmbrellaHeader() { 95 | #create ffmpeg.h 96 | cat > $OUTPUT_UMBRELLA_HEADER < 98 | #import 99 | #import 100 | #include "avcodec.h" 101 | #include "avdevice.h" 102 | #include "avfilter.h" 103 | #include "avformat.h" 104 | #include "avutil.h" 105 | #include "swscale.h" 106 | #include "swresample.h" 107 | double FFmpegVersionNumber = $FFMPEG_VERSION; 108 | EOF 109 | 110 | cat > $OUTPUT_MODULES_FILE < $OUTPUT_INFO_PLIST_FILE < 130 | 131 | 132 | 133 | BuildMachineOSBuild 134 | $OS_BUILD_VERSION 135 | CFBundleDevelopmentRegion 136 | en 137 | CFBundleExecutable 138 | $FRAMEWORK_NAME 139 | CFBundleIdentifier 140 | $BUNDLE_ID 141 | CFBundleInfoDictionaryVersion 142 | 6.0 143 | CFBundleName 144 | $FRAMEWORK_NAME 145 | CFBundlePackageType 146 | FMWK 147 | CFBundleShortVersionString 148 | $FFMPEG_VERSION 149 | CFBundleSignature 150 | ???? 151 | CFBundleSupportedPlatforms 152 | 153 | iPhoneOS 154 | 155 | CFBundleVersion 156 | 1 157 | DTCompiler 158 | $DTCompiler 159 | DTPlatformBuild 160 | $DTPlatformBuild 161 | DTPlatformName 162 | iphoneos 163 | DTPlatformVersion 164 | $DEFAULT_iOS_SDK_VERSION 165 | DTSDKBuild 166 | $DTSDKBuild 167 | DTSDKName 168 | iphoneos$DEFAULT_iOS_SDK_VERSION 169 | DTXcode 170 | $DTXcode 171 | DTXcodeBuild 172 | $DTXcodeBuild 173 | MinimumOSVersion 174 | 8.0 175 | UIDeviceFamily 176 | 177 | 1 178 | 2 179 | 180 | 181 | 182 | EOF 183 | } 184 | 185 | CompileSource 186 | CreateFramework 187 | MergeStaticLibrary 188 | RenameHeader 189 | CreateModulemapAndUmbrellaHeader 190 | CopyInttype 191 | CreateInfoPlist 192 | -------------------------------------------------------------------------------- /build-ffmpeg-tvos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # directories 4 | SOURCE="ffmpeg-3.1.1" 5 | FAT="FFmpeg-tvOS" 6 | 7 | SCRATCH="scratch-tvos" 8 | # must be an absolute path 9 | THIN=`pwd`/"thin-tvos" 10 | 11 | # absolute path to x264 library 12 | #X264=`pwd`/../x264-ios/x264-iOS 13 | 14 | #FDK_AAC=`pwd`/fdk-aac/fdk-aac-ios 15 | 16 | CONFIGURE_FLAGS="--enable-cross-compile --disable-debug --disable-programs \ 17 | --disable-doc --enable-pic --disable-indev=avfoundation" 18 | 19 | if [ "$X264" ] 20 | then 21 | CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-gpl --enable-libx264" 22 | fi 23 | 24 | if [ "$FDK_AAC" ] 25 | then 26 | CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libfdk-aac" 27 | fi 28 | 29 | # avresample 30 | #CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-avresample" 31 | 32 | ARCHS="arm64 x86_64" 33 | 34 | COMPILE="y" 35 | LIPO="y" 36 | 37 | DEPLOYMENT_TARGET="9.0" 38 | 39 | if [ "$*" ] 40 | then 41 | if [ "$*" = "lipo" ] 42 | then 43 | # skip compile 44 | COMPILE= 45 | else 46 | ARCHS="$*" 47 | if [ $# -eq 1 ] 48 | then 49 | # skip lipo 50 | LIPO= 51 | fi 52 | fi 53 | fi 54 | 55 | if [ "$COMPILE" ] 56 | then 57 | if [ ! `which yasm` ] 58 | then 59 | echo 'Yasm not found' 60 | if [ ! `which brew` ] 61 | then 62 | echo 'Homebrew not found. Trying to install...' 63 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \ 64 | || exit 1 65 | fi 66 | echo 'Trying to install Yasm...' 67 | brew install yasm || exit 1 68 | fi 69 | if [ ! `which gas-preprocessor.pl` ] 70 | then 71 | echo 'gas-preprocessor.pl not found. Trying to install...' 72 | (curl -L https://github.com/libav/gas-preprocessor/raw/master/gas-preprocessor.pl \ 73 | -o /usr/local/bin/gas-preprocessor.pl \ 74 | && chmod +x /usr/local/bin/gas-preprocessor.pl) \ 75 | || exit 1 76 | fi 77 | 78 | if [ ! -r $SOURCE ] 79 | then 80 | echo 'FFmpeg source not found. Trying to download...' 81 | curl http://www.ffmpeg.org/releases/$SOURCE.tar.bz2 | tar xj \ 82 | || exit 1 83 | fi 84 | 85 | CWD=`pwd` 86 | for ARCH in $ARCHS 87 | do 88 | echo "building $ARCH..." 89 | mkdir -p "$SCRATCH/$ARCH" 90 | cd "$SCRATCH/$ARCH" 91 | 92 | CFLAGS="-arch $ARCH" 93 | if [ "$ARCH" = "x86_64" ] 94 | then 95 | PLATFORM="AppleTVSimulator" 96 | CFLAGS="$CFLAGS -mtvos-simulator-version-min=$DEPLOYMENT_TARGET" 97 | else 98 | PLATFORM="AppleTVOS" 99 | CFLAGS="$CFLAGS -mtvos-version-min=$DEPLOYMENT_TARGET -fembed-bitcode" 100 | if [ "$ARCH" = "arm64" ] 101 | then 102 | EXPORT="GASPP_FIX_XCODE5=1" 103 | fi 104 | fi 105 | 106 | XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'` 107 | CC="xcrun -sdk $XCRUN_SDK clang" 108 | AR="xcrun -sdk $XCRUN_SDK ar" 109 | CXXFLAGS="$CFLAGS" 110 | LDFLAGS="$CFLAGS" 111 | if [ "$X264" ] 112 | then 113 | CFLAGS="$CFLAGS -I$X264/include" 114 | LDFLAGS="$LDFLAGS -L$X264/lib" 115 | fi 116 | if [ "$FDK_AAC" ] 117 | then 118 | CFLAGS="$CFLAGS -I$FDK_AAC/include" 119 | LDFLAGS="$LDFLAGS -L$FDK_AAC/lib" 120 | fi 121 | 122 | TMPDIR=${TMPDIR/%\/} $CWD/$SOURCE/configure \ 123 | --target-os=darwin \ 124 | --arch=$ARCH \ 125 | --cc="$CC" \ 126 | --ar="$AR" \ 127 | $CONFIGURE_FLAGS \ 128 | --extra-cflags="$CFLAGS" \ 129 | --extra-ldflags="$LDFLAGS" \ 130 | --prefix="$THIN/`basename $PWD`" \ 131 | || exit 1 132 | 133 | xcrun -sdk $XCRUN_SDK make -j3 install $EXPORT || exit 1 134 | cd $CWD 135 | done 136 | fi 137 | 138 | if [ "$LIPO" ] 139 | then 140 | echo "building fat binaries..." 141 | mkdir -p $FAT/lib 142 | set - $ARCHS 143 | CWD=`pwd` 144 | cd $THIN/$1/lib 145 | for LIB in *.a 146 | do 147 | cd $CWD 148 | echo lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB 1>&2 149 | lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB || exit 1 150 | done 151 | 152 | cd $CWD 153 | cp -rf $THIN/$1/include $FAT 154 | fi 155 | 156 | echo Done 157 | -------------------------------------------------------------------------------- /build-ffmpeg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # directories 4 | FF_VERSION="4.3.1" 5 | #FF_VERSION="snapshot-git" 6 | if [[ $FFMPEG_VERSION != "" ]]; then 7 | FF_VERSION=$FFMPEG_VERSION 8 | fi 9 | SOURCE="ffmpeg-$FF_VERSION" 10 | FAT="FFmpeg-iOS" 11 | 12 | SCRATCH="scratch" 13 | # must be an absolute path 14 | THIN=`pwd`/"thin" 15 | 16 | # absolute path to x264 library 17 | #X264=`pwd`/fat-x264 18 | 19 | #FDK_AAC=`pwd`/../fdk-aac-build-script-for-iOS/fdk-aac-ios 20 | 21 | CONFIGURE_FLAGS="--enable-cross-compile --disable-debug --disable-programs \ 22 | --disable-doc --enable-pic" 23 | 24 | if [ "$X264" ] 25 | then 26 | CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-gpl --enable-libx264" 27 | fi 28 | 29 | if [ "$FDK_AAC" ] 30 | then 31 | CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libfdk-aac --enable-nonfree" 32 | fi 33 | 34 | # avresample 35 | #CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-avresample" 36 | 37 | ARCHS="arm64 armv7 x86_64 i386" 38 | 39 | COMPILE="y" 40 | LIPO="y" 41 | 42 | DEPLOYMENT_TARGET="8.0" 43 | 44 | if [ "$*" ] 45 | then 46 | if [ "$*" = "lipo" ] 47 | then 48 | # skip compile 49 | COMPILE= 50 | else 51 | ARCHS="$*" 52 | if [ $# -eq 1 ] 53 | then 54 | # skip lipo 55 | LIPO= 56 | fi 57 | fi 58 | fi 59 | 60 | if [ "$COMPILE" ] 61 | then 62 | if [ ! `which yasm` ] 63 | then 64 | echo 'Yasm not found' 65 | if [ ! `which brew` ] 66 | then 67 | echo 'Homebrew not found. Trying to install...' 68 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \ 69 | || exit 1 70 | fi 71 | echo 'Trying to install Yasm...' 72 | brew install yasm || exit 1 73 | fi 74 | if [ ! `which gas-preprocessor.pl` ] 75 | then 76 | echo 'gas-preprocessor.pl not found. Trying to install...' 77 | (curl -L https://github.com/libav/gas-preprocessor/raw/master/gas-preprocessor.pl \ 78 | -o /usr/local/bin/gas-preprocessor.pl \ 79 | && chmod +x /usr/local/bin/gas-preprocessor.pl) \ 80 | || exit 1 81 | fi 82 | 83 | if [ ! -r $SOURCE ] 84 | then 85 | echo 'FFmpeg source not found. Trying to download...' 86 | curl http://www.ffmpeg.org/releases/$SOURCE.tar.bz2 | tar xj \ 87 | || exit 1 88 | fi 89 | 90 | CWD=`pwd` 91 | for ARCH in $ARCHS 92 | do 93 | echo "building $ARCH..." 94 | mkdir -p "$SCRATCH/$ARCH" 95 | cd "$SCRATCH/$ARCH" 96 | 97 | CFLAGS="-arch $ARCH" 98 | if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ] 99 | then 100 | PLATFORM="iPhoneSimulator" 101 | CFLAGS="$CFLAGS -mios-simulator-version-min=$DEPLOYMENT_TARGET" 102 | else 103 | PLATFORM="iPhoneOS" 104 | CFLAGS="$CFLAGS -mios-version-min=$DEPLOYMENT_TARGET -fembed-bitcode" 105 | if [ "$ARCH" = "arm64" ] 106 | then 107 | EXPORT="GASPP_FIX_XCODE5=1" 108 | fi 109 | fi 110 | 111 | XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'` 112 | CC="xcrun -sdk $XCRUN_SDK clang" 113 | 114 | # force "configure" to use "gas-preprocessor.pl" (FFmpeg 3.3) 115 | if [ "$ARCH" = "arm64" ] 116 | then 117 | AS="gas-preprocessor.pl -arch aarch64 -- $CC" 118 | else 119 | AS="gas-preprocessor.pl -- $CC" 120 | fi 121 | 122 | CXXFLAGS="$CFLAGS" 123 | LDFLAGS="$CFLAGS" 124 | if [ "$X264" ] 125 | then 126 | CFLAGS="$CFLAGS -I$X264/include" 127 | LDFLAGS="$LDFLAGS -L$X264/lib" 128 | fi 129 | if [ "$FDK_AAC" ] 130 | then 131 | CFLAGS="$CFLAGS -I$FDK_AAC/include" 132 | LDFLAGS="$LDFLAGS -L$FDK_AAC/lib" 133 | fi 134 | 135 | TMPDIR=${TMPDIR/%\/} $CWD/$SOURCE/configure \ 136 | --target-os=darwin \ 137 | --arch=$ARCH \ 138 | --cc="$CC" \ 139 | --as="$AS" \ 140 | $CONFIGURE_FLAGS \ 141 | --extra-cflags="$CFLAGS" \ 142 | --extra-ldflags="$LDFLAGS" \ 143 | --prefix="$THIN/$ARCH" \ 144 | || exit 1 145 | 146 | make -j3 install $EXPORT || exit 1 147 | cd $CWD 148 | done 149 | fi 150 | 151 | if [ "$LIPO" ] 152 | then 153 | echo "building fat binaries..." 154 | mkdir -p $FAT/lib 155 | set - $ARCHS 156 | CWD=`pwd` 157 | cd $THIN/$1/lib 158 | for LIB in *.a 159 | do 160 | cd $CWD 161 | echo lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB 1>&2 162 | lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB || exit 1 163 | done 164 | 165 | cd $CWD 166 | cp -rf $THIN/$1/include $FAT 167 | fi 168 | 169 | echo Done 170 | --------------------------------------------------------------------------------