source: main/trunk/gli/makegli.sh

Last change on this file was 37326, checked in by davidb, 15 months ago

Initial set of changes that allows the webswing version of GLI call a Javascript callback hander

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 7.7 KB
RevLine 
[36055]1#!/bin/bash
2
[6752]3glilang=en
[4935]4
[36055]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"
[32913]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
[6262]17echo
[12287]18if [ "$glilang" = "es" ]; then
[6959]19 echo "Interfaz de la Biblioteca Digital Greenstone (Greenstone Librarian Interface - GLI)"
[17946]20 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[6959]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"
[12287]24elif [ "$glilang" = "fr" ]; then
[6955]25 echo "Interface du Bibliothécaire Greenstone (Greenstone Librarian Interface - GLI)"
[17946]26 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[6955]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"
[12287]29elif [ "$glilang" = "ru" ]; then
[7041]30 echo "âÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone (Greenstone Librarian Interface - GLI)"
[17946]31 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[7041]32 echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
33 echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
[6706]34else
[7041]35 echo "Greenstone Librarian Interface (GLI)"
[17946]36 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[7041]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"
[6706]39fi
[6223]40echo
[5011]41
42## -------- Compile the Greenstone Librarian Interface --------
43
[36055]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
[36061]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;
[36055]55fi
56
[5011]57## ---- Check Javac exists ----
58javacpath=
59
60# Some users may set the above line manually
[12287]61if [ "x$javacpath" = "x" ]; then
[5011]62
[23359]63 # If the JAVAC environment variable is set then use it
64 if [ "x$JAVAC" != "x" ] ; then
65 javacpath=$JAVAC
[6467]66 # If it is set, use the JAVA_HOME environment variable
[23359]67 elif [ "x$JAVA_HOME" != "x" ]; then
[6467]68 javacpath="$JAVA_HOME/bin/javac"
[5011]69 # Check if Javac is on the search path
70 else
71 javacpath=`which javac 2> /dev/null`
72 fi
73fi
74
[35574]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
[23359]79
[35566]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
[5011]85# Check that a Javac executable has been found
[12287]86if [ "$glilang" = "es" ]; then
[6746]87 echo "Revisando Javac: $javacpath"
[12287]88elif [ "$glilang" = "fr" ]; then
[6711]89 echo "Vérification de Javac: $javacpath"
[12287]90elif [ "$glilang" = "ru" ]; then
[6706]91 echo "ðÒÏ×ÅÒËÁ Javac: $javacpath"
92else
93 echo "Checking Javac: $javacpath"
94fi
[5011]95if [ ! -x "$javacpath" ]; then
96 echo
[12287]97 if [ "$glilang" = "es" ]; then
[7003]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."
[12287]102 elif [ "$glilang" = "fr" ]; then
[6711]103 echo "Une version appropriée de Javac n'a pas pu être localisée."
[7003]104 echo "Veuillez installer une nouvelle version de Java SDK (version 1.4 ou"
105 echo "plus récente) et redémarrez ce script."
[12287]106 elif [ "$glilang" = "ru" ]; then
[6706]107 echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Javac."
[7003]108 echo "ðÏÖÁÌÕÊÓÔÁ, ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ Java SDK (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ"
109 echo "ÎÏ×ÕÀ) É ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ."
[6706]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
[4935]115 exit 1
[4916]116fi
117
[5011]118## ---- Compile the GLI ----
119
[4947]120# If a file has been specified at the command-line, just compile that file
[4935]121if [ ! "x$*" = "x" ] ; then
[10422]122 echo
[12287]123 if [ "$glilang" = "es" ]; then
[6746]124 echo "Compilando $* y clases dependientes..."
[12287]125 elif [ "$glilang" = "fr" ]; then
[6711]126 echo "Compilation de $* et des classes dépendantes,,,"
[12287]127 elif [ "$glilang" = "ru" ]; then
[6706]128 echo "ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ $* É ÚÁ×ÉÓÉÍÙÅ ËÌÁÓÓÙ..."
129 else
[8978]130 echo "Compiling $* and dependent classes..."
[6706]131 fi
[5011]132
[37326]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:lib/webswing-api.jar $*
[5011]134
[12287]135 if [ "$glilang" = "es" ]; then
[6746]136 echo "¡Hecho!"
[12287]137 elif [ "$glilang" = "fr" ]; then
[6711]138 echo "Terminé!"
[12287]139 elif [ "$glilang" = "ru" ]; then
[6706]140 echo "÷ÙÐÏÌÎÅÎÏ!"
141 else
142 echo "Done!"
143 fi
[4935]144 exit 0
145fi
146
147# Otherwise compile the lot...
[10422]148
149# Remove any existing class files first
150./clean.sh
151
[12287]152if [ "$glilang" = "es" ]; then
[6746]153 echo "Compilando la Interfaz de la Biblioteca Digital Greenstone..."
[12287]154elif [ "$glilang" = "fr" ]; then
[6711]155 echo "Compilation de Greenstone Librarian Interface,,,"
[12287]156elif [ "$glilang" = "ru" ]; then
[6706]157 echo "ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Greenstone..."
158else
159 echo "Compiling the Greenstone Librarian Interface..."
160fi
[5011]161
[9336]162# Compile the GLI
[37326]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:lib/webswing-api.jar src/org/greenstone/gatherer/GathererProg.java
[36180]164if [ $? -ne 0 ]; then
165 exit 1;
166fi
[37326]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:lib/webswing-api.jar src/org/greenstone/gatherer/WebGatherer.java
[36180]168if [ $? -ne 0 ]; then
169 exit 1;
170fi
[37326]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:lib/webswing-api.jar src/org/greenstone/gatherer/GathererApplet.java
[36180]172if [ $? -ne 0 ]; then
173 exit 1;
174fi
[37326]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:lib/webswing-api.jar src/org/greenstone/gatherer/GathererApplet4gs3.java
[9336]176# Compile the GEMS
[37326]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:lib/webswing-api.jar src/org/greenstone/gatherer/gems/GEMS.java
[36180]178if [ $? -ne 0 ]; then
179 exit 1;
180fi
[13386]181# Compile the standalone programs needed on the server for remote building
[23359]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
[13386]184
[12287]185if [ "$glilang" = "es" ]; then
[6746]186 echo "¡Hecho!"
[12287]187elif [ "$glilang" = "fr" ]; then
[6711]188 echo "Terminé!"
[12287]189elif [ "$glilang" = "ru" ]; then
[6706]190 echo "÷ÙÐÏÌÎÅÎÏ!"
191else
192 echo "Done!"
193fi
Note: See TracBrowser for help on using the repository browser.