source: main/trunk/release-kits/bin/rk@ 35571

Last change on this file since 35571 was 35571, checked in by davidb, 3 years ago

Changed so RK_HOME is correctly set even if one of the parent directories has a space in its name. While rk was tested to confirm it works, unfortunately later stages of the process (e.g. where CFLAGS is passed on to configure scripts) are not robust to having spaces in their name, and so rk fails at that point. At this stage not planning to address the CFLAGS space issue, and so reverting to only working with the Release Kit installed into a directory area with no spaces in the parent directory name

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/bash
2
3function show_title() {
4 echo "RK_HOME: $RK_HOME"
5 echo "O---------------------------------------------O"
6 echo
7 echo " $rk_name ";
8 echo " $rk_fullname ";
9 echo
10 echo "O---------------------------------------------O"
11
12}
13
14function show_help {
15 echo "usage: {rk2|rk3|sork2|sork2|cdrk2|derk|clientrk} [-help|-cmd] [ANT_ARGS]"
16 echo " -help show this help screen"
17 echo " -cmd show the ant command being used by the releas kit"
18 echo " ANT_ARGS additional arguments to be passed to ant"
19}
20
21#determine requested release kit
22rk_name=$(basename "$0")
23rk_dirname=$(dirname "$0")
24export RK_HOME=$(cd "$rk_dirname/.." && pwd)
25
26
27if [ "$rk_name" == "rk2" ]; then
28 rk_fullname="Release Kit for Greenstone2"
29elif [ "$rk_name" == "rk3" ]; then
30 rk_fullname="Release Kit for Greenstone3"
31elif [ "$rk_name" == "sork2" ]; then
32 rk_fullname="Source Code Release Kit for Greenstone2"
33elif [ "$rk_name" == "sork3" ]; then
34 rk_fullname="Source Code Release Kit for Greenstone3"
35elif [ "$rk_name" == "cdrk2" ]; then
36 rk_fullname="CD-ROM Release Kit for Greenstone2"
37elif [ "$rk_name" == "derk" ]; then
38 rk_fullname="Documented Examples Release Kit"
39elif [ "$rk_name" == "clientrk" ]; then
40 rk_fullname="Standalone Client-GLI Release Kit"
41else
42 show_help
43 exit
44fi
45
46#make sure ant has enough memory
47export ANT_OPTS=-Xmx1024M
48
49# set JAVACFLAGS (used in the relevant javac lines in our Makefiles) so that any compiled Java code
50# is backwards compatible with Java v1.6
51
52# Note: Given the way autoconf uses 'eval' to test javac, then the usual technique of double-quoting
53# (e.g.) the bootclasspath directory to project against spaces *won't* *work* as it is not passed
54# to a shell environment to be interpretted first.
55# Instead, we result to backlash escaping any spaces
56export RK_HOME_BACKSLASH_ESCAPED=`echo $RK_HOME | sed 's/ /\\\\ /g'`
57
58export JAVACFLAGS="-source 1.6 -target 1.6 -bootclasspath $RK_HOME_BACKSLASH_ESCAPED/shared/core/java-rt/rt-openjdk6.jar -extdirs ''"
59
60#create the command
61toexec="ant -lib \"`pwd`/installer/classes\" -f \"$RK_HOME/kits/$rk_name/ant-scripts/build.xml\" \"-Dbasedir=`pwd`\" \"-Drk.home=$RK_HOME\" \"-Drk.name=$rk_name\""
62
63# Generally, an ant property can be true|on|yes vs false|off|no (or left unset)
64# see https://ant.apache.org/manual/properties.html#if+unless
65# However, the release-kit code requires envvar KEEP_SRC to be "true" in order to stop it deleting source code
66# set KEEP_SRC env var here or in envi/etc/tasks/snapshot/environment.pl
67#KEEP_SRC=true
68#echo "KEEP_SRC: $KEEP_SRC"
69if test -n $KEEP_SRC ; then
70 toexec="$toexec \"-Dkeep.src=$KEEP_SRC\""
71fi
72
73show_cmd=false
74
75#pass on the arguments
76while [ "$1" != "" ]; do
77
78 if [ "$1" == "-help" ]; then
79 show_help
80 exit
81 elif [ "$1" == "-cmd" ]; then
82 show_cmd=true
83 else
84 toexec="$toexec \"$1\""
85 fi
86 shift
87
88done
89
90#show the command to be executed
91if [ "$show_cmd" == "true" ]; then
92 echo $toexec
93#execute
94else
95 show_title | tee ${rk_name}.out
96 $toexec 2>&1 | tee -a ${rk_name}.out
97fi
98
Note: See TracBrowser for help on using the repository browser.