From 12b1ec62645e772174cd710a208f59ab823eafe0 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Fri, 20 Jul 2012 07:38:12 -0700
Subject: [PATCH] refactor to build llphysicsextensions_tpv package for
 sublicensees

---
 autobuild.xml                         |  12 +-
 build.sh                              |  55 +++--
 indra/cmake/LLPhysicsExtensions.cmake |  18 +-
 package_physicsextensions.sh          |  52 -----
 package_physicsextensions.xml         | 292 --------------------------
 5 files changed, 58 insertions(+), 371 deletions(-)
 delete mode 100755 package_physicsextensions.sh
 delete mode 100644 package_physicsextensions.xml

diff --git a/autobuild.xml b/autobuild.xml
index 7f06291cafc..a25056ac87b 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1158,11 +1158,11 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>9bba702fbbd41d3f6cd288ae1c763753</string>
+              <string>4a9a12f396c4486cf9a456b251397150</string>
               <key>hash_algorithm</key>
               <string>md5</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source/rev/261592/arch/Darwin/installer/llphysicsextensions_source-0.2-darwin-20120711.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/oz_llphysicsextensions-source/rev/262209/arch/Darwin/installer/llphysicsextensions_source-0.3-darwin-20120720.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin</string>
@@ -1172,9 +1172,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>7989a1e993a5e08cd9832d9f68cd025f</string>
+              <string>156abe6878ff3427c1c21d8cb6f9f3c5</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source/rev/261592/arch/Linux/installer/llphysicsextensions_source-0.2-linux-20120711.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/oz_llphysicsextensions-source/rev/262209/arch/Linux/installer/llphysicsextensions_source-0.3-linux-20120720.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
@@ -1184,9 +1184,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>846b4efadf740b2fe6ea800d4f8608c1</string>
+              <string>d123648105c8c363ef4b445bef983fd5</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source/rev/261592/arch/CYGWIN/installer/llphysicsextensions_source-0.2-windows-20120711.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/oz_llphysicsextensions-source/rev/262209/arch/CYGWIN/installer/llphysicsextensions_source-0.3-windows-20120720.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
diff --git a/build.sh b/build.sh
index d19d8a5d6b2..bd71de762c8 100755
--- a/build.sh
+++ b/build.sh
@@ -70,19 +70,46 @@ pre_build()
  end_section "Pre$variant"
 }
 
+package_llphysicsextensions_tpv()
+{
+  begin_section "PhysicsExtensions_TPV"
+  tpv_status=0
+  if [ "$variant" = "Release" ]
+  then 
+      llpetpvcfg=$build_dir/packages/llphysicsextensions/autobuild-tpv.xml
+      "$AUTOBUILD" build --verbose --config-file $llpetpvcfg -c Tpv
+      
+      # capture the package file name for use in upload later...
+      PKGTMP=`mktemp -t pgktpv.XXXXXX`
+      trap "rm $PKGTMP* 2>/dev/null" 0
+      "$AUTOBUILD" package --verbose --config-file $llpetpvcfg > $PKGTMP
+      tpv_status=$?
+      sed -n -e 's/^wrote *//p' $PKGTMP > $build_dir/llphysicsextensions_package
+  else
+      echo "Do not provide llphysicsextensions_tpv for $variant"
+      llphysicsextensions_package=""
+  fi
+  end_section "PhysicsExtensions_TPV"
+  return $tpv_status
+}
+
 build()
 {
   local variant="$1"
   if $build_viewer
   then
     begin_section "Viewer$variant"
-    if "$AUTOBUILD" build --no-configure -c $variant
+    "$AUTOBUILD" build --no-configure -c $variant
+    viewer_build_ok=$?
+    end_section "Viewer$variant"
+    package_llphysicsextensions_tpv
+    tpvlib_build_ok=$?
+    if [ $viewer_build_ok -eq 0 -a $tpvlib_build_ok -eq 0 ]
     then
       echo true >"$build_dir"/build_ok
     else
       echo false >"$build_dir"/build_ok
     fi
-    end_section "Viewer$variant"
   fi
 }
 
@@ -196,11 +223,6 @@ do
   mkdir -p "$build_dir"
   mkdir -p "$build_dir/tmp"
 
-  # Install packages.
-  begin_section "AutobuildInstall" 
-  "$AUTOBUILD" install --verbose --skip-license-check
-  end_section "AutobuildInstall" 
-
   if pre_build "$variant" "$build_dir" >> "$build_log" 2>&1
   then
     if $build_link_parallel
@@ -270,21 +292,22 @@ then
       upload_item quicklink "$package" binary/octet-stream
       [ -f summary.json ] && upload_item installer summary.json text/plain
 
-      # Upload crash reporter files and symbolfile for public llphysicsextensions build.
       case "$last_built_variant" in
       Release)
+        # Upload crash reporter files
         for symbolfile in $symbolfiles
         do
           upload_item symbolfile "$build_dir/$symbolfile" binary/octet-stream
         done
-
-        mapfilepath=$build_dir/newview
-        gzip $mapfilepath/secondlife-bin.MAP
-        mapfile=secondlife-bin-$arch.MAP.gz
-        mv $mapfilepath/secondlife-bin.MAP.gz $mapfilepath/$mapfile
-        upload_item mapfile "$mapfilepath/$mapfile" binary/octet-stream
-        echo "Uploaded mapfile for $last_built_variant"
-
+        
+        # Upload the llphysicsextensions_tpv package, if one was produced
+        if [ -r "$build_dir/llphysicsextensions_package" ]
+        then
+            llphysicsextensions_package=$(cat $build_dir/llphysicsextensions_package)
+            upload_item private_artifact "$llphysicsextensions_package" binary/octet-stream
+        else
+            echo "No llphysicsextensions_package"
+        fi
         ;;
       *)
         echo "Skipping mapfile for $last_built_variant"
diff --git a/indra/cmake/LLPhysicsExtensions.cmake b/indra/cmake/LLPhysicsExtensions.cmake
index 72ac35e02b1..e6afee762ec 100644
--- a/indra/cmake/LLPhysicsExtensions.cmake
+++ b/indra/cmake/LLPhysicsExtensions.cmake
@@ -1,22 +1,30 @@
 # -*- cmake -*-
 include(Prebuilt)
 
-# Note that the use_prebuilt_binary macros below do not in fact include binaries;
-# the llphysicsextensions_* packages are source only and are built here.
-# The source package and the stub package both build libraries of the same name.
+# There are three possible solutions to provide the llphysicsextensions:
+# - The full source package, selected by -DHAVOK:BOOL=ON
+# - The stub source package, selected by -DHAVOK:BOOL=OFF 
+# - The prebuilt package available to those with sublicenses, selected by -DHAVOK_TPV:BOOL=ON
 
-# Using the real wrapper or the stub can be controlled with -DHAVOK:BOOL={ON,OFF}
-# the default
 if (INSTALL_PROPRIETARY)
    set(HAVOK ON CACHE BOOL "Use Havok physics library")
 endif (INSTALL_PROPRIETARY)
 
+
+# Note that the use_prebuilt_binary macros below do not in fact include binaries;
+# the llphysicsextensions_* packages are source only and are built here.
+# The source package and the stub package both build libraries of the same name.
+
 if (HAVOK)
    include(Havok)
    use_prebuilt_binary(llphysicsextensions_source)
    set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src)
    set(LLPHYSICSEXTENSIONS_LIBRARIES    llphysicsextensions)
 
+elseif (HAVOK_TPV)
+   use_prebuilt_binary(llphysicsextensions_tpv)
+   set(LLPHYSICSEXTENSIONS_LIBRARIES    llphysicsextensions_tpv)
+
 else (HAVOK)
    use_prebuilt_binary(llphysicsextensions_stub)
    set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
diff --git a/package_physicsextensions.sh b/package_physicsextensions.sh
deleted file mode 100755
index 5b4c23ecc9f..00000000000
--- a/package_physicsextensions.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-
-cd "$(dirname "$0")"
-
-# turn on verbose debugging output for parabuild logs.
-set -x
-# make errors fatal
-set -e
-
-if [ -z "$AUTOBUILD" ] ; then
-    fail
-fi
-
-if [ "$OSTYPE" = "cygwin" ] ; then
-    export AUTOBUILD="$(cygpath -u $AUTOBUILD)"
-fi
-
-# load autbuild provided shell functions and variables
-eval "$("$AUTOBUILD" source_environment)"
-
-projectDir="$(pwd)"
-
-#directories we need the headers from
-projects="llcommon llimage llmath llrender"
-
-source="$projectDir/indra"
-
-stage="$projectDir/stage/include"
-mkdir -p $stage
-
-for project in $projects
-do
-	dstIncludeDir="$stage/$project"
-	mkdir -p $dstIncludeDir
-	headers="$source/$project/*.h"
-	cp $headers "$dstIncludeDir"
-	headers="$source/$project/*.inl"
-	# not all projects have .inl files
-	files=$(ls $headers 2> /dev/null | wc -l)
-	if [ "$files" != "0" ] ; then
-	    cp $headers "$dstIncludeDir"
-	fi
-done
-	
-# Copy the license files into place for packaging
-srcLicenseDir="$projectDir/doc"
-dstLicenseDir="$projectDir/stage/LICENSES"
-
-mkdir -p "$dstLicenseDir"
-cp "$srcLicenseDir/LGPL-licence.txt" "$dstLicenseDir/LGPL-licence.txt"
-
-pass
diff --git a/package_physicsextensions.xml b/package_physicsextensions.xml
deleted file mode 100644
index 0bde6ad7705..00000000000
--- a/package_physicsextensions.xml
+++ /dev/null
@@ -1,292 +0,0 @@
-<?xml version="1.0" ?>
-<llsd>
-<map>
-    <key>package_description</key>
-    <map>
-      <key>description</key>
-      <string>include files referenced in the llphysicsextensions</string>
-      <key>license</key>
-      <string>LGPL</string>
-      <key>license_file</key>
-      <string>LICENSES/LGPL-licence.txt</string>
-      <key>name</key>
-      <string>pathfinding_includes</string>
-      <key>platforms</key>
-      <map>
-        <key>common</key>
-        <map>
-          <key>build_directory</key>
-          <string>stage</string>
-          <key>configurations</key>
-          <map>
-            <key>Debug</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>True</string>
-              <key>name</key>
-              <string>Debug</string>
-            </map>
-            <key>Release</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>True</string>
-              <key>name</key>
-              <string>Release</string>
-            </map>
-            <key>RelWithDebInfo</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>True</string>
-              <key>name</key>
-              <string>RelWithDebInfo</string>
-            </map>
-          </map>
-          <key>name</key>
-          <string>common</string>
-        </map>
-        <key>darwin</key>
-        <map>
-          <key>build_directory</key>
-          <string>stage</string>
-          <key>configurations</key>
-          <map>
-            <key>Debug</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>manifest</key>
-              <array>
-                <string>include/</string>
-                <string>LICENSES</string>
-              </array>
-              <key>name</key>
-              <string>Debug</string>
-            </map>
-            <key>Release</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>manifest</key>
-              <array>
-                <string>include/</string>
-                <string>LICENSES</string>
-              </array>
-              <key>name</key>
-              <string>Release</string>
-            </map>
-            <key>RelWithDebInfo</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>manifest</key>
-              <array>
-                <string>include/</string>
-                <string>LICENSES</string>
-              </array>
-              <key>name</key>
-              <string>RelWithDebInfo</string>
-            </map>
-          </map>
-          <key>name</key>
-          <string>darwin</string>
-        </map>
-        <key>linux</key>
-        <map>
-          <key>build_directory</key>
-          <string>stage</string>
-          <key>configurations</key>
-          <map>
-            <key>Debug</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>name</key>
-              <string>Debug</string>
-            </map>
-            <key>Release</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>name</key>
-              <string>Release</string>
-            </map>
-            <key>RelWithDebInfo</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>name</key>
-              <string>RelWithDebInfo</string>
-            </map>
-          </map>
-          <key>manifest</key>
-          <array>
-            <string>include</string>
-            <string>LICENSES</string>
-          </array>
-          <key>name</key>
-          <string>linux</string>
-        </map>
-        <key>windows</key>
-        <map>
-          <key>build_directory</key>
-          <string>stage</string>
-          <key>configurations</key>
-          <map>
-            <key>Debug</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>manifest</key>
-              <array>
-                <string>include/</string>
-                <string>LICENSES</string>
-              </array>
-              <key>name</key>
-              <string>Debug</string>
-            </map>
-            <key>Release</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>manifest</key>
-              <array>
-                <string>include/</string>
-                <string>LICENSES</string>
-              </array>
-              <key>name</key>
-              <string>Release</string>
-            </map>
-            <key>RelWithDebInfo</key>
-            <map>
-              <key>build</key>
-              <map>
-                <key>command</key>
-                <string>bash</string>
-                <key>options</key>
-                <array>
-                  <string>-c ../package_physicsextensions.sh</string>
-                </array>
-              </map>
-              <key>default</key>
-              <string>true</string>
-              <key>manifest</key>
-              <array>
-                <string>include/</string>
-                <string>LICENSES</string>
-              </array>
-              <key>name</key>
-              <string>RelWithDebInfo</string>
-            </map>
-          </map>
-          <key>name</key>
-          <string>windows</string>
-        </map>
-      </map>
-      <key>version</key>
-      <string>1.0</string>
-    </map>
-    <key>type</key>
-    <string>autobuild</string>
-    <key>version</key>
-    <string>1.2</string>
-  </map>
-</llsd>
-- 
GitLab