-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwaf.main
More file actions
executable file
·138 lines (129 loc) · 4.39 KB
/
Copy pathwaf.main
File metadata and controls
executable file
·138 lines (129 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# --------------------------------------------------------------------
# Copyright (C) 1991 - 2025 - EDF R&D - www.code-aster.org
# This file is part of code_aster.
#
# code_aster is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# code_aster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with code_aster. If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------------------
# script alias to the waf engine script
set_prefix() {
local this=$(readlink -n -f "$1")
prefix=$(dirname "${this}")
}
set_prefix "${0}"
export ASTER_REQS_USE_DEBUG=${ASTER_REQS_USE_DEBUG:-0}
waf_main()
{
# source the environment only if DEVTOOLS_COMPUTER_ID is not already defined
printf "checking environment... "
if [ -z "${DEVTOOLS_COMPUTER_ID}" ]; then
host=$(detect_host)
if [ -z "${host}" ]; then
echo "no preset configuration found"
source ${prefix}/env.d/version.sh
# transitional
[ "${VERSION}" = "20240327" ] && VERSION="${VERSION}b"
export VERSION
args=( "-v" )
[ ${ASTER_REQS_USE_DEBUG} -eq 1 ] && args=()
${prefix}/.devhelper/check_requirements.sh
iret=$?
[ ${iret} -eq 4 ] && exit ${iret}
if [ ${iret} -eq 0 ]; then
export ASTER_CONFIG=$(ls ${prefix}/build/codeaster-prerequisites-${VERSION}-*/*.sh | grep ${args[@]} debug | head -1)
else
printf "⚠️ code_aster requirements not found, configuration may fail!\n\n"
fi
host=$(detect_host)
fi
if [ ! -z "${host}" ]; then
export WAFBUILD_ENV="$(get_wafbuild_env ${host})"
if [ -e "${WAFBUILD_ENV}" ]; then
. "${WAFBUILD_ENV}"
echo "loading ${WAFBUILD_ENV}"
else
echo "no found: ${WAFBUILD_ENV}"
unset WAFBUILD_ENV
fi
fi
else
if [ -z "${WAFBUILD_ENV}" ]; then
export WAFBUILD_ENV="$(get_wafbuild_env ${DEVTOOLS_COMPUTER_ID})"
fi
if [ -e "${WAFBUILD_ENV}" ]; then
echo "already set: ${WAFBUILD_ENV}"
else
echo "no found: ${WAFBUILD_ENV}"
unset WAFBUILD_ENV
fi
fi
# really execute waf
engine=$(echo ${0} | sed -e 's/\main$/engine/g')
echo "executing: ${engine} ${@}"
"${engine}" "${@}"
return $?
}
# detect for supported host for automatic configuration
detect_host()
{
if [ ! -z "${ASTER_CONFIG}" ]; then
printf aster_config
return
fi
if [ "${PIXI_PROJECT_NAME}" = "codeaster-src" ]; then
printf ${PIXI_PROJECT_NAME}
return
fi
if [ ! -z "${SINGULARITY_NAME}" ] || [ -f /.dockerenv ]; then
local wbe=$(ls /opt/public/*_${WAF_SUFFIX}.sh 2> /dev/null)
if [ ! -z "${wbe}" ]; then
plt=$(basename "${wbe}" | sed -e "s%_${WAF_SUFFIX}\.sh$%%")
printf "${plt}"
return
fi
fi
if [ -f /software/shared/simumeca/aster/selena ]; then
printf selena
elif [ -f /software/restricted/simumeca/aster/cronos ]; then
printf cronos
elif [ -f /software/simumeca/aster/cirrus ]; then
printf cirrus
elif [ -f /projets/simumeca/gaia ]; then
printf gaia
elif egrep -q "Scibian 10.0" /etc/issue; then
printf scibian10
elif egrep -q "Scibian 9.0" /etc/issue; then
printf scibian9
elif egrep -q "Calibre 9|Debian GNU/Linux 8" /etc/issue; then
printf calibre9
fi
printf ""
}
get_wafbuild_env()
{
# usage: get_wafbuild_env platform
local plt="${1}"
if [ "${plt}" = "aster_config" ]; then
printf "${ASTER_CONFIG}"
return
fi
local wbe="/opt/public/${plt}_${WAF_SUFFIX}.sh"
if [ ! -f "${wbe}" ]; then
wbe="${prefix}/env.d/${plt}_${WAF_SUFFIX}.sh"
[ ! -f "${wbe}" ] && wbe=""
fi
printf "${wbe}"
}
waf_main "${@}"
exit $?