[36055] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
[6752] | 3 | glilang=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)
|
---|
| 7 | thisdir="`dirname \"$0\"`"
|
---|
| 8 | thisdir="`cd \"$thisdir\" && pwd`"
|
---|
| 9 | cd "$thisdir"
|
---|
[32913] | 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 |
|
---|
[6262] | 17 | echo
|
---|
[12287] | 18 | if [ "$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] | 24 | elif [ "$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] | 29 | elif [ "$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] | 34 | else
|
---|
[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] | 39 | fi
|
---|
[6223] | 40 | echo
|
---|
[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)
|
---|
| 49 | exit_status=0
|
---|
| 50 | source ./findgsdl.sh
|
---|
| 51 | exit_status=$?
|
---|
| 52 | if [ "$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] | 55 | fi
|
---|
| 56 |
|
---|
[5011] | 57 | ## ---- Check Javac exists ----
|
---|
| 58 | javacpath=
|
---|
| 59 |
|
---|
| 60 | # Some users may set the above line manually
|
---|
[12287] | 61 | if [ "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
|
---|
| 73 | fi
|
---|
| 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
|
---|
| 81 | if [ -f lib/rt-openjdk6.jar ] ; then
|
---|
| 82 | JAVACFLAGS="$JAVACFLAGS -bootclasspath lib/rt-openjdk6.jar -extdirs \"\""
|
---|
| 83 | fi
|
---|
| 84 |
|
---|
[5011] | 85 | # Check that a Javac executable has been found
|
---|
[12287] | 86 | if [ "$glilang" = "es" ]; then
|
---|
[6746] | 87 | echo "Revisando Javac: $javacpath"
|
---|
[12287] | 88 | elif [ "$glilang" = "fr" ]; then
|
---|
[6711] | 89 | echo "Vérification de Javac: $javacpath"
|
---|
[12287] | 90 | elif [ "$glilang" = "ru" ]; then
|
---|
[6706] | 91 | echo "ðÒÏ×ÅÒËÁ Javac: $javacpath"
|
---|
| 92 | else
|
---|
| 93 | echo "Checking Javac: $javacpath"
|
---|
| 94 | fi
|
---|
[5011] | 95 | if [ ! -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] | 116 | fi
|
---|
| 117 |
|
---|
[5011] | 118 | ## ---- Compile the GLI ----
|
---|
| 119 |
|
---|
[4947] | 120 | # If a file has been specified at the command-line, just compile that file
|
---|
[4935] | 121 | if [ ! "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
|
---|
| 145 | fi
|
---|
| 146 |
|
---|
| 147 | # Otherwise compile the lot...
|
---|
[10422] | 148 |
|
---|
| 149 | # Remove any existing class files first
|
---|
| 150 | ./clean.sh
|
---|
| 151 |
|
---|
[12287] | 152 | if [ "$glilang" = "es" ]; then
|
---|
[6746] | 153 | echo "Compilando la Interfaz de la Biblioteca Digital Greenstone..."
|
---|
[12287] | 154 | elif [ "$glilang" = "fr" ]; then
|
---|
[6711] | 155 | echo "Compilation de Greenstone Librarian Interface,,,"
|
---|
[12287] | 156 | elif [ "$glilang" = "ru" ]; then
|
---|
[6706] | 157 | echo "ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Greenstone..."
|
---|
| 158 | else
|
---|
| 159 | echo "Compiling the Greenstone Librarian Interface..."
|
---|
| 160 | fi
|
---|
[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] | 164 | if [ $? -ne 0 ]; then
|
---|
| 165 | exit 1;
|
---|
| 166 | fi
|
---|
[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] | 168 | if [ $? -ne 0 ]; then
|
---|
| 169 | exit 1;
|
---|
| 170 | fi
|
---|
[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] | 172 | if [ $? -ne 0 ]; then
|
---|
| 173 | exit 1;
|
---|
| 174 | fi
|
---|
[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] | 178 | if [ $? -ne 0 ]; then
|
---|
| 179 | exit 1;
|
---|
| 180 | fi
|
---|
[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] | 185 | if [ "$glilang" = "es" ]; then
|
---|
[6746] | 186 | echo "¡Hecho!"
|
---|
[12287] | 187 | elif [ "$glilang" = "fr" ]; then
|
---|
[6711] | 188 | echo "Terminé!"
|
---|
[12287] | 189 | elif [ "$glilang" = "ru" ]; then
|
---|
[6706] | 190 | echo "÷ÙÐÏÌÎÅÎÏ!"
|
---|
| 191 | else
|
---|
| 192 | echo "Done!"
|
---|
| 193 | fi
|
---|