author  wenzelm 
Thu, 17 Jul 2008 15:26:04 +0200  
changeset 27628  901656b3205d 
child 27629  ec92e8eb6a1e 
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 
# 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

5 
# Administrative build  finish Isabelle source distribution. 
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 

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

12 
PATH="/home/scala/bin:$PATH" 
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 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

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

22 
OLD_LAYOUT=false 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

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

24 

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

25 

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

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

27 

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

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

29 

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

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

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

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

33 

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

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

35 

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

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

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

38 

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

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

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

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

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

43 

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

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

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

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

47 

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

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

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

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

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

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

53 

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

54 

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

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

56 

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

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

58 

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

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

60 

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

61 

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

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

63 

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

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

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

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

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

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

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

70 

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

71 

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

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

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

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

75 
echo "### Building graph browser ..." 
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 

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

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

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

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

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

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

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

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

85 

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

86 

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

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

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

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

90 
echo "### Building documentation ..." 
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 

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

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

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

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

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

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

98 

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

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

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

101 
pushd "$DOC" > /dev/null 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

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

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

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

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

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

107 

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

108 

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

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

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

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

112 
echo "### Building JVM components ..." 
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 

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

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

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

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

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

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

120 

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

121 
pushd lib/classes 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

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

123 
[ f isabelle.jar ]  fail "Failed to build Isabelle process wrapper!" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

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

125 

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

126 
type p scalac  fail "Scala compiler unavailable" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

127 
pushd lib/jedit/plugin 
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 jEdit plugin!" 
901656b3205d
Administrative build  finish Isabelle source distribution.
wenzelm
parents:
diff
changeset

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

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

132 

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

133 

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

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

135 

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

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

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

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

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

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

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

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

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

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

145 
done 