虽然说极路由的插件很不错,但是不知道为什么在我这里一直没有下载速度,一怒之下萌生了自己编译一个aria2的想法,网上很多人是下了openwrt的源码进行编译的,我这里虽然成功了,但是在路由器上跑不起来,可能是平台问题。后来在极路由开发平台上看到了他们提供的编译器,于是编译之旅正式开始。
1、首先进入极路由开发平台,下载对应的编译器,我的路由器对应mtmips的
http://doc.hiwifi.com/docs/sdk_usage
2、交叉编译python
编译之前先设置好交叉编译环境
export PATH=$PATH:/root/mtmips/staging_dir/toolchain-mipsel_1004kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin
export STAGING_DIR=/root/mtmips/staging_dir
用极路由平台上提供的方法也可以
./scripts/cross-compile.sh ./
使用文件 python.2.7
参考网址 http://www.linuxidc.com/Linux/2014-03/98457.htm
http://blog.youkuaiyun.com/shuxiao9058/article/details/7026205
echo ac_cv_file__dev_ptmx=no > config.site
echo ac_cv_file__dev_ptc=no >> config.site
export CONFIG_SITE=config.site
./configure --host=mipsel-linux --build=i386-linux-gnu --disable-ipv6
修改makefile
OPT= -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
一行中,去掉-g
make
make install
3、编译libxml2
修改默认包含的python头文件地址,开始编译。
C_INCLUDE_PATH=/root/Python-2.7.15/Include:/root/Python-2.7.15
export C_INCLUDE_PATH
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/root/Python-2.7.15/Include:/root/Python-2.7.15
export CPLUS_INCLUDE_PATH
./configure --host=mipsel-linux --prefix=/finrod/mips_lib/test_xml/libxml --enable-static=yes --without-zlib
make
make install
4、编译aria2
C_INCLUDE_PATH=/root/Python-2.7.15/Include:/root/Python-2.7.15:/root/libxml2-2.9.7/include/
export C_INCLUDE_PATH
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/root/Python-2.7.15/Include:/root/Python-2.7.15:/root/libxml2-2.9.7/include/
export CPLUS_INCLUDE_PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/libxml2-2.9.7/.libs
export LD_LIBRARY_PATH
LIBRARY_PATH=$LIBRARY_PATH:/root/libxml2-2.9.7/.libs
export LIBRARY_PATH
./configure --host=mipsel-openwrt-linux-uclibc --without-gnutls --disable-nls --without-libgcrypt --with-libnettle --without-libgmp --without-libexpat --without-libcares --without-sqlite3 --with-openssl --with-libxml2 --with-libz CFLAGS="-I/root/mtmips/staging_dir/target-mipsel_1004kc_uClibc-0.9.33.2/usr/include" LDFLAGS="-L/root/mtmips/staging_dir/target-mipsel_1004kc_uClibc-0.9.33.2/usr/lib" ZLIB_CFLAGS="-I/root/mtmips/staging_dir/target-mipsel_1004kc_uClibc-0.9.33.2/usr/include" ZLIB_LIBS="-L/root/mtmips/staging_dir/target-mipsel_1004kc_uClibc-0.9.33.2/usr/lib -lz"
make -j1 V=99
5、编译完成后src目录下aria2文件有70M左右,需要做一些简化
./staging_dir/toolchain-mipsel_1004kc_gcc-4.8-linaro_uClibc-0.9.33.2/mipsel-openwrt-linux-uclibc/bin/strip ../aria2-1.34.0/src/aria2c
平台跟我一样的童鞋,可以直接拿去用,资源还在审核
https://download.youkuaiyun.com/download/cswchf/10631619
链接: https://pan.baidu.com/s/15dqd23t18V-vCLpS6r7XfQ 密码: 5a4k
参考文章