Skip to content

Instantly share code, notes, and snippets.

@cuteribs-1
Last active January 21, 2019 15:24
Show Gist options
  • Save cuteribs-1/aec3239bdea0ce8198f005a47c6af52b to your computer and use it in GitHub Desktop.
Save cuteribs-1/aec3239bdea0ce8198f005a47c6af52b to your computer and use it in GitHub Desktop.
#!/bin/sh

#export PATH=$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
#host=arm-buildroot-linux-gnueabi
export PATH=$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
host=aarch64-buildroot-linux-gnu
prefix=/opt/dists

# build mbedtls
cd /opt
ver=2.6.0
#wget --no-check-certificate https://tls.mbed.org/download/mbedtls-$ver-gpl.tgz
#tar zxf mbedtls-$ver-gpl.tgz
cd mbedtls-$ver
sed -i "s/DESTDIR=\/usr\/local/DESTDIR=\/opt\/dists\/mbedtls/g" Makefile
CC=$host-gcc AR=$host-ar LD=$host-ld LDFLAGS=-static make install

# build pcre
cd /opt
ver=8.41
#wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$ver.tar.gz
#tar zxf pcre-$ver.tar.gz
cd pcre-$ver
./configure --host=$host --prefix=$prefix/pcre --disable-shared --enable-utf8 --enable-unicode-properties
make && make install

# build libsodium
cd /opt
ver=1.0.13
#wget --no-check-certificate https://download.libsodium.org/libsodium/releases/libsodium-$ver.tar.gz
#tar zxf libsodium-$ver.tar.gz
cd libsodium-$ver
./configure --host=$host --prefix=$prefix/libsodium --disable-ssp --disable-shared
make && make install

# build libev
cd /opt
ver=4.24
#wget http://dist.schmorp.de/libev/libev-$ver.tar.gz
#tar zxf libev-$ver.tar.gz
cd /libev-$ver
./configure --host=$host --prefix=$prefix/libev --disable-shared
make && make install

# build libudns
cd /opt
#git clone https://github.com/shadowsocks/libudns
cd libudns
./autogen.sh
./configure --host=$host --prefix=$prefix/libudns
make && make install

# build shadowsocks-libev
ver=v3.0.8
cd /opt
#git clone -b $ver https://github.com/shadowsocks/shadowsocks-libev
cd shadowsocks-libev
#git submodule init && git submodule update
./autogen.sh
LIBS="-lpthread -lm" LDFLAGS="-Wl,-static -static -static-libgcc -L$prefix/libudns/lib -L$prefix/libev/lib" CFLAGS="-I$prefix/libudns/include -I$prefix/libev/include" ./configure --host=$host --prefix=$prefix/shadowsocks-libev --disable-ssp --disable-documentation --with-mbedtls=$prefix/mbedtls --with-pcre=$prefix/pcre --with-sodium=$prefix/libsodium
make && make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment