comparison Resources/CreateThreeDist.sh @ 0:4e889a8e8be2

initial commit of the viewer plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Jul 2023 19:15:27 +0200
parents
children 42ebec01143b
comparison
equal deleted inserted replaced
-1:000000000000 0:4e889a8e8be2
1 #!/bin/bash
2
3 # SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 # STL plugin for Orthanc
7 # Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
8 #
9 # This program is free software: you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation, either version 3 of the
12 # License, or (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22
23
24 # This command-line script uses the "npm" tool to populate the "dist"
25 # folder of Three.js. It uses Docker to this end, in order to be
26 # usable on our CIS.
27
28 set -ex
29
30 if [ "$1" = "" ]; then
31 PACKAGE=three.js-r154-sources
32 else
33 PACKAGE=$1
34 fi
35
36 if [ -t 1 ]; then
37 # TTY is available => use interactive mode
38 DOCKER_FLAGS='-i'
39 fi
40
41 ROOT_DIR=`dirname $(readlink -f $0)`/..
42 IMAGE=orthanc-stl-node
43
44 echo "Creating the distribution of Three.js from $PACKAGE"
45
46 if [ -e "${ROOT_DIR}/Three/dist/" ]; then
47 echo "Target folder is already existing, aborting"
48 exit -1
49 fi
50
51 if [ ! -f "${ROOT_DIR}/Three/${PACKAGE}.tar.gz" ]; then
52 mkdir -p "${ROOT_DIR}/Three"
53 ( cd ${ROOT_DIR}/Three && \
54 wget https://orthanc.uclouvain.be/third-party-downloads/${PACKAGE}.tar.gz )
55 fi
56
57 mkdir -p ${ROOT_DIR}/Three/dist/
58
59 ( cd ${ROOT_DIR}/Resources/CreateThreeDist && \
60 docker build --no-cache -t ${IMAGE} . )
61
62 docker run -t ${DOCKER_FLAGS} --rm \
63 --user $(id -u):$(id -g) \
64 -v ${ROOT_DIR}/Resources/CreateThreeDist/build.sh:/source/build.sh:ro \
65 -v ${ROOT_DIR}/Three/${PACKAGE}.tar.gz:/source/${PACKAGE}.tar.gz:ro \
66 -v ${ROOT_DIR}/Three/dist/:/target:rw \
67 ${IMAGE} \
68 bash /source/build.sh ${PACKAGE}