1 | #!/bin/bash
|
---|
2 |
|
---|
3 | glilang=en
|
---|
4 |
|
---|
5 | # Need to run this script from its own directory instead of whichever directory it may be called from
|
---|
6 | #currentdir=$(cd `dirname "$0"` && pwd)
|
---|
7 | thisdir="`dirname \"$0\"`"
|
---|
8 | thisdir="`cd \"$thisdir\" && pwd`"
|
---|
9 | cd "$thisdir"
|
---|
10 |
|
---|
11 | # Don't bother compiling GLI if there's no source code (e.g. if this is a binary only)
|
---|
12 | if [ ! -d "src" ]; then
|
---|
13 | echo "WARNING: There is no gli source code (src directory) to compile. Terminating makegli."
|
---|
14 | exit 0
|
---|
15 | fi
|
---|
16 |
|
---|
17 | echo
|
---|
18 | if [ "$glilang" = "es" ]; then
|
---|
19 | echo "Interfaz de la Biblioteca Digital Greenstone (Greenstone Librarian Interface - GLI)"
|
---|
20 | echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
|
---|
21 | echo "La Interfaz de la Biblioteca Digital Greenstone NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÍA."
|
---|
22 | echo "Para mayor información vea los términos de la licencia en LICENSE.txt"
|
---|
23 | echo "Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita"
|
---|
24 | elif [ "$glilang" = "fr" ]; then
|
---|
25 | echo "Interface du Bibliothécaire Greenstone (Greenstone Librarian Interface - GLI)"
|
---|
26 | echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
|
---|
27 | echo "GLI est fourni sans AUCUNE GARANTIE; pour des détails, voir LICENSE.txt"
|
---|
28 | echo "Ceci est un logiciel libre, et vous êtes invité à le redistribuer"
|
---|
29 | elif [ "$glilang" = "ru" ]; then
|
---|
30 | echo "âÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone (Greenstone Librarian Interface - GLI)"
|
---|
31 | echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
|
---|
32 | echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
|
---|
33 | echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
|
---|
34 | else
|
---|
35 | echo "Greenstone Librarian Interface (GLI)"
|
---|
36 | echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
|
---|
37 | echo "GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
|
---|
38 | echo "This is free software, and you are welcome to redistribute it"
|
---|
39 | fi
|
---|
40 | echo
|
---|
41 |
|
---|
42 | ## -------- Compile the Greenstone Librarian Interface --------
|
---|
43 |
|
---|
44 | ## ---- Determine GSDLHOME ----
|
---|
45 | # we want to have the same environment (eg JAVA_HOME set in local folder) as the runtime does.
|
---|
46 |
|
---|
47 | # need to source a script in order to inherit the env vars it has set
|
---|
48 | # Exit on error code (non-zero)
|
---|
49 | exit_status=0
|
---|
50 | source ./findgsdl.sh
|
---|
51 | exit_status=$?
|
---|
52 | if [ "$exit_status" -eq 1 ]; then
|
---|
53 | echo "Couldn't determine Greenstone version. This is an error for normal GLI, but not if you are compiling for Client GLI."
|
---|
54 | #exit 1;
|
---|
55 | fi
|
---|
56 |
|
---|
57 | ## ---- Check Javac exists ----
|
---|
58 | javacpath=
|
---|
59 |
|
---|
60 | # Some users may set the above line manually
|
---|
61 | if [ "x$javacpath" = "x" ]; then
|
---|
62 |
|
---|
63 | # If the JAVAC environment variable is set then use it
|
---|
64 | if [ "x$JAVAC" != "x" ] ; then
|
---|
65 | javacpath=$JAVAC
|
---|
66 | # If it is set, use the JAVA_HOME environment variable
|
---|
67 | elif [ "x$JAVA_HOME" != "x" ]; then
|
---|
68 | javacpath="$JAVA_HOME/bin/javac"
|
---|
69 | # Check if Javac is on the search path
|
---|
70 | else
|
---|
71 | javacpath=`which javac 2> /dev/null`
|
---|
72 | fi
|
---|
73 | fi
|
---|
74 |
|
---|
75 | # The following is now explicitly set in the Release Kit
|
---|
76 | #if [ "x$JAVACFLAGS" = "x" ] ; then
|
---|
77 | # JAVACFLAGS="-source 1.6 -target 1.6"
|
---|
78 | #fi
|
---|
79 |
|
---|
80 | # https://stackoverflow.com/questions/15492948/javac-source-and-target-options
|
---|
81 | if [ -f lib/rt-openjdk6.jar ] ; then
|
---|
82 | JAVACFLAGS="$JAVACFLAGS -bootclasspath lib/rt-openjdk6.jar -extdirs \"\""
|
---|
83 | fi
|
---|
84 |
|
---|
85 | # Check that a Javac executable has been found
|
---|
86 | if [ "$glilang" = "es" ]; then
|
---|
87 | echo "Revisando Javac: $javacpath"
|
---|
88 | elif [ "$glilang" = "fr" ]; then
|
---|
89 | echo "Vérification de Javac: $javacpath"
|
---|
90 | elif [ "$glilang" = "ru" ]; then
|
---|
91 | echo "ðÒÏ×ÅÒËÁ Javac: $javacpath"
|
---|
92 | else
|
---|
93 | echo "Checking Javac: $javacpath"
|
---|
94 | fi
|
---|
95 | if [ ! -x "$javacpath" ]; then
|
---|
96 | echo
|
---|
97 | if [ "$glilang" = "es" ]; then
|
---|
98 | echo "No se pudo localizar una versión apropiada de Javac."
|
---|
99 | echo "Por favor instale una nueva versión del Kit de Desarrollo de"
|
---|
100 | echo "Software Java (versión 1.4 o posterior) y ejecute nuevamente"
|
---|
101 | echo "este guión."
|
---|
102 | elif [ "$glilang" = "fr" ]; then
|
---|
103 | echo "Une version appropriée de Javac n'a pas pu être localisée."
|
---|
104 | echo "Veuillez installer une nouvelle version de Java SDK (version 1.4 ou"
|
---|
105 | echo "plus récente) et redémarrez ce script."
|
---|
106 | elif [ "$glilang" = "ru" ]; then
|
---|
107 | echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Javac."
|
---|
108 | echo "ðÏÖÁÌÕÊÓÔÁ, ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ Java SDK (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ"
|
---|
109 | echo "ÎÏ×ÕÀ) É ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ."
|
---|
110 | else
|
---|
111 | echo "Failed to locate an appropriate version of Javac. You must install a"
|
---|
112 | echo "Java Development Kit (version 1.4 or greater) before compiling the"
|
---|
113 | echo "Greenstone Librarian Interface."
|
---|
114 | fi
|
---|
115 | exit 1
|
---|
116 | fi
|
---|
117 |
|
---|
118 | ## ---- Compile the GLI ----
|
---|
119 |
|
---|
120 | # If a file has been specified at the command-line, just compile that file
|
---|
121 | if [ ! "x$*" = "x" ] ; then
|
---|
122 | echo
|
---|
123 | if [ "$glilang" = "es" ]; then
|
---|
124 | echo "Compilando $* y clases dependientes..."
|
---|
125 | elif [ "$glilang" = "fr" ]; then
|
---|
126 | echo "Compilation de $* et des classes dépendantes,,,"
|
---|
127 | elif [ "$glilang" = "ru" ]; then
|
---|
128 | echo "ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ $* É ÚÁ×ÉÓÉÍÙÅ ËÌÁÓÓÙ..."
|
---|
129 | else
|
---|
130 | echo "Compiling $* and dependent classes..."
|
---|
131 | fi
|
---|
132 |
|
---|
133 | $javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar $*
|
---|
134 |
|
---|
135 | if [ "$glilang" = "es" ]; then
|
---|
136 | echo "¡Hecho!"
|
---|
137 | elif [ "$glilang" = "fr" ]; then
|
---|
138 | echo "Terminé!"
|
---|
139 | elif [ "$glilang" = "ru" ]; then
|
---|
140 | echo "÷ÙÐÏÌÎÅÎÏ!"
|
---|
141 | else
|
---|
142 | echo "Done!"
|
---|
143 | fi
|
---|
144 | exit 0
|
---|
145 | fi
|
---|
146 |
|
---|
147 | # Otherwise compile the lot...
|
---|
148 |
|
---|
149 | # Remove any existing class files first
|
---|
150 | ./clean.sh
|
---|
151 |
|
---|
152 | if [ "$glilang" = "es" ]; then
|
---|
153 | echo "Compilando la Interfaz de la Biblioteca Digital Greenstone..."
|
---|
154 | elif [ "$glilang" = "fr" ]; then
|
---|
155 | echo "Compilation de Greenstone Librarian Interface,,,"
|
---|
156 | elif [ "$glilang" = "ru" ]; then
|
---|
157 | echo "ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Greenstone..."
|
---|
158 | else
|
---|
159 | echo "Compiling the Greenstone Librarian Interface..."
|
---|
160 | fi
|
---|
161 |
|
---|
162 | # Compile the GLI
|
---|
163 | $javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar src/org/greenstone/gatherer/GathererProg.java
|
---|
164 | if [ $? -ne 0 ]; then
|
---|
165 | exit 1;
|
---|
166 | fi
|
---|
167 | $javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar src/org/greenstone/gatherer/WebGatherer.java
|
---|
168 | if [ $? -ne 0 ]; then
|
---|
169 | exit 1;
|
---|
170 | fi
|
---|
171 | $javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar src/org/greenstone/gatherer/GathererApplet.java
|
---|
172 | if [ $? -ne 0 ]; then
|
---|
173 | exit 1;
|
---|
174 | fi
|
---|
175 | #$javacpath -deprecation -d classes/ -sourcepath src/ -classpath classes/:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar src/org/greenstone/gatherer/GathererApplet4gs3.java
|
---|
176 | # Compile the GEMS
|
---|
177 | $javacpath -deprecation -d classes/ -sourcepath src/ -classpath classes/:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar src/org/greenstone/gatherer/gems/GEMS.java
|
---|
178 | if [ $? -ne 0 ]; then
|
---|
179 | exit 1;
|
---|
180 | fi
|
---|
181 | # Compile the standalone programs needed on the server for remote building
|
---|
182 | $javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/ src/org/greenstone/gatherer/remote/Zip*.java
|
---|
183 | $javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/ src/org/greenstone/gatherer/remote/Unzip.java
|
---|
184 |
|
---|
185 | if [ "$glilang" = "es" ]; then
|
---|
186 | echo "¡Hecho!"
|
---|
187 | elif [ "$glilang" = "fr" ]; then
|
---|
188 | echo "Terminé!"
|
---|
189 | elif [ "$glilang" = "ru" ]; then
|
---|
190 | echo "÷ÙÐÏÌÎÅÎÏ!"
|
---|
191 | else
|
---|
192 | echo "Done!"
|
---|
193 | fi
|
---|