Last active
November 7, 2023 08:18
-
-
Save Acris/60abe3f1a17567a7986000745fbe2742 to your computer and use it in GitHub Desktop.
Build shadowsocks-libev for asuswrt-merlin
This file contains hidden or 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
#!/bin/bash | |
set -e | |
# libev version | |
LIBEV_VER=4.27 | |
# mbedTLS version | |
MBEDTLS_VER=2.16.2 | |
# libsodium version | |
LIBSODIUM_VER=1.0.18 | |
# PCRE version | |
PCRE_VER=8.43 | |
# c-ares version | |
CARES_VER=1.15.0 | |
# shadowsocks-libev version | |
SHADOWSOCKS_VER=3.3.3 | |
# Preparing | |
BUILD="/home/build" | |
mkdir -p $BUILD/src | |
mkdir -p $BUILD/arm | |
export ARM=$BUILD/arm | |
export SRC=$BUILD/src | |
# Set environment | |
# For Broadcom SDK6/SDK7 ARM platform (RT-AC56 upto RT-AC5300) | |
. /root/env/bcm-sdk.sh | |
# For Broadcom HND ARM platform (RT-AC86U) | |
#. /root/env/bcm-hnd.sh | |
# For Broadcom HND AX ARM (RT-AX88U) | |
#. /root/env/bcm-hnd-802.11ax.sh | |
# Build mbedTLS | |
cd $SRC | |
wget --no-check-certificate https://tls.mbed.org/download/mbedtls-${MBEDTLS_VER}-gpl.tgz | |
tar -xzvf mbedtls-${MBEDTLS_VER}-gpl.tgz | |
cd mbedtls-${MBEDTLS_VER} | |
CC=arm-linux-gcc AR=arm-linux-ar LD=arm-linux-ld LDFLAGS=-static make SHARED=1 CFLAGS="-O2 -fPIC" -j$(nproc) && make DESTDIR=$ARM/mbedtls install | |
# Build PCRE | |
cd $SRC | |
wget https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VER}.tar.gz | |
tar -xzvf pcre-${PCRE_VER}.tar.gz | |
cd pcre-${PCRE_VER} | |
CPPFLAGS="-DNEED_PRINTF" ./configure --host=arm-linux --prefix=$ARM/pcre --enable-jit --enable-utf8 --enable-unicode-properties --disable-shared | |
make -j$(nproc) && make install | |
# Build libsodium | |
cd $SRC | |
wget --no-check-certificate https://download.libsodium.org/libsodium/releases/libsodium-${LIBSODIUM_VER}.tar.gz | |
tar -xzvf libsodium-${LIBSODIUM_VER}.tar.gz | |
cd libsodium-${LIBSODIUM_VER} | |
./configure --host=arm-linux --prefix=$ARM/libsodium --disable-ssp --disable-shared | |
make -j$(nproc) && make install | |
# Build libev | |
cd $SRC | |
wget http://dist.schmorp.de/libev/Attic/libev-${LIBEV_VER}.tar.gz | |
tar -xzvf libev-${LIBEV_VER}.tar.gz | |
cd libev-${LIBEV_VER} | |
./configure --host=arm-linux --prefix=$ARM/libev --disable-shared | |
make -j$(nproc) && make install | |
# Build c-ares | |
cd $SRC | |
wget https://c-ares.haxx.se/download/c-ares-${CARES_VER}.tar.gz | |
tar -xzvf c-ares-${CARES_VER}.tar.gz | |
cd c-ares-${CARES_VER} | |
./configure --host=arm-linux --prefix=$ARM/c-ares --disable-shared | |
make -j$(nproc) && make install | |
# Build shadowsocks-libev | |
cd $SRC | |
wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SHADOWSOCKS_VER}/shadowsocks-libev-${SHADOWSOCKS_VER}.tar.gz | |
tar xvf shadowsocks-libev-${SHADOWSOCKS_VER}.tar.gz | |
cd shadowsocks-libev-${SHADOWSOCKS_VER} | |
LIBS="-lpthread -lm" LDFLAGS="-Wl,-static -static-libgcc -L$ARM/c-ares/lib -L$ARM/libev/lib" CFLAGS="-I$ARM/c-ares/include -I$ARM/libev/include" ./configure --host=arm-linux --prefix=$ARM/shadowsocks --disable-ssp --disable-documentation --disable-assert --with-mbedtls=$ARM/mbedtls --with-pcre=$ARM/pcre --with-sodium=$ARM/libsodium | |
make -j$(nproc) && make install |
Hi. After installed this script I'm give ss-server or ss-client on my router?
@avalonix This script only compiles the binary for the ARM platform.
I have Asus ac68u wrt Merlin router and shadowsocks server in Europe. I need shadowsocks client for wrt Merlin . This script install client?
@avalonix This script does not install shadowsocks client on your router, please try this one: https://github.com/Acris/shadowsocks-asuswrt-merlin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quick Start
Start docker container
Get the build script
Build
Get the binary
you can find binary in
/home/build/arm/shadowsocks/bin
, you can also strip the binary file byarm-uclibc-strip
for Broadcom SDK6/SDK7 ARM platform orarm-linux-strip
for Broadcom HND ARM platform.