Skip to content
WangBin edited this page Feb 20, 2017 · 50 revisions

Supports mingw gcc, msvc(>=2013) for desktop and store, android, ios, meego, sailfish os etc.

You can pass arguments to the script, ./avbuild.sh $TARGET_OS "$TARGET_ARCHS".

You may have to set some vars in config-${TARGET_OS}.sh.

After building, the result headers and libs you need are in sdk-${TARGET_OS}-${TARGET_ARCH} for single architecture build.

Host Build

./avbuild.sh

Windows

MinGW Cross Build

Install mingw-w64 compiler on linux or macOS, run ./avbuild.sh mingw64 x86 or ./avbuild.sh mingw64 x86_64

Windows Desktop(MinGW/VC), Store, Phone

MSYS2 is required. Environment var MSYS2_DIR must be set, for example C:\msys64. Click a shortcut in tools dir. Follow the guide in the new shell window.

You can also start a vs prompt, go to msys' bin dir and run sh --login -i and ./avbuild.sh vc to build for desktop

Android

Environment var ANDROID_NDK is required. ./avbuild.sh android "arch1 arch2 ... arch1-clang arch2-clang..."

export FFSRC=/path/to/ffmpeg              # if no ffmpeg source fold under this dir
./avbuild.sh android                      # gcc build for default archs (armv5, armv7, arm64, x86)
./avbuild.sh android armv7                # gcc build for armv7
./avbuild.sh android "armv7 arm64"        # gcc build for armv7 and arm64
./avbuild.sh android "armv7-clang arm64"  # clang build for armv7, gcc build for arm64

The result dir struct is sdk-android-{gcc,clang}/{include,lib/{armeabi,armeabi-v7a,arm64,x86}}

TODO: ./avbuild android$version ...

iOS

To build universal library contains multiple architectures (default are armv7, arm64, i386, x86_64), run ./avbuild.sh ios "arch1 arch2 ..."

export FFSRC=/path/to/ffmpeg     # if no ffmpeg source fold under this dir
./avbuild.sh ios                 # armv7, arm64, i386, x86_64. destination dir is sdk-ios
./avbuild.sh ios "armv7 arm64"   # build for armv7 and arm64. destination dir is sdk-ios
./avbuild.sh ios "arm64"         # build for arm64 only, destination dir is sdk-ios-arm64

The result libraries are in sdk-ios for multiple architectures build.

Bitcode is enabled for devices by default. To disable bitcode, run BITCODE=0 ./avbuild.sh ... or BITCODE=0 ./ios.sh instead

Use ./avbuild.sh ios4.0 ... to set minimal supported iOS version (4.0 here)

Raspberry Pi Cross Build

Download toolchains and sysroot

The default gcc is arm-linux-gnueabihf-gcc, sysroot is gcc sysroot. Set PATH to include gcc dir export PATH=$GCC_BIN_DIR:$PATH. Run ./avbuild.sh rpi or CROSS_PREFIX=your_prefix SYSROOT=your_sysroot ./avbuild.sh rpi.

Lite Build

Copy config-lite.sh to config.sh. Only frequently used features are enabled. Encoding is disabled except hardware accelerated encoders.

Prebuilt FFmpeg