From c77f659d4d80f0c2061e06df5e3d6580e508bb23 Mon Sep 17 00:00:00 2001
From: brad kittenbrink <brad@lindenlab.com>
Date: Fri, 23 Apr 2010 16:56:54 -0700
Subject: [PATCH] Added a separate autobuild buildscript build-cmd.sh so
 parabuild can deal with the extra steps of packaging and uploading
 separately.

---
 autobuild.xml |  6 +++---
 build-cmd.sh  | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 build.sh      | 34 +++++++---------------------------
 3 files changed, 61 insertions(+), 30 deletions(-)
 create mode 100755 build-cmd.sh

diff --git a/autobuild.xml b/autobuild.xml
index 6c5c932..c9b0c87 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -8,17 +8,17 @@
         <key>darwin</key>
         <map>
           <key>command</key>
-          <string>sh ./build.sh</string>
+          <string>sh ./build-cmd.sh</string>
         </map>
         <key>linux</key>
         <map>
           <key>command</key>
-          <string>sh ./build.sh</string>
+          <string>sh ./build-cmd.sh</string>
         </map>
         <key>windows</key>
         <map>
           <key>command</key>
-          <string>sh ./build.sh</string>
+          <string>sh ./build-cmd.sh</string>
         </map>
       </map>
       <key>builddir</key>
diff --git a/build-cmd.sh b/build-cmd.sh
new file mode 100755
index 0000000..f39a05f
--- /dev/null
+++ b/build-cmd.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# turn on verbose debugging output for parabuild logs.
+set -x
+# make errors fatal
+set -e
+
+ZLIB_VERSION="1.2.3"
+ZLIB_SOURCE_DIR="zlib-$ZLIB_VERSION"
+ZLIB_ARCHIVE="$ZLIB_SOURCE_DIR.tar.gz"
+ZLIB_URL="http://downloads.sourceforge.net/project/libpng/zlib/$ZLIB_VERSION/$ZLIB_ARCHIVE"
+ZLIB_MD5="debc62758716a169df9f62e6ab2bc634" # for zlib-1.2.3.tar.gz
+
+if [ -z "$autobuild" ] ; then 
+    fail
+fi
+
+# load autbuild provided shell functions and variables
+set +x
+eval "$("$autobuild" source_environment)"
+set -x
+
+fetch_archive "$ZLIB_URL" "$ZLIB_ARCHIVE" "$ZLIB_MD5"
+extract "$ZLIB_ARCHIVE"
+
+top="$(pwd)"
+cd "$ZLIB_SOURCE_DIR"
+    case "$AUTOBUILD_PLATFORM" in
+        "windows")
+            build_sln "contrib/vstudio/vc8/zlibvc.sln" "Debug|Win32"
+            build_sln "contrib/vstudio/vc8/zlibvc.sln" "Release|Win32"
+            mkdir -p stage/lib/{debug,release}
+            cp "contrib/vstudio/vc8/x86/ZlibStatDebug/zlibstat.lib" \
+                "stage/lib/debug/zlibd.lib"
+            cp "contrib/vstudio/vc8/x86/ZlibStatRelease/zlibstat.lib" \
+                "stage/lib/release/zlib.lib"
+            mkdir -p "stage/include/zlib"
+            cp {zlib.h,zconf.h} "stage/include/zlib"
+        ;;
+        *)
+            ./configure --prefix="$(pwd)/stage"
+            make
+            make install
+        ;;
+    esac
+    mkdir -p stage/LICENSES
+    tail -n 31 README > stage/LICENSES/zlib.txt
+cd "$top"
+
+pass
+
diff --git a/build.sh b/build.sh
index 09ea33c..79c1301 100755
--- a/build.sh
+++ b/build.sh
@@ -54,37 +54,17 @@ set +x
 eval "$("$autobuild" source_environment)"
 set -x
 
-fetch_archive "$ZLIB_URL" "$ZLIB_ARCHIVE" "$ZLIB_MD5"
-extract "$ZLIB_ARCHIVE"
-
-top="$(pwd)"
-cd "$ZLIB_SOURCE_DIR"
-    case "$AUTOBUILD_PLATFORM" in
-        "windows")
-            build_sln "contrib/vstudio/vc8/zlibvc.sln" "Debug|Win32"
-            build_sln "contrib/vstudio/vc8/zlibvc.sln" "Release|Win32"
-            mkdir -p stage/lib/{debug,release}
-            cp "contrib/vstudio/vc8/x86/ZlibStatDebug/zlibstat.lib" \
-                "stage/lib/debug/zlibd.lib"
-            cp "contrib/vstudio/vc8/x86/ZlibStatRelease/zlibstat.lib" \
-                "stage/lib/release/zlib.lib"
-            mkdir -p "stage/include/zlib"
-            cp {zlib.h,zconf.h} "stage/include/zlib"
-        ;;
-        *)
-            ./configure --prefix="$(pwd)/stage"
-            make
-            make install
-        ;;
-    esac
-    mkdir -p stage/LICENSES
-    tail -n 31 README > stage/LICENSES/zlib.txt
-cd "$top"
+"$autobuild" build
 
 "$autobuild" package
 
-ZLIB_INSTALLABLE_PACKAGE_FILENAME="zlib-$ZLIB_VERSION-$AUTOBUILD_PLATFORM-$(date +%Y%m%d)*.tar.bz2"
+ZLIB_INSTALLABLE_PACKAGE_FILENAME="$(ls -1 zlib-$ZLIB_VERSION-$AUTOBUILD_PLATFORM-$(date +%Y%m%d)*.tar.bz2)"
 "$autobuild" upload "$ZLIB_INSTALLABLE_PACKAGE_FILENAME"
 
+ZLIB_INSTALLABLE_PACKAGE_MD5="$(calc_md5 "$ZLIB_INSTALLABLE_PACKAGE_FILENAME")"
+echo "{'md5':'$ZLIB_INSTALLABLE_PACKAGE_MD5', 'url':'http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/$ZLIB_INSTALLABLE_PACKAGE_FILENAME'}" > "output.json"
+
+uplodad_item installer "output.json" text/plain
+
 pass
 
-- 
GitLab