author  wenzelm 
Fri, 15 Aug 2008 22:16:13 +0200  
changeset 27904  343696007eca 
parent 27655  cf0c60e821bb 
child 27915  42581956d75b 
permissions  rwxrxrx 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

1 
#!/usr/bin/env bash 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

2 
# 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

3 
# $Id$ 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

4 
# 
27629  5 
# Administrative build for Isabelle source distribution. 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

6 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

7 
## global environment 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

8 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

9 
#paranoia setting for sunbroy 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

10 
PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

11 

27650  12 
PATH="/home/scala/scala/bin:$PATH" 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

13 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

14 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

15 
## directory layout 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

16 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

17 
ISABELLE_DIR="$(cd "$(dirname "$0")"; cd "$(pwd P)"; cd ..; pwd)" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

18 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

19 
if [ d "$ISABELLE_DIR/Distribution" ]; then 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

20 
OLD_LAYOUT=true 
27904  21 
ISATOOL="$ISABELLE_DIR/Distribution/bin/isatool" 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

22 
else 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

23 
OLD_LAYOUT=false 
27904  24 
ISATOOL="$ISABELLE_DIR/bin/isatool" 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

25 
fi 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

26 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

27 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

28 
## diagnostics 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

29 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

30 
PRG="$(basename "$0")" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

31 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

32 
function usage() 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

33 
{ 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

34 
cat <<EOF 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

35 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

36 
Usage: $PRG [MODULES] 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

37 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

38 
Produce Isabelle distribution modules from current repository sources. 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

39 
The MODULES list may contain any of the following: 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

40 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

41 
all all modules below 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

42 
browser graph browser (requires jdk) 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

43 
doc documentation (requires latex and rail) 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

44 
jars JVM components (requires jdk and scala) 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

45 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

46 
EOF 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

47 
exit 1 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

48 
} 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

49 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

50 
function fail() 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

51 
{ 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

52 
echo "$1" >&2 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

53 
exit 2 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

54 
} 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

55 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

56 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

57 
## process command line 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

58 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

59 
[ "$#" eq 0 ] && usage 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

60 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

61 
MODULES="$@"; shift "$#" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

62 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

63 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

64 
## modules 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

65 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

66 
function build_all () 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

67 
{ 
27649  68 
build_doc 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

69 
build_browser 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

70 
build_jars 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

71 
} 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

72 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

73 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

74 
function build_browser () 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

75 
{ 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

76 
echo "###" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

77 
echo "### Building graph browser ..." 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

78 
echo "###" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

79 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

80 
if [ "$OLD_LAYOUT" = true ]; then 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

81 
cd "$ISABELLE_DIR/Distribution/lib/browser" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

82 
else 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

83 
cd "$ISABELLE_DIR/lib/browser" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

84 
fi 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

85 
make clean all  fail "Failed to build graph browser!" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

86 
} 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

87 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

88 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

89 
function build_doc () 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

90 
{ 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

91 
echo "###" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

92 
echo "### Building documentation ..." 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

93 
echo "###" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

94 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

95 
if [ "$OLD_LAYOUT" = true ]; then 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

96 
cd "$ISABELLE_DIR/Doc" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

97 
else 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

98 
cd "$ISABELLE_DIR/docsrc" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

99 
fi 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

100 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

101 
for DOC in $(cat Dirs) 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

102 
do 
27629  103 
pushd "$DOC" >/dev/null 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

104 
make clean dvi  fail "DVI document for $DOC failed!" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

105 
make clean pdf  fail "PDF document for $DOC failed!" 
27629  106 
popd >/dev/null 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

107 
done 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

108 
} 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

109 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

110 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

111 
function build_jars () 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

112 
{ 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

113 
echo "###" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

114 
echo "### Building JVM components ..." 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

115 
echo "###" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

116 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

117 
if [ "$OLD_LAYOUT" = true ]; then 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

118 
cd "$ISABELLE_DIR/Distribution" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

119 
else 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

120 
cd "$ISABELLE_DIR" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

121 
fi 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

122 

27904  123 
pushd src/Pure >/dev/null 
124 
"$ISATOOL" make jar  fail "Failed to build Pure.jar!" 

125 
popd >/dev/null 

126 

27629  127 
pushd lib/classes >/dev/null 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

128 
./mk 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

129 
[ f isabelle.jar ]  fail "Failed to build Isabelle process wrapper!" 
27629  130 
popd >/dev/null 
27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

131 

27655  132 
if [ d "$HOME/lib/jedit/current" ]; then 
133 
type p scalac >/dev/null  fail "Scala compiler unavailable" 

134 
pushd lib/jedit/plugin >/dev/null 

135 
./mk 

136 
[ f ../isabelle.jar ]  fail "Failed to build jEdit plugin!" 

137 
popd >/dev/null 

138 
else 

139 
echo "Warning: skipping jedit plugin" 

140 
fi 

27628
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

141 
} 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

142 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

143 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

144 
## main 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

145 

901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

146 
for MODULE in $MODULES 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

147 
do 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

148 
case $MODULE in 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

149 
all) build_all;; 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

150 
browser) build_browser;; 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

151 
doc) build_doc;; 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

152 
jars) build_jars;; 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

153 
*) fail "Bad module $MODULE" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

154 
esac 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

155 
done 