赞
踩
开源库链接:https://github.com/aria2/aria2.git
这个库本身没有提供makefile文件,而是使用configure.ac和makefile.am文件自动生成makefile。本文通过学习其自动生成的makefile文件,自己尝试写一个makefile,编译整个项目。
注:使用mingw64编译器,生成windows上可执行的aria2c.exe可执行文件(其他平台类似)。
通过查看对应的文档:https://aria2.github.io/manual/en/html/README.html#how-to-build,下载了并安装了相关库文件,具体可以参考Linux:https://blog.csdn.net/qq_33850438/article/details/80199588
- gmp-6.1.2.tar.lz
- expat-2.2.0.tar.bz2
- sqlite-autoconf-3160200.tar.gz
- zlib-1.2.11.tar.gz
- c-ares-1.12.0.tar.gz
- libssh2-1.8.0.tar.gz
需要获取通过工具./configure生成一个conifg.h文件(其作用影响代码的编译,哪些模块的代码需要加入,哪些代码不需要加入),同时使用mingw-config文件查看相关库安装情况,环境等作用,通过这个也能知道链接时候需要的一些库以及所对应的选项。
- configure: summary of build options:
-
- Build: x86_64-pc-linux-gnu
- Host: x86_64-w64-mingw32
- Target: x86_64-w64-mingw32
- Install prefix: /usr/local/x86_64-w64-mingw32
- CC: x86_64-w64-mingw32-gcc
- CXX: x86_64-w64-mingw32-g++
- CPP: x86_64-w64-mingw32-gcc -E
- CXXFLAGS: -g -O2
- CFLAGS: -g -O2
- CPPFLAGS: -I/usr/local/x86_64-w64-mingw32/include
- LDFLAGS: -L/usr/local/x86_64-w64-mingw32/lib
- LIBS:
- DEFS: -DHAVE_CONFIG_H
- CXX1XCXXFLAGS: -std=c++11
- EXTRACXXFLAGS: -pipe
- EXTRACFLAGS: -pipe
- EXTRACPPFLAGS: -D_POSIX_C_SOURCE=1
- EXTRALDFLAGS: -Wl,--dynamicbase -Wl,--nxcompat -all-static
- EXTRALIBS: -lws2_32 -lwsock32 -lgdi32 -lwinmm -liphlpapi -lpsapi
- WARNCXXFLAGS:
- LibUV: no (CFLAGS='' LIBS='')
- SQLite3: yes (CFLAGS='-I/usr/local/x86_64-w64-mingw32/include' LIBS='-L/usr/local/x86_64-w64-mingw32/lib -lsqlite3 -lpthread')
- SSL Support: yes
- AppleTLS: no (LDFLAGS='')
- WinTLS: yes (LIBS='-lcrypt32 -lsecur32 -ladvapi32')
- GnuTLS: no (CFLAGS='' LIBS='')
- OpenSSL: no (CFLAGS='' LIBS='')
- CA Bundle:
- LibNettle: no (CFLAGS='' LIBS='')
- LibGmp: yes (CFLAGS='' LIBS='-lgmp')
- LibGcrypt: no (CFLAGS='' LIBS='')
- LibXML2: no (CFLAGS='' LIBS='')
- LibExpat: yes (CFLAGS='-I/usr/local/x86_64-w64-mingw32/include' LIBS='-L/usr/local/x86_64-w64-mingw32/lib -lexpat')
- LibCares: yes (CFLAGS='-I/usr/local/x86_64-w64-mingw32/include' LIBS='-L/usr/local/x86_64-w64-mingw32/lib -lcares -lws2_32')
- Zlib: yes (CFLAGS='-I/usr/local/x86_64-w64-mingw32/include' LIBS='-L/usr/local/x86_64-w64-mingw32/lib -lz')
- Libssh2: yes (CFLAGS='-I/usr/local/x86_64-w64-mingw32/include' LIBS='-L/usr/local/x86_64-w64-mingw32/lib -lssh2 -lws2_32 -lbcrypt -lcrypt32 -lws2_32 -lbcrypt -lcrypt32 -lz')
- Tcmalloc: no (CFLAGS='' LIBS='')
- Jemalloc: no (CFLAGS='' LIBS='')
- Epoll: no
- Bittorrent: yes
- Metalink: yes
- XML-RPC: yes
- Message Digest: internal
- WebSocket: yes (CFLAGS='-I$(top_builddir)/deps/wslay/lib/includes -I$(top_srcdir)/deps/wslay/lib/includes' LIBS='$(top_builddir)/deps/wslay/lib/libwslay.la')
- Libaria2: no (shared=yes static=no)
- bash_completion dir: ${datarootdir}/doc/${PACKAGE_TARNAME}/bash_completion
- Static build: yes
可以参考:https://blog.csdn.net/qq_33850438/article/details/80199588 将自动生成的makefile文件的信息打印出来(操作:make -n>makefilelog.txt,这个操作不会编译文件,会将makefile文件编译时候的信息打印出来,然后通过查看makefilelog.txt)以下截取一小片段。
echo " CXX " A
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。