Mercurial > hg > orthanc-object-storage
annotate Aws/mingw-compile.sh @ 197:df0b6998fd27
integration 2.3.0: back to mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Jun 2024 12:38:31 +0200 |
parents | f7654d481226 |
children |
rev | line source |
---|---|
161
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 #!/bin/bash |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 # Cloud storage plugins for Orthanc |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 # Copyright (C) 2020-2023 Osimis S.A., Belgium |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 # |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 # This program is free software: you can redistribute it and/or |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 # modify it under the terms of the GNU Affero General Public License |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # as published by the Free Software Foundation, either version 3 of |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # the License, or (at your option) any later version. |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 # This program is distributed in the hope that it will be useful, but |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 # WITHOUT ANY WARRANTY; without even the implied warranty of |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # Affero General Public License for more details. |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 # |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 # You should have received a copy of the GNU Affero General Public License |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 set -ex |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 if [ "$1" != "Debug" -a "$1" != "Release" ]; then |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 echo "Please provide build type as first argument: Debug or Release" |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 exit -1 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 fi |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 if [ "$2" != "i686" -a "$2" != "x86_64" ]; then |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 echo "Please provide architecture as second argument: i686 or x86_64" |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 exit -1 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 fi |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 ## |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 ## Prepare a Docker container with mingw |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 ## |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 if [ -t 1 ]; then |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 # TTY is available => use interactive mode |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 DOCKER_FLAGS='-i' |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 fi |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 ROOT_DIR=`dirname $(readlink -f $0)`/.. |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 IMAGE=orthanc-aws-mingw |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 TARGET=${ROOT_DIR}/mingw-binaries-$2/ |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 if [ -e "${TARGET}" ]; then |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 echo "Target folder is already existing, aborting" |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 exit -1 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 fi |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 mkdir -p ${TARGET} |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 ( cd ${ROOT_DIR}/Aws/mingw-compile && \ |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 docker build -t ${IMAGE} . ) |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 ## |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 ## Build |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 ## |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 docker run -t ${DOCKER_FLAGS} --rm \ |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 --user $(id -u):$(id -g) \ |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 -v ${ROOT_DIR}/:/source:ro \ |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 -v ${TARGET}:/target:rw \ |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 ${IMAGE} \ |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 bash /source/Aws/mingw-compile/build.sh $1 $2 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 |
f7654d481226
created Aws/mingw-compile.sh
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 ls -lR ${TARGET} |