diff options
author | wsnipex <wsnipex@a1.net> | 2014-01-18 21:58:35 +0100 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2014-04-27 18:04:53 +0200 |
commit | afa5146400a5ad656de76b1c718ca955e18adb09 (patch) | |
tree | cbd7dc6b9d49b01e001411fb8ab271d71495c67c | |
parent | df696023c9c80fd8cd541eeec0d456925e13f1c9 (diff) |
[configure] remove internal ffmpeg
-rw-r--r-- | Makefile.in | 14 | ||||
-rw-r--r-- | Makefile.include.in | 3 | ||||
-rw-r--r-- | configure.in | 338 | ||||
-rwxr-xr-x | tools/depends/target/ffmpeg/autobuild.sh | 166 |
4 files changed, 282 insertions, 239 deletions
diff --git a/Makefile.in b/Makefile.in index 6f689cfbd1..9128c3b866 100644 --- a/Makefile.in +++ b/Makefile.in @@ -473,13 +473,13 @@ DYNOBJSXBMC+= xbmc/freebsd/freebsd.a endif ifeq (@USE_STATIC_FFMPEG@,1) -FFMPEGOBJS = lib/ffmpeg/libavcodec/libavcodec.a \ - lib/ffmpeg/libavfilter/libavfilter.a \ - lib/ffmpeg/libswresample/libswresample.a \ - lib/ffmpeg/libavformat/libavformat.a \ - lib/ffmpeg/libavutil/libavutil.a \ - lib/ffmpeg/libpostproc/libpostproc.a \ - lib/ffmpeg/libswscale/libswscale.a +FFMPEGOBJS = @FFMPEG_LIBDIR@/libavcodec.a \ + @FFMPEG_LIBDIR@/libavfilter.a \ + @FFMPEG_LIBDIR@/libswresample.a \ + @FFMPEG_LIBDIR@/libavformat.a \ + @FFMPEG_LIBDIR@/libavutil.a \ + @FFMPEG_LIBDIR@/libpostproc.a \ + @FFMPEG_LIBDIR@/libswscale.a DYNOBJSXBMC+= $(FFMPEGOBJS) LIBS+= @GNUTLS_ALL_LIBS@ @VORBISENC_ALL_LIBS@ diff --git a/Makefile.include.in b/Makefile.include.in index 3452dd99fc..b409aec42b 100644 --- a/Makefile.include.in +++ b/Makefile.include.in @@ -44,9 +44,6 @@ INCLUDES+=-I@abs_top_srcdir@/addons/library.xbmc.addon INCLUDES+=-I@abs_top_srcdir@/addons/library.xbmc.pvr INCLUDES+=-I@abs_top_srcdir@/addons/library.xbmc.codec INCLUDES+=$(sort @INCLUDES@) -ifneq (@USE_EXTERNAL_FFMPEG@,1) - INCLUDES+=-I@abs_top_srcdir@/lib/ffmpeg -endif INCLUDES+=-I@abs_top_srcdir@/xbmc/linux INCLUDES+=-I@abs_top_srcdir@/xbmc/cores/dvdplayer DEFINES+= \ diff --git a/configure.in b/configure.in index d0775a9cf7..c6ebeba3d9 100644 --- a/configure.in +++ b/configure.in @@ -188,13 +188,16 @@ libusb_disabled_udev_found="== libusb disabled. ==" libcec_enabled="== libcec enabled. ==" libcec_disabled="== libcec disabled. CEC adapter support will not be available. ==" -# External library message strings -external_libraries_enabled="== Use of all supported external libraries enabled. ==" -external_libraries_disabled="== Use of all supported external libraries disabled. ==" dashes="------------------------" final_message="\n XBMC Configuration:" final_message="\n$dashes$final_message\n$dashes" +AC_ARG_WITH([ffmpeg], + [AS_HELP_STRING([--with-ffmpeg], + [ffmpeg options: auto (search pkg-config or auto build), force (always build ffmpeg), shared (link dynamically), path_to_ffmpeg [default=force]])], + [ffmpeg_dir=$with_ffmpeg], + [with_ffmpeg=force]) + AC_ARG_ENABLE([shared-lib], [AS_HELP_STRING([--enable-shared-lib], [build libxbmc. helpful for tests (default is no)])], @@ -207,30 +210,12 @@ AC_ARG_ENABLE([debug], [use_debug=$enableval], [use_debug=yes]) -AC_ARG_WITH([arch], - [AS_HELP_STRING([--with-arch], - [build with given arch passing to internal ffmpeg (default is no, needed for crosscompiling)])], - [use_arch=$withval], - [use_arch=no]) - AC_ARG_WITH([platform], [AS_HELP_STRING([--with-platform], [use a pre-configured config for common arm boards])], [use_platform=$withval], [use_platform=none]) -AC_ARG_WITH([cpu], - [AS_HELP_STRING([--with-cpu], - [build with given cpu passing to ffmpeg (default is no)])], - [use_cpu=$withval], - [use_cpu=no]) - -AC_ARG_ENABLE([neon], - [AS_HELP_STRING([--enable-neon], - [enable neon passing to ffmpeg (default is no)])], - [use_neon=$enableval], - [use_neon=no]) - AC_ARG_ENABLE([optimizations], [AS_HELP_STRING([--enable-optimizations], [enable optimization (default is yes)])], @@ -423,12 +408,6 @@ AC_ARG_ENABLE([upnp], [use_upnp=$enableval], [use_upnp=yes]) -AC_ARG_ENABLE([ffmpeg_libvorbis], - [AS_HELP_STRING([--enable-ffmpeg-libvorbis], - [enable FFmpeg vorbis encoding (default is no)])], - [use_ffmpeg_libvorbis=$enableval], - [use_ffmpeg_libvorbis=no]) - AC_ARG_ENABLE([dvdcss], [AS_HELP_STRING([--enable-dvdcss], [enable DVDCSS support (default is yes)])], @@ -562,13 +541,6 @@ AC_ARG_ENABLE([codec], [add_codecs=$enableval], [add_codecs=no]) -### External libraries options -AC_ARG_ENABLE([external-libraries], - [AS_HELP_STRING([--enable-external-libraries], - [enable use of all supported external libraries (default is no) 'Linux only'])], - [use_external_libraries=$enableval], - [use_external_libraries=no]) - AC_ARG_ENABLE([libav-compat], [AS_HELP_STRING([--enable-libav-compat], [build a wrapper around libav to provide the functions needed by XBMC. This is @@ -600,17 +572,6 @@ PKG_PROG_PKG_CONFIG MAKE="${MAKE:-make}" OBJDUMP="${OBJDUMP:-objdump}" -use_external_ffmpeg=no -use_static_ffmpeg=no - -# ffmpeg needs the output of uname -s (e.x. linux, darwin) for the target_os -# there is no autoconf variable which will give -# the correct output format when doing cross compilation -# so we have to use our own var here -# defaults to the build side target_os -# and should be overridden for cross below (see android) -ffmpeg_target_os=$(tolower $(uname -s)) - # host detection and setup case $host in i*86*-linux-android*) @@ -618,7 +579,6 @@ case $host in ARCH="i486-linux" use_arch="x86" use_cpu="i686" - ffmpeg_target_os=linux use_joystick=no use_gles=yes use_optical_drive=no @@ -632,7 +592,7 @@ case $host in use_arch="x86" use_cpu="i686" fi - use_static_ffmpeg=yes + USE_STATIC_FFMPEG=1 ;; x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*) ARCH="x86_64-linux" @@ -640,7 +600,7 @@ case $host in use_arch="x86_64" use_cpu="x86_64" fi - use_static_ffmpeg=yes + USE_STATIC_FFMPEG=1 ;; i386-*-freebsd*) ARCH="x86-freebsd" @@ -689,21 +649,19 @@ case $host in arm*-*-linux-gnu*|arm*-*-linux-uclibc*) ARCH="arm" use_arch="arm" - ffmpeg_target_os=linux use_joystick=no use_neon=yes use_gles=yes use_sdl=no use_x11=no use_wayland=no - use_static_ffmpeg=yes + USE_STATIC_FFMPEG=1 ;; arm*-*linux-android*) target_platform=target_android use_arch="arm" use_cpu=cortex-a9 ARCH="arm" - ffmpeg_target_os=linux use_joystick=no use_neon=yes use_gles=yes @@ -748,7 +706,6 @@ case $use_platform in USE_OMXLIB=1; AC_DEFINE([HAVE_OMXLIB],[1],["Define to 1 if OMX libs is enabled"]) CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" - ffmpeg_target_os=linux ;; esac @@ -824,7 +781,6 @@ if echo "$ARCH" | grep -q "freebsd" ; then CXXFLAGS="$CXXFLAGS -I$LOCALBASE/include" CPPFLAGS="$CPPFLAGS -I$LOCALBASE/include" LDFLAGS="$LDFLAGS -L$LOCALBASE/lib" - FFMPEG_EXTRACFLAGS="-I$LOCALBASE/include" fi if test "$host_vendor" = "apple" ; then # standard xbmc paths @@ -845,14 +801,12 @@ if test "$host_vendor" = "apple" ; then LIBS="$LIBS -framework SystemConfiguration" LIBS="$LIBS -framework VideoDecodeAcceleration" fi - USE_EXTERNAL_FFMPEG=1 elif test "$target_platform" = "target_raspberry_pi"; then ARCH="arm" use_arch="arm" elif test "$use_arch" = "arm"; then CFLAGS="$CFLAGS -mno-apcs-stack-check" CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check" - FFMPEG_EXTRACFLAGS="" if test "$use_tegra" = "yes"; then # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support SAVE_CFLAGS="$CFLAGS" @@ -861,7 +815,6 @@ elif test "$use_arch" = "arm"; then [AC_LANG_SOURCE([int foo;])], [ CFLAGS="$SAVE_CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork" CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork" - FFMPEG_EXTRACFLAGS="$FFMPEG_EXTRACFLAGS -mtune=cortex-a9 -mfpu=vfpv3-d16" use_cpu=cortex-a9], [ CFLAGS="$SAVE_CFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork" CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork" @@ -870,18 +823,9 @@ elif test "$use_arch" = "arm"; then if test "$use_neon" = "yes"; then CFLAGS="$CFLAGS -mfpu=neon -mvectorize-with-neon-quad" CXXFLAGS="$CXXFLAGS -mfpu=neon -mvectorize-with-neon-quad" - FFMPEG_EXTRACFLAGS="$FFMPEG_EXTRACFLAGS -mfpu=neon" fi fi fi -if test "$use_static_ffmpeg" = "yes"; then - USE_STATIC_FFMPEG=1 - AC_DEFINE([USE_STATIC_FFMPEG], [1], [link ffmpeg statically]) - # ffmpeg may depend on gnutls and vorbisenc, we add those libs at the end of linker - # command in order to resolve any missing symbols - GNUTLS_ALL_LIBS=`${PKG_CONFIG} --static --libs-only-l --silence-errors gnutls` - VORBISENC_ALL_LIBS=`${PKG_CONFIG} --static --libs-only-l --silence-errors vorbisenc` -fi # Checks for library functions. AC_FUNC_ALLOCA @@ -1117,7 +1061,7 @@ if test "$gcrypt_headers_available" = "yes"; then AC_CHECK_LIB([gcrypt],[gcry_control],, AC_MSG_ERROR($missing_library)) AC_DEFINE([HAVE_GCRYPT],[1],[Define if we have gcrypt]) fi -PKG_CHECK_MODULES([GNUTLS], [gnutls], [have_gnutls=yes];AC_DEFINE([HAVE_GNUTLS], [1], [Define if we have gnutls]), AC_MSG_WARN("gnutls not found, ffmpeg TLS support disabled")) +PKG_CHECK_MODULES([GNUTLS], [gnutls], [have_gnutls=yes];AC_DEFINE([HAVE_GNUTLS], [1], [Define if we have gnutls]), AC_MSG_WARN("gnutls not found")) AC_CHECK_LIB([bz2], [main],, AC_MSG_ERROR($missing_library)) AC_CHECK_LIB([jpeg], [main],, AC_MSG_ERROR($missing_library)) # check for cximage @@ -1761,40 +1705,108 @@ else AC_MSG_NOTICE($libcap_disabled) fi -### External libraries checks - -# Hacks for supporting libav +# FFmpeg +FFMPEG_LIBNAMES="libavcodec >= 55.39.101 + libavfilter >= 3.90.100 + libavformat >= 55.19.104 + libavutil >= 52.48.101 + libpostproc >= 52.3.100 + libswscale >= 2.5.101 + libswresample >= 0.17.104" + +if test "$with_ffmpeg" = "shared"; then + # allow linking against shared ffmpeg libs + # a proper version must be installed, we won't build ffmpeg + USE_STATIC_FFMPEG=0 + AC_DEFINE([USE_STATIC_FFMPEG], [0], [FFmpeg linked dynamically]) +fi +if test "${USE_STATIC_FFMPEG}" = "1"; then + AC_DEFINE([USE_STATIC_FFMPEG], [1], [FFmpeg linked statically]) + ff_libs=$(${ECHO} ${FFMPEG_LIBNAMES} | ${AWK} '/lib/{print $1}' ORS=' ') + if test -n "${PKG_CONFIG_SYSROOT_DIR}"; then + # workaround for cross compiling with buildroot on different buildsystem + # Rpi buildroots pkg-config returns static libs with + # PKG_CONFIG_SYSROOT_DIR prefixed, OEs does not + # so lets make sure we always prefix in case PKG_CONFIG_SYSROOT_DIR is defined + pkg_cfg_prefix="${PKG_CONFIG_SYSROOT_DIR}" + elif test "${target_platform}" = "target_raspberry_pi" && test "${USE_BUILDROOT}" = "1"; then + pkg_cfg_prefix=${SYSROOT} + fi -USE_LIBAV_HACKS=0 -if test "$use_libav_hacks" = "yes"; then - export PKG_CONFIG_PATH="${srcdir}/lib/xbmc-libav-hacks/pkgconfig/:$PKG_CONFIG_PATH" - USE_LIBAV_HACKS=1 - AC_DEFINE([USE_LIBAV_HACKS], [1], [Whether to use libav compatibility hacks.]) -fi + if test "$cross_compiling" != "yes"; then + ffmpeg_build="${abs_top_srcdir}/tools/depends/target/ffmpeg" + if test "$use_debug" != "yes"; then + FFMPEG_OPTS="-r" + fi + if test "$use_optimizations" != "yes"; then + FFMPEG_OPTS="${FFMPEG_OPTS} --disable-optimizations" + fi -# External FFmpeg -if test "$use_external_ffmpeg" = "yes"; then - FFMPEG_LIBNAMES="libavcodec libavfilter libavformat libavutil libpostproc libswscale libswresample" + if test "$with_ffmpeg" = "auto" || test "$with_ffmpeg" = "yes"; then + SAVE_INCLUDES="$INCLUDES" + SAVE_LIBS="$LIBS" + # check for system installed ffmpeg. We require minimum versions. + PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES], + [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"; FFMPEG_FOUND="true"], + [FFMPEG_FOUND="false"]) + + if test "${USE_STATIC_FFMPEG}" = "1" && test "$FFMPEG_FOUND" = "true"; then + # we need to check if static libs are available + FFMPEG_LIBDIR=$(${PKG_CONFIG} --static --variable=libdir libavcodec) + for ff_lib in ${ff_libs}; do + if test -f ${FFMPEG_LIBDIR}/${ff_lib}.a; then :; else + AC_MSG_NOTICE("${FFMPEG_LIBDIR}/${ff_lib}.a not found") + FFMPEG_FOUND="false" + # restore includes and libs, the ones we found are invalid + INCLUDES="$SAVE_INCLUDES" + LIBS="$SAVE_LIBS" + unset FFMPEG_LIBS FFMPEG_CFLAGS FFMPEG_LIBDIR + fi + done + fi + if test "$with_ffmpeg" = "yes" || test "$FFMPEG_FOUND" = "false"; then + # ffmpeg not found with pkg-config, lets install it + AC_MSG_NOTICE("Installing FFmpeg") + CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS} + export PKG_CONFIG_PATH="${ffmpeg_build}/ffmpeg-install/lib/pkgconfig:$PKG_CONFIG_PATH" + fi - PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES], - [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"], - AC_MSG_ERROR($missing_library)) + elif test "$with_ffmpeg" = "force"; then + # always build our ffmpeg + AC_MSG_NOTICE("FFmpeg installation forced by user - installing our version") + CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS} + export PKG_CONFIG_PATH="${ffmpeg_build}/ffmpeg-install/lib/pkgconfig:$PKG_CONFIG_PATH" - # in case the headers are in a custom directory - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS" + elif test "$with_ffmpeg" != "no"; then + # user passed --with-ffmpeg=/some/path, lets use it + AC_MSG_NOTICE("using ffmpeg: ${with_ffmpeg}") + export PKG_CONFIG_PATH="${with_ffmpeg}/lib/pkgconfig:$PKG_CONFIG_PATH" + fi + fi +fi - AC_CHECK_HEADERS([libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h libavutil/avutil.h libpostproc/postprocess.h libswscale/swscale.h],, - [AC_MSG_ERROR($missing_headers)]) +if test "$FFMPEG_FOUND" != "true"; then + PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES], + [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"; FFMPEG_FOUND="true"], + [AC_MSG_ERROR("ffmpeg not found")]) +fi - AC_MSG_NOTICE($external_ffmpeg_enabled) - USE_EXTERNAL_FFMPEG=1 - AC_DEFINE([USE_EXTERNAL_FFMPEG], [1], [Whether to use external FFmpeg libraries.]) +if test "${USE_STATIC_FFMPEG}" = "1"; then + # get the libdir for static linking + FFMPEG_LIBDIR=${pkg_cfg_prefix}$(PKG_CONFIG_SYSROOT_DIR="" ${PKG_CONFIG} --static --variable=libdir libavcodec) + GNUTLS_ALL_LIBS=$(${PKG_CONFIG} --static --libs-only-l --silence-errors gnutls) + VORBISENC_ALL_LIBS=$(${PKG_CONFIG} --static --libs-only-l --silence-errors vorbisenc) - CPPFLAGS="$SAVE_CPPFLAGS" -else - AC_MSG_NOTICE($external_ffmpeg_disabled) - USE_EXTERNAL_FFMPEG=0 + # check if static libs are available + for ff_lib in ${ff_libs}; do + if test -f ${FFMPEG_LIBDIR}/${ff_lib}.a; then :; else + AC_MSG_ERROR("${FFMPEG_LIBDIR}/${ff_lib}.a not found") + fi + # filter out libs we link statically + filter=$(${ECHO} ${ff_lib} | ${SED} 's/lib/-l/g') + LIBS=$(${ECHO} ${LIBS} | ${SED} "s/${filter}//g") + done + LIBS=$(${ECHO} ${LIBS} | ${SED} ':a;N;$!ba;s/\n/ /g') fi echo "Checking for SWIG installation" @@ -2474,12 +2486,6 @@ fi ### External libraries messages -if test "$use_external_ffmpeg" = "yes"; then - final_message="$final_message\n External FFmpeg:\tYes" -else - final_message="$final_message\n External FFmpeg:\tNo" -fi - if test "$host_vendor" = "apple" ; then # built internal but referenced as external, we link directly to them. # this MUST be the last thing before OUTPUT_FILES as they do not @@ -2618,9 +2624,11 @@ AC_SUBST(DISABLE_GOOM) AC_SUBST(DISABLE_RSXS) AC_SUBST(DISABLE_FISHBMC) AC_SUBST(DISABLE_PROJECTM) -AC_SUBST(USE_SKIN_TOUCHED) -AC_SUBST(USE_EXTERNAL_FFMPEG) +AC_SUBST(FFMPEG_LIBDIR) AC_SUBST(USE_STATIC_FFMPEG) +AC_SUBST(GNUTLS_ALL_LIBS) +AC_SUBST(VORBISENC_ALL_LIBS) +AC_SUBST(USE_SKIN_TOUCHED) AC_SUBST(USE_LIBAV_HACKS) AC_SUBST(PYTHON_VERSION) AC_SUBST(OUTPUT_FILES) @@ -2666,8 +2674,6 @@ AC_SUBST(USE_ANDROID) AC_SUBST(GTEST_CONFIGURED) AC_SUBST(USE_DOXYGEN) AC_SUBST(USE_PVR_ADDONS) -AC_SUBST(GNUTLS_ALL_LIBS) -AC_SUBST(VORBISENC_ALL_LIBS) # pushd and popd are not available in other shells besides bash, so implement # our own pushd/popd functions @@ -2719,132 +2725,6 @@ fi ]) ]) -XB_CONFIG_MODULE([lib/ffmpeg], [ - if test "$host_vendor" = "apple" ; then - ffmpg_config="--target-os=$ffmpeg_target_os" - # handle disables first, we do individual enables later - ffmpg_config="$ffmpg_config --disable-muxers --disable-encoders" - ffmpg_config="$ffmpg_config --disable-devices --disable-doc" - ffmpg_config="$ffmpg_config --disable-ffplay --disable-ffmpeg" - ffmpg_config="$ffmpg_config --disable-ffprobe --disable-ffserver" - ffmpg_config="$ffmpg_config --enable-vda --disable-crystalhd" - ffmpg_config="$ffmpg_config --disable-decoder=mpeg_xvmc" - - # handle conditional enables/disables - if test "$use_debug" = "no"; then - ffmpg_config="$ffmpg_config --disable-debug" - fi - if test "$use_cpu" != "no"; then - ffmpg_config="$ffmpg_config --cpu=$use_cpu" - fi - if test "$use_arch" != "no"; then - ffmpg_config="$ffmpg_config --arch=$use_arch --enable-cross-compile" - fi - if test "$use_arch" = "arm"; then - ffmpg_config="$ffmpg_config --enable-pic" - ffmpg_config="$ffmpg_config --disable-armv5te --disable-armv6t2" - if test "$use_neon" = "yes"; then - ffmpg_config="$ffmpg_config --enable-neon" - else - ffmpg_config="$ffmpg_config --disable-neon" - fi - else - ffmpg_config="$ffmpg_config --disable-amd3dnow" - fi - if test "$use_ffmpeg_libvorbis" = "yes"; then - ffmpg_config="$ffmpg_config --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis" - else - ffmpg_config="$ffmpg_config --disable-libvorbis" - fi - if test "$have_gnutls" = "yes"; then - ffmpg_config="$ffmpg_config --enable-gnutls" - fi - - # handle individual enables - ffmpg_config="$ffmpg_config --enable-gpl" - ffmpg_config="$ffmpg_config --enable-postproc" - ffmpg_config="$ffmpg_config --enable-static --enable-pthreads" - ffmpg_config="$ffmpg_config --enable-muxer=spdif --enable-muxer=adts --enable-muxer=asf --enable-muxer=ipod" - ffmpg_config="$ffmpg_config --enable-encoder=ac3 --enable-encoder=aac --enable-encoder=wmav2" - ffmpg_config="$ffmpg_config --enable-protocol=http" - ffmpg_config="$ffmpg_config --enable-runtime-cpudetect" - - # ffmpeg will not compile with llvm-gcc-4.2, use clang instead - case $CC in - *llvm-gcc-4.2*) - ffmpg_config="$ffmpg_config --cc=clang" ;; - *) - ffmpg_config="$ffmpg_config --cc=$CC" ;; - esac - - # extra-cflags must be passed alone or it gets expanded wrong by the ffmpeg configure - FFMPEG_EXTRACFLAGS="$CFLAGS $FFMPEG_EXTRACFLAGS -w -D_DARWIN_C_SOURCE -Dattribute_deprecated=" - - LDFLAGS="$LDFLAGS" ./configure --extra-cflags="$FFMPEG_EXTRACFLAGS" $ffmpg_config --as="$AS" - - # if using llvm-gcc-4.2 as assembler, -MMD is not enough to generate - # dependency files in the right place, replace it with something that works - case $AS in - *llvm-gcc-4.2*) - sed -ie "s#AS_DEPFLAGS=-MMD#AS_DEPFLAGS=-MMD -MF \$(\@:.o=.d) -MT \$\@#" config.mak ;; - esac - - # ffmpeg will use yasm found at ${prefix}/bin during configure - # but then hardcodes 'yasm' in config.mak, fix it. - sed -ie "s#YASM=yasm#YASM=${YASM}#" config.mak - sed -ie "s#YASMDEP=yasm#YASMDEP=${YASM}#" config.mak - sed -ie "s# -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 # #" config.mak - else - CFLAGS="" \ - CPPFLAGS="" \ - CXXFLAGS="" \ - LDFLAGS="$(echo "$LDFLAGS" | sed "s/-Wl,-Bsymbolic-functions//g")" \ - ./configure \ - --extra-cflags="$PASSED_CFLAGS $FFMPEG_EXTRACFLAGS" \ - `if test "$use_debug" = "no"; then echo --disable-debug; fi` \ - `if test "$cross_compiling" = "yes"; then echo --enable-cross-compile; fi` \ - `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\ - `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\ - `if test "$use_neon" = "yes"; then echo --enable-neon; else echo --disable-neon; fi`\ - --target-os=$ffmpeg_target_os \ - --disable-muxers \ - --enable-muxer=spdif \ - --enable-muxer=adts \ - --enable-muxer=asf \ - --enable-muxer=ipod \ - --disable-encoders \ - --enable-encoder=ac3 \ - --enable-encoder=aac \ - --enable-encoder=wmav2 \ - `if test "$use_ffmpeg_libvorbis" = "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \ - --disable-decoder=mpeg_xvmc \ - --disable-devices \ - --disable-ffprobe \ - --disable-ffplay \ - --disable-ffserver \ - --disable-ffmpeg \ - --disable-crystalhd \ - `if test "$use_static_ffmpeg" = "yes"; then echo --enable-static --disable-shared; else echo --disable-static --enable-shared; fi` \ - --disable-doc \ - --enable-postproc \ - --enable-gpl \ - `if test "x$use_vdpau" != "xno"; then echo --enable-vdpau; else echo --disable-vdpau; fi` \ - `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \ - `if test "$use_optimizations" != "no"; then echo --enable-optimizations; else echo --disable-optimizations; fi` \ - --enable-protocol=http \ - `if test "$have_gnutls" = "yes"; then echo --enable-gnutls; fi` \ - --enable-pthreads \ - --enable-runtime-cpudetect \ - `if test "$use_hardcoded_tables" = "yes"; then echo --enable-hardcoded-tables; else echo --disable-hardcoded-tables; fi`\ - `if test "$target_platform" = "target_android"; then echo "--custom-libname-with-major=\\$(SLIBPREF)\\$(FULLNAME)-\\$(LIBMAJOR)-${ARCH}\\$(SLIBSUF)"; \ - else echo "--custom-libname-with-major=\\$(FULLNAME)-\\$(LIBMAJOR)-${ARCH}\\$(SLIBSUF)"; fi` \ - `case $host_cpu in i?86*) echo --disable-pic ;; *) echo --enable-pic ;; esac` \ - --cc="$CC" && - sed -i -e "s#define HAVE_SYMVER 1#define HAVE_SYMVER 0#" config.h && - sed -i -e "s#define HAVE_SYMVER_GNU_ASM 1#define HAVE_SYMVER_GNU_ASM 0#" config.h - fi -], [$USE_EXTERNAL_FFMPEG]) - XB_CONFIG_MODULE([lib/libdvd/libdvdcss], [ ./configure \ CC="$CC" \ diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh new file mode 100755 index 0000000000..b7a1ba66a0 --- /dev/null +++ b/tools/depends/target/ffmpeg/autobuild.sh @@ -0,0 +1,166 @@ +#!/bin/bash +# +# Copyright (C) 2005-2013 Team XBMC +# http://xbmc.org +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with XBMC; see the file COPYING. If not, see +# <http://www.gnu.org/licenses/>. +# + + +MYDIR=$(cd $(dirname $0); pwd) +cd $MYDIR +FFMPEG_PREFIX=${MYDIR}/ffmpeg-install + +BASE_URL=$(grep "BASE_URL=" FFMPEG-VERSION | sed 's/BASE_URL=//g') +VERSION=$(grep "VERSION=" FFMPEG-VERSION | sed 's/VERSION=//g') +ARCHIVE=ffmpeg-${VERSION}.tar.gz + +function usage { + echo "usage $(basename $0) + [-p | --prefix] ... ffmepg install prefix + [-d | --download] ... no build, download tarfile only + [-r | --release] ... disable debugging symbols + [-j] ... make concurrency level + [--cpu=CPU] ... minimum required CPU + [--arch=ARCH] ... select architecture + [--disable-optimizations] + " +} + +while : +do + case $1 in + -h | --help) + usage + exit 0 + ;; + -p | --prefix) + FFMPEG_PREFIX=$2 + shift 2 + ;; + --prefix=*) + FFMPEG_PREFIX=${1#*=} + shift + ;; + -d | --download) + downloadonly=true + shift + ;; + -r | --release) + FLAGS="$FLAGS --disable-debug" + shift + ;; + --disable-optimizations) + FLAGS="$FLAGS --disable-optimizations" + shift + ;; + --cpu=*) + FLAGS="$FLAGS --cpu=${1#*=}" + shift + ;; + --arch=*) + FLAGS="$FLAGS --arch=${1#*=}" + shift + ;; + --extra-cflags=*) + FLAGS="$FLAGS --extra-cflags=\"${1#*=}\"" + shift + ;; + --extra-cxxflags=*) + FLAGS="$FLAGS --extra-cxxflags=\"${1#*=}\"" + shift + ;; + -j) + BUILDTHREADS=$2 + shift 2 + ;; + --) + shift + break + ;; + -*) + echo "WARN: Unknown option (ignored): $1" >&2 + shift + ;; + *) + break + ;; + esac +done + +BUILDTHREADS=${BUILDTHREADS:-$(grep -c processor /proc/cpuinfo)} + +[ -z ${VERSION} ] && exit 3 +if [ -f ${FFMPEG_PREFIX}/lib/pkgconfig/libavcodec.pc ] && [ -f .ffmpeg-installed ] +then + CURVER=$(cat .ffmpeg-installed) + [ "$VERSION" == "$CURVER" ] && exit 0 +fi + +[ -f ${ARCHIVE} ] || curl -Ls --create-dirs -f -o ${ARCHIVE} ${BASE_URL}/${VERSION}.tar.gz +[ $downloadonly ] && exit 0 + +[ -d ffmpeg-${VERSION} ] && rm -rf ffmpeg-${VERSION} && rm .ffmpeg-installed >/dev/null 2>&1 +if [ -d ${FFMPEG_PREFIX} ] +then + [ -w ${FFMPEG_PREFIX} ] || SUDO="sudo" +else + [ -w $(dirname ${FFMPEG_PREFIX}) ] || SUDO="sudo" +fi + +mkdir ffmpeg-${VERSION} +cd ffmpeg-${VERSION} || exit 2 +tar --strip-components=1 -xf ../${ARCHIVE} + +CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ +./configure --prefix=$FFMPEG_PREFIX \ + --disable-devices \ + --disable-ffplay \ + --disable-ffmpeg \ + --disable-ffprobe \ + --disable-ffserver \ + --disable-doc \ + --enable-gpl \ + --enable-runtime-cpudetect \ + --enable-postproc \ + --enable-vaapi \ + --enable-vdpau \ + --enable-bzlib \ + --enable-gnutls \ + --enable-muxer=spdif \ + --enable-muxer=adts \ + --enable-muxer=asf \ + --enable-muxer=ipod \ + --enable-encoder=ac3 \ + --enable-encoder=aac \ + --enable-encoder=wmav2 \ + --enable-protocol=http \ + --enable-libvorbis \ + --enable-muxer=ogg \ + --enable-encoder=libvorbis \ + --enable-nonfree \ + --enable-pthreads \ + --enable-zlib \ + ${FLAGS} + +make -j ${BUILDTHREADS} +if [ $? -eq 0 ] +then + [ ${SUDO} ] && echo "Root priviledges are required to install to ${FFMPEG_PREFIX}" + ${SUDO} make install && echo "$VERSION" > ../.ffmpeg-installed +else + echo "ERROR: building ffmpeg failed" + exit 1 +fi |