SettingUpGenericBuildsystem: setup-generic-buildsystem.5.sh

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

Version 5 of the setup-generic-buildsystem.sh script. This version patches mingw-w64 and nsis automatically from an apt repositry. Only Ubuntu 14.04 is supported - use older versions of the script if you need support for older operating systems and patch MinGW manually.

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 libtool"
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"
10MINGW_PACKAGES="mingw-w64 mingw-w64-common mingw-w64-i686-dev mingw-w64-x86-64-dev"
11NSIS_PACKAGES="nsis nsis-common nsis-doc nsis-pluginapi"
12GIT_PKG="git"
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
29    echo "Example:"
30    echo
31    echo "   setup-generic-buildsystem.sh trusty"
32    echo
33    exit 1
34}
35
36install_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
52install_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
63clone_openvpn_build() {
64    if ! [ -d "openvpn-build" ]; then
65        git clone $OPENVPN_BUILD_URL
66    fi
67}
68
69# Main script
70
71export OSCODENAME=$1
72
73if [ "$OSCODENAME" = "trusty" ]; then
74    GNUEABI_PKG="gcc-4.7-arm-linux-gnueabi"
75else
76    echo "ERROR: unknown oscodename"
77    echo
78    usage
79fi
80
81check_if_root
82install_packages
83install_osslsigncode
84clone_openvpn_build