Skip to content

Commit 2883b97

Browse files
committed
add option to build clara
1 parent 725a682 commit 2883b97

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

install-clara

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function get() {
2323

2424
function install() {
2525
find clara-cre -exec touch {} +
26-
chmod -R a+r clara-cre
27-
chmod a+x clara-cre/bin/*
26+
chmod -f -R a+r clara-cre
27+
chmod -f a+x clara-cre/bin/*
2828
mv clara-cre $clara_home
2929
}
3030

@@ -36,7 +36,7 @@ function litter() {
3636
then
3737
echo -e "\nSee temporary build directory for more info:\n\t$tmp_dir"
3838
else
39-
rm -r $tmp_dir && echo -e "\nRemoved temporary build directory:\n\t$tmp_dir"
39+
rm -rf $tmp_dir && echo -e "\nRemoved temporary build directory:\n\t$tmp_dir"
4040
fi
4141
fi
4242
}
@@ -57,16 +57,28 @@ function cleanup() {
5757
[ "$exit_code" -eq 0 ] && check
5858
}
5959

60+
function build_clara {
61+
export CLARA_HOME=$1
62+
git clone https://github.com/baltzell/clara-java
63+
cd clara-java
64+
git checkout java21
65+
./gradlew && ./gradlew deploy
66+
cd -
67+
}
68+
6069
trap cleanup EXIT
6170

6271
# Configure:
6372
debug=0
6473
args=()
65-
usage="Usage: install-clara [-v] [-f CLARA] [-c COATJAVA] [-g GRAPES] [-j JRE] PATH"
74+
usage="Usage: install-clara [-v] [-b] [-f CLARA] [-c COATJAVA] [-g GRAPES] [-j JRE] PATH"
6675
info="\
6776
- The default COATJAVA/CLARA/GRAPES versions are $coatjava/$clara/$grapes.\n\
6877
- Unless requested, no JRE will be included in the installation.\n\
69-
- COATJAVA can also be specified as a local installation directory."
78+
- COATJAVA can also be specified as a local installation directory.\n\
79+
- [-v adds verbosity and disables cleanup]\n\
80+
- [-b builds clara from source]"
81+
7082
while [[ $# -gt 0 ]]
7183
do
7284
case $1 in
@@ -75,6 +87,7 @@ do
7587
-c) coatjava="$2" && shift && shift ;;
7688
-g) grapes="$2" && shift && shift ;;
7789
-j) jre="$2" && shift && shift ;;
90+
-b) build=1 && shift ;;
7891
-v) let debug=$debug+1 && shift ;;
7992
-*|--*) echo -e "$usage\n\nUnknown option: $1" && exit 1 ;;
8093
*) args+=("$1") && shift ;;
@@ -108,8 +121,14 @@ echo -e "\nCreating temporary build directory:\n\t$tmp_dir"
108121
cd $tmp_dir
109122

110123
# CLARA:
111-
echo -e "\nRetrieving CLARA version $clara ..."
112-
get https://clasweb.jlab.org/clas12offline/distribution/clara/clara-cre-$clara.tar.gz
124+
if ! [ -z ${build+x} ]
125+
then
126+
echo -e "\nBuilding CLARA from source ..."
127+
build_clara $PWD/clara-cre
128+
else
129+
echo -e "\nRetrieving CLARA version $clara ..."
130+
get https://clasweb.jlab.org/clas12offline/distribution/clara/clara-cre-$clara.tar.gz
131+
fi
113132

114133
# COATJAVA:
115134
if ! compgen -G "$coatjava/lib/clas/coat-libs-*.jar" > /dev/null
@@ -125,13 +144,13 @@ cp -Lr $coatjava/etc $coatjava/bin $coatjava/lib* clara-cre/plugins/clas12
125144
echo -e "\nRetrieving GRAPES version $grapes ..."
126145
get https://clasweb.jlab.org/clas12offline/distribution/grapes/grapes-$grapes.tar.gz
127146
mv grapes-$grapes clara-cre/plugins/grapes
128-
cp -r clara-cre/plugins/grapes/bin/clara-grapes clara-cre/bin/
147+
mv -f clara-cre/plugins/grapes/bin/clara-grapes clara-cre/bin/
129148

130149
# JRE:
131-
if ! [ -z ${jre+x} ]
132-
then
133-
echo -e "\nRetrieving JRE version $jre ..."
134-
mkdir clara-cre/jre
135-
get https://userweb.jlab.org/~gurjyan/clara-cre/linux-64-$jre.tar.gz clara-cre/jre
136-
fi
150+
#if ! [ -z ${jre+x} ]
151+
#then
152+
# echo -e "\nRetrieving JRE version $jre ..."
153+
# mkdir clara-cre/jre
154+
# get https://userweb.jlab.org/~gurjyan/clara-cre/linux-64-$jre.tar.gz clara-cre/jre
155+
#fi
137156

0 commit comments

Comments
 (0)