Skip to content

Commit

Permalink
* Add x265 in the cppbuild.sh script for FFmpeg, thanks to Mark Bo…
Browse files Browse the repository at this point in the history
…lstad
  • Loading branch information
saudet committed Feb 20, 2015
1 parent 9fe9fbc commit 778d34b
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add x265 in the `cppbuild.sh` script for FFmpeg, thanks to Mark Bolstad
* Upgrade presets for FFmpeg 2.5.4, OpenSSL 1.0.2
* Switch from `IntPointer` to `BoolPointer` for the `BOOL*` pointer type of Leptonica ([issue #36](https://github.com/bytedeco/javacpp-presets/issues/36))
* Add `preload` for `gif`, `jpeg`, `png`, `tiff`, and `webp` libraries in presets for Leptonica ([issue #36](https://github.com/bytedeco/javacpp-presets/issues/36))
Expand Down
37 changes: 31 additions & 6 deletions ffmpeg/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ else
SPEEX=speex-1.2rc1
OPENCORE_AMR=opencore-amr-0.1.3
OPENSSL=openssl-1.0.2
X265=x265_1.5
FFMPEG_VERSION=2.5.4
download http://downloads.sourceforge.net/project/lame/lame/3.99/$LAME.tar.gz $LAME.tar.gz
download http://downloads.xiph.org/releases/speex/$SPEEX.tar.gz $SPEEX.tar.gz
download http://sourceforge.net/projects/opencore-amr/files/opencore-amr/$OPENCORE_AMR.tar.gz/download $OPENCORE_AMR.tar.gz
download https://www.openssl.org/source/$OPENSSL.tar.gz $OPENSSL.tar.gz
download ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2 last_stable_x264.tar.bz2
download https://bitbucket.org/multicoreware/x265/downloads/$X265.tar.gz $X265.tar.gz
download http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 ffmpeg-$FFMPEG_VERSION.tar.bz2

mkdir -p $PLATFORM
Expand All @@ -40,8 +42,11 @@ else
tar -xzvf ../$OPENCORE_AMR.tar.gz
tar -xzvf ../$OPENSSL.tar.gz
tar -xjvf ../last_stable_x264.tar.bz2
tar -xzvf ../$X265.tar.gz
tar -xjvf ../ffmpeg-$FFMPEG_VERSION.tar.bz2
X264=`echo x264-snapshot-*`

patch -Np0 < ../../$X265.patch || true
fi

case $PLATFORM in
Expand Down Expand Up @@ -70,9 +75,13 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-cli --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --host=arm-linux --extra-cflags="-DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" --extra-ldflags="-nostdlib -Wl,--fix-cortex-a8 -lgcc -ldl -lz -lm -lc"
make -j4
make install
cd ../$X265
cmake -DENABLE_CLI=OFF -DENABLE_SHARED=OFF -DCMAKE_TOOLCHAIN_FILE=android-arm.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source
make -j4
make install
cd ../ffmpeg-$FFMPEG_VERSION
patch -Np1 < ../../../ffmpeg-$FFMPEG_VERSION-android.patch
./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --enable-cross-compile --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --target-os=linux --arch=arm --extra-cflags="-I../include/ -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" --extra-ldflags="-L../lib/ -nostdlib -Wl,--fix-cortex-a8" --extra-libs="-lgcc -ldl -lz -lm -lc" --disable-symver --disable-programs
./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --enable-libx265 --enable-cross-compile --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --target-os=linux --arch=arm --extra-cflags="-I../include/ -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" --extra-ldflags="$ANDROID_ROOT/usr/lib/crtbegin_dynamic.o -L../lib/ -L$ANDROID_CPP/libs/armeabi/ -nostdlib -Wl,--fix-cortex-a8" --extra-libs="-lgnustl_static -lgcc -ldl -lz -lm -lc" --disable-symver --disable-programs
make -j4
make install
;;
Expand Down Expand Up @@ -101,15 +110,19 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-cli --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --host=i686-linux --extra-cflags="-DANDROID -fPIC -ffunction-sections -funwind-tables -mtune=atom -mssse3 -mfpmath=sse -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" --extra-ldflags="-nostdlib -lgcc -ldl -lz -lm -lc"
make -j4
make install
cd ../$X265
cmake -DENABLE_CLI=OFF -DENABLE_SHARED=OFF -DCMAKE_TOOLCHAIN_FILE=android-x86.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source
make -j4 x265-static
make install
cd ../ffmpeg-$FFMPEG_VERSION
patch -Np1 < ../../../ffmpeg-$FFMPEG_VERSION-android.patch
./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --enable-cross-compile --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --target-os=linux --arch=atom --extra-cflags="-I../include/ -DANDROID -fPIC -ffunction-sections -funwind-tables -mssse3 -mfpmath=sse -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" --extra-ldflags="-L../lib/ -nostdlib" --extra-libs="-lgcc -ldl -lz -lm -lc" --disable-symver --disable-programs
./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --enable-libx265 --enable-cross-compile --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --target-os=linux --arch=atom --extra-cflags="-I../include/ -DANDROID -fPIC -ffunction-sections -funwind-tables -mssse3 -mfpmath=sse -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300" --extra-ldflags="$ANDROID_ROOT/usr/lib/crtbegin_dynamic.o -L../lib/ -L$ANDROID_CPP/libs/x86/ -nostdlib" --extra-libs="-lgnustl_static -lgcc -ldl -lz -lm -lc" --disable-symver --disable-programs
make -j4
make install
;;
linux-x86)
cd $LAME
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32"
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux CFLAGS="-m32 -msse2"
make -j4
make install
cd ../$SPEEX
Expand All @@ -128,8 +141,12 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-opencl --host=i686-linux
make -j4
make install
cd ../$X265
CC="gcc -m32" CXX="g++ -m32" cmake -DENABLE_SHARED=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source
make -j4
make install
cd ../ffmpeg-$FFMPEG_VERSION
PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-opencl --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --cc="gcc -m32" --extra-cflags="-I../include/" --extra-ldflags="-L../lib/ -ldl"
PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-opencl --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --enable-libx265 --cc="gcc -m32" --extra-cflags="-I../include/" --extra-ldflags="-L../lib/ -lstdc++ -ldl"
make -j4
make install
;;
Expand All @@ -154,8 +171,12 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-opencl --host=x86_64-linux
make -j4
make install
cd ../$X265
CC="gcc -m64" CXX="g++ -m64" cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source
make -j4
make install
cd ../ffmpeg-$FFMPEG_VERSION
PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-opencl --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --cc="gcc -m64" --extra-cflags="-I../include/" --extra-ldflags="-L../lib/ -ldl"
PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-opencl --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --enable-libx265 --cc="gcc -m64" --extra-cflags="-I../include/" --extra-ldflags="-L../lib/ -lstdc++ -ldl"
make -j4
make install
;;
Expand All @@ -180,9 +201,13 @@ case $PLATFORM in
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-opencl
make -j4
make install
cd ../$X265
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source
make -j4
make install
cd ../ffmpeg-$FFMPEG_VERSION
patch -Np1 < ../../../ffmpeg-$FFMPEG_VERSION-macosx.patch
./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-opencl --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --extra-cflags="-I../include/" --extra-ldflags="-L../lib/ -Wl,-headerpad_max_install_names -ldl"
PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --disable-opencl --disable-outdev=sdl --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libx264 --enable-libx265 --extra-cflags="-I../include/" --extra-ldflags="-L../lib/ -Wl,-headerpad_max_install_names -lstdc++ -ldl"
make -j4
make install
;;
Expand Down
25 changes: 17 additions & 8 deletions ffmpeg/ffmpeg-2.5.4-android.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
diff -ruN ffmpeg-2.4.3/configure ffmpeg-2.4.3-android/configure
--- ffmpeg-2.4.3/configure 2014-11-02 10:47:33.000000000 +0900
+++ ffmpeg-2.4.3-android/configure 2014-11-16 15:42:17.803121217 +0900
@@ -4839,7 +4839,7 @@
require smbclient libsmbclient.h smbc_init -lsmbclient; }
diff -ruN ffmpeg-2.5.4/configure ffmpeg-2.5.4-android/configure
--- ffmpeg-2.5.4/configure 2015-02-14 00:56:33.000000000 +0900
+++ ffmpeg-2.5.4-android/configure 2015-02-20 23:49:04.739388778 +0900
@@ -4885,7 +4885,7 @@
require smbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
-enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
+enabled libspeex && require speex speex/speex.h speex_decoder_init -lspeex
enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
diff -ruN ffmpeg-2.4.3/library.mak ffmpeg-2.4.3-android/library.mak
--- ffmpeg-2.4.3/library.mak 2014-11-02 10:47:36.000000000 +0900
+++ ffmpeg-2.4.3-android/library.mak 2014-11-16 15:41:51.826622161 +0900
@@ -4913,7 +4913,7 @@
warn "using libx264 without pkg-config"; } } &&
{ check_cpp_condition x264.h "X264_BUILD >= 118" ||
die "ERROR: libx264 must be installed and version must be >= 0.118."; }
-enabled libx265 && require_pkg_config x265 x265.h x265_encoder_encode &&
+enabled libx265 && require x265 x265.h x265_encoder_encode -lx265 &&
{ check_cpp_condition x265.h "X265_BUILD >= 17" ||
die "ERROR: libx265 version must be >= 17."; }
enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
diff -ruN ffmpeg-2.5.4/library.mak ffmpeg-2.5.4-android/library.mak
--- ffmpeg-2.5.4/library.mak 2015-02-14 00:56:25.000000000 +0900
+++ ffmpeg-2.5.4-android/library.mak 2015-02-20 23:48:46.564033472 +0900
@@ -48,16 +48,13 @@
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
Expand Down
21 changes: 15 additions & 6 deletions ffmpeg/ffmpeg-2.5.4-macosx.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -ruN ffmpeg-2.4.3/configure ffmpeg-2.4.3-macosx/configure
--- ffmpeg-2.4.3/configure 2014-11-02 10:47:33.000000000 +0900
+++ ffmpeg-2.4.3-macosx/configure 2014-11-16 22:51:24.000000000 +0900
@@ -4006,7 +4006,7 @@
diff -ruN ffmpeg-2.5.4/configure ffmpeg-2.5.4-macosx/configure
--- ffmpeg-2.5.4/configure 2015-02-14 00:56:33.000000000 +0900
+++ ffmpeg-2.5.4-macosx/configure 2015-02-20 23:51:52.349665360 +0900
@@ -4034,7 +4034,7 @@
;;
darwin)
enabled ppc && add_asflags -force_cpusubtype_ALL
Expand All @@ -10,12 +10,21 @@ diff -ruN ffmpeg-2.4.3/configure ffmpeg-2.4.3-macosx/configure
enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
strip="${strip} -x"
add_ldflags -Wl,-dynamic,-search_paths_first
@@ -4839,7 +4839,7 @@
require smbclient libsmbclient.h smbc_init -lsmbclient; }
@@ -4885,7 +4885,7 @@
require smbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
-enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
+enabled libspeex && require speex speex/speex.h speex_decoder_init -lspeex
enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
@@ -4913,7 +4913,7 @@
warn "using libx264 without pkg-config"; } } &&
{ check_cpp_condition x264.h "X264_BUILD >= 118" ||
die "ERROR: libx264 must be installed and version must be >= 0.118."; }
-enabled libx265 && require_pkg_config x265 x265.h x265_encoder_encode &&
+enabled libx265 && require x265 x265.h x265_encoder_encode -lx265 &&
{ check_cpp_condition x265.h "X265_BUILD >= 17" ||
die "ERROR: libx265 version must be >= 17."; }
enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
Loading

0 comments on commit 778d34b

Please sign in to comment.