Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix the build of java bundles, sorry
[simgrid.git] / buildtools / Cmake / Scripts / java_bundle.sh
1 #!/bin/sh
2
3 set -e
4 #set -x
5
6 if [ $# -lt 3 ]; then
7     cat >&2 <<EOF
8 Usage: $0 simgrid.jar java_command strip_command [-so file.so...] [-txt file.txt...]
9     simgrid.jar    SimGrid jar file
10     java_command   path to the Java runtime
11     strip_command  path to the command used to strip libraries
12     file.so        library file to stript and bundle into the archive
13     file.txt       other file  to bundle into the archive
14 EOF
15     exit 1
16 fi
17
18 SIMGRID_JAR=$1
19 JAVA=$2
20 STRIP=$3
21 shift 3
22
23 JSG_BUNDLE=$("$JAVA" -classpath "$SIMGRID_JAR" org.simgrid.NativeLib --quiet)
24
25 # sanity check
26 case "$JSG_BUNDLE" in
27     NATIVE/*)
28         cat >&2 <<EOF
29 -- [Java] Native libraries bundled into: ${JSG_BUNDLE}
30 EOF
31         ;;
32     *)
33         cat >&2 <<EOF
34 -- [Java] Native libraries NOT bundled into invalid directory: ${JSG_BUNDLE}
35 EOF
36         exit 1
37         ;;
38 esac
39
40 # prepare directory
41 rm -fr NATIVE
42 mkdir -p "$JSG_BUNDLE"
43
44 if [ "$1" = "-so" ]; then
45     shift
46     for file; do
47         [ "$file" != "-txt" ] || break
48         cp -f "$file" "$JSG_BUNDLE"
49         "$STRIP" -S "$JSG_BUNDLE/${file##*/}"
50         shift
51     done
52 fi
53
54 if [ "$1" = "-txt" ]; then
55     shift
56     for file; do
57         cp -f "$file" "$JSG_BUNDLE"
58         shift
59     done
60 fi