annotate Resources/Builders/Debian/docker-internal.sh @ 219:3678a028f1f6

making the project REUSE-compliant
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jul 2024 18:05:11 +0200
parents 53f3920af4c3
children 49b5413699d3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/bin/bash
219
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
2
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
3 # SPDX-FileCopyrightText: 2020-2023 Osimis S.A., 2024-2024 Orthanc Team SRL, 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
4 # SPDX-License-Identifier: AGPL-3.0-or-later
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
5
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
6 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
7 ## Python plugin for Orthanc
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
8 ## Copyright (C) 2020-2023 Osimis S.A., Belgium
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
9 ## Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
10 ## Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
11 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
12 ## This program is free software: you can redistribute it and/or
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
13 ## modify it under the terms of the GNU Affero General Public License
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
14 ## as published by the Free Software Foundation, either version 3 of
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
15 ## the License, or (at your option) any later version.
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
16 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
17 ## This program is distributed in the hope that it will be useful, but
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
18 ## WITHOUT ANY WARRANTY; without even the implied warranty of
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
19 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
20 ## Affero General Public License for more details.
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
21 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
22 ## You should have received a copy of the GNU Affero General Public License
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
23 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
24 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
25
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
26
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 set -ex
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
29 BUILD_TYPE=$1
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
30 PYTHON_VERSION=$2
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
31 USER_ID=$3
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
32 GROUP_ID=$4
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
33
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
34 # Create the same user and group than the one who is running the
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
35 # "./docker-{distro}-compile.sh" script on the hosting system (*)
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
36 groupadd -g ${GROUP_ID} -r orthanc
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
37 useradd -u ${USER_ID} -r -g orthanc orthanc
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
38
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
39 apt-get update
90
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
40 DEBIAN_FRONTEND=noninteractive apt-get -y install nano build-essential unzip cmake pkg-config python libpython3-dev curl
89
74a51200a134 fix error in Docker with debconf
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 88
diff changeset
41 apt-get -y clean
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
42 rm -rf /var/lib/apt/lists/*
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
43
90
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
44
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
45 # On Bullseye, we get "stat: cannot statx
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
46 # '/usr/share/mercurial/hgext.rc': Operation not permitted" if
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
47 # installing the "mercurial" package using apt-get. As a consequence,
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
48 # we manually install Mercurial from sources.
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
49 MERCURIAL=mercurial-5.4.1
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
50 cd /tmp
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
51 curl https://www.mercurial-scm.org/release/${MERCURIAL}.tar.gz > ${MERCURIAL}.tar.gz
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
52 tar xvf ${MERCURIAL}.tar.gz
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
53 export PATH=${PATH}:/tmp/${MERCURIAL}/
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
54
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
55
9
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
56 mkdir /tmp/source-writeable
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
57
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
58 cp -r /source/CMakeLists.txt /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
59 cp -r /source/Sources /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
60 cp -r /source/Resources /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
61
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 mkdir /tmp/build
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 cd /tmp/build
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
9
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
65 cmake /tmp/source-writeable/ \
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
66 -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
67 -DPYTHON_VERSION=${PYTHON_VERSION} \
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 -DSTATIC_BUILD=ON \
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 -DCMAKE_INSTALL_PREFIX=/target
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 make -j`nproc`
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 if [ "$1" == "Release" ]; then
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 strip ./libOrthancPython.so
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 fi
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
77 # Copy the installation to the host filesystem, using the
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
78 # newly-created user "orthanc" (*) that corresponds to the user who is
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
79 # running "./debian-{distro}-compile.sh" script. This allows to avoid
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
80 # files owned by the "root" user on the host filesystem.
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
81 su -c "cp /tmp/build/libOrthancPython.so /target" orthanc