SettingUpGenericBuildsystem: setup-generic-buildsystem.7.sh

File setup-generic-buildsystem.7.sh, 1.4 KB (added by Samuli Seppänen, 4 years ago)

Setup openvpn-build on Ubuntu 16.04 - fix osslsigncode download URL and exit on any error

Line 
1#!/bin/sh
2#
3# Script to setup the environment for openvpn-build/generic and openvpn-build/windows-nsis
4
5# Exit immediate on errors
6set -e
7
8BUILD_DEPS="mingw-w64 man2html dos2unix nsis unzip wget curl autoconf libtool gcc-arm-linux-gnueabi"
9OSSLSIGNCODE_DEPS="libssl-dev libcurl4-openssl-dev build-essential"
10OSSLSIGNCODE_URL="https://netcologne.dl.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz"
11OSSLSIGNCODE_PACKAGE="osslsigncode-latest.tar.gz"
12OPENVPN_BUILD_URL="https://github.com/OpenVPN/openvpn-build.git"
13MINGW_PACKAGES="mingw-w64 mingw-w64-common mingw-w64-i686-dev mingw-w64-x86-64-dev"
14NSIS_PACKAGES="nsis nsis-common nsis-doc nsis-pluginapi"
15GIT_PKG="git"
16
17check_if_root() {
18    if ! [ `whoami` = "root" ]; then
19            echo "ERROR: you must run this script as root!"
20            exit 1
21    fi
22}
23
24install_packages() {
25    apt-get update
26    apt-get -y install $BUILD_DEPS $GIT_PKG $GNUEABI_PKG $MINGW_PACKAGES $NSIS_PACKAGES
27}
28
29# osslsigncode is required for signing the binaries and installers
30install_osslsigncode() {
31    apt-get -y install $OSSLSIGNCODE_DEPS
32    curl -L $OSSLSIGNCODE_URL > $OSSLSIGNCODE_PACKAGE
33    tar -zxf $OSSLSIGNCODE_PACKAGE
34    cd osslsigncode-*
35    ./configure
36    make
37    make install
38    cd ..
39}
40
41clone_openvpn_build() {
42    if ! [ -d "openvpn-build" ]; then
43        git clone $OPENVPN_BUILD_URL
44    fi
45}
46
47# Main script
48check_if_root
49install_packages
50install_osslsigncode
51clone_openvpn_build