58
|
1 #!/bin/bash
|
|
2
|
|
3 # Cloud storage plugins for Orthanc
|
|
4 # Copyright (C) 2020-2021 Osimis S.A., Belgium
|
|
5 #
|
|
6 # This program is free software: you can redistribute it and/or
|
|
7 # modify it under the terms of the GNU Affero General Public License
|
|
8 # as published by the Free Software Foundation, either version 3 of
|
|
9 # the License, or (at your option) any later version.
|
|
10 #
|
|
11 # This program is distributed in the hope that it will be useful, but
|
|
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 # Affero General Public License for more details.
|
|
15 #
|
|
16 # You should have received a copy of the GNU Affero General Public License
|
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
|
19
|
|
20 ##
|
|
21 ## This script compiles cross-distribution Linux binaries thanks to
|
|
22 ## Holy Build Box: https://github.com/phusion/holy-build-box
|
|
23 ##
|
|
24 ## The ideal solution would be to use Linux Standard Base
|
|
25 ## (LSB). Unfortunately, the LSB C++ compiler is a pre-4.8 gcc that
|
|
26 ## does not feature full C++11 capabilities, which prevents compiling
|
|
27 ## AWS SDK.
|
|
28 ##
|
|
29
|
|
30 set -ex
|
|
31
|
|
32 if [ "$1" != "Debug" -a "$1" != "Release" ]; then
|
|
33 echo "Please provide build type: Debug or Release"
|
|
34 exit -1
|
|
35 fi
|
|
36
|
|
37 if [ -t 1 ]; then
|
|
38 # TTY is available => use interactive mode
|
|
39 DOCKER_FLAGS='-i'
|
|
40 fi
|
|
41
|
|
42 ROOT_DIR=`dirname $(readlink -f $0)`/..
|
|
43
|
|
44 DOCKER_IMAGE=phusion/holy-build-box-64:3.0.0
|
|
45
|
|
46 mkdir -p ${ROOT_DIR}/holy-build-box
|
|
47
|
|
48 # Mapping "/etc/passwd" and "/etc/group" is necessary, otherwise git
|
|
49 # fails with error: "fatal: unable to look up current user in the
|
|
50 # passwd file: no such user"
|
|
51 docker run -t ${DOCKER_FLAGS} --rm \
|
|
52 --user $(id -u):$(id -g) \
|
|
53 -v /etc/passwd:/etc/passwd:ro \
|
|
54 -v /etc/group:/etc/group:ro \
|
|
55 -v ${ROOT_DIR}:/source:ro \
|
|
56 -v ${ROOT_DIR}/holy-build-box:/target:rw \
|
|
57 ${DOCKER_IMAGE} \
|
|
58 bash /source/Aws/holy-build-box-internal.sh $1
|
|
59
|
|
60 ls -lR ${ROOT_DIR}/holy-build-box/
|