-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathopenvpn.sh
executable file
·94 lines (75 loc) · 2.64 KB
/
openvpn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -e
set -x
mkdir ~/openvpn && cd ~/openvpn
BASE=`pwd`
SRC=$BASE/src
WGET="wget --prefer-family=IPv4"
DEST=$BASE/jffs
LDFLAGS="-L$DEST/lib -Wl,--gc-sections"
CPPFLAGS="-I$DEST/include"
CFLAGS="-mtune=mips32 -mips32 -O3 -ffunction-sections -fdata-sections"
CXXFLAGS=$CFLAGS
CONFIGURE="./configure --prefix=/jffs --host=mipsel-linux"
MAKE="make -j`nproc`"
mkdir $SRC
######## ####################################################################
# ZLIB # ####################################################################
######## ####################################################################
mkdir $SRC/zlib && cd $SRC/zlib
$WGET http://www.zlib.net/zlib-1.2.10.tar.gz
tar zxvf zlib-1.2.10.tar.gz
cd zlib-1.2.10
LDFLAGS=$LDFLAGS \
CPPFLAGS=$CPPFLAGS \
CFLAGS=$CFLAGS \
CXXFLAGS=$CXXFLAGS \
CROSS_PREFIX=mipsel-linux- \
./configure \
--prefix=/jffs
$MAKE
make install DESTDIR=$BASE
########### #################################################################
# OPENSSL # #################################################################
########### #################################################################
mkdir -p $SRC/openssl && cd $SRC/openssl
$WGET https://www.openssl.org/source/openssl-1.0.2j.tar.gz
tar zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./Configure linux-mips32 \
-mtune=mips32 -mips32 -ffunction-sections -fdata-sections -Wl,--gc-sections \
--prefix=/opts zlib \
--with-zlib-lib=$DEST/lib \
--with-zlib-include=$DEST/include
make CC=mipsel-linux-gcc
make CC=mipsel-linux-gcc install INSTALLTOP=$DEST OPENSSLDIR=$DEST/ssl
######## ####################################################################
# LZO2 # ####################################################################
######## ####################################################################
mkdir $SRC/lzo2 && cd $SRC/lzo2
$WGET http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz
tar zxvf lzo-2.09.tar.gz
cd lzo-2.09
LDFLAGS=$LDFLAGS \
CPPFLAGS=$CPPFLAGS \
CFLAGS=$CFLAGS \
CXXFLAGS=$CXXFLAGS \
$CONFIGURE
$MAKE
make install DESTDIR=$BASE
########### #################################################################
# OPENVPN # #################################################################
########### #################################################################
mkdir $SRC/openvpn && cd $SRC/openvpn
$WGET https://swupdate.openvpn.org/community/releases/openvpn-2.4.0.tar.gz
tar zxvf openvpn-2.4.0.tar.gz
cd openvpn-2.4.0
LIBS="-lssl -lcrypto -lz" \
LDFLAGS=$LDFLAGS \
CPPFLAGS=$CPPFLAGS \
CFLAGS=$CFLAGS \
CXXFLAGS=$CXXFLAGS \
$CONFIGURE \
--disable-plugins
$MAKE LIBS="-all-static -lssl -lcrypto -lz -llzo2"
make install DESTDIR=$BASE/openvpn