[mapguide-commits] r6580 - trunk/Installer/scripts

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Apr 19 12:56:15 EDT 2012


Author: jng
Date: 2012-04-19 09:56:15 -0700 (Thu, 19 Apr 2012)
New Revision: 6580

Added:
   trunk/Installer/scripts/build_oem_ubuntu.sh
   trunk/Installer/scripts/setvars.sh
Modified:
   trunk/Installer/scripts/build.sh
   trunk/Installer/scripts/dpkgmapguide.sh
Log:
Update linux build scripts for Ubuntu 11.10 and greater flexibility

Modified: trunk/Installer/scripts/build.sh
===================================================================
--- trunk/Installer/scripts/build.sh	2012-04-19 16:09:38 UTC (rev 6579)
+++ trunk/Installer/scripts/build.sh	2012-04-19 16:56:15 UTC (rev 6580)
@@ -1,22 +1,28 @@
 #!/bin/bash
-APIVERSION=2.3
-BUILDNUM=${APIVERSION}.0
-BUILDROOT=`pwd`
-INSTALLROOT=/usr/local/mapguideopensource-${BUILDNUM}
-LOCKFILEDIR=/var/lock/mgserver
-MGSOURCE=${BUILDROOT}/mgdev
-VERFILE=${MGSOURCE}/Common/ProductVersion.h
-SVNROOT="svn://svn.bld.mgproto.net"
-#SVNROOT="http://svn.osgeo.org"
 
-rm -rf ${MGSOURCE}
-rm -rf ${INSTALLROOT}
+# Make sure setvars.sh is called first before running this script
 
+if [ ! -d ${JAVA_HOME} ];
+then
+echo "ERROR: Environment variable JAVA_HOME not set. Please set this enviroment variable first"
+exit
+fi
+
+sudo rm -rf ${MGSOURCE}
+sudo rm -rf ${INSTALLROOT}
+
 REVISION=`svn info ${SVNROOT}/mapguide/trunk/MgDev | perl revnum.pl`
 echo ${REVISION} > revnum.txt
+echo "Exporting svn revision ${REVISION}"
+if [ ${LOCALSVN} = 1 ] 
+then
+    echo "Making local SVN copy to ${MGSOURCE}"
+    cp -R ${SVNROOT}/mapguide/trunk/MgDev ${MGSOURCE}
+else
+    echo "Performing fresh SVN export to ${MGSOURCE}"
+    svn export -q -r ${REVISION} ${SVNROOT}/mapguide/trunk/MgDev ${MGSOURCE}
+fi
 echo "Building Revision ${BUILDNUM}.${REVISION}" 
-svn export -q -r ${REVISION} ${SVNROOT}/mapguide/trunk/MgDev ${MGSOURCE}
-
 cd ${MGSOURCE}
 
 echo "#ifndef PRODUCTVERSION_H_" > ${VERFILE}
@@ -25,48 +31,71 @@
 echo 'const STRING ApiVersion     = L"'${APIVERSION}'";' >> ${VERFILE}
 echo '#endif' >> ${VERFILE}
 
+echo "Building LinuxApt"
 pushd ${MGSOURCE}/Oem/LinuxApt
-./build_apt.sh --prefix ${INSTALLROOT} --with-tomcat
+sudo ./build_apt.sh --prefix ${INSTALLROOT} --with-tomcat
 popd
 
-./build_oem.sh --prefix=${INSTALLROOT}
+echo "Building Oem"
+# Need an ubuntu-flavoured build_oem.sh if we're doing ubuntu
+if [ ${UBUNTU} = 1 ]
+then
+    cp ${BUILDROOT}/build_oem_ubuntu.sh .
+    chmod +x build_oem_ubuntu.sh
+    sudo ./build_oem_ubuntu.sh --prefix=${INSTALLROOT}
+else
+    sudo ./build_oem.sh --prefix=${INSTALLROOT}
+fi
 
+echo "Building Fusion"
 pushd ${MGSOURCE}/Oem/fusion
 ant prepare
 ant compress
 popd
 
+echo "Building MapGuide"
 aclocal
 libtoolize --force
 automake --add-missing --copy
 autoconf
 ./configure --enable-optimized --prefix=${INSTALLROOT}
-make
-make install
+make $MY_MAKE_OPTS
+sudo make install
 
+echo "Preparing binaries for packaging"
 # Prepare binaries for packaging by removing unnecessary
 # .la and .a files and stripping unneeded symbols from the binaries
 pushd ${INSTALLROOT}
 LIBDIRS="lib server/lib webserverextensions/lib" 
+echo "Stripping symbols from binaries"
 for libdir in ${LIBDIRS}
 do
-   # Remove any .la and .a files in lib directories
-   rm -f ${libdir}/*.la
-   rm -f ${libdir}/*.a
+    # Remove any .la and .a files in lib directories
+    sudo rm -f ${libdir}/*.la
+    sudo rm -f ${libdir}/*.a
 
-   # Remove unneeded symbols from files in the lib directories
-   for file in `find ${libdir}/lib*.so* -type f -print`
-   do
-      strip --strip-unneeded ${file}
-      chmod a-x ${file}
-   done
+    # Remove unneeded symbols from files in the lib directories
+    for file in `find ${libdir}/lib*.so* -type f -print`
+    do
+        sudo strip --strip-unneeded ${file}
+        sudo chmod a-x ${file}
+    done
 done
+if [ ${LOCALSVN} = 1 ]
+then
+    echo "Stripping out .svn directories"
+    # Empty out all .svn directories
+    find -name "\.svn" -exec sudo rm -rf {} \;
+fi
 popd
 
+echo "Creating MapGuide Open Source binary tarball"
 # Tarball the whole works and put it in a bin directory
 pushd ${BUILDROOT}
 if [ ! -d bin ]; then
-   mkdir -p bin
+    mkdir -p bin
 fi
-tar -zcf bin/mapguideopensource-${BUILDNUM}.${REVISION}.tar.gz ${INSTALLROOT} ${LOCKFILEDIR}
-popd
+
+sudo tar -zcf bin/mapguideopensource-${BUILDNUM}.${REVISION}.tar.gz ${INSTALLROOT} ${LOCKFILEDIR}
+
+echo "Build complete!"

Added: trunk/Installer/scripts/build_oem_ubuntu.sh
===================================================================
--- trunk/Installer/scripts/build_oem_ubuntu.sh	                        (rev 0)
+++ trunk/Installer/scripts/build_oem_ubuntu.sh	2012-04-19 16:56:15 UTC (rev 6580)
@@ -0,0 +1,612 @@
+#
+#! /bin/bash
+#
+
+#
+# MapGuide Open Source build script (tweaked for Ubuntu)
+#
+
+#**********************************************************
+# Initialization
+#**********************************************************
+
+echo "MapGuide Open Source build script for OEM components"
+INSTALLDIR=/usr/local/mapguideopensource-2.4.0
+MY_MAKE_OPTS="-j 4"
+CLEAN_FLAG=0
+while [ $# -gt 0 ]; do    # Until you run out of parameters...
+    case "$1" in
+        -prefix|--prefix)
+            INSTALLDIR="$2"
+            shift
+            ;;
+        -clean|--clean)
+            CLEAN_FLAG=1
+            shift
+            ;;
+        -help|--help)
+            echo "Usage: $0 (options)"
+            echo "Options:"
+            echo "  --prefix [installation directory]"
+            echo "  --clean [clean all objects and binaries in Oem]"
+            echo "  --help [Display usage]"
+            exit
+            ;;
+    esac
+    shift   # Check next set of parameters.
+done
+
+echo "OEM Build Initialization ............................"
+echo "Oem Libraries will be installed at: ${INSTALLDIR}"
+
+LIB_NAME=""
+
+#**********************************************************
+# Generic Functions
+#**********************************************************
+
+check_build()
+{
+    error=$?
+    if [ $error -ne 0 ]; then
+        echo "$LIB_NAME: Error build failed ($error)................."
+        exit $error
+    fi
+}
+
+check_clean()
+{
+    error=$?
+    if [ $error -ne 0 ]; then
+        echo "$LIB_NAME: Error clean failed ($error)................."
+        exit $error
+    fi
+}
+
+#**********************************************************
+# Build ACE 5.7
+# Notes: none
+#**********************************************************
+
+init_ace()
+{
+    LIB_NAME="ACE 5.7"
+}
+
+build_ace()
+{
+    pushd ACE/ACE_wrappers
+    ACE_PATH="${PWD}"
+    pushd ace
+    env ACE_ROOT="${ACE_PATH}" make $MY_MAKE_OPTS
+    check_build
+    popd
+    popd
+}
+
+clean_ace()
+{
+    pushd ACE/ACE_wrappers
+    ACE_PATH="${PWD}"
+    pushd ace
+    env ACE_ROOT="${ACE_PATH}" make clean
+    check_clean
+    popd
+    popd
+}
+
+#**********************************************************
+# Build DWFCORE 1.0
+# Notes: none
+#**********************************************************
+
+init_dwfcore()
+{
+    LIB_NAME="DWFCORE 1.0"
+    pushd DWFTK7.1/develop/global/build/gnu/dwfcore
+    sh ./build_setup.sh
+    popd
+}
+
+build_dwfcore()
+{
+    pushd DWFTK7.1/develop/global/src/dwfcore
+    sh ./configure --enable-optimized --prefix="${INSTALLDIR}"
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_dwfcore()
+{
+    pushd DWFTK7.1/develop/global/src/dwfcore
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build DWFTOOLKIT 7.1
+# Notes: none
+#**********************************************************
+
+init_dwftk()
+{
+    LIB_NAME="DWFTK 7.1"
+    pushd DWFTK7.1/develop/global/build/gnu/dwftoolkit
+    sh ./build_setup.sh
+    popd
+}
+
+build_dwftk()
+{
+    pushd DWFTK7.1/develop/global/src/dwf
+    sh ./configure --enable-optimized --prefix="${INSTALLDIR}"
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_dwftk()
+{
+    pushd DWFTK7.1/develop/global/src/dwf
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build DWFEMAP 1.0
+# Notes: none
+#**********************************************************
+
+init_dwfemap()
+{
+    LIB_NAME="DWFEMAP 1.0"
+    pushd DWFTK7.1/develop/global/build/gnu/dwfemap
+    sh ./build_setup.sh
+    popd
+}
+
+build_dwfemap()
+{
+    pushd DWFTK7.1/develop/global/src/dwfemap
+    sh ./configure --enable-optimized --prefix="${INSTALLDIR}"
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_dwfemap()
+{
+    pushd DWFTK7.1/develop/global/src/dwfemap
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build GEOS 2.2.0
+# Notes: none
+#**********************************************************
+
+init_geos()
+{
+    LIB_NAME="GEOS 2.2.0"
+}
+
+build_geos()
+{
+    pushd geos-2.2.0
+    # Force regen to take into account our modified configure.in
+    aclocal -I macros
+    libtoolize --copy --force
+    autoconf
+    automake --add-missing --copy --force-missing
+    sh ./configure --prefix="${INSTALLDIR}"
+    make $MY_MAKE_OPTS
+    # The check build is disabled as the build will fail with automake version < 2.59
+    # check_build
+    popd
+}
+
+clean_geos()
+{
+    pushd geos-2.2.0
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build PHP 5.3.1
+# Notes: Configure PHP source tree for building PHP extension
+#**********************************************************
+
+init_php()
+{
+    LIB_NAME="PHP 5.3.1"
+}
+
+build_php()
+{
+    pushd php
+    sh ./configure
+    check_build
+    popd
+}
+
+clean_php()
+{
+    pushd php
+    make distclean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build SWIGEx 1.0
+# Notes: none
+#**********************************************************
+
+init_swigex()
+{
+    LIB_NAME="SWIGEx 1.0"
+}
+
+build_swigex()
+{
+    pushd SWIGEx
+    mkdir -p Linux/obj/release
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_swigex()
+{
+    pushd SWIGEx
+    # Note: the qmake system is required to regenerate the Makefile.
+    #       This is disabled.
+    # make clean
+    # check_clean
+    popd
+}
+
+#**********************************************************
+# Build BDBXML
+# Notes: none
+#**********************************************************
+
+init_bdbxml()
+{
+    LIB_NAME="BDBXML"
+}
+
+build_bdbxml()
+{
+    # Need to force regen of the correct xerces config header before building dbxml proper
+    pushd dbxml/xerces-c-src
+    sh ./configure
+    popd
+    # Also need to check and set executable flag for s_paths
+    pushd dbxml/dbxml/dist
+    chmod +x s_paths
+    popd
+    pushd dbxml
+    sh ./buildall.sh
+    check_build
+    popd
+}
+
+clean_bdbxml()
+{
+    pushd dbxml
+    sh ./buildall.sh --clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build CPPUNIT 1.9.14
+# Notes: none
+#**********************************************************
+
+init_cppunit()
+{
+    LIB_NAME="CPPUNIT 1.9.14"
+}
+
+build_cppunit()
+{
+    pushd CppUnit-1.9.14
+    # the configure script as-is is incompatible with ubuntu, so regen it
+    aclocal -I config
+    libtoolize --copy --force
+    autoconf
+    automake --add-missing --copy --force-missing
+    # -ldl is to prevent undefined reference to dlsym/dlopen/dlclose
+    sh ./configure --prefix="${INSTALLDIR}" LDFLAGS="-ldl"
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_cppunit()
+{
+    pushd CppUnit-1.9.14
+    sh ./configure --prefix="${INSTALLDIR}"
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build IMake 1.0
+# Notes: none
+#**********************************************************
+
+init_imake()
+{
+    LIB_NAME="IMake 1.0"
+}
+
+build_imake()
+{
+    pushd ../BuildTools/WebTools/IMake
+    mkdir -p Linux/obj/debug
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_imake()
+{
+    pushd ../BuildTools/WebTools/IMake
+    # Note: does not support clean as qmake is needed to regenerate the Makefile.
+    # make clean
+    # check_clean
+    popd
+}
+
+#**********************************************************
+# Build ZLIB 1.2.3
+# Notes: none
+#**********************************************************
+
+init_zlib()
+{
+    LIB_NAME="ZLIB 1.2.3"
+}
+
+build_zlib()
+{
+    pushd gd/zlib
+    sh ./configure
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_zlib()
+{
+    pushd gd/zlib
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build LIBPNG 1.2.8
+# Notes: none
+#**********************************************************
+
+init_libpng()
+{
+    LIB_NAME="LIBPNG 1.2.8"
+}
+
+build_libpng()
+{
+    pushd gd/lpng
+    cp scripts/makefile.std makefile
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_libpng()
+{
+    pushd gd/lpng
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build JPEG 6b
+# Notes: none
+#**********************************************************
+
+init_jpeg()
+{
+    LIB_NAME="JPEG 6b"
+}
+
+build_jpeg()
+{
+    pushd gd/jpeg
+    sh ./configure --enable-static --disable-shared
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_jpeg()
+{
+    pushd gd/jpeg
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build FREETYPE 2.1.10
+# Notes: none
+#**********************************************************
+
+init_freetype()
+{
+    LIB_NAME="FREETYPE 2.1.10"
+}
+
+build_freetype()
+{
+    pushd gd/freetype
+    sh ./configure --enable-static --disable-shared
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_freetype()
+{
+    pushd gd/freetype
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build GD 2.0.33
+# Notes: none
+#**********************************************************
+
+init_gd()
+{
+    LIB_NAME="GD 2.0.33"
+}
+
+build_gd()
+{
+    pushd gd/gd
+    sh ./configure --enable-static --disable-shared --without-fontconfig
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_gd()
+{
+    pushd gd/gd
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build AGG 2.4
+# Notes: none
+#**********************************************************
+
+init_agg()
+{
+    LIB_NAME="AGG 2.4"
+}
+
+build_agg()
+{
+    pushd agg-2.4
+    make $MY_MAKE_OPTS
+    check_build
+    popd
+}
+
+clean_agg()
+{
+    pushd agg-2.4
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Build JSON
+# Notes: none
+#**********************************************************
+
+init_json()
+{
+    LIB_NAME="JSON"
+}
+
+build_json()
+{
+    pushd jsoncpp
+    #Use the scons installed by apt-get
+    scons platform=linux-gcc
+    popd
+}
+
+clean_json()
+{
+    pushd jsoncpp
+    rm -rf lib buildscons dist
+    popd
+}
+
+#**********************************************************
+# Build CSMAP
+# Notes: none
+#**********************************************************
+
+init_csmap()
+{
+    LIB_NAME="CSMAP"
+}
+
+build_csmap()
+{
+    pushd CsMap
+    mkdir -p .libs
+    pushd Source
+    make -fLibrary.mak $MY_MAKE_OPTS
+    cp CsMap.a ../.libs/libCsmap.a
+    popd
+    pushd Dictionaries
+    make -fCompiler.mak $MY_MAKE_OPTS
+    ./CS_Comp -b . .
+    popd
+    check_build
+    popd
+}
+
+clean_csmap()
+{
+    pushd CsMap
+    make clean
+    check_clean
+    popd
+}
+
+#**********************************************************
+# Script loop
+#**********************************************************
+
+pushd Oem
+for lib in ace dwfcore dwftk dwfemap geos php swigex bdbxml cppunit imake zlib libpng jpeg freetype gd agg json csmap;
+do
+    echo "$lib: Initialization..........................."
+    init_"$lib"
+
+    if test "$CLEAN_FLAG" = "1"; then
+        echo "$lib: Clean ....................................."
+        clean_"$lib"
+        echo "$lib: Clean Successful .........................."
+    else
+        echo "$lib: Configure/Build ..........................."
+        build_"$lib"
+        echo "$lib: Build Successful .........................."
+    fi
+done
+popd


Property changes on: trunk/Installer/scripts/build_oem_ubuntu.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/Installer/scripts/dpkgmapguide.sh
===================================================================
--- trunk/Installer/scripts/dpkgmapguide.sh	2012-04-19 16:09:38 UTC (rev 6579)
+++ trunk/Installer/scripts/dpkgmapguide.sh	2012-04-19 16:56:15 UTC (rev 6580)
@@ -6,31 +6,33 @@
 #   changelog - generated changelog file
 #   substvars - subst params created by dpkg-shlibdeps
 #   mapguidecommon/ - packaging directory for common MapGuide components
-#     usr/local/mapguideopensource-2.2.0/ - copied tree for common components
+#     usr/local/mapguideopensource-2.4.0/ - copied tree for common components
 #     DEBIAN/
 #       control - control file generated from dpkg-gencontrol
 #       symbols - symbols file generated from dpkg-gensymbols
 #
 #   mapguideserver/ - packaging directory for MapGuide Server
-#     usr/local/mapguideopensource-2.2.0/ - copied tree for Server
+#     usr/local/mapguideopensource-2.4.0/ - copied tree for Server
 #     DEBIAN/
 #       control - control file generated from dpkg-gencontrol
 #       symbols - symbols file generated from dpkg-gensymbols
 #
 #   mapguidewebextensions/ - packaging directory for Web Extensions
-#     usr/local/mapguideopensource-2.2.0/ - copied tree for Web Extensions
+#     usr/local/mapguideopensource-2.4.0/ - copied tree for Web Extensions
 #     DEBIAN/
 #       control - control file generated from dpkg-gencontrol
 #       symbols - symbols file generated from dpkg-gensymbols
 #
 #   mapguidehttpd/ - packaging directory for Apache Bundle
-#     usr/local/mapguideopensource-2.2.0/ - copied tree for Apache bundle
+#     usr/local/mapguideopensource-2.4.0/ - copied tree for Apache bundle
 #     DEBIAN/
 #       control - control file generated from dpkg-gencontrol
 #       symbols - symbols file generated from dpkg-gensymbols
 # 
+#
+# Make sure setvars.sh is called first before running this script
 BUILDROOT=`pwd`
-MGBUILD=2.2.0
+MGBUILD=${BUILDNUM}
 MGINST=usr/local/mapguideopensource-${MGBUILD}
 ROOT=${BUILDROOT}/debian/mapguidecommon
 TREE=${BUILDROOT}/debian
@@ -124,7 +126,7 @@
 cat > debian/changelog <<END-OF-CHANGELOG
 mapguideopensource-src (${MGBUILD}-${BUILDNUM}) experimental; urgency=low
 
-  * 2.2.0 Release Candidate 1
+  * ${BUILDNUM}
 
  -- MapGuide Internals Mail List <mapguide-internals at lists.osgeo.org>  ${CURRTIME}
 END-OF-CHANGELOG

Added: trunk/Installer/scripts/setvars.sh
===================================================================
--- trunk/Installer/scripts/setvars.sh	                        (rev 0)
+++ trunk/Installer/scripts/setvars.sh	2012-04-19 16:56:15 UTC (rev 6580)
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Sets the common set of vars used throughout these build scripts
+
+export APIVERSION=2.4
+export BUILDNUM=${APIVERSION}.0
+export BUILDROOT=`pwd`
+export INSTALLROOT=/usr/local/mapguideopensource-${BUILDNUM}
+export LOCKFILEDIR=/var/lock/mgserver
+export MGSOURCE=${BUILDROOT}/mgdev
+export VERFILE=${MGSOURCE}/Common/ProductVersion.h
+# Use LOCALSVN=1 if you want to build from an existing copy instead of building
+# from an export
+export LOCALSVN=1
+export SVNROOT=/home/user
+#export SVNROOT="svn://svn.bld.mgproto.net"
+#export SVNROOT="http://svn.osgeo.org"
+export MY_MAKE_OPTS="-j 4"
+export UBUNTU=1


Property changes on: trunk/Installer/scripts/setvars.sh
___________________________________________________________________
Added: svn:executable
   + *



More information about the mapguide-commits mailing list