-
Notifications
You must be signed in to change notification settings - Fork 117
Home
Supports mingw gcc, msvc(>=2013) for desktop and store, android, ios, raspberry pi, sailfish etc.
You have to set FFmpeg source dir before build: export FFSRC=ffmpeg/source/dir
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.
./avbuild.sh
Install mingw-w64 compiler on linux or macOS, run ./avbuild.sh mingw64 x86
or ./avbuild.sh mingw64 x86_64
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
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 ...
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)
Download toolchains and sysroot
- http://gnutoolchains.com/raspberry/ (windows, sysroot included)
- http://www.jaredwolff.com/toolchains/ (macOS)
- https://github.com/raspberrypi/tools/tree/master/arm-bcm2708 (linux)
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 rpi2, rpi3
or CROSS_PREFIX=gcc_prefix SYSROOT=your_sysroot ./avbuild.sh rpi
.
Requirements: clang + lld + sysroot
Ubuntu install: apt install clang-5.0 lld-5.0 # latest release
If lld is found, gcc cross toolchain and CROSS_PREFIX
is not required. You can build on any host such as windows, linux and macOS
If lld is not found, gcc cross toolchain is required to invoke binutils such as strip, ld.
Examples:
- clang + gcc binutils:
CROSS_PREFIX=gcc_prefix SYSROOT=your_sysroot ./avbuild.sh rpi armv6zk-clang-5.0
- clang + lld:
SYSROOT=your_sysroot ./avbuild.sh rpi armv7-a-clang-5.0
- gcc-7-arm-linux-gnueabihf asm generates wrong code, results in bus error on pi
- clang asm can not build swscale
Copy config-lite.sh to config.sh. Only frequently used features are enabled. Encoding is disabled except hardware accelerated encoders.