Skip to content

Commit d9c64d3

Browse files
committed
use installed deps if found, use gmsh nox
1 parent d3ce33c commit d9c64d3

9 files changed

Lines changed: 172 additions & 60 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
bin
12
deps
3+
data

autoclean.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/false
2+
# WARNING! WARNING! WARNING!
3+
#
4+
# This script will delete your custom cads and cases.
5+
# Run it explicitly with
6+
#
7+
# $ sh autoclean.sh
8+
#
9+
# It does not have execution permissions to avoid running it by mistake.
10+
#
11+
# WARNING! WARNING! WARNING!
12+
13+
14+
if [ ! -d auths ]; then
15+
echo "error: run $0 from SunCAE's root directory"
16+
echo 1
17+
fi
18+
19+
for i in bin deps data; do
20+
echo -n "cleaning ${i}... "
21+
rm -rf ${i} || exit 1
22+
echo "ok"
23+
done
24+
25+
pwd=$PWD
26+
for i in $(find . -name .gitignore); do
27+
dir=$(dirname ${i})
28+
if [ "x${dir}" != "x." ]; then
29+
echo "cleaning ${dir}"
30+
cd ${dir}
31+
cat .gitignore | sed '/^#.*/ d' | sed '/^\s*$/ d' | sed 's/^/rm -rf /' | bash || exit 1
32+
cd ${pwd}
33+
fi
34+
done

bin/.gitignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

data/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if [ ! -e deps.sh ]; then
1212
fi
1313

1414
# check for needed tools
15-
for i in wget tar unzip patchelf python3; do
15+
for i in wget tar unzip python3; do
1616
if [ -z "$(which $i)" ]; then
1717
echo "error: ${i} not installed"
1818
exit 1
@@ -26,11 +26,17 @@ fi
2626

2727
mkdir -p deps
2828

29+
30+
# Function to compare versions (include in main deps.sh or source from a utils file)
31+
version_ge() {
32+
printf '%s\n%s\n' "$2" "$1" | sort -V -C
33+
return $?
34+
}
35+
36+
2937
# TODO: parse conf.php
3038
. renderers/x3dom/deps.sh
3139
. uxs/faster-than-quick/deps.sh
3240
. meshers/gmsh/deps.sh
3341
. solvers/feenox/deps.sh
3442
. solvers/ccx/deps.sh
35-
36-

meshers/gmsh/deps.sh

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,54 @@
11
#!/bin/false
22

33
gmsh_version=4.14.0
4+
gmsh_min_version=4.11.0 # Minimum required version
5+
6+
# Function to extract version from binary
7+
get_gmsh_version() {
8+
local binary="$1"
9+
"$binary" --version | head -1
10+
}
411

512
# gmsh
613
echo -n "meshers/gmsh... "
7-
# gmsh_tarball=gmsh-nox-git-Linux64-sdk
8-
gmsh_tarball=gmsh-${gmsh_version}-Linux64-sdk
9-
if [ $force = 1 ] || [ ! -x bin/gmsh ] || [ ! -f deps/${gmsh_tarball}.tgz ]; then
10-
cd deps
11-
if [ ! -e ${gmsh_tarball}.tgz ]; then
12-
wget -c http://gmsh.info/bin/Linux/${gmsh_tarball}.tgz
14+
15+
# Check if gmsh is already installed system-wide
16+
use_system_binary=0
17+
if [ -x "$(which gmsh 2>/dev/null)" ] && [ $force = 0 ]; then
18+
installed_version=$(get_gmsh_version "$(which gmsh)")
19+
if [ -n "$installed_version" ] && version_ge "$installed_version" "$gmsh_min_version"; then
20+
echo "found system version $installed_version (>= $gmsh_min_version), using it"
21+
use_system_binary=1
22+
# Create symlink to system binary
23+
mkdir -p bin
24+
ln -sf "$(which gmsh)" bin/gmsh
25+
else
26+
echo "system version $installed_version is too old (need >= $gmsh_min_version), will download"
27+
fi
28+
fi
29+
30+
if [ $use_system_binary = 0 ]; then
31+
gmsh_tarball=gmsh-nox-git-Linux64-sdk
32+
# gmsh_tarball=gmsh-${gmsh_version}-Linux64-sdk
33+
if [ $force = 1 ] || [ ! -x bin/gmsh ] || [ ! -f deps/${gmsh_tarball}.tgz ]; then
34+
# check for patchelf
35+
if [ -z "$(which patchelf)" ]; then
36+
echo "error: downloaded gmsh needs ${i}, please do sudo apt install patchelf"
37+
exit 1
38+
fi
39+
cd deps
40+
if [ ! -e ${gmsh_tarball}.tgz ]; then
41+
wget -c http://gmsh.info/bin/Linux/${gmsh_tarball}.tgz
42+
fi
43+
tar xzf ${gmsh_tarball}.tgz
44+
cp ${gmsh_tarball}/bin/gmsh ../bin
45+
cp ${gmsh_tarball}/lib/gmsh.py ../bin
46+
cp -d ${gmsh_tarball}/lib/libgmsh.so* ../bin
47+
cd ../bin
48+
patchelf --set-rpath ${PWD} gmsh
49+
echo "done"
50+
cd ..
51+
else
52+
echo "already installed"
1353
fi
14-
tar xzf ${gmsh_tarball}.tgz
15-
cp ${gmsh_tarball}/bin/gmsh ../bin
16-
cp ${gmsh_tarball}/lib/gmsh.py ../bin
17-
cp -d ${gmsh_tarball}/lib/libgmsh.so* ../bin
18-
cd ../bin
19-
# this is needed to add pwd to the binary's rpath
20-
patchelf --set-rpath ${PWD} gmsh
21-
echo "done"
22-
cd ..
23-
else
24-
echo "already installed"
2554
fi

renderers/x3dom/deps.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ if [ $force = 1 ] || [ ! -e renderers/x3dom/x3dom.js ]; then
1919
# cp x3dom/x3dom.js ../renderers/x3dom
2020
# cp x3dom/x3dom.css ../renderers/x3dom
2121

22-
wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.js
23-
cp x3dom.js ../renderers/x3dom
24-
wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.css
25-
cp x3dom.css ../renderers/x3dom
26-
22+
wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.js -o ../renderers/x3dom/x3dom.js
23+
wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.css -o ../renderers/x3dom/x3dom.css
24+
2725
cd ../uxs/faster-than-quick/js
2826
if [ ! -e x3dom.js ]; then
2927
ln -s ../../../renderers/x3dom/x3dom.js

solvers/feenox/deps.sh

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,46 @@
11
#!/bin/false
22

3-
feenox_version=1.1.72
3+
feenox_version=1.2
4+
feenox_version_min=1.72
45

56
# feenox
6-
echo -n "solvers/feenox... "
7-
feenox_tarball=feenox-${feenox_version}-linux-amd64
8-
if [ $force = 1 ] || [ ! -x bin/feenox ] || [ ! -f deps/${feenox_tarball}.tar.gz ]; then
9-
cd deps
10-
if [ ! -e ${feenox_tarball}.tar.gz ]; then
11-
wget -c https://www.seamplex.com/feenox/dist/linux/${feenox_tarball}.tar.gz
7+
# Function to extract version from binary
8+
get_feenox_version() {
9+
local binary="$1"
10+
"$binary" --version 2>&1 | head -n1 | cut -d" " -f2
11+
}
12+
13+
echo -n "meshers/feenox... "
14+
15+
# Check if feenox is already installed system-wide
16+
use_system_binary=0
17+
if [ -x "$(which feenox 2>/dev/null)" ] && [ $force = 0 ]; then
18+
installed_version=$(get_feenox_version "$(which feenox)")
19+
if [ -n "$installed_version" ] && version_ge "$installed_version" "$feenox_min_version"; then
20+
echo "found system version $installed_version (>= $feenox_min_version), using it"
21+
use_system_binary=1
22+
# Create symlink to system binary
23+
mkdir -p bin
24+
ln -sf "$(which feenox)" bin/feenox
25+
else
26+
echo "system version $installed_version is too old (need >= $feenox_min_version), will download"
27+
fi
28+
fi
29+
30+
if [ $use_system_binary = 0 ]; then
31+
feenox_tarball=feenox-${feenox_version}-linux-amd64
32+
if [ $force = 1 ] || [ ! -x bin/feenox ] || [ ! -f deps/${feenox_tarball}.tgz ]; then
33+
cd deps
34+
if [ ! -e ${feenox_tarball}.tar.gz ]; then
35+
wget -c https://www.seamplex.com/feenox/dist/linux/${feenox_tarball}.tar.gz
36+
fi
37+
tar xzf ${feenox_tarball}.tar.gz
38+
cp ${feenox_tarball}/bin/feenox ../bin
39+
cp ${feenox_tarball}/bin/fee2ccx ../bin
40+
echo "done"
41+
cd ..
42+
else
43+
echo "already installed"
1244
fi
13-
tar xzf ${feenox_tarball}.tar.gz
14-
cp ${feenox_tarball}/bin/feenox ../bin
15-
cp ${feenox_tarball}/bin/fee2ccx ../bin
16-
echo "done"
17-
cd ..
18-
else
19-
echo "already installed"
2045
fi
46+

uxs/faster-than-quick/deps.sh

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ bootstrap_version=5.3.3
44
bootstrap_icons_version=1.11.3
55
katex_version=0.16.11
66
pandoc_version=3.5
7+
pandoc_version_min=3.2
78

89
# boostrap (we only need the js, the css comes from bootswatch)
910
echo -n "uxs/faster-than-quick/bootstrap.js... "
@@ -71,22 +72,46 @@ else
7172
fi
7273

7374
# pandoc
75+
# Function to extract version from binary
76+
get_pandoc_version() {
77+
local binary="$1"
78+
"$binary" --version 2>&1 | head -n1 | cut -d" " -f2
79+
}
80+
7481
echo -n "uxs/faster-than-quick/pandoc... "
75-
pandoc_tarball=pandoc-${pandoc_version}-linux-amd64
76-
if [ $force = 1 ] || [ ! -e bin/pandoc ] || [ ! -f deps/${pandoc_tarball}.tar.gz ]; then
77-
cd deps
78-
if [ ! -e ${pandoc_tarball}.tar.gz ]; then
79-
wget https://github.com/jgm/pandoc/releases/download/${pandoc_version}/${pandoc_tarball}.tar.gz
82+
83+
# Check if pandoc is already installed system-wide
84+
use_system_binary=0
85+
if [ -x "$(which pandoc 2>/dev/null)" ] && [ $force = 0 ]; then
86+
installed_version=$(get_pandoc_version "$(which pandoc)")
87+
if [ -n "$installed_version" ] && version_ge "$installed_version" "$pandoc_version_min"; then
88+
echo "found system version $installed_version (>= $pandoc_version_min), using it"
89+
use_system_binary=1
90+
# Create symlink to system binary
91+
mkdir -p bin
92+
ln -sf "$(which pandoc)" bin/pandoc
93+
else
94+
echo "system version $installed_version is too old (need >= $pandoc_version_min), will download"
8095
fi
81-
if [ ! -d pandoc-${pandoc_version} ]; then
82-
tar xvzf ${pandoc_tarball}.tar.gz
96+
fi
97+
98+
if [ $use_system_binary = 0 ]; then
99+
pandoc_tarball=pandoc-${pandoc_version}-linux-amd64
100+
if [ $force = 1 ] || [ ! -x bin/pandoc ] || [ ! -f deps/${pandoc_tarball}.tgz ]; then
101+
cd deps
102+
if [ ! -e ${pandoc_tarball}.tar.gz ]; then
103+
wget https://github.com/jgm/pandoc/releases/download/${pandoc_version}/${pandoc_tarball}.tar.gz
104+
fi
105+
if [ ! -d pandoc-${pandoc_version} ]; then
106+
tar xvzf ${pandoc_tarball}.tar.gz
107+
fi
108+
cp pandoc-${pandoc_version}/bin/pandoc ../bin
109+
echo "done"
110+
cd ..
111+
else
112+
echo "already installed"
83113
fi
84-
cp pandoc-${pandoc_version}/bin/pandoc ../bin
85-
echo "done"
86-
cd ..
87-
else
88-
echo "already installed"
89114
fi
90115

91-
# TODO: gnuplot?
116+
# TODO: gnuplot
92117

0 commit comments

Comments
 (0)