libnghttp2 NDK 交叉编译
生活随笔
收集整理的這篇文章主要介紹了
libnghttp2 NDK 交叉编译
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
移植nghttp2到android
創(chuàng)建工作目錄,并進(jìn)入
| 12 | mkdir androidcd android |
clone源碼
| 1 | git clone git@github.com:nghttp2/nghttp2.git |
生成交叉編譯工具鏈
| 1 | $ANDROID_NDK/build/tools/make-standalone-toolchain.sh --arch=arm --install-dir=./toolchain |
導(dǎo)出環(huán)境變量
| 123456 | export CURRENT_HOME=`pwd`export TOOLCHAIN=$CURRENT_HOME/toolchainexport PATH=$TOOLCHAIN/bin:$PATHexport PKG_CONFIG_LIBDIR=$TOOLCHAIN/lib/pkgconfigexport CPPFLAGS="-fPIE -I$TOOLCHAIN/sysroot/usr/include"export LDFLAGS="-fPIE -pie -I$TOOLCHAIN/sysroot/usr/lib" |
編譯并安裝
| 123456789 | cd nghttp2autoreconf -i./configure --enable-lib-only \--host=arm-linux-androideabi \--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \--disable-shared \--prefix="$TOOLCHAIN/sysroot/usr/local"makemake install |
卸載
| 1 | make uninstall |
何大仙提供的shell腳本
| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | #!/bin/shif [! -d "nghttp2" ]; thengit clone git@github.com:nghttp2/nghttp2.gitelsecd nghttp2git pullcd ..fi# envif [-d "out/nghttp2" ]; thenrm -fr "out/nghttp2"fimkdir "out"mkdir "out/nghttp2"_compile() { SURFIX=$1 TOOL=$2 ARCH_FLAGS=$3 ARCH_LINK=$4 ARCH=$5 if [! -d "out/nghttp2/${SURFIX}" ]; thenmkdir "out/nghttp2/${SURFIX}"fi if [! -d "toolchain_${SURFIX}" ]; then $ANDROID_NDK/build/tools/make-standalone-toolchain.sh --arch=${ARCH} --install-dir=./toolchain_${SURFIX}fi export CURRENT_HOME=`pwd` export TOOLCHAIN=$CURRENT_HOME/toolchain_${SURFIX} export PATH=$TOOLCHAIN/bin:$PATH export PKG_CONFIG_LIBDIR=$TOOLCHAIN/lib/pkgconfig export ARCH_FLAGS=$ARCH_FLAGS export ARCH_LINK=$ARCH_LINK export CPPFLAGS="-fPIE -I$TOOLCHAIN/sysroot/usr/include" export LDFLAGS="-fPIE -pie -I$TOOLCHAIN/sysroot/usr/lib"cd nghttp2/autoreconf -i./configure --enable-lib-only --host=${TOOL} --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` --disable-shared --prefix="$TOOLCHAIN/sysroot/usr/local"make cleanmake -j4make installcd ..mv nghttp2/lib/.libs/libnghttp2.a out/nghttp2/${SURFIX}/}# arm_compile "armeabi" "arm-linux-androideabi" "-mthumb" "" "arm"# armv7_compile "armeabi-v7a" "arm-linux-androideabi" "-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16" "-march=armv7-a -Wl,--fix-cortex-a8" "arm"# arm64v8_compile "arm64-v8a" "aarch64-linux-android" "" "" "arm64"# x86_compile "x86" "i686-linux-android" "-march=i686 -m32 -msse3 -mstackrealign -mfpmath=sse -mtune=intel" "" "x86"# x86_64_compile "x86_64" "x86_64-linux-android" "-march=x86-64 -m64 -msse4.2 -mpopcnt -mtune=intel" "" "x86_64"# mips_compile "mips" "mipsel-linux-android" "" "" "mips"# mips64_compile "mips64" "mips64el-linux-android" "" "" "mips64"echo "done" |
總結(jié)
以上是生活随笔為你收集整理的libnghttp2 NDK 交叉编译的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Android Studio Libra
- 下一篇: openssl NDK 交叉编译