shellfiles/build_stx_libjava.sh
changeset 226 a48cbce777eb
parent 113 28d9dbbe08c2
child 227 8f0a7e9bddfb
--- a/shellfiles/build_stx_libjava.sh	Fri Jan 24 16:30:31 2014 +0100
+++ b/shellfiles/build_stx_libjava.sh	Fri Jan 24 17:38:45 2014 +0100
@@ -14,17 +14,6 @@
     UNIX=1
 fi
 
-if [ "$1" == "-tests" ]; then
-    SKIP_CHECKOUT=yes
-    SKIP_COMPILE=yes
-    SKIP_ARTIFACTS=yes
-
-    RUN_REPORTS=yes
-fi
-
-
-
-
 # Setup...
 if [ "$WIN32" == "1" ]; then
     # WINDOWS
@@ -42,6 +31,11 @@
     # LINUX
     # to get Mercurial
     export PATH=$PATH:/home/vrany/bin
+    if [ $(uname -n) == 'exeptn' ]; then
+    	# On exeptn, default Java is 1.4, sigh
+    	export PATH=/usr/java/jdk1.7.0_13/bin:$PATH
+    fi
+
     # Make using regular make here..."
     MAKE=make
     # Defaults
@@ -87,40 +81,61 @@
 
 pushd "$BUILD"
 
+function checkout_hg {
+	local directory=$1
+	local repository=$2
+	local branch=$3
+
+	if [ -z "$branch" ]; then
+		branch=default
+	fi
+
+    if [ -d "$directory/CVS" ]; then
+      rm -rf "$directory"
+    fi
+
+    if [ ! -d "$directory" ]; then
+      if ! hg clone "$repository" "$directory" -b "$branch";  then
+        echo "ERROR: HG: Cannot clone $directory";
+        exit;
+      fi
+    else
+      if ! hg --cwd "$directory" pull;  then
+        echo "ERROR: HG: Cannot pull $directory";
+        exit;
+      fi
+      if ! hg --cwd "$directory" update;  then
+        echo "ERROR: HG: Cannot update $directory";
+        exit;
+      fi
+    fi
+
+}
+
+
 if [ -z "$SKIP_CHECKOUT" ]; then
 
     echo "INFO: Checking out source code"
-    
+
     # Checkout stx
     if [ ! -d stx ]; then
       if ! cvs co stx; then
-        echo "ERROR: CVS: Cannot checkout stx";  
+        echo "ERROR: CVS: Cannot checkout stx";
         exit;
       fi
     else
       (cd stx && cvs update -d)
     fi
-    
-    # Checkout stx:libjava
-    if [ -d stx/libjava/CVS ]; then
-      rm -rf stx/libjava
-    fi
+
+    checkout_hg stx/stc /home/vrany/repositories/hg/stx.stc jv
+    checkout_hg stx/librun /home/vrany/repositories/hg/stx.librun jv
 
-    if [ ! -d stx/libjava ]; then
-      if ! hg clone https://swing.fit.cvut.cz/hg/stx.libjava/ stx/libjava -b development;  then
-        echo "ERROR: HG: Cannot clone stx/libjava";  
-        exit;
-      fi     
-    else 
-      if ! hg --cwd stx/libjava pull;  then
-        echo "ERROR: HG: Cannot pull stx/libjava";  
-        exit;
-      fi
-      if ! hg --cwd stx/libjava update;  then
-        echo "ERROR: HG: Cannot update stx/libjava";  
-        exit;
-      fi
+    # stx:libjava repo is huge, so first update from local cache
+    # and then fetch updates from BitBucket.  
+    if [ $(uname -n) == 'exeptn' ]; then
+       checkout_hg stx/libjava /home/vrany/repositories/hg/stx.libjava development
     fi
+    checkout_hg stx/libjava https://janvrany@bitbucket.org/janvrany/stx-libjava development
 
 else
     echo "INFO: Checkout skipped (SKIP_CHECKOUT=$SKIP_CHECKOUT)"
@@ -130,6 +145,16 @@
 
 if [ -z "$SKIP_COMPILE" ]; then
 
+    if [ "$UNIX" == "1" ]; then
+	if [ ! -f stx/configurations/myConf ]; then
+	    (cd stx && ./CONFIG)
+	fi
+	# Hack...
+        if [ ! -f stx/librun/makefile ]; then
+            (cd stx/librun && ../rules/stmkmf)
+        fi
+    fi
+
     echo "INFO: Compiling"
     TARGETS1="stx stx/libjava stx/goodies/petitparser stx/libjava/tools stx/libjava/experiments stx/projects/smalltalk stx/librun"
     for target in $TARGETS1; do
@@ -138,7 +163,7 @@
         exit 3
       fi
     done
-  
+
 else
     echo "INFO: Compilation skipped (SKIP_COMPILE=$SKIP_COMPILE)"
 fi