annotate Resources/holy-build-box-compile.sh @ 4:58a9a644bd15

check for tty
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Jun 2019 16:06:27 +0200
parents cd1231292eb6
children 4b5362d154f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/bin/bash
2
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
2
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
3 ##
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
4 ## This script compiles cross-distribution Linux binaries thanks to
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
5 ## Holy Build Box: https://github.com/phusion/holy-build-box
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
6 ##
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
7 ## The ideal solution would be to use Linux Standard Base
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
8 ## (LSB). Unfortunately, the LSB C++ compiler is a pre-4.8 gcc that
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
9 ## does not feature full C++11 capabilities, which prevents compiling
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
10 ## the google-cloud-cpp project.
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
11 ##
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
12
0
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 set -ex
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
3
cd1231292eb6 build type in holy build box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
15 if [ "$1" != "Debug" -a "$1" != "Release" ]; then
cd1231292eb6 build type in holy build box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
16 echo "Please provide build type: Debug or Release"
cd1231292eb6 build type in holy build box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
17 exit -1
cd1231292eb6 build type in holy build box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
18 fi
cd1231292eb6 build type in holy build box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
19
4
58a9a644bd15 check for tty
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3
diff changeset
20 if [ -t 1 ]; then
58a9a644bd15 check for tty
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3
diff changeset
21 # TTY is available => use interactive mode
58a9a644bd15 check for tty
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3
diff changeset
22 DOCKER_FLAGS='-i'
58a9a644bd15 check for tty
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3
diff changeset
23 fi
58a9a644bd15 check for tty
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3
diff changeset
24
0
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 ROOT_DIR=`dirname $(readlink -f $0)`/..
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
2
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
27 mkdir -p ${ROOT_DIR}/holy-build-box
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
28
4
58a9a644bd15 check for tty
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3
diff changeset
29 docker run -t ${DOCKER_FLAGS} --rm \
2
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
30 --user $(id -u):$(id -g) \
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
31 -v ${ROOT_DIR}:/source:ro \
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
32 -v ${ROOT_DIR}/holy-build-box:/target:rw \
39bdff8f0247 user management in holy-build-box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1
diff changeset
33 phusion/holy-build-box-64:2.0.1 \
3
cd1231292eb6 build type in holy build box
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
34 bash /source/Resources/holy-build-box-internal.sh $1
0
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 ls -l ${ROOT_DIR}/holy-build-box/