LINPHONE在嵌入式LINUX下的交叉编译和移植

2019-07-13 00:06发布

注:此过程仅适合LINPHONE3.6.1以下的版本,高版本的编译有所不同环境变量:export PREFIX=/usrexport HOSTTPL=arm-linux-gnueabihfexport INSTALLDIR=/home/elinux/linphone/armbuild tslib: $ sudo apt-get install libtool automake autoconf$ ./autogen.sh$ echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache$ ./configure --prefix=$PREFIX --host=$HOSTTPL --cache-file=arm-linux.cache$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild libiconv:$ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild  SDL: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --build=i386 --with-gnu-ld --disable-video-nanox --disable-video-qtopia --disable-pulseaudio --disable-video-photon  --disable-video-ggi --disable-video-svga --disable-video-aalib --disable-video-dummy --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-video-x11 --disable-nasm --enable-joystick --enable-input-tslib --enable-video-fbcon   CPPFLAGS="-I${INSTALLDIR}/usr/include"   LDFLAGS="-L${INSTALLDIR}/usr/lib -lts -liconv"$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild ncurses: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-shared --with-gnu-ld$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild readline: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --disable-static$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild  libosip2: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --disable-static$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild  libogg: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild    rm $INSTALLDIR$PREFIX/lib/*.la libeXosip2: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --disable-static OSIP_CFLAGS="-I${INSTALLDIR}/usr/include" OSIP_LIBS="-L${INSTALLDIR}/usr/lib -losip2 -losipparser2"$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild    speex: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --disable-static --enable-fixed-point --enable-arm-asm --with-ogg="${INSTALLDIR}/usr/"$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild   libav: $ ./configure --prefix=$PREFIX --enable-cross-compile --cross-prefix=arm-linux-gnueabihf- --arch=armv7 --target-os=linux  --extra-cflags=-fPIC$ make$ make install DESTDIR=$INSTALLDIR $ make install DESTDIR='pwd'/armbuild  libvorbis: $ ./configure --prefix=$PREFIX --host=$HOSTTPL --with-gnu-ld --with-ogg="$INSTALLDIR/usr/"$ make$ make install DESTDIR=$INSTALLDIR $ make install DESTDIR='pwd'/armbuild  zlib: $ ./configure --prefix=$PREFIX修改MakefileCC=arm-linux-gnueabihf-gccLDSHARED=arm-linux-gnueabihf-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.mapCPP=arm-linux-gnueabihf-g++ -EAR=arm-linux-gnueabihf-ar rc$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild libv4l:$ vi libv4l1/Makefile$ vi libv4l2/Makefile$ vi libv4lconvert/Makefile在文件起始处增加以下两行:CC=arm-linux-gnueabihf-gccAR=arm-linux-gnueabihf-ar$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuildrm $INSTALLDIR$PREFIX/lib/*.la linphone:$ ./configure --prefix=$PREFIX --host=$HOSTTPL --disable-static --disable-glib --enable-gtk_ui=no  --disable-xv --disable-X11 --disable-pulseaudio --enable-video --enable-ffmpeg  --enable-sdl --enable-libv4l --enable-oss --enable-ipv6 --with-gnu-ld --with-ffmpeg=$INSTALLDIR/usr/ --with-libiconv-prefix=$INSTALLDIR/usr/  --with-osip=$INSTALLDIR/usr/  -with-readline=$INSTALLDIR/usr/ SPEEX_CFLAGS="-I$INSTALLDIR/usr/include" SPEEX_LIBS="-L$INSTALLDIR/usr/lib -lspeex" FFMPEG_CFLAGS="-I$INSTALLDIR/usr/include" FFMPEG_LIBS="-L$INSTALLDIR/usr/lib -lavcodec" SWSCALE_CFLAGS="-I$INSTALLDIR/usr/include"  SWSCALE_LIBS="-L$INSTALLDIR/usr/lib -lswscale"SDL_CFLAGS="-I$INSTALLDIR/usr/include"  SDL_LIBS="-L$INSTALLDIR/usr/lib -lSDL" OSIP_CFLAGS="-I$INSTALLDIR/usr/include" OSIP_LIBS="-L$INSTALLDIR/usr/lib -losip2 -losipparser2 -leXosip2"  SPEEX_CFLAGS="-I$INSTALLDIR/usr/include" SPEEX_LIBS="-L$INSTALLDIR/usr/lib -lspeex -lspeexdsp" SPEEXDSP_CFLAGS="-I$INSTALLDIR/usr/include" SPEEXDSP_LIBS="-L$INSTALLDIR/usr/lib -lspeex -lspeexdsp" LIBV4L2_CFLAGS="-I$INSTALLDIR/usr/include" LIBV4L2_LIBS="-L$INSTALLDIR/usr/lib -lv4l2" LIBV4L1_CFLAGS="-I$INSTALLDIR/usr/include" LIBV4L1_LIBS="-L$INSTALLDIR/usr/lib -lv4l1" 配置完configure后修改Makefile如下: mediastreamer2/tests/Makefile:LIBS =  -pthread -lpthread -lrt -lvorbisenc -lv4l1 -lv4l2 -lv4lconvert -liconv -lvorbis -logg -lz coreapi/Makefile:LIBS =  -lspeex -lspeexdsp -lSDL -lvorbisenc -lv4l1 -lv4l2 -lv4lconvert -liconv -lvorbis -logg -lz -lavutil coreapi/help/Makefile:LIBS =  -losip2 -losipparser2 -leXosip2 -lspeex -lspeexdsp -lSDL -lvorbisenc -lv4l1 -lv4l2 -lv4lconvert -liconv -lvorbis -logg -lz -lavutil helloworld_LDADD = $(top_builddir)/coreapi/liblinphone.la         $(EXOSIP_LIBS)         $(MEDIASTREAMER_LIBS)         $(ORTP_LIBS)  console/Makefile:LIBS =  -lSDL -lvorbisenc -lv4l1 -lv4l2 -lv4lconvert -liconv   -lvorbis -logg   -lz -lavutil linphonecsh_LDADD = $(ORTP_LIBS) -L${INSTALLDIR}/usr/lib$ make$ make install DESTDIR=$INSTALLDIR$ make install DESTDIR='pwd'/armbuild