Skip to content

Commit 2474bee

Browse files
committed
Improve the Aria2 source code download process
1 parent 2ed88ea commit 2474bee

10 files changed

+32
-21
lines changed

aria2-gnu-linux-build-amd64.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# File name: aria2-gnu-linux-build.sh
1010
# Description: Aria2 ard64 platform build
1111
# System Required: Debian & Ubuntu & Fedora & Arch Linux
12-
# Version: 1.5
12+
# Version: 1.6
1313
#
1414

1515
set -e
@@ -21,6 +21,7 @@ SCRIPT_DIR=$(dirname $(readlink -f $0))
2121
ARCH="amd64"
2222
OPENSSL_ARCH="linux-x86_64"
2323
BUILD_DIR="/tmp"
24+
ARIA2_CODE_DIR="$BUILD_DIR/aria2"
2425
OUTPUT_DIR="$HOME/output"
2526
PREFIX="$BUILD_DIR/aria2-build-libs"
2627
ARIA2_PREFIX="/usr/local"

aria2-gnu-linux-build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# File name: aria2-gnu-linux-build.sh
1010
# Description: Aria2 Build on the target platforms
1111
# System Required: Debian & Ubuntu & Fedora & Arch Linux
12-
# Version: 1.5
12+
# Version: 1.6
1313
#
1414

1515
set -e
@@ -21,6 +21,7 @@ SCRIPT_DIR=$(dirname $(readlink -f $0))
2121
ARCH="$(uname -m)"
2222
OPENSSL_ARCH="linux-elf"
2323
BUILD_DIR="/tmp"
24+
ARIA2_CODE_DIR="$BUILD_DIR/aria2"
2425
OUTPUT_DIR="$HOME/output"
2526
PREFIX="$BUILD_DIR/aria2-build-libs"
2627
ARIA2_PREFIX="/usr/local"

aria2-gnu-linux-cross-build-arm64.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# File name: aria2-gnu-linux-cross-build-arm64.sh
1010
# Description: Aria2 ard64 platform cross build
1111
# System Required: Debian & Ubuntu & Fedora & Arch Linux
12-
# Version: 1.5
12+
# Version: 1.6
1313
#
1414

1515
set -e
@@ -22,6 +22,7 @@ ARCH="arm64"
2222
HOST="aarch64-linux-gnu"
2323
OPENSSL_ARCH="linux-aarch64"
2424
BUILD_DIR="/tmp"
25+
ARIA2_CODE_DIR="$BUILD_DIR/aria2"
2526
OUTPUT_DIR="$HOME/output"
2627
PREFIX="$BUILD_DIR/aria2-cross-build-libs-$ARCH"
2728
ARIA2_PREFIX="$HOME/aria2-local"

aria2-gnu-linux-cross-build-armhf.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# File name: aria2-gnu-linux-cross-build-armhf.sh
1010
# Description: Aria2 armhf platform cross build
1111
# System Required: Ubuntu 14.04/16.04
12-
# Version: 1.5
12+
# Version: 1.6
1313
#
1414

1515
set -e
@@ -22,6 +22,7 @@ ARCH="armhf"
2222
HOST="arm-linux-gnueabihf"
2323
OPENSSL_ARCH="linux-generic32"
2424
BUILD_DIR="/tmp"
25+
ARIA2_CODE_DIR="$BUILD_DIR/aria2"
2526
OUTPUT_DIR="$HOME/output"
2627
PREFIX="$BUILD_DIR/aria2-cross-build-libs-$ARCH"
2728
ARIA2_PREFIX="$HOME/aria2-local"

aria2-gnu-linux-cross-build-i386.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# File name: aria2-gnu-linux-cross-build-i386.sh
1010
# Description: Aria2 i386 platform cross build
1111
# System Required: Debian & Ubuntu & Fedora & Arch Linux
12-
# Version: 1.5
12+
# Version: 1.6
1313
#
1414

1515
set -e
@@ -22,6 +22,7 @@ ARCH="i386"
2222
HOST="i686-linux-gnu"
2323
OPENSSL_ARCH="linux-x86"
2424
BUILD_DIR="/tmp"
25+
ARIA2_CODE_DIR="$BUILD_DIR/aria2"
2526
OUTPUT_DIR="$HOME/output"
2627
PREFIX="$BUILD_DIR/aria2-cross-build-libs-$ARCH"
2728
ARIA2_PREFIX="$HOME/aria2-local"

snippet/aria2-bin

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
#
1010

1111
ARIA2_BIN() {
12-
cd $BUILD_DIR/aria2/src
12+
cd $ARIA2_CODE_DIR/src
1313
$STRIP aria2c
1414
mkdir -p $OUTPUT_DIR
1515
cp aria2c $OUTPUT_DIR
1616
}
1717

1818
ARIA2_PACKAGE() {
19-
cd $BUILD_DIR/aria2/src
19+
cd $ARIA2_CODE_DIR/src
2020
$STRIP aria2c
2121
mkdir -p $OUTPUT_DIR
2222
tar zcvf $OUTPUT_DIR/aria2-static-linux-$ARCH.tar.gz aria2c
2323
}
2424

2525
ARIA2_INSTALL() {
26-
cd $BUILD_DIR/aria2
26+
cd $ARIA2_CODE_DIR
2727
make install-strip
2828
}

snippet/aria2-code

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@
88
# File name: snippet/aria2-code
99
#
1010

11-
ARIA2_SOURCE() {
12-
if [ -e $BUILD_DIR/aria2 ]; then
13-
cd $BUILD_DIR/aria2
11+
ARIA2_GIT_CODE() {
12+
if [[ -d $ARIA2_CODE_DIR && -d $ARIA2_CODE_DIR/.git ]]; then
13+
cd $ARIA2_CODE_DIR
14+
git checkout master || git checkout HEAD
1415
git reset --hard origin || git reset --hard
1516
git pull
1617
else
17-
git clone https://github.com/aria2/aria2 $BUILD_DIR/aria2
18-
cd $BUILD_DIR/aria2
18+
rm -rf $ARIA2_CODE_DIR
19+
git clone https://github.com/aria2/aria2 $ARIA2_CODE_DIR
20+
cd $ARIA2_CODE_DIR
1921
fi
20-
autoreconf -i
22+
autoreconf -fi || autoreconf -fiv
2123
}
2224

23-
ARIA2_RELEASE() {
24-
mkdir -p $BUILD_DIR/aria2 && cd $BUILD_DIR/aria2
25+
ARIA2_RELEASE_CODE() {
26+
mkdir -p $ARIA2_CODE_DIR && cd $ARIA2_CODE_DIR
2527
curl -s 'https://api.github.com/repos/aria2/aria2/releases/latest' |
2628
grep 'browser_download_url.*[0-9]\.tar\.xz' | sed -e 's/^[[:space:]]*//' |
2729
cut -d ' ' -f 2 | xargs -I % curl -Ls -o - '%' | tar Jxvf - --strip-components=1
@@ -30,3 +32,9 @@ ARIA2_RELEASE() {
3032
ARIA2_PATCH() {
3133
git apply $SCRIPT_DIR/patch/*.patch
3234
}
35+
36+
ARIA2_CODE_GET() {
37+
#ARIA2_RELEASE_CODE
38+
ARIA2_GIT_CODE
39+
ARIA2_PATCH
40+
}

snippet/clean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CLEANUP_SRC() {
1717
openssl \
1818
sqlite3 \
1919
libssh2 \
20-
aria2
20+
$ARIA2_CODE_DIR
2121
}
2222

2323
CLEANUP_LIB() {

snippet/cross-build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ JEMALLOC_BUILD() {
9494
}
9595

9696
ARIA2_BUILD() {
97-
ARIA2_RELEASE || ARIA2_SOURCE
98-
ARIA2_PATCH
97+
ARIA2_CODE_GET
9998
./configure \
10099
--host=$HOST \
101100
--prefix=${ARIA2_PREFIX:-'/usr/loacl'} \

snippet/target-build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ JEMALLOC_BUILD() {
8585
}
8686

8787
ARIA2_BUILD() {
88-
ARIA2_RELEASE || ARIA2_SOURCE
89-
ARIA2_PATCH
88+
ARIA2_CODE_GET
9089
./configure \
9190
--prefix=${ARIA2_PREFIX:-'/usr/loacl'} \
9291
--without-libxml2 \

0 commit comments

Comments
 (0)