SettingUpGenericBuildsystem: setup-generic-buildsystem.2.sh

File setup-generic-buildsystem.2.sh, 2.7 KB (added by Samuli Seppänen, 8 years ago)

Updated script to support Ubuntu 14.04

Line 
1#!/bin/sh
2#
3# Script to setup the environment for openvpn-build/generic and openvpn-build/windows-nsis
4
5BUILD_DEPS="mingw-w64 man2html dos2unix nsis unzip wget curl autoconf"
6OSSLSIGNCODE_DEPS="libssl-dev libcurl4-openssl-dev build-essential"
7OSSLSIGNCODE_URL="http://sourceforge.net/projects/osslsigncode/files/latest/download"
8OSSLSIGNCODE_PACKAGE="osslsigncode-latest.tar.gz"
9OPENVPN_BUILD_URL="https://github.com/OpenVPN/openvpn-build.git"
10PATCHED_DEBS_BASEURL="http://build.openvpn.net/downloads/packaging"
11PATCHED_DEBS_PRECISE="mingw-w64-dev_2.0.1-101_all.deb mingw-w64-tools_2.0.1-101_amd64.deb mingw-w64_2.0.1-101_all.deb nsis-common_2.46-101_all.deb nsis-doc_2.46-101_all.deb nsis-pluginapi_2.46-101_all.deb nsis_2.46-101_amd64.deb"
12PATCHED_DEBS_QUANTAL="mingw-w64-dev_2.0.3-101_all.deb mingw-w64-tools_2.0.3-101_amd64.deb mingw-w64_2.0.3-101_all.deb mingw-w64-i686-dev_2.0.3-101_all.deb mingw-w64-x86-64-dev_2.0.3-101_all.deb nsis-common_2.46-101_all.deb nsis-doc_2.46-101_all.deb nsis-pluginapi_2.46-101_all.deb nsis_2.46-101_amd64.deb"
13
14check_if_root() {
15    if ! [ `whoami` = "root" ]; then
16            echo "ERROR: you must run this script as root!"
17            exit 1
18    fi
19}
20
21usage() {
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 "    precise (Ubuntu 12.04)"
29    echo "    quantal (Ubuntu 12.10)"
30    echo
31    echo "Example:"
32    echo
33    echo "   setup-generic-buildsystem.sh trusty"
34    echo
35    exit 1
36}
37
38install_prequisites() {
39    #apt-get update
40    apt-get -y install $BUILD_DEPS $GIT_PKG $GNUEABI_PKG
41}
42
43install_osslsigncode() {
44    apt-get -y install $OSSLSIGNCODE_DEPS
45    curl -L $OSSLSIGNCODE_URL > $OSSLSIGNCODE_PACKAGE
46    tar -zxf $OSSLSIGNCODE_PACKAGE
47    cd osslsigncode-*
48    ./configure
49    make
50    make install
51    cd ..
52}
53
54install_patched_debs() {
55
56    for DEB in $PATCHED_DEBS; do
57        if ! [ -r $DEB ]; then
58            curl -O $PATCHED_DEBS_BASEURL/$DEB
59        fi
60    done
61    dpkg -i $PATCHED_DEBS
62}
63
64clone_openvpn_build() {
65    if ! [ -d "openvpn-build" ]; then
66        git clone $OPENVPN_BUILD_URL
67    fi
68}
69
70OSCODENAME=$1
71
72if [ "$OSCODENAME" = "trusty" ]; then
73    PATCHED_DEBS=""
74    GIT_PKG="git"
75    GNUEABI_PKG="gcc-4.7-arm-linux-gnueabi"
76elif [ "$OSCODENAME" = "precise" ]; then
77    PATCHED_DEBS=$PATCHED_DEBS_PRECISE
78    GIT_PKG="git-core"
79    GNUEABI_PKG="gcc-4.6-arm-linux-gnueabi"
80elif [ "$OSCODENAME" = "quantal" ]; then
81    PATCHED_DEBS=$PATCHED_DEBS_QUANTAL
82    GIT_PKG="git-core"
83    GNUEABI_PKG="gcc-4.6-arm-linux-gnueabi"
84else
85    echo "ERROR: unknown oscodename"
86    echo
87    usage
88fi
89
90check_if_root
91install_prequisites
92install_osslsigncode
93
94if ! [ "$PATCHED_DEBS" = "" ]; then
95    install_patched_debs
96fi
97
98clone_openvpn_build