comparison Resources/CreateJavaScriptLibraries.sh @ 37:2cc9950018ab

replaced folder ./Three by ./JavaScriptLibraries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Apr 2024 07:52:43 +0200
parents Resources/CreateThreeDist.sh@dd0cd39e6259
children 970994058acd
comparison
equal deleted inserted replaced
36:13698d34e059 37:2cc9950018ab
1 #!/bin/bash
2
3 # SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 # STL plugin for Orthanc
7 # Copyright (C) 2023-2024 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
25 # "JavaScriptLibraries/dist" folder. It uses Docker to this end, in
26 # order to be usable on our CIS.
27
28 set -ex
29
30
31 ##
32 ## Prepare a Docker container with npm
33 ##
34
35 if [ -t 1 ]; then
36 # TTY is available => use interactive mode
37 DOCKER_FLAGS='-i'
38 fi
39
40 ROOT_DIR=`dirname $(readlink -f $0)`/..
41 IMAGE=orthanc-stl-node
42
43 if [ -e "${ROOT_DIR}/JavaScriptLibraries/dist/" ]; then
44 echo "Target folder is already existing, aborting"
45 exit -1
46 fi
47
48 mkdir -p ${ROOT_DIR}/JavaScriptLibraries/dist/
49
50 ( cd ${ROOT_DIR}/Resources/CreateJavaScriptLibraries && \
51 docker build --no-cache -t ${IMAGE} . )
52
53
54 ##
55 ## Building Three.js
56 ##
57
58 THREE=three.js-r154-sources
59
60 echo "Creating the distribution of Three.js from $THREE"
61
62 if [ ! -f "${ROOT_DIR}/JavaScriptLibraries/${THREE}.tar.gz" ]; then
63 mkdir -p "${ROOT_DIR}/JavaScriptLibraries"
64 ( cd ${ROOT_DIR}/JavaScriptLibraries && \
65 wget https://orthanc.uclouvain.be/downloads/third-party-downloads/${THREE}.tar.gz )
66 fi
67
68 docker run -t ${DOCKER_FLAGS} --rm \
69 --user $(id -u):$(id -g) \
70 -v ${ROOT_DIR}/Resources/CreateJavaScriptLibraries/build-three.sh:/source/build-three.sh:ro \
71 -v ${ROOT_DIR}/JavaScriptLibraries/${THREE}.tar.gz:/source/${THREE}.tar.gz:ro \
72 -v ${ROOT_DIR}/JavaScriptLibraries/dist/:/target:rw \
73 ${IMAGE} \
74 bash /source/build-three.sh ${THREE}