1212# - SUDO : specify the command prefix to run as root (if any)
1313# - SED : command to run sed (usually sed for linux, gsed for mac)
1414# - OS : reference to the Operating system, used to name the plugin tarball (and when using setup_var() function)
15-
15+ # - OS_VERSION : reference to the Operating system version, used to name the plugin tarball (and when using setup_var() function)
1616
1717set -ex
1818
@@ -25,19 +25,26 @@ function mac_install_prerequisites() {
2525 brew install eigen gcc@6 gsed
2626}
2727
28- function ubuntu_version () {
29- export UBUNTU_VERSION =$( lsb_release -rs | cut -d" ." -f1)
30- echo " Ubuntu Version: " $UBUNTU_VERSION
28+ function unix_version () {
29+ export LINUX_VERSION =$( lsb_release -rs | cut -d" ." -f1)
30+ echo " Linux Version: " $LINUX_VERSION
3131}
3232
3333function linux_install_prerequisites() {
3434 TZ=America/Chicago
3535 $SUDO ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
3636 $SUDO sh -c ' echo $TZ > /etc/timezone'
3737 $SUDO apt-get update -y
38- $SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3 lsb-core
38+ if [ " $OS " == " ubuntu" ]; then
39+ $SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3 lsb-core
40+ fi
41+ if [ " $OS " == " debian" ]; then
42+ $SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3
43+ fi
3944 $SUDO update-alternatives --install /usr/bin/python python /usr/bin/python3 10; \
45+ if [ $LINUX_VERSION -lt 21 ] && [ " $OS " == " ubuntu" ]; then
4046 $SUDO update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10; \
47+ fi
4148}
4249
4350function setup() {
@@ -72,28 +79,31 @@ function setup_var() {
7279 return 1
7380 fi
7481
75- if [ " OS" == " MAC" ]; then
82+ if [ " $ OS" == " MAC" ]; then
7683 BUILD_SHARED_LIBS=" OFF"
7784 BUILD_STATIC_LIBS=" ON"
78- elif [ " OS" == " UBUNTU" ]; then
85+ elif [ " $OS " == " ubuntu" ]; then
86+ BUILD_SHARED_LIBS=" ON"
87+ BUILD_STATIC_LIBS=" OFF"
88+ elif [ " $OS " == " debian" ]; then
7989 BUILD_SHARED_LIBS=" ON"
8090 BUILD_STATIC_LIBS=" OFF"
8191 else
82- echo " OS ENV variable needs to be defined to either UBUNTU or MAC"
92+ echo " OS ENV variable needs to be defined to either UBUNTU, DEBIAN or MAC"
8393 return 1
8494 fi
8595}
8696
8797function linux_build_hdf5() {
8898 # if ubuntu 18.04 or lower rely on apt-get hdf5
89- ubuntu_version
90- if [ $UBUNTU_VERSION -lt 20 ]; then
99+ unix_version
100+ if [ $LINUX_VERSION -lt 20 ] && [ " $OS " == " ubuntu " ]; then
91101 $SUDO apt-get install -y libhdf5-serial-dev
92102 else
93103 cd ${PLUGIN_ABS_PATH}
94104 mkdir -p hdf5/bld
95105 cd hdf5
96- git clone https://github.com/HDFGroup/hdf5.git -b hdf5-1_12_0 --depth 1
106+ git clone https://github.com/HDFGroup/hdf5.git -b hdf5-1_12_0 --depth 1 --shallow-submodules
97107 cd bld
98108 cmake ../hdf5 -DBUILD_SHARED_LIBS:BOOL=ON
99109 make
@@ -110,7 +120,7 @@ function build_moab() {
110120 cd ${PLUGIN_ABS_PATH}
111121 mkdir -pv moab/bld
112122 cd moab
113- git clone https://bitbucket.org/fathomteam/moab -b 5.3.0 --depth 1
123+ git clone https://bitbucket.org/fathomteam/moab -b 5.3.0 --depth 1 --shallow-submodules
114124 cd moab
115125 # patching MOAB CMakeLists.txt to use default find(HDF5)
116126 $SED -i " s/HDF5_MOAB/HDF5/" CMakeLists.txt
@@ -134,7 +144,7 @@ function build_dagmc(){
134144 cd ${PLUGIN_ABS_PATH}
135145 mkdir -pv DAGMC/bld
136146 cd DAGMC
137- git clone https://github.com/svalinn/DAGMC -b develop --depth 1
147+ git clone https://github.com/svalinn/DAGMC -b develop --depth 1 --shallow-submodules
138148 cd bld
139149 cmake ../DAGMC -DMOAB_DIR=${PLUGIN_ABS_PATH} /moab \
140150 -DBUILD_UWUW=ON \
@@ -262,9 +272,10 @@ function linux_build_plugin_pkg(){
262272 cd ..
263273 ln -sv svalinn/libsvalinn_plugin.so .
264274 cd ../..
265- tar --sort=name -czvf svalinn-plugin_${OS} _cubit_$1 .tgz bin
266- chmod 666 svalinn-plugin_${OS} _cubit_$1 .tgz
267- cp svalinn-plugin_${OS} _cubit_$1 .tgz $SCRIPTPATH /release/
275+ PLUGIN_FILENAME=svalinn-plugin_${OS} -${OS_VERSION} _cubit_$1 .tgz
276+ tar --sort=name -czvf ${PLUGIN_FILENAME} bin
277+ chmod 666 ${PLUGIN_FILENAME}
278+ cp ${PLUGIN_FILENAME} $SCRIPTPATH /release/
268279}
269280
270281function mac_build_plugin_pkg(){
@@ -287,12 +298,12 @@ function mac_build_plugin_pkg(){
287298 install_name_tool -rpath ${CUBIT_PATH} /bin ${CUBIT_PATH} /MacOS libsvalinn_plugin.so
288299 fi
289300
290-
291301 # Create the Svalinn plugin tarball
292302 cd ..
293303 ln -sv svalinn/libsvalinn_plugin.so .
294304 cd ../..
295- tar -czvf svalinn-plugin_${OS} _cubit_${1} .tgz MacOS
296- chmod 666 svalinn-plugin_${OS} _cubit_$1 .tgz
297- cp svalinn-plugin_${OS} _cubit_$1 .tgz $SCRIPTPATH /release/
305+ PLUGIN_FILENAME=svalinn-plugin_${OS} -${OS_VERSION} _cubit_$1 .tgz
306+ tar -czvf ${PLUGIN_FILENAME} MacOS
307+ chmod 666 ${PLUGIN_FILENAME}
308+ cp ${PLUGIN_FILENAME} $SCRIPTPATH /release/
298309}
0 commit comments