-
-
Save langhaidian/9224b243ee63f87dfb31b55bf88c5653 to your computer and use it in GitHub Desktop.
aria2 build scripts for msys2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1.0.{build} | |
install: | |
- cmd: >- | |
C:\msys64\usr\bin\pacman -Syyuu --noconfirm | |
C:\msys64\usr\bin\pacman -Suu --noconfirm | |
C:\msys64\usr\bin\pacman -S --noconfirm --needed base-devel zlib-devel sqlite git unzip zip tar gmp gmp-devel libssh2 libssh2-devel openssl-devel | |
build_script: | |
- cmd: >- | |
set MSYSTEM=MINGW64 | |
C:\msys64\usr\bin\bash -lc "cd \"$APPVEYOR_BUILD_FOLDER\" && exec ./build-aria2.sh" | |
7z a aria2c.7z aria2\src\aria2c.exe | |
appveyor PushArtifact aria2c.7z | |
rd /s /q aria2 | |
set MSYSTEM=MINGW32 | |
C:\msys64\usr\bin\bash -lc "cd \"$APPVEYOR_BUILD_FOLDER\" && exec ./build-aria2.sh" | |
7z a aria2c_x86.7z aria2\src\aria2c.exe | |
appveyor PushArtifact aria2c_x86.7z | |
test: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From a21c65112cac1d392c35ce7ced5eac17638d27e7 Mon Sep 17 00:00:00 2001 | |
From: myfreeer <[email protected]> | |
Date: Mon, 29 May 2017 22:06:13 +0800 | |
Subject: [PATCH 1/2] options: change default path to current dir | |
--- | |
src/OptionHandlerFactory.cc | 2 +- | |
src/util.cc | 8 ++++---- | |
2 files changed, 5 insertions(+), 5 deletions(-) | |
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc | |
index 6f352cd4..79705aab 100644 | |
--- a/src/OptionHandlerFactory.cc | |
+++ b/src/OptionHandlerFactory.cc | |
@@ -1276,7 +1276,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
} | |
{ | |
OptionHandler* op(new LocalFilePathOptionHandler( | |
- PREF_NETRC_PATH, TEXT_NETRC_PATH, util::getHomeDir() + "/.netrc", | |
+ PREF_NETRC_PATH, TEXT_NETRC_PATH, File::getCurrentDir() + "/.netrc", | |
/* acceptStdin = */ false, 0, /* mustExist = */ false)); | |
handlers.push_back(op); | |
} | |
diff --git a/src/util.cc b/src/util.cc | |
index 40fc55f2..71f9cc0b 100644 | |
--- a/src/util.cc | |
+++ b/src/util.cc | |
@@ -1452,9 +1452,9 @@ std::string getXDGDir(const std::string& environmentVariable, | |
std::string getConfigFile() | |
{ | |
- std::string filename = getHomeDir() + "/.aria2/aria2.conf"; | |
+ std::string filename = File::getCurrentDir() + "/.aria2/aria2.conf"; | |
if (!File(filename).exists()) { | |
- filename = getXDGDir("XDG_CONFIG_HOME", getHomeDir() + "/.config") + | |
+ filename = getXDGDir("XDG_CONFIG_HOME", File::getCurrentDir() + "/.config") + | |
"/aria2/aria2.conf"; | |
} | |
return filename; | |
@@ -1463,9 +1463,9 @@ std::string getConfigFile() | |
std::string getDHTFile(bool ipv6) | |
{ | |
std::string filename = | |
- getHomeDir() + (ipv6 ? "/.aria2/dht6.dat" : "/.aria2/dht.dat"); | |
+ File::getCurrentDir() + (ipv6 ? "/.aria2/dht6.dat" : "/.aria2/dht.dat"); | |
if (!File(filename).exists()) { | |
- filename = getXDGDir("XDG_CACHE_HOME", getHomeDir() + "/.cache") + | |
+ filename = getXDGDir("XDG_CACHE_HOME", File::getCurrentDir() + "/.cache") + | |
(ipv6 ? "/aria2/dht6.dat" : "/aria2/dht.dat"); | |
} | |
return filename; | |
-- | |
2.12.1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ac269cf2b9c7e6896439b26ee422d33af30fbcd7 Mon Sep 17 00:00:00 2001 | |
From: myfreeer <[email protected]> | |
Date: Mon, 29 May 2017 22:11:33 +0800 | |
Subject: [PATCH 2/2] options: unlock connection-per-server limit | |
--- | |
src/OptionHandlerFactory.cc | 16 ++++++++-------- | |
1 file changed, 8 insertions(+), 8 deletions(-) | |
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc | |
index 79705aab..6ce0b946 100644 | |
--- a/src/OptionHandlerFactory.cc | |
+++ b/src/OptionHandlerFactory.cc | |
@@ -158,7 +158,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
} | |
{ | |
OptionHandler* op(new BooleanOptionHandler( | |
- PREF_CONTINUE, TEXT_CONTINUE, A2_V_FALSE, OptionHandler::OPT_ARG, 'c')); | |
+ PREF_CONTINUE, TEXT_CONTINUE, A2_V_TRUE, OptionHandler::OPT_ARG, 'c')); | |
op->addTag(TAG_BASIC); | |
op->addTag(TAG_FTP); | |
op->addTag(TAG_HTTP); | |
@@ -432,7 +432,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
{ | |
OptionHandler* op(new NumberOptionHandler(PREF_MAX_CONCURRENT_DOWNLOADS, | |
TEXT_MAX_CONCURRENT_DOWNLOADS, | |
- "5", 1, -1, 'j')); | |
+ "16", 1, -1, 'j')); | |
op->addTag(TAG_BASIC); | |
op->setChangeGlobalOption(true); | |
handlers.push_back(op); | |
@@ -440,7 +440,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
{ | |
OptionHandler* op(new NumberOptionHandler(PREF_MAX_CONNECTION_PER_SERVER, | |
TEXT_MAX_CONNECTION_PER_SERVER, | |
- "1", 1, 16, 'x')); | |
+ "16", 1, -1, 'x')); | |
op->addTag(TAG_BASIC); | |
op->addTag(TAG_FTP); | |
op->addTag(TAG_HTTP); | |
@@ -501,7 +501,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
} | |
{ | |
OptionHandler* op(new UnitNumberOptionHandler( | |
- PREF_MIN_SPLIT_SIZE, TEXT_MIN_SPLIT_SIZE, "20M", 1_m, 1_g, 'k')); | |
+ PREF_MIN_SPLIT_SIZE, TEXT_MIN_SPLIT_SIZE, "1M", 1_k, 1_g, 'k')); | |
op->addTag(TAG_BASIC); | |
op->addTag(TAG_FTP); | |
op->addTag(TAG_HTTP); | |
@@ -834,7 +834,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
} | |
{ | |
OptionHandler* op(new NumberOptionHandler( | |
- PREF_CONNECT_TIMEOUT, TEXT_CONNECT_TIMEOUT, "60", 1, 600)); | |
+ PREF_CONNECT_TIMEOUT, TEXT_CONNECT_TIMEOUT, "30", 1, 600)); | |
op->addTag(TAG_FTP); | |
op->addTag(TAG_HTTP); | |
op->setInitialOption(true); | |
@@ -905,7 +905,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
} | |
{ | |
OptionHandler* op(new UnitNumberOptionHandler( | |
- PREF_PIECE_LENGTH, TEXT_PIECE_LENGTH, "1M", 1_m, 1_g)); | |
+ PREF_PIECE_LENGTH, TEXT_PIECE_LENGTH, "1M", 1_k, 1_g)); | |
op->addTag(TAG_ADVANCED); | |
op->addTag(TAG_FTP); | |
op->addTag(TAG_HTTP); | |
@@ -926,7 +926,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
} | |
{ | |
OptionHandler* op( | |
- new NumberOptionHandler(PREF_RETRY_WAIT, TEXT_RETRY_WAIT, "0", 0, 600)); | |
+ new NumberOptionHandler(PREF_RETRY_WAIT, TEXT_RETRY_WAIT, "1", 0, 600)); | |
op->addTag(TAG_FTP); | |
op->addTag(TAG_HTTP); | |
op->setInitialOption(true); | |
@@ -971,7 +971,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() | |
} | |
{ | |
OptionHandler* op( | |
- new NumberOptionHandler(PREF_SPLIT, TEXT_SPLIT, "5", 1, -1, 's')); | |
+ new NumberOptionHandler(PREF_SPLIT, TEXT_SPLIT, "128", 1, -1, 's')); | |
op->addTag(TAG_BASIC); | |
op->addTag(TAG_FTP); | |
op->addTag(TAG_HTTP); | |
-- | |
2.12.1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bash | |
case $MSYSTEM in | |
MINGW32) | |
export MINGW_PACKAGE_PREFIX=mingw-w64-i686 | |
export HOST=i686-w64-mingw32 | |
;; | |
MINGW64) | |
export MINGW_PACKAGE_PREFIX=mingw-w64-x86_64 | |
export HOST=x86_64-w64-mingw32 | |
;; | |
esac | |
# workaround for appveyor | |
git config --global user.email "[email protected]" | |
git config --global user.name "Your Name" | |
pacman -S --noconfirm --needed $MINGW_PACKAGE_PREFIX-toolchain \ | |
$MINGW_PACKAGE_PREFIX-expat $MINGW_PACKAGE_PREFIX-gmp $MINGW_PACKAGE_PREFIX-c-ares | |
PREFIX=/usr/local/$HOST | |
CPUCOUNT=$(grep -c ^processor /proc/cpuinfo) | |
curl_opts=(/usr/bin/curl --connect-timeout 15 --retry 3 | |
--retry-delay 5 --silent --location --insecure --fail) | |
clean_html_index() { | |
local url="$1" | |
local filter="${2:-(?<=href=\")[^\"]+\.(tar\.(gz|bz2|xz)|7z)}" | |
"${curl_opts[@]}" -l "$url" | grep -ioP "$filter" | sort -uV | |
} | |
clean_html_index_sqlite() { | |
local url="$1" | |
local filter="${2:-(\d+\/sqlite-autoconf-\d+\.tar\.gz)}" | |
"${curl_opts[@]}" -l "$url" | grep -ioP "$filter" | sort -uV | tail -1 | |
} | |
get_last_version() { | |
local filelist="$1" | |
local filter="$2" | |
local version="$3" | |
local ret | |
ret="$(echo "$filelist" | /usr/bin/grep -E "$filter" | sort -V | tail -1)" | |
[[ -n "$version" ]] && ret="$(echo "$ret" | /usr/bin/grep -oP "$version")" | |
echo "$ret" | |
} | |
expat_ver="$(clean_html_index https://sourceforge.net/projects/expat/files/expat/ 'expat/[0-9]+\.[0-9]+\.[0-9]+')" | |
expat_ver="$(get_last_version "${expat_ver}" expat '2\.\d+\.\d+')" | |
expat_ver="${expat_ver:-2.2.3}" | |
wget -c --no-check-certificate "https://downloads.sourceforge.net/project/expat/expat/${expat_ver}/expat-${expat_ver}.tar.bz2" | |
tar xf "expat-${expat_ver}.tar.bz2" | |
cd "expat-${expat_ver}" | |
./configure \ | |
--disable-shared \ | |
--enable-static \ | |
--prefix=/usr/local/$HOST \ | |
--host=$HOST | |
make install -j$CPUCOUNT | |
cd .. | |
rm -rf "expat-${expat_ver}" | |
sqlite_ver=$(clean_html_index_sqlite "https://www.sqlite.org/download.html") | |
[[ ! "$sqlite_ver" ]] && sqlite_ver="2017/sqlite-autoconf-3200000.tar.gz" | |
sqlite_file=$(echo ${sqlite_ver} | grep -ioP "(sqlite-autoconf-\d+\.tar\.gz)") | |
wget -c --no-check-certificate "https://www.sqlite.org/${sqlite_ver}" | |
tar xf "${sqlite_file}" | |
echo ${sqlite_ver} | |
sqlite_name=$(echo ${sqlite_ver} | grep -ioP "(sqlite-autoconf-\d+)") | |
cd "${sqlite_name}" | |
./configure \ | |
--disable-shared \ | |
--enable-static \ | |
--prefix=/usr/local/$HOST \ | |
--host=$HOST | |
make install -j$CPUCOUNT | |
cd .. | |
rm -rf "${sqlite_name}" | |
[[ ! "$cares_ver" ]] && | |
cares_ver="$(clean_html_index https://c-ares.haxx.se/download/)" && | |
cares_ver="$(get_last_version "$cares_ver" c-ares "1\.\d+\.\d")" | |
cares_ver="${cares_ver:-1.12.0}" | |
echo "c-ares-${cares_ver}" | |
wget -c --no-check-certificate "https://c-ares.haxx.se/download/c-ares-${cares_ver}.tar.gz" | |
tar xf "c-ares-${cares_ver}.tar.gz" | |
cd "c-ares-${cares_ver}" && \ | |
./configure \ | |
--disable-shared \ | |
--enable-static \ | |
--without-random \ | |
--prefix=/usr/local/$HOST \ | |
--host=$HOST \ | |
LIBS="-lws2_32" | |
make install -j$CPUCOUNT | |
cd .. | |
rm -rf "c-ares-${cares_ver}" | |
[[ ! "$ssh_ver" ]] && | |
ssh_ver="$(clean_html_index https://libssh2.org/download/)" && | |
ssh_ver="$(get_last_version "$ssh_ver" tar.gz "1\.\d+\.\d")" | |
ssh_ver="${ssh_ver:-1.8.0}" | |
echo "${ssh_ver}" | |
wget -c --no-check-certificate "https://libssh2.org/download/libssh2-${ssh_ver}.tar.gz" | |
tar xf "libssh2-${ssh_ver}.tar.gz" | |
cd "libssh2-${ssh_ver}" | |
./configure \ | |
--disable-shared \ | |
--enable-static \ | |
--prefix=/usr/local/$HOST \ | |
--host=$HOST \ | |
--without-openssl \ | |
--with-wincng \ | |
LIBS="-lws2_32" | |
make install -j$CPUCOUNT | |
cd .. | |
rm -rf "libssh2-${ssh_ver}" | |
git clone https://github.com/aria2/aria2 --depth=1 | |
cd aria2 | |
git am ../aria2-*.patch | |
autoreconf -i | |
./configure \ | |
--host=$HOST \ | |
--prefix=$PREFIX \ | |
--without-included-gettext \ | |
--disable-nls \ | |
--with-libcares \ | |
--without-gnutls \ | |
--without-openssl \ | |
--with-sqlite3 \ | |
--without-libxml2 \ | |
--with-libexpat \ | |
--with-libz \ | |
--with-libgmp \ | |
--with-libssh2 \ | |
--without-libgcrypt \ | |
--without-libnettle \ | |
--with-cppunit-prefix=$PREFIX \ | |
ARIA2_STATIC=yes \ | |
CPPFLAGS="-I$PREFIX/include" \ | |
LDFLAGS="-L$PREFIX/lib" \ | |
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" | |
make -j$CPUCOUNT | |
strip src/aria2c.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
pushd "%~dp0" | |
setlocal EnableExtensions EnableDelayedExpansion | |
:Deps | |
set MSYSTEM=MINGW64 | |
REM MINGW64 means 64-bit build; MINGW32 means 32-bit build; | |
set msysbin=msys64\usr\bin | |
set sh=%msysbin%\bash | |
set pacman=%msysbin%\pacman | |
if exist msys64\mingw64.exe goto :Update | |
if exist busybox.exe if exist msys2-x86_64-latest.tar.xz goto :Extract | |
echo. dependency broken. download msys2-x86_64-latest.tar.xz and busybox.exe and put them in the same folder of the script. | |
echo. download busybox.exe from https://frippery.org/files/busybox/busybox.exe | |
echo. and deonload msys2-x86_64-latest.tar.xz from http://repo.msys2.org/distrib/msys2-x86_64-latest.tar.xz | |
pause | |
exit /B -1 | |
:Extract | |
busybox tar -Jxvf msys2-x86_64-latest.tar.xz | |
:Init | |
%sh% -lc "pacman-key --init && exit" 2>&1 | busybox tee -a init.log | |
:Chi_Mirror | |
for %%i in ( mirrorlist.mingw32 mirrorlist.mingw64 mirrorlist.msys) do if exist %%i copy /y %%i msys64\etc\pacman.d\ | |
:Update | |
%pacman% -Syyuu --needed --noconfirm 2>&1 | busybox tee -a update.log | |
:Install | |
%pacman% -S --needed --noconfirm base-devel zlib-devel sqlite git unzip zip tar gmp gmp-devel libssh2 libssh2-devel openssl-devel 2>&1 | busybox tee -a install.log | |
%pacman% -Sc --noconfirm 2>&1 | busybox tee -a install.log | |
:Clone | |
%sh% -lc "if [[ -d ~/aria2 ]]; then cd aria2; git pull; else git clone https://gist.github.com/a780c730b7282e090f238e8286f815f3.git aria2; cd aria2; git pull; fi" 2>&1 | busybox tee -a clone.log | |
:Build | |
%sh% -lc "cd ~/aria2 && exec ./build-aria2.sh" 2>&1 | busybox tee -a build.log | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment