Skip to content

Commit bce836e

Browse files
committed
updated build scripts
1 parent 25d7af0 commit bce836e

2 files changed

Lines changed: 46 additions & 60 deletions

File tree

ci/build.sh

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,24 @@
88
# ./ci/build.sh
99

1010
source ci/env.sh
11-
12-
# module gemc gives $GEMC (used in meson prefix) and PKG_CONFIG_PATH
13-
# not strickly necessary, one could set those manually
14-
module load gemc/dev
15-
echo GEMC for prefix set to: $GEMC
16-
echo
17-
1811
meson_option=$(meson_options $1)
1912

20-
mkdir -p /root/src/logs
21-
setup_log=/root/src/logs/setup.log
22-
compile_log=/root/src/logs/build.log
23-
test_log=/root/src/logs/test.log
24-
25-
touch $setup_log $compile_log $test_log
26-
27-
echo Logs:
28-
29-
ls -l $setup_log
30-
ls -l $compile_log
31-
ls -l $test_log
32-
3313
echo " > Geant-config: $(which geant4-config) : $(geant4-config --version)" | tee $setup_log
3414
echo " > Root-config: $(which root-config) : $(root-config --version)" | tee -a $setup_log
15+
echo Meson Options: $meson_option
16+
exit
3517

36-
setup_options=" --native-file=core.ini $meson_option -Dprefix=$GEMC --wipe "
37-
38-
local mode="${1:-release}"
39-
local install_dir="${GEMC:?GEMC not set}"
40-
41-
local args=(
42-
"--native-file=core.ini"
43-
"-Droot=enabled"
44-
"-Dprefix=${install_dir}"
45-
)
46-
47-
# detect cores and cap at 32
18+
# detect cores and cap at 16
4819
cores=$(getconf _NPROCESSORS_ONLN 2>/dev/null || nproc)
49-
jobs=$((cores < 32 ? cores : 32))
20+
jobs=$((cores < 16 ? cores : 16))
5021

5122
meson subprojects download yaml-cpp
5223
meson subprojects download assimp
5324
echo " > Applying patch to version 0.8.0" | tee -a $setup_log
5425
meson subprojects update yaml-cpp --reset
5526
echo
5627
echo " > Running meson setup build ${args[@]}" | tee -a $setup_log
57-
meson setup build "${args[@]}" - >> $setup_log
28+
meson setup build "meson_option" - >> $setup_log
5829
if [ $? -ne 0 ]; then
5930
echo "Build Configure failed. Log: "
6031
cat $setup_log

ci/env.sh

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#!/usr/bin/env zsh
22

3-
4-
DetectorDirNotExisting() {
5-
echo "System directory: $system not existing"
6-
exit 3
3+
# enable git describe --tags, needed by meson
4+
function enable_git_describe {
5+
is_shallow=$(git rev-parse --is-shallow-repository)
6+
if [ "$is_shallow" = "true" ]; then
7+
echo "Repository is_shallow: $is_shallow"
8+
echo " > Fetching all tags"
9+
git fetch --tags --unshallow
10+
fi
711
}
812

9-
function show_installation {
13+
function show_gemc_installation {
1014
echo
1115
echo "- Content of \$GEMC=$GEMC"
1216
ls -lrt $GEMC
@@ -20,8 +24,9 @@ function show_installation {
2024
fi
2125
}
2226

23-
function meson_options {
27+
function meson_setup_options {
2428
# valid options: address, thread, undefined, memory, leak
29+
local install_dir="${GEMC:?GEMC not set}"
2530

2631
meson_options=""
2732
buildtype=" -Dbuildtype=debug "
@@ -55,35 +60,45 @@ function meson_options {
5560
;;
5661
esac
5762

58-
echo $meson_options $buildtype
59-
}
63+
additional_args=(
64+
"--native-file=core.ini"
65+
"-Di_test=true"
66+
"-Droot=enabled"
67+
"-Dprefix=${install_dir}"
68+
"-Dpkg_config_path=$PKG_CONFIG_PATH:${install_dir}/lib/pkgconfig"
69+
)
6070

71+
echo $meson_options $buildtype "${additional_args[@]}"
72+
}
6173

62-
# recent versions of Git refuse to touch a repository whose on-disk owner
63-
# doesn’t match the UID that is running the command
64-
# mark the workspace (and any nested path) as safe
65-
echo "Marking workspace as safe for Git"
66-
git config --global --add safe.directory '*'
6774

68-
is_shallow=$(git rev-parse --is-shallow-repository)
75+
# recent versions of Git refuse to touch a repository whose on-disk owner
76+
# doesn’t match the UID that is running the command
77+
# mark the workspace (and any nested path) as safe
78+
echo "Marking workspace as safe for Git"
79+
git config --global --add safe.directory '*'
6980

70-
if [ "$is_shallow" = "true" ]; then
71-
echo "Repository is_shallow: $is_shallow"
72-
echo " > Fetching all tags"
73-
git fetch --tags --unshallow
74-
fi
81+
enable_git_describe
82+
log_dir=$SIM_HOME/logs
7583

7684
# if we are in the docker container, we need to load the modules
7785
if [[ -z "${AUTOBUILD}" ]]; then
7886
echo "\nNot in container"
7987
else
8088
echo "\nIn docker container."
81-
if [[ -n "${GITHUB_WORKFLOW}" ]]; then
82-
echo "GITHUB_WORKFLOW: ${GITHUB_WORKFLOW}"
83-
fi
84-
source /etc/profile.d/local_g4setup.sh
85-
echo
89+
log_dir=/root/src/logs
8690
fi
8791

88-
export ARTIFACT_DIR=$RUNNER_TEMP/artifacts
89-
mkdir -p $ARTIFACT_DIR
92+
export $GEMC=$SIM_HOME/gemc/dev
93+
94+
setup_log=/root/src/logs/setup.log
95+
compile_log=/root/src/logs/build.log
96+
test_log=/root/src/logs/test.log
97+
98+
touch $setup_log $compile_log $test_log
99+
100+
echo Logs:
101+
102+
ls -l $setup_log
103+
ls -l $compile_log
104+
ls -l $test_log

0 commit comments

Comments
 (0)