source: main/trunk/gli/makegli.sh@ 36061

Last change on this file since 36061 was 36061, checked in by kjdon, 2 years ago

if we are using a standalone gli, then findgsdl will return 1, but this is not an error. So don't exit in this case.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 KB
Line 
1#!/bin/bash
2
3glilang=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)
7thisdir="`dirname \"$0\"`"
8thisdir="`cd \"$thisdir\" && pwd`"
9cd "$thisdir"
10
11# Don't bother compiling GLI if there's no source code (e.g. if this is a binary only)
12if [ ! -d "src" ]; then
13 echo "WARNING: There is no gli source code (src directory) to compile. Terminating makegli."
14 exit 0
15fi
16
17echo
18if [ "$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"
24elif [ "$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"
29elif [ "$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 "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
34else
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"
39fi
40echo
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)
49exit_status=0
50source ./findgsdl.sh
51exit_status=$?
52if [ "$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;
55fi
56
57## ---- Check Javac exists ----
58javacpath=
59
60# Some users may set the above line manually
61if [ "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
73fi
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
81if [ -f lib/rt-openjdk6.jar ] ; then
82 JAVACFLAGS="$JAVACFLAGS -bootclasspath lib/rt-openjdk6.jar -extdirs \"\""
83fi
84
85# Check that a Javac executable has been found
86if [ "$glilang" = "es" ]; then
87 echo "Revisando Javac: $javacpath"
88elif [ "$glilang" = "fr" ]; then
89 echo "Vérification de Javac: $javacpath"
90elif [ "$glilang" = "ru" ]; then
91 echo "ðÒÏ×ÅÒËÁ Javac: $javacpath"
92else
93 echo "Checking Javac: $javacpath"
94fi
95if [ ! -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
116fi
117
118## ---- Compile the GLI ----
119
120# If a file has been specified at the command-line, just compile that file
121if [ ! "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
145fi
146
147# Otherwise compile the lot...
148
149# Remove any existing class files first
150./clean.sh
151
152if [ "$glilang" = "es" ]; then
153 echo "Compilando la Interfaz de la Biblioteca Digital Greenstone..."
154elif [ "$glilang" = "fr" ]; then
155 echo "Compilation de Greenstone Librarian Interface,,,"
156elif [ "$glilang" = "ru" ]; then
157 echo "ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Greenstone..."
158else
159 echo "Compiling the Greenstone Librarian Interface..."
160fi
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$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
165$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
166#$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
167# Compile the GEMS
168$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
169
170# Compile the standalone programs needed on the server for remote building
171$javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/ src/org/greenstone/gatherer/remote/Zip*.java
172$javacpath $JAVACFLAGS -deprecation -d classes/ -sourcepath src/ -classpath classes/ src/org/greenstone/gatherer/remote/Unzip.java
173
174if [ "$glilang" = "es" ]; then
175 echo "¡Hecho!"
176elif [ "$glilang" = "fr" ]; then
177 echo "Terminé!"
178elif [ "$glilang" = "ru" ]; then
179 echo "÷ÙÐÏÌÎÅÎÏ!"
180else
181 echo "Done!"
182fi
Note: See TracBrowser for help on using the repository browser.