summaryrefslogtreecommitdiff
path: root/lang/sml-nj-devel/files/patch-config::install.sh
blob: f295a29314182c6d84b716084141c3783210b23f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
--- config/install.sh.orig	Thu Oct 28 17:44:01 2004
+++ config/install.sh	Wed Nov  3 13:36:09 2004
@@ -12,6 +12,8 @@
 # Author: Matthias Blume (blume@tti-c.org)
 #
 
+[ -n "$RECOMPILEDIR" ] && echo "RECOMPILEDIR=$RECOMPILEDIR"
+
 if [ x${INSTALL_QUIETLY} = xtrue ] ; then
     export CM_VERBOSE
     CM_VERBOSE=false
@@ -32,6 +34,28 @@
     exit 1
 }
 
+#
+# do_patch patch-file
+# apply a patch file
+do_patch() {
+	patchfile=$FILESDIR/$1
+
+	if [ ! -r $patchfile ]; then
+		echo "$this: !!! patch file $patchfile not found."
+		exit 1;
+	fi
+
+	if [ ! -f $CONFIGDIR/.patch_$1 ]; then
+		$PATCH $PATCH_ARGS < $patchfile || {\
+			echo "$this: !!! patch file $patchfile failed to patch."
+			exit 1;
+		}
+		echo > $CONFIGDIR/.patch_$1
+	else
+		echo "$this: patch $patchfile already installed."
+	fi
+}
+
 this=$0
 
 
@@ -299,7 +323,12 @@
 # the name of the bin files directory
 #
 BOOT_ARCHIVE=boot.$ARCH-unix
-BOOT_FILES=sml.$BOOT_ARCHIVE
+if [ -z "$RECOMPILEDIR" ]
+then
+	BOOT_FILES=sml.$BOOT_ARCHIVE
+else
+	BOOT_FILES=$RECOMPILEDIR/sml.$BOOT_ARCHIVE
+fi
 
 #
 # build the run-time system
@@ -308,12 +337,17 @@
     vsay $this: Run-time system already exists.
 else
     $CONFIGDIR/unpack $ROOT runtime
+    [ -n "$MLRUNTIMEPATCHES" ] && \
+    for p in $MLRUNTIMEPATCHES
+    do
+	do_patch $p
+    done
     cd $SRCDIR/runtime/objs
     echo $this: Compiling the run-time system.
     $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
     if [ -x run.$ARCH-$OPSYS ]; then
 	mv run.$ARCH-$OPSYS $RUNDIR
-	$MAKE MAKE=$MAKE clean
+	[ "$MLNORUNTIMECLEAN" ] || $MAKE MAKE=$MAKE clean
     else
 	complain "$this: !!! Run-time system build failed for some reason."
     fi
@@ -330,7 +364,7 @@
     export CM_DIR_ARC
     CM_DIR_ARC=$ORIG_CM_DIR_ARC
 else
-    $CONFIGDIR/unpack $ROOT $BOOT_ARCHIVE
+    [ -n "$RECOMPILEDIR" ] || $CONFIGDIR/unpack $ROOT $BOOT_ARCHIVE
 
     fish $ROOT/$BOOT_FILES/basis.cm
 
@@ -399,5 +433,18 @@
 else
     complain "$this: !!! Installation of libraries and programs failed."
 fi
+
+# extract required sources
+[ -n "$MLSOURCEUNPACKTARGETS" ] && \
+for t in $MLSOURCEUNPACKTARGETS
+do
+	$CONFIGDIR/unpack $ROOT $t
+done
+# apply source patches
+[ -n "$MLSOURCEPATCHES" ] && \
+for p in "$MLSOURCEPATCHES"
+do
+	do_patch $p
+done
 
 exit 0