annotate Aws/holy-build-box-compile.sh @ 58:37185ec1cf49

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