移植nghttp2到android

创建工作目录,并进入

                 1                         2        
                 mkdir android                         cd 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        

导出环境变量

                 1                         2                         3                         4                         5                         6        
                 export         CURRENT_HOME=`pwd`                         export         TOOLCHAIN=         $CURRENT_HOME/toolchain                         export         PATH=         $TOOLCHAIN/bin:$PATH                         export         PKG_CONFIG_LIBDIR=         $TOOLCHAIN/lib/pkgconfig                         export         CPPFLAGS=         "-fPIE -I$TOOLCHAIN/sysroot/usr/include"                         export         LDFLAGS=         "-fPIE -pie -I$TOOLCHAIN/sysroot/usr/lib"        

编译并安装

                 1                         2                         3                         4                         5                         6                         7                         8                         9        
                 cd nghttp2                         autoreconf -i                         ./configure --enable-         lib-only \                         --host=arm-linux-androideabi \                         --build=         `dpkg-architecture -qDEB_BUILD_GNU_TYPE` \                         --disable-shared \                         --prefix=         "$TOOLCHAIN/sysroot/usr/local"                         make                         make install        

卸载

                 1        
                 make uninstall        

何大仙提供的shell脚本

                 1                         2                         3                         4                         5                         6                         7                         8                         9                         10                         11                         12                         13                         14                         15                         16                         17                         18                         19                         20                         21                         22                         23                         24                         25                         26                         27                         28                         29                         30                         31                         32                         33                         34                         35                         36                         37                         38                         39                         40                         41                         42                         43                         44                         45                         46                         47                         48                         49                         50                         51                         52                         53                         54                         55                         56                         57                         58                         59                         60                         61                         62                         63                         64                         65                         66                         67                         68                         69                         70                         71                         72                         73                         74                         75                         76        
                 #!/bin/sh                                 if [! -d         "nghttp2" ]; then                         git clone [email protected]:nghttp2/nghttp2.git                         else                         cd nghttp2                         git pull                         cd         ..                         fi                                 # env                         if [-d         "out/nghttp2" ]; then                         rm -fr         "out/nghttp2"                         fi                                 mkdir         "out"                         mkdir         "out/nghttp2"                                 _compile() {                         SURFIX=         $1                         TOOL=         $2                         ARCH_FLAGS=         $3                         ARCH_LINK=         $4                         ARCH=         $5                                 if [! -d         "out/nghttp2/${SURFIX}" ]; then                         mkdir         "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 clean                         make -j4                         make install                         cd         ..                                 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"        

http://fucknmb.com/2017/05/24/libnghttp2-NDK%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91/

更多相关文章

  1. Ubuntu12.04下的Android 源码编译
  2. Android 属性动画(Property Animation) 完全解析【附源码】
  3. [Android]Android系统启动流程源码分析
  4. [Android]瀑布流实例android_waterfall源码分析
  5. Android中Activity启动过程源码阅读笔记:
  6. 手把手教你查看android系统源码

随机推荐

  1. 赵雅智_java的多线程下载移植到android客
  2. Android手写优化
  3. Android中文API合集(7) + 开发者指南合集
  4. 分享一个好用的Android投屏工具-scrcpy
  5. 修改编译android文件系统编译链版本
  6. Android 仿滴滴首页嵌套滑动效果
  7. Android中VideoView及SurfaceView视频播
  8. Android基于腾讯X5内核的WebView(超级浏
  9. 用Kotlin实现Android点击事件的方法
  10. Android 中Seekbar详解及简单实例