]> gitweb.fperrin.net Git - DictionaryPC.git/commitdiff
Move library search to a common file
authorFrédéric Perrin <fred@fperrin.net>
Sun, 7 Feb 2021 00:33:50 +0000 (00:33 +0000)
committerFrédéric Perrin <fred@fperrin.net>
Sun, 7 Feb 2021 00:33:50 +0000 (00:33 +0000)
WiktionarySplitter.sh
compile.sh
convert_to_v6.sh
javalibs.sh [new file with mode: 0644]
run.sh

index 66d38a23cfe8d20309a38b436121fd0cd8002099..e160adf35cad7febf3603367fcac678e50c02de2 100755 (executable)
@@ -1,12 +1,10 @@
+#!/bin/bash
+
 # Run after downloading (data/downloadInputs.sh) to generate
 # per-language data files from enwiktionary.
 RUNNER=./DictionaryPC
 if ! test -x "$RUNNER" ; then
-  ICU4J=/usr/share/java/icu4j-49.1.jar
-  test -r "$ICU4J" || ICU4J=/usr/share/icu4j-55/lib/icu4j.jar
-  COMMONS_COMPRESS=/usr/share/java/commons-compress.jar
-  JAVA=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
-  test -x "$JAVA" || JAVA=java
+  . javalibs.sh
   RUNNER="$JAVA -Xmx4096m -Xverify:none -classpath bin/:$ICU4J:$COMMONS_COMPRESS com.hughes.android.dictionary.engine.Runner"
 fi
 $RUNNER WiktionarySplitter "$@"
index da057ce253fc438694da7000074c75141c0efa29..fdbb88739ae19e2b7f9f75c0c26095908fb13d78 100755 (executable)
@@ -1,35 +1,8 @@
-ICU4J=/usr/share/java/icu4j.jar
-test -r "$ICU4J" || ICU4J=/usr/share/icu4j-55/lib/icu4j.jar
-JUNIT=/usr/share/java/junit.jar
-test -r "$JUNIT" || JUNIT=/usr/share/junit/lib/junit.jar
-COMMONS=/usr/share/java/commons-lang3.jar
-test -r "$COMMONS" || COMMONS=/usr/share/commons-lang-3.3/lib/commons-lang.jar
-COMMONS_COMPRESS=/usr/share/java/commons-compress.jar
-if [ ! -x ../Dictionary ] ; then
-    echo "You need to clone the Dictionary repository (including subprojects) into .."
-    exit 1
-fi
-if [ ! -r "$ICU4J" ] ; then
-    echo "ICU4J needs to be installed"
-    exit 1;
-fi
-if [ ! -r "$JUNIT" ] ; then
-    echo "Junit needs to be installed"
-    exit 1;
-fi
-if [ ! -r "$COMMONS" ] ; then
-    echo "commons-lang needs to be installed"
-    exit 1;
-fi
-if [ ! -r "$COMMONS_COMPRESS" ] ; then
-    echo "commons-compress needs to be installed"
-    exit 1;
-fi
-JAVAC=/usr/lib/jvm/java-8-openjdk-amd64/bin/javac
-test -x "$JAVAC" || JAVAC=javac
+#!/bin/bash
+. ./javalibs.sh
 
 mkdir -p bin
 # -encoding is just a work around for user that still run systems
 # with non-UTF8 locales
 # Limit to Java 11 for compatibility with native-image
-$JAVAC -Xlint:all -encoding UTF-8 -g -d bin/ ../Dictionary/Util/src/com/hughes/util/*.java ../Dictionary/Util/src/com/hughes/util/raf/*.java ../Dictionary/src/com/hughes/android/dictionary/DictionaryInfo.java ../Dictionary/src/com/hughes/android/dictionary/engine/*.java ../Dictionary/src/com/hughes/android/dictionary/C.java src/com/hughes/util/*.java src/com/hughes/android/dictionary/*.java src/com/hughes/android/dictionary/*/*.java src/com/hughes/android/dictionary/*/*/*.java -classpath "$ICU4J:$JUNIT:$COMMONS:$COMMONS_COMPRESS"
+$JAVAC -Xlint:all -encoding UTF-8 -g -d bin/ ../Dictionary/Util/src/com/hughes/util/*.java ../Dictionary/Util/src/com/hughes/util/raf/*.java ../Dictionary/src/com/hughes/android/dictionary/DictionaryInfo.java ../Dictionary/src/com/hughes/android/dictionary/engine/*.java ../Dictionary/src/com/hughes/android/dictionary/C.java src/com/hughes/util/*.java src/com/hughes/android/dictionary/*.java src/com/hughes/android/dictionary/*/*.java src/com/hughes/android/dictionary/*/*/*.java -classpath "$ICU4J:$JUNIT:$COMMONS_LANG3:$COMMONS_TEXT:$COMMONS_COMPRESS"
index 426a10cbe801e615a017c2d2b871327ea491a100..60cd01d3d95f6c5a455c88b9ff039b26658e74c4 100755 (executable)
@@ -1,7 +1,8 @@
+#!/bin/bash
+
 RUNNER=./DictionaryPC
 if ! test -x "$RUNNER" ; then
-  JAVA=/usr/lib/jvm/java-8-openjdk-amd64/bin/java
-  test -x "$JAVA" || JAVA=java
+  . javalibs.sh
   RUNNER="$JAVA -classpath bin/ com.hughes.android.dictionary.engine.Runner"
 fi
 $RUNNER ConvertToV6 "$@"
diff --git a/javalibs.sh b/javalibs.sh
new file mode 100644 (file)
index 0000000..f25a436
--- /dev/null
@@ -0,0 +1,56 @@
+set -e
+
+if [ -z $ICU4J ]; then
+    ICU4J=/usr/share/java/icu4j.jar
+    ICU4J=/usr/share/java/com.ibm.icu-4.4.jar
+    test -r "$ICU4J" || ICU4J=/usr/share/icu4j-55/lib/icu4j.jar
+fi
+if [ ! -r "$ICU4J" ] ; then
+    echo "ICU4J needs to be installed"
+    exit 1;
+fi
+
+if [ -z "$JUNIT" ]; then
+    JUNIT=/usr/share/java/junit.jar
+    test -r "$JUNIT" || JUNIT=/usr/share/junit/lib/junit.jar
+fi
+if [ ! -r "$JUNIT" ] ; then
+    echo "Junit needs to be installed"
+    exit 1;
+fi
+
+if [ -z "$COMMONS_LANG3" ]; then
+    COMMONS_LANG3=/usr/share/java/commons-lang3.jar
+    test -r "$COMMONS_LANG3" || COMMONS_LANG3=/usr/share/commons-lang-3.3/lib/commons-lang.jar
+fi
+if [ ! -r "$COMMONS_LANG3" ] ; then
+    echo "commons-lang needs to be installed"
+    exit 1;
+fi
+
+if [ -z "$COMMONS_COMPRESS" ]; then
+    COMMONS_COMPRESS=/usr/share/java/commons-compress.jar
+fi
+if [ ! -r "$COMMONS_COMPRESS" ] ; then
+    echo "commons-compress needs to be installed"
+    exit 1;
+fi
+
+if [ ! -x ../Dictionary ] ; then
+    echo "You need to clone the Dictionary repository (including subprojects) into .."
+    exit 1
+fi
+
+if [ -z "$JAVA" ]; then
+    JAVA=/usr/lib/jvm/java-8-openjdk-amd64/bin/java
+fi
+if [ ! -r "$JAVA" ]; then
+    echo "could not find java at $JAVA"
+    exit 1
+fi
+JAVAC=${JAVA}c
+if [ ! -r "$JAVAC" ]; then
+    echo "could not find javac at $JAVAC"
+    exit 1
+fi
+
diff --git a/run.sh b/run.sh
index 13514180fcbb78e40f59f02c3d33c2972e7dcf6f..89503bf9190a1076f4af2cfcaaf5d0a84085f4d3 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -1,14 +1,8 @@
+#!/bin/bash
+
 RUNNER=./DictionaryPC
 if ! test -x "$RUNNER" ; then
-  # -agentlib:hprof=heap=sites,depth=20
-  ICU4J=/usr/share/java/icu4j.jar
-  test -r "$ICU4J" || ICU4J=/usr/share/icu4j-55/lib/icu4j.jar
-  COMMONS_LANG3=/usr/share/java/commons-lang3.jar
-  test -r "$COMMONS_LANG3" || COMMONS_LANG3=/usr/share/commons-lang-3.3/lib/commons-lang.jar
-  COMMONS_TEXT=/usr/share/java/commons-text.jar
-  COMMONS_COMPRESS=/usr/share/java/commons-compress.jar
-  JAVA=/usr/lib/jvm/java-8-openjdk-amd64/bin/java
-  test -x "$JAVA" || JAVA=java
+  . javalibs.sh
   RUNNER="$JAVA -Djava.util.logging.config.file=logging.properties -Xmx4096m -classpath bin/:$ICU4J:$COMMONS_LANG3:$COMMONS_TEXT:$COMMONS_COMPRESS com.hughes.android.dictionary.engine.Runner"
 fi
 $RUNNER DictionaryBuilder "$@"