From 2e9acc00319e6666093c301c75b38fd20fb8fa33 Mon Sep 17 00:00:00 2001
From: Dave Huseby <huseby@lindenlab.com>
Date: Mon, 14 Nov 2011 11:26:33 -0800
Subject: [PATCH] adding debug build to linux

---
 .hgignore     |  7 +++++++
 autobuild.xml | 17 +++++++++--------
 build-cmd.sh  | 21 +++++++++++++++------
 3 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/.hgignore b/.hgignore
index f1dbb0a..ab76c2c 100644
--- a/.hgignore
+++ b/.hgignore
@@ -1,3 +1,10 @@
 syntax: glob
 stage/
 autobuild-parabuild-bootstrap/
+zlib-1.2.5/*.lo
+zlib-1.2.5/*.o
+zlib-1.2.5/*.so*
+zlib-1.2.5/*.a
+zlib-1.2.5/*.pc
+zlib-1.2.5/example*
+zlib-1.2.5/minigzip*
diff --git a/autobuild.xml b/autobuild.xml
index 308d0ac..c31b388 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -17,7 +17,7 @@
           <string>stage</string>
           <key>configurations</key>
           <map>
-            <key>Release</key>
+            <key>default</key>
             <map>
               <key>build</key>
               <map>
@@ -30,7 +30,7 @@
                 <string>bash</string>
               </map>
               <key>name</key>
-              <string>Release</string>
+              <string>default</string>
             </map>
           </map>
           <key>manifest</key>
@@ -45,7 +45,7 @@
         <map>
           <key>configurations</key>
           <map>
-            <key>Release</key>
+            <key>default</key>
             <map>
               <key>build</key>
               <map>
@@ -53,7 +53,7 @@
               <key>default</key>
               <boolean>true</boolean>
               <key>name</key>
-              <string>Release</string>
+              <string>default</string>
             </map>
           </map>
           <key>manifest</key>
@@ -67,7 +67,7 @@
         <map>
           <key>configurations</key>
           <map>
-            <key>Release</key>
+            <key>default</key>
             <map>
               <key>build</key>
               <map>
@@ -75,12 +75,13 @@
               <key>default</key>
               <boolean>true</boolean>
               <key>name</key>
-              <string>Release</string>
+              <string>default</string>
             </map>
           </map>
           <key>manifest</key>
           <array>
             <string>lib/release/libz.a</string>
+            <string>lib/debug/libz_debug.a</string>
           </array>
           <key>name</key>
           <string>linux</string>
@@ -89,7 +90,7 @@
         <map>
           <key>configurations</key>
           <map>
-            <key>Release</key>
+            <key>default</key>
             <map>
               <key>build</key>
               <map>
@@ -97,7 +98,7 @@
               <key>default</key>
               <boolean>true</boolean>
               <key>name</key>
-              <string>Release</string>
+              <string>default</string>
             </map>
           </map>
           <key>manifest</key>
diff --git a/build-cmd.sh b/build-cmd.sh
index f41cbf2..435becc 100755
--- a/build-cmd.sh
+++ b/build-cmd.sh
@@ -56,15 +56,24 @@ pushd "$ZLIB_SOURCE_DIR"
             mv "$stage/include/"*.h "$stage/include/zlib/"
         ;;
         "linux")
-            CFLAGS="-m32" CXXFLAGS="-m32" ./configure --prefix="$stage"
+			# do release build
+            CFLAGS="-m32 -O2" CXXFLAGS="-m32 -O2" ./configure --prefix="$stage" --includedir="$stage/include/zlib" --libdir="$stage/lib/release"
+            make
+            make install
+
+			# clean the build artifacts
+			make distclean
+
+			# do debug build
+            CFLAGS="-m32 -O0 -gstabs+" CXXFLAGS="-m32 -O0 -gstabs+" ./configure --prefix="$stage" --includedir="$stage/include/zlib" --libdir="$stage/lib/debug"
             make
             make install
-            mkdir -p "$stage/include/zlib"
-            mv "$stage/include/"*.h "$stage/include/zlib/"
 
-            mv "$stage/lib" "$stage/release"
-            mkdir -p "$stage/lib"
-            mv "$stage/release" "$stage/lib"
+			# fix the names of the debug library files
+			for f in `ls $stage/lib/debug/libz*`
+			do
+				mv ${f} ${f/libz/libz_debug}
+			done
         ;;
     esac
     mkdir -p "$stage/LICENSES"
-- 
GitLab