[原创]交叉编译android平台的ffmpeg及其第三方拓展库的方法–包含编译所用脚本

难道最近做android平台的人多了?突然看到很多人遇到编译android平台的库的问题.这里把我平常使用的脚本贴出来分享一下,也方便其他人吧,就请各位能"举手之劳",留留言什么~

欢迎转载,请注明出处并留链接,非常感谢.

#!/bin/bash
#这里是armeabi架构的配置
export PREFIX=/home/xidige/libraries/armeabi
export NDK_ROOT=/home/xidige/android-ndk-r9d
export default_toolchain_name="arm-linux-androideabi-4.8" #mipsel-linux-android-4.8 x86-4.8 
export API_Levels="android-9"  #android2.3.3   sdl最小要android-10,但r9d没有这个
export toolchain_install_dir="/home/xidige/arm-toolchain"
export NDK_SYSROOT="$toolchain_install_dir/sysroot"
export my_host_system="linux-x86_64"
export use_stl="gnustl"
export libused4stl="stdc++"  #gnustl_shared stdc++
export ARCH="arm"    # just for ffmpeg,fontconfig
#export CPU="arm"   #just for ffmpeg armv7-a
export target_for_vpx="armv7-android-gcc"   #just for vpx,armv5te-android-gcc  armv7-android-gcc
export build_for_configure=x86_64-unknown-linux-gnu   #for configure --build
export compile_for_debug="no"  #如果不想生成调试版本的话就留空,否则就yes

export PATH=$toolchain_install_dir/bin:$PATH
export CROSS_PREFIX="arm-linux-androideabi-"
export CC="arm-linux-androideabi-gcc -fPIC -DANDROID -nostdlib"
export CXX="arm-linux-androideabi-gcc -fPIC -DANDROID -nostdlib"
#export LD="arm-linux-androideabi-gcc -fPIC -DANDROID -nostdlib"
export AR="arm-linux-androideabi-ar"
export NM="arm-linux-androideabi-nm"
export STRIP="arm-linux-androideabi-strip"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
export CFLAGS="-fPIC -DANDROID -nostdlib -I$PREFIX/include -Wl,--fix-cortex-a8 -Dipv6mr_interface=ipv6mr_ifindex -DHAVE_SYS_UIO_H=1"  # -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -march=armv5
export LDFLAGS="--sysroot=$NDK_SYSROOT -Wl,--fix-cortex-a8 -L$PREFIX/lib -L$toolchain_install_dir/arm-linux-androideabi/lib -L$toolchain_install_dir/arm-linux-androideabi/lib/gcc/arm-linux-androideabi/4.8 -lc -lm -ldl -lz -llog -lgcc -l$libused4stl "  
export CXXFLAGS="-l$libused4stl"
#export CPPFLAGS="$CFLAGS"

create_toolchain(){
toolchain_install_sign_xidige=$toolchain_install_dir/.sign_xidige
if [ -f $toolchain_install_sign_xidige ];then
echo 'toolchain has been created'
else
$NDK_ROOT/build/tools/make-standalone-toolchain.sh --platform=$API_Levels --install-dir=$toolchain_install_dir --toolchain=$default_toolchain_name --system=$my_host_system --stl=$use_stl || exit 1
ln -s /usr/bin/pkg-config $toolchain_install_dir/bin/arm-linux-androideabi-pkg-config

echo 'toolchain created' > $toolchain_install_sign_xidige
fi
}


base_dir_path=$(pwd)


#libiconv
build_libiconv(){
cd libiconv-1.14 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --without-libiconv-prefix --without-libintl-prefix --disable-nls && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#glob.c   ,needed by libxml2
build_glob(){
$CC -c $CFLAGS -I. glob.c
mkdir -p $PREFIX/lib
cp glob.o $PREFIX/lib 
mkdir -p $PREFIX/include
cp glob.h $PREFIX/include
cd $base_dir_path
}

#libpng   ,needed by xml2 ,ass ,freetype
build_libpng(){
cd libpng-1.6.10 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT"   && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


#xml2
build_xml2(){   #needed by fontconfig
cd libxml2-2.9.1 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" LDFLAGS="$LDFLAGS $PREFIX/lib/glob.o" --without-python && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#expat
build_expat(){        #needed by fontconfig
cd expat-2.1.0 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#freetype
build_freetype(){    #needed by fontconfig
cd freetype-2.5.2 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --without-png && make clean && make -j4 && make install || exit 1
#sed -i 's/Libs: -L${libdir} -lfreetype.*/Libs: -L${libdir} -lfreetype -lexpat/' "$PKG_CONFIG_PATH/freetype2.pc"
ln -s $PREFIX/include/freetype2 $PREFIX/include/freetype
cd $base_dir_path
}

#fontconfig
build_fontconfig(){     #needed by libass
cd fontconfig-2.10.95 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" FREETYPE_CFLAGS="-I$PREFIX/include/freetype2" FREETYPE_LIBS="-L$PREFIX/lib -lfreetype"   --with-expat-includes="$PREFIX/include" --with-expat="$PREFIX" EXPAT_CFLAGS="-I$PREFIX/include" EXPAT_LIBS="-L$PREFIX/lib -lexpat" --with-arch="$ARCH"  --disable-docs --without-freetype --enable-libxml2  && make clean && make -j4 && make install || exit 1
cd $base_dir_path
#
}


#fribidi
build_fribidi(){
cd fribidi-0.19.6 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --without-glib && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#libass
build_libass(){
cd libass-0.10.2 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared  --with-sysroot="$NDK_SYSROOT" FREETYPE_CFLAGS="-I$PREFIX/include/freetype2" FREETYPE_LIBS="-L$PREFIX/lib -lfreetype"   FRIBIDI_CFLAGS="-I$PREFIX/include/fribidi" FRIBIDI_LIBS="-L$PREFIX/lib -lfribidi" FONTCONFIG_CFLAGS="-I$PREFIX/include/fontconfig" FONTCONFIG_LIBS="-L$PREFIX/lib -lfontconfig"  --disable-harfbuzz --disable-enca && make clean && make -j4 && make install || exit 1
#sed -i 's/-lass -lm/-lass -lfribidi -lm/' "$PKG_CONFIG_PATH/libass.pc"
cd $base_dir_path
}


#flac
build_flac(){   #needed by sndfile
cd flac-1.3.0 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --with-ogg="$PREFIX" --with-libiconv-prefix="$PREFIX" --disable-3dnow --disable-thorough-tests --disable-doxygen-docs && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}
#sqlite ,needed by sndfile
build_sqlite(){
cd sqlite || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#sndfile
build_sndfile(){
cd libsndfile-1.0.25 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}



#vo-aacenc
build_vo_aacenc(){
cd vo-aacenc-0.1.3 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#faac
build_faac(){
cd faac-1.28 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --without-mp4v2 && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


#x264
build_x264() {
cd x264 || exit 1
if [ $compile_for_debug = "yes" ] ;then
echo "调试版本。。。。。。"
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS" --sysroot="$NDK_SYSROOT" --cross-prefix="$CROSS_PREFIX" --enable-pic  --disable-cli  --disable-opencl --enable-debug && make clean && make -j4  && make install || exit 1
else
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS" --sysroot="$NDK_SYSROOT" --cross-prefix="$CROSS_PREFIX" --enable-pic  --disable-cli  --disable-opencl && make clean && make -j4  && make install || exit 1
fi

cd $base_dir_path
}

#libvpx
build_libvpx(){
cd libvpx-v1.3.0 || exit 1
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-examples --disable-docs --sdk-path="$NDK_ROOT" --enable-vp8 --enable-vp9 --extra-cflags="$CFLAGS" --target=$target_for_vpx && make clean && make -j4  && make install || exit 1
cd $base_dir_path
}


#fdk-aac
build_fdk_aac(){
cd fdk-aac-0.1.3 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --with-pic && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


#xvid
build_xvid(){
cd xvidcore/build/generic || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared && make clean && make -j4 && make install || exit 1
rm $PREFIX/lib/libxvidcore.so*
cd $base_dir_path
}


#xavs
build_xavs(){
cd xavs || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared  --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS" --cross-prefix="$CROSS_PREFIX" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#lame
build_lame() {
cd lame-3.99.5 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --disable-rpath --disable-frontend  && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#twolame
build_twolame(){
cd twolame-0.3.13 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared  --with-sysroot="$NDK_SYSROOT" SNDFILE_CFLAGS="-I$PREFIX/include" SNDFILE_LDFLAGS="-L$PREFIX/lib -lsndfile" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#vo-amrwbenc
build_vo_amrwbenc(){
cd vo-amrwbenc-0.1.3 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#opencore-amr
build_opencore_amr(){
cd opencore-amr-0.1.3 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


#libbluray
build_bluray(){
cd libbluray-0.4.0 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared  LIBS="-lc" --with-sysroot="$NDK_SYSROOT" --without-libxml2 --without-freetype --disable-examples --disable-doxygen-doc --disable-doxygen-dot --disable-doxygen-html --disable-doxygen-ps --disable-doxygen-pdf || exit 1
sed -i "s/-Werror=implicit-function-declaration/-Wall/g" Makefile
sed -i "s/-Werror=implicit-function-declaration/-Wall/g" src/Makefile
make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


#ogg
build_ogg(){
cd libogg-1.3.1 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#libvorbis
build_libvorbis(){
cd libvorbis-1.3.3 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --with-ogg="$PREFIX" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#libtheora
build_libtheora(){
cd libtheora-1.1.1 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --with-ogg="$PREFIX" --with-vorbis="$PREFIX" --disable-examples && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


#speex
build_speex(){
cd speex-1.2rc1 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --with-ogg="$PREFIX" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#libgsm
build_libgsm(){
cd gsm-1.0-pl13 || exit 1
make clean
make CC="$CC" INSTALL_ROOT="$PREFIX" || exit 1
mkdir -p $PREFIX/lib && cp lib/libgsm.a $PREFIX/lib || exit 1
mkdir -p $PREFIX/include/gsm && cp inc/gsm.h $PREFIX/include/gsm || exit 1
cd $base_dir_path
}

#libopus
build_libopus(){
cd opus-1.1 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#modplug
build_modplug(){
cd libmodplug-0.8.8.4 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT"  CC="$CC -Wall" CXX="$CXX -Wall" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#frei0r
build_frei0r(){
cd frei0r-1.3 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#build_gmp
build_gmp(){
cd gmp-6.0.0 || exit 1
ORG_CC_FOR_BUILD=$CC_FOR_BUILD
ORG_CPP_FOR_BUILD=$CPP_FOR_BUILD
export CC_FOR_BUILD=/usr/bin/gcc
export CPP_FOR_BUILD=usr/bin/cpp
./configure --prefix=$PREFIX CC="$CC --sysroot=$NDK_SYSROOT -lc" --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" || exit 1
make clean && make -j4 && make install || exit 1
if [ ORG_CC_FOR_BUILD = "" ];then
 unset CC_FOR_BUILD
 unset CPP_FOR_BUILD
fi    
cd $base_dir_path
}

#nettle
build_nettle(){
cd nettle-2.7.1 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --disable-doc  && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#gnutls
build_gnutls(){
cd gnutls-3.3.2 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" --disable-doc --disable-cxx  CXX=  && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}
#polarssl
build_polarssl(){
cd polarssl-1.3.7 || exit 1
sed -i "s#DESTDIR=/usr/local# #" Makefile
export DESTDIR="$PREFIX"
temp_cc=$CC
make clean && make SYS=android CC="$CC --sysroot=$NDK_SYSROOT"  APPS= && make install CC="$CC --sysroot=$NDK_SYSROOT"  || exit 1
unset DESTDIR
echo $CC
cd $base_dir_path
}

#rtmp
build_rtmp(){
#该版本需要经过修改,才能配合最新版本的polarssl
cd rtmpdump-2.3/librtmp || exit 1
make clean && make SYS=android CROSS_COMPILE="$CROSS_PREFIX" INC="$CFLAGS -I$NDK_SYSROOT/usr/include" XLDFLAGS="--sysroot=$NDK_SYSROOT $LDFLAGS -lgcc -lz" XCFLAGS="--sysroot=$NDK_SYSROOT $CFLAGS "  CRYPTO=POLARSSL SHARED= || exit 1
sed -i "s/-lrtmp -lz/-lrtmp -lz -lpolarssl/" librtmp.pc
make SHARED= CROSS_COMPILE="$CROSS_PREFIX" install || exit 1
cd $base_dir_path
}

#orc
build_orc(){
cd orc-0.4.19 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#schroedinger-1.0.11   
build_schroedinger(){
cd schroedinger-1.0.11 || exit 1
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


#libpcap
build_pcap(){
cd libpcap-1.6.2 || exit 1
#export CCOPT="-O2 -fpic --sysroot=$NDK_SYSROOT -DANDROID -DOS_ANDROID"
./configure --prefix=$PREFIX --host=arm-linux --enable-static --disable-shared --with-pcap=linux --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}

#reaver
build_reaver(){
cd reaver-1.4/src || exit 1
#export CCOPT="-O2 -fpic --sysroot=$NDK_SYSROOT -DANDROID -DOS_ANDROID"
./configure --prefix=$PREFIX --host=arm-linux --with-sysroot="$NDK_SYSROOT" && make clean && make -j4 && make install || exit 1
cd $base_dir_path
}


build_cpufeature(){
mkdir -p $PREFIX/lib
$CC -c $NDK_ROOT/sources/android/cpufeatures/cpu-features.c -o $PREFIX/lib/libcpufeatures.a || exit 1 #/tmp/cpu-features.o 
#$AR cvf $PREFIX/lib/libcpu-features.a /tmp/cpu-features.o
}
#ffmpeg
ffmpeg_path=ffmpeg-2.2.3
build_ffmpeg(){
cd $ffmpeg_path || exit 1
ffmpeg_enable_libs="--disable-avfilter --enable-librtmp --enable-libfaac --enable-libfdk-aac  --enable-libgsm  --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-libtheora --enable-libtwolame  --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid"
export PKG_CONFIG_LIBDIR=$PKG_CONFIG_PATH
if [ $compile_for_debug = "yes" ] ;then
echo "调试版本。。。。。。"
./configure --prefix=$PREFIX  \
--enable-cross-compile --arch=$ARCH \
--cross-prefix="$CROSS_PREFIX" \
--target-os=linux --sysroot=$NDK_SYSROOT \
--cc="$CC" \
--extra-cflags="$CFLAGS" --extra-cxxflags="$CXXFLAGS" \
--extra-ldflags="$LDFLAGS -lcpufeatures" \
--extra-libs="-l$libused4stl -ldl -lc -lgcc -lz -lm" \
--enable-static --disable-shared --enable-pic \
 --disable-ffplay --disable-ffserver --disable-doc \
--disable-htmlpages  --disable-manpages  --disable-podpages  --disable-txtpages  --disable-symver --enable-debug --disable-stripping --disable-optimizations --enable-memalign-hack --disable-asm \
 --enable-gpl --enable-version3 --enable-nonfree \
 --disable-iconv --disable-bzlib $ffmpeg_enable_libs || exit 1
else 
./configure --prefix=$PREFIX  \
--enable-cross-compile --arch=$ARCH \
--cross-prefix="$CROSS_PREFIX" \
--target-os=linux --sysroot=$NDK_SYSROOT \
--cc="$CC" --nm="$NM" \
--extra-cflags="$CFLAGS" --extra-cxxflags="$CXXFLAGS" \
--extra-ldflags="$LDFLAGS  -lcpufeatures" \
--extra-libs="-l$libused4stl -ldl -lc -lgcc -lz -lm" \
--enable-static --disable-shared --enable-pic \
 --disable-ffplay --disable-ffserver --disable-doc \
--disable-htmlpages  --disable-manpages  --disable-podpages  --disable-txtpages  --disable-symver --disable-debug --enable-memalign-hack --disable-asm \
 --enable-gpl --enable-version3 --enable-nonfree \
 --disable-iconv --disable-bzlib $ffmpeg_enable_libs || exit 1
fi
#sed -i "s/#define av_restrict restrict/#define av_restrict/g" config.h

#sed -i "s/HAVE_LLRINT 0/HAVE_LLRINT 1/g" config.h
#sed -i "s/HAVE_LLRINTF 0/HAVE_LLRINTF 1/g" config.h
#sed -i "s/HAVE_LRINT 0/HAVE_LRINT 1/g" config.h
#sed -i "s/HAVE_LRINTF 0/HAVE_LRINTF 1/g" config.h
#sed -i "s/HAVE_ROUND 0/HAVE_ROUND 1/g" config.h
#sed -i "s/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g" config.h
#sed -i "s/HAVE_ISINF 0/HAVE_ISINF 1/g" config.h
#sed -i "s/HAVE_ISNAN 0/HAVE_ISNAN 1/g" config.h
make clean && make -j4 && make install || exit 1
#cp libavutil/colorspace.h $PREFIX/include/libavutil/colorspace.h
#cp config.h $PREFIX/include/config.h
cd $base_dir_path
}

#试着编个单独的库
build_so_ffmpeg1(){
cd $ffmpeg_path || exit 1
#$AR d libavcodec/libavcodec.a inverse.o
$CC $CFLAGS --sysroot=$NDK_SYSROOT -shared -fPIC  $LDFLAGS -o $PREFIX/libffmpeg.so -L$PREFIX/lib -Wl,--whole-archive libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libavfilter/libavfilter.a libswscale/libswscale.a libavdevice/libavdevice.a libswresample/libswresample.a libpostproc/libpostproc.a  -Wl,-nostdlib -Wl,--sysroot=$NDK_SYSROOT -l$libused4stl -lm -lc -lz -ldl -lgcc  > compile_log.log 2>&1 || exit 1
#$DEFAULT_STRIP  --strip-unneeded $PREFIX/libffmpeg.so
cd $base_dir_path
#-lxavs -logg -lfaac -lfdk-aac -lgsm -lmp3lame -lopencore-amrwb -lopencore-amrnb -lopus -lvorbis -lvorbisfile -lvorbisenc  -ltheora -ltheoraenc -ltheoradec -lspeex  -lspeexdsp -ltwolame -lvo-aacenc -lvo-amrwbenc -lxvidcore -lvpx -lx264
}



#######################################
###########用来复制的,懒得敲键盘了
#######################################
pass_fun(){
echo "not run "

create_toolchain

build_glob  #needed by xml2
build_libiconv   #needed by lame
build_expat    #needed by fontconfig  
build_libpng    #needed by xml2,ass
build_xml2
build_freetype    #needed by fontconfig
######build_fontconfig        #libpng16.la' is not a valid libtool archive

####build_fribidi    #needed by libass
#####build_libass         #libpng16.la' is not a valid libtool archive

build_ogg
build_speex
build_libvorbis
build_libtheora


###build_flac
###build_sqlite

###build_sndfile   #use flac,sqlite,ogg,vorbis,speex   libvorbis.la' is not a valid libtool archive

build_libgsm
build_libopus
######build_modplug     # error: 'float sinf(float)' was declared 'extern' and later 'static' [-fpermissive]

#build_gmp         #needed by nettle
#build_nettle      #needed by gnutls
######build_gnutls     #undefined reference to atexit  
##########build_frei0r       #cant install
#########build_rtmp       #cant found pthread  or gnutls

#########build_orc          # need pthread
##########build_schroedinger         #need orc
   
build_vo_aacenc
build_faac
build_fdk_aac
build_xvid
build_xavs
build_lame
build_twolame
build_vo_amrwbenc
build_opencore_amr
build_bluray    #ffmpeg error: undefined reference to 'setmntent'
build_x264
build_libvpx
}

#######这里是最神圣的地方了,所有要的都在这里写吧,记得顺序
build_media(){
build_ogg
build_speex
build_libvorbis
build_libtheora

build_libgsm


build_x264
build_libvpx
build_vo_aacenc
build_faac
build_fdk_aac
build_xvid
build_xavs
build_lame
build_twolame
build_vo_amrwbenc
build_opencore_amr

build_polarssl
build_rtmp



#build_libopus   #ffmpeg cannot found 

#build_fribidi
#build_freetype  #ffmpeg cannot found
#build_expat   cannot be found by fontconfig,use xml2 insteaded of
#build_glob
#build_xml2
#build_fontconfig
#build_libass 
}

######调用上面的方法的地方
#create_toolchain
#build_pcap
#build_sqlite
#build_reaver
#build_cpufeature
#build_media
#build_ffmpeg
#build_so_ffmpeg1

因为我用了很多的拓展库, 所以脚本看起来很多, 不过,也懒得整理了,大家可以选自己想看的,或干脆全部复制,然后编哪个库,就调用哪个函数吧

如有问题,可以留言,我会尽量帮忙找出问题的解决方法的.

» 本文链接地址:https://www.xidige.com/849

打开支付宝扫一扫,即可进行扫码打赏哦

扫码支持
扫码打赏,你说多少就多少

标签:

分享到:

扫一扫 在手机阅读、分享本文

上一篇: 下一篇:
评论区0人评论1,176人参与

电子邮件地址不会被公开。 必填项已用*标注

*

loading

赞助商广告