1 | #!/bin/sh |
---|
2 | # |
---|
3 | # Script to setup the environment for openvpn-build/generic and openvpn-build/windows-nsis |
---|
4 | |
---|
5 | BUILD_DEPS="mingw-w64 man2html dos2unix nsis unzip wget curl autoconf libtool" |
---|
6 | OSSLSIGNCODE_DEPS="libssl-dev libcurl4-openssl-dev build-essential" |
---|
7 | OSSLSIGNCODE_URL="http://sourceforge.net/projects/osslsigncode/files/latest/download" |
---|
8 | OSSLSIGNCODE_PACKAGE="osslsigncode-latest.tar.gz" |
---|
9 | OPENVPN_BUILD_URL="https://github.com/OpenVPN/openvpn-build.git" |
---|
10 | MINGW_PACKAGES="mingw-w64 mingw-w64-common mingw-w64-i686-dev mingw-w64-x86-64-dev" |
---|
11 | NSIS_PACKAGES="nsis nsis-common nsis-doc nsis-pluginapi" |
---|
12 | GIT_PKG="git" |
---|
13 | |
---|
14 | check_if_root() { |
---|
15 | if ! [ `whoami` = "root" ]; then |
---|
16 | echo "ERROR: you must run this script as root!" |
---|
17 | exit 1 |
---|
18 | fi |
---|
19 | } |
---|
20 | |
---|
21 | usage() { |
---|
22 | |
---|
23 | echo "Usage: setup-generic-buildsystem.sh <oscodename>" |
---|
24 | echo |
---|
25 | echo "Parameter <oscodename> is:" |
---|
26 | echo |
---|
27 | echo " trusty (Ubuntu 14.04)" |
---|
28 | echo |
---|
29 | echo "Example:" |
---|
30 | echo |
---|
31 | echo " setup-generic-buildsystem.sh trusty" |
---|
32 | echo |
---|
33 | exit 1 |
---|
34 | } |
---|
35 | |
---|
36 | install_packages() { |
---|
37 | |
---|
38 | # We need patched .deb files fix a few serious issues: |
---|
39 | # |
---|
40 | # 1) On Ubuntu 12.04-14.04 the stock nsis version does not support long strings |
---|
41 | # required when extremely longs paths are used (Trac #465). In addition |
---|
42 | # the MinGW headers require patching since OpenVPN 2.3.8 or so. |
---|
43 | # |
---|
44 | wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg|apt-key add - |
---|
45 | echo "deb http://build.openvpn.net/apt $OSCODENAME main" > /etc/apt/sources.list.d/build.openvpn.net.list |
---|
46 | apt-get update |
---|
47 | #echo $BUILD_DEPS $GIT_PKG $GNUEABI_PKG $MINGW_PACKAGES $NSIS_PACKAGES |
---|
48 | apt-get -y install $BUILD_DEPS $GIT_PKG $GNUEABI_PKG $MINGW_PACKAGES $NSIS_PACKAGES |
---|
49 | } |
---|
50 | |
---|
51 | # osslsigncode is required for signing the binaries and installers |
---|
52 | install_osslsigncode() { |
---|
53 | apt-get -y install $OSSLSIGNCODE_DEPS |
---|
54 | curl -L $OSSLSIGNCODE_URL > $OSSLSIGNCODE_PACKAGE |
---|
55 | tar -zxf $OSSLSIGNCODE_PACKAGE |
---|
56 | cd osslsigncode-* |
---|
57 | ./configure |
---|
58 | make |
---|
59 | make install |
---|
60 | cd .. |
---|
61 | } |
---|
62 | |
---|
63 | clone_openvpn_build() { |
---|
64 | if ! [ -d "openvpn-build" ]; then |
---|
65 | git clone $OPENVPN_BUILD_URL |
---|
66 | fi |
---|
67 | } |
---|
68 | |
---|
69 | # Main script |
---|
70 | |
---|
71 | export OSCODENAME=$1 |
---|
72 | |
---|
73 | if [ "$OSCODENAME" = "trusty" ]; then |
---|
74 | GNUEABI_PKG="gcc-4.7-arm-linux-gnueabi" |
---|
75 | else |
---|
76 | echo "ERROR: unknown oscodename" |
---|
77 | echo |
---|
78 | usage |
---|
79 | fi |
---|
80 | |
---|
81 | check_if_root |
---|
82 | install_packages |
---|
83 | install_osslsigncode |
---|
84 | clone_openvpn_build |
---|