author | blanchet |
Wed, 18 Jul 2012 08:44:04 +0200 | |
changeset 48315 | 82d6e46c673f |
parent 47970 | 257fc09aa8a1 |
permissions | -rwxr-xr-x |
47970
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
1 |
#!/usr/bin/env bash |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
2 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
3 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
4 |
## diagnostics |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
5 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
6 |
PRG="$(basename "$0")" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
7 |
THIS="$(cd $(dirname "$0"); pwd)" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
8 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
9 |
function usage() |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
10 |
{ |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
11 |
cat <<EOF |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
12 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
13 |
Usage: $PRG [VERSION] |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
14 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
15 |
Build hybrid Isabelle component for JDK on x86-linux/x86_64-linux. |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
16 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
17 |
VERSION is 7u4 for 1.7.0_04 etc. |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
18 |
EOF |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
19 |
exit 1 |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
20 |
} |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
21 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
22 |
function fail() |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
23 |
{ |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
24 |
echo "$1" >&2 |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
25 |
exit 2 |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
26 |
} |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
27 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
28 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
29 |
## process command line |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
30 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
31 |
# args |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
32 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
33 |
VERSION="" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
34 |
[ "$#" -gt 0 ] && { VERSION="$1"; shift; } |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
35 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
36 |
[ "$#" -gt 0 ] && usage |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
37 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
38 |
case "$VERSION" in |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
39 |
*u?) |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
40 |
MAJOR="$(echo "$VERSION" | cut -du -f1)" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
41 |
MINOR="0$(echo "$VERSION" | cut -du -f2)" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
42 |
;; |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
43 |
*u??) |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
44 |
MAJOR="$(echo "$VERSION" | cut -du -f1)" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
45 |
MINOR="$(echo "$VERSION" | cut -du -f2)" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
46 |
;; |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
47 |
*) |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
48 |
fail "Bad version identifier: \"$VERSION\"" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
49 |
;; |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
50 |
esac |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
51 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
52 |
FULL_VERSION="1.${MAJOR}.0_${MINOR}" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
53 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
54 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
55 |
## main |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
56 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
57 |
DIR="jdk${FULL_VERSION}_x86-linux" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
58 |
mkdir "$DIR" || fail "Cannot create fresh directory: \"$DIR\"" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
59 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
60 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
61 |
# README |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
62 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
63 |
cat >> "$DIR/README" << EOF |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
64 |
This is JDK $FULL_VERSION for x86-linux and x86_64-linux |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
65 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
66 |
See http://www.oracle.com/technetwork/java/javase/downloads/index.html |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
67 |
for the original downloads, which are covered by the Oracle Binary |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
68 |
Code License Agreement for Java SE. |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
69 |
EOF |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
70 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
71 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
72 |
# settings |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
73 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
74 |
mkdir "$DIR/etc" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
75 |
cat >> "$DIR/etc/settings" << EOF |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
76 |
# -*- shell-script -*- :mode=shellscript: |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
77 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
78 |
ISABELLE_JDK_HOME="\$COMPONENT/\${ISABELLE_PLATFORM64:-\$ISABELLE_PLATFORM}" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
79 |
EOF |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
80 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
81 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
82 |
# content |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
83 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
84 |
tar -C "$DIR" -x -f "jdk-$VERSION-linux-i586.tar.gz" || \ |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
85 |
fail "Bad archive: \"jdk-$VERSION-linux-i586.tar.gz\"" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
86 |
mv "$DIR/jdk$FULL_VERSION" "$DIR/x86-linux" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
87 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
88 |
tar -C "$DIR" -x -f "jdk-$VERSION-linux-x64.tar.gz" || \ |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
89 |
fail "Bad archive: \"jdk-$VERSION-linux-x64.tar.gz\"" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
90 |
mv "$DIR/jdk$FULL_VERSION" "$DIR/x86_64-linux" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
91 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
92 |
( |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
93 |
cd "$DIR/x86-linux" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
94 |
for FILE in $(find . -type f) |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
95 |
do |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
96 |
if cmp -s "$FILE" "../x86_64-linux/$FILE" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
97 |
then |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
98 |
ln -f "$FILE" "../x86_64-linux/$FILE" |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
99 |
fi |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
100 |
done |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
101 |
) |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
102 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
103 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
104 |
# create archive |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
105 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
106 |
tar -cz -f "${DIR}.tar.gz" "$DIR" && rm -rf "$DIR" |