Index: main/trunk/package-kits/linux/build.properties
===================================================================
--- main/trunk/package-kits/linux/build.properties	(revision 29474)
+++ 	(revision )
@@ -1,139 +1,0 @@
-#### properties file for Greenstone3 building using ANT. See the README for more 
-#### information
-
-## Tomcat installation
-# Set this to the internet/intranet name of the machine that Tomcat is/will be 
-# run on. localhost is fine for accessing the server from the local machine, 
-# but not remotely
-tomcat.server=localhost
-# The port number that tomcat is/will be run on
-tomcat.port=8383
-# Tomcat's shutdown port - this may need to be changed if you are running two or more Tomcats
-tomcat.shutdown.port=8305
-# If tomcat is already running, enter the path to the base directory here
-tomcat.installed.path=
-# uncomment the following if you have moved the greenstone3 web directory to tomcats webapps dir 
-#web.home=${tomcat.installed.path}/webapps/greenstone3
-
-## Collection building options
-# uncomment if you don't want to have collection building enabled
-#disable.collection.building=true
-#
-# uncomment (and edit) if you want to control where perl is found
-#perl.path=/usr/bin
-
-## Greenstone 3 server program options
-# does running the server automatically start up Tomcat and a browser
-server.auto.start=false
-# if set to true, won't try other ports if the specified port is not available
-server.keep.port=false
-# default servlet to start with
-server.default.servlet=/library
-
-# The context name of your GS3 digital library. By default this will be "greenstone3". 
-# Ensure this has a value. If you change this multiple times, you need to remove the old versions
-# of <custom.context>.xml from GS3/packages/tomcat/conf/Catalina/localhost
-# does not contain previous 
-custom.context=greenstone3
-
-##Browser setup
-browser.path=
-
-## Proxy setup - Greenstone installation will attempt to download extra packages. Set the proxy information here if you are behind a firewall.
-# The proxy server name 
-proxy.host=
-# The proxy server port
-proxy.port=
-# A user name to use when talking to the proxy server (optional, will prompt if not entered here)
-proxy.user=
-# A password to use when talking to the proxy server (optional, will prompt if not entered here)
-proxy.password=
-
-## java compilation properties - for javac
-# Should compilation include the debug option?
-compile.debug=true
-# Should compilation include the deprecation option?
-compile.deprecation=true
-# Should compilation include the optimize option?
-compile.optimize=true
-
-# Properties that control cross-compiling
-compile.cross        = false
-#cross.os             = windows
-#cross.host           = i686-w64-mingw32
-#cross.build          = i686-pc-linux-gnu
-#cross.configure.extraargs =
-
-#cross.os             = android
-#cross.host           = arm-linux-androideabi
-#cross.build          = i686-pc-linux-gnu
-#cross.configure.extraargs = gl_cv_header_working_stdint_h=yes
-
-
-# Control whether or not JNI bindings are used
-#   e.g. MG, MG++ and GDBM and the like
-# Setting this false means these components are not available to the install
-# The expectation is that collections will be build from 100% Java components:
-#   e.g Lucene and JDBM
-# 
-# Ant 1.7.1 and before only test for *existence* so this needs to be commented
-# in or out to control whether jni is used or not
-with.jni=true
-
-## Controls whether or not we want GLI and GEMS to be checked out and compiled
-#with.gli.and.gems=true
-
-## Control if compilation of gs2 is static or not. Used, for example, for distributions
-# Same issue as 'with.jni' for how this gets used in ant 1.7.1 and before
-#compile.static=true
-
-# A flag used by the release-kit to compile with gnomelib
-# (Previously this flag was called use.support.lib but got conflated with
-# the property checkout.gnomelib.ext below)
-#use.gnomelib.ext=true
-
-## Uncomment these lines if enabling compilation with the gnome-lib extension
-## and if compiling imagemagick
-## These extensions should be in the [gsdl3home]/gs2build/ext directory
-#checkout.gnomelib.ext=true
-#checkout.imagemagick.ext=true
-
-# By default, GS3 will check out the pdfbox extension from SVN
-checkout.pdfbox.ext=true
-
-# The following two properties are automatically overridden by gs3-server
-# when running off a read-only medium such as a DVD ...
-#
-# The 'writable' home default is to be the same location as gsdl3.home
-gsdl3home.isreadonly=false
-gsdl3.writablehome=${basedir}/web
-
-# ... alternative the above can be changed to
-#
-#  gsdl3home.isreadonly=true
-#  gsdl3.writablehome=${java.io.tmpdir}/greenstone/web
-#
-# ... or else provided on the command line, e.g.:
-#   ant -Dgsdl3home.isreadonly=true gsdl3.writablehome=/tmp/greenstone/web start
-
-## windows c++ compilation
-# The following property does not help in build.xml. 
-# The user needs to run Visual Studio's vcvars32.bat script from the
-# MSDOS prompt before compiling Greenstone3 (before "ant prepare install")
-#compile.windows.c++.setup=C:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT
-
-##Flax stuff##
-##uncomment if you want to install flax
-#install.flax=true
-#flax.checkout.path=${flax.svn.root}/trunk/flaxmain
-
-##These need to be uncommented if using Fedora and Fedora GSearch with Greenstone's tomcat
-#fedora.home=#${basedir}/ext/fedora3
-#fedora.maxpermsize=-XX:MaxPermSize=128m
-#fedora.password=pounamu
-#index.writelock.timeout=10000
-
-##Web services related constants##
-base.webservice.name=SOAPServer
-##listing and description of all the web services deployable on GS3##
-web.services.list=${base.webservice.name} for Greenstone3's core web services, QBR${base.webservice.name} for Query, Browse and Retrieve services
Index: main/trunk/package-kits/linux/generate
===================================================================
--- main/trunk/package-kits/linux/generate	(revision 29481)
+++ main/trunk/package-kits/linux/generate	(revision 29481)
@@ -0,0 +1,96 @@
+#!/usr/bin/env perl
+
+# Generates Makefiles for different systems and packages
+# Uses a hashmap to do config variables  (see readvar for how variables are
+#  read in and an example of how they are resolved / used)
+
+use strict;
+use warnings;
+use utf8;
+use File::Basename;
+use File::Path 'make_path';
+use File::Copy;
+use Storable 'dclone';
+
+my $USAGE = "Usage: " . basename($0) . " <platforms> <packages>
+    platforms: A comma separated list of the platforms defined in pkg.in/platforms
+               Or 'all' (for all platforms)
+    packages:  A comma separated list of the packages defined in pkg.in/packages
+               Or 'all' (for all platforms)
+";
+
+$#ARGV == 1 or die $USAGE;
+
+sub globbify {
+    my ($dir, $files) = @_;
+    $files =~ /^all$/i and return glob "$dir/*";
+    my @list = glob "$dir/{$files}";
+    for (@list) {
+        -f or die "Could not find '", $_, "'";
+    }
+    return @list;
+}
+
+sub readvar {
+    my ($vars, $line) = @_;
+    my ($var, $val) = split "=", $line;
+    defined $var and defined $val or die "Invalid variable assignment: '$line'";
+    $val =~ s/%([\w]+)%/$vars->{$1}/g;
+    $vars->{$var} = $val;
+}
+
+my @platforms = globbify "pkg.in/platforms", shift;
+my @packages  = globbify "pkg.in/packages",  shift;
+
+for (@platforms) {
+    my ($platform) = /^pkg\.in\/platforms\/(.*)$/;
+    my %platform_vars = ();
+    open FH, '<', $_ or die "Failed to open '$_' for reading: $!";
+    # read platform variable definitons
+    while (<FH>) {
+        chomp;
+        readvar \%platform_vars, $_;
+    }
+    close FH;
+
+    for (@packages) {
+        my ($package) = /^pkg\.in\/packages\/(.*)$/;
+        my $package_path = "build/$platform/$package";
+        make_path $package_path;
+
+        open FH, '<', $_ or die "Failed to open '$_' for reading: $!";
+
+        # read package file dependencies
+        while (<FH>) {
+            chomp;
+            /^[\s]*$/ and last;
+            -e "pkg.in/files/$_" or die "Could not find '", $_, "'";
+            copy "pkg.in/files/$_", "$package_path/$_" or die "Failed to copy '$_': $!";
+        }
+
+        my %package_vars = %{dclone \%platform_vars};
+        # read package variable definitions
+        while (<FH>) {
+            chomp;
+            /^[\s]*$/ and last;
+            readvar \%package_vars, $_;
+        }
+        
+        my $outfile = "$package_path/Makefile";
+        open OUT, '>', $outfile or die "Failed to open '$outfile' for writing: $!";
+        # read package makefile segments
+        while (<FH>) {
+            chomp;
+            open SEG, '<', "pkg.in/segments/$_" or die "Failed to open '$_' for reading: $!";
+            # write the makefile
+            while (<SEG>) {
+                s/%([\w]+)%/$package_vars{$1}/g;
+                print OUT;
+            }
+            close SEG;
+        }
+        close FH;
+        close OUT;
+    }
+    print "Generated $platform build scripts in build/$platform/\n";
+}
Index: main/trunk/package-kits/linux/gli
===================================================================
--- main/trunk/package-kits/linux/gli	(revision 29474)
+++ 	(revision )
@@ -1,20 +1,0 @@
-#!/bin/bash
-
-if test -z "$JAVA_HOME"; then
-    for dir in /usr/lib/jvm/default/ /usr/lib/jvm/default-java/; do
-        if test -d $dir; then
-            JAVA_HOME=$dir
-            break
-        fi
-    done
-fi
-if test -z "$JAVA_HOME"; then
-    echo -e "Could not find JAVA_HOME.\nPlease export JAVA_HOME=<jre_location>" >&2
-    exit 1
-fi
-
-export JAVA_HOME
-
-. greenstone --no-interactive
-
-/opt/gli/gli.sh
Index: main/trunk/package-kits/linux/greenstone
===================================================================
--- main/trunk/package-kits/linux/greenstone	(revision 29474)
+++ 	(revision )
@@ -1,97 +1,0 @@
-#!/bin/sh
-
-interactive=1
-sourced=1
-unset use_shell
-case $* in
-    *--no-interactive*)
-        unset interactive
-        ;;
-esac
-
-fail() {
-    echo $* >&2
-    exit 1
-}
-
-# make sure we are sourced, and not run
-if test "`basename $0`" = "greenstone" ; then
-# if $0 is "greenstone" we've been run... $0 is shellname if sourced.
-# One exception is zsh has an option to set it temporarily to the script name
-    if test -z "$ZSH_NAME" ; then
-        # we aren't using zsh
-        unset sourced
-    fi
-fi
-
-if test -z "$sourced" ; then
-    test -z "$interactive" && fail "Script must be sourced for non-interactive use"
-    echo "Script was not sourced" >&2
-    echo -n "Use a new shell? (y/[n]) " >&2
-    read use_shell
-    test "$use_shell" != "y" -a "$use_shell" != "Y" && fail "Script must either be sourced, or allowed to start an interactive shell"
-    use_shell=1
-fi
-
-GSDLHOME=/opt/greenstone/gs2build
-export GSDLHOME
-
-GSDLOS=linux
-export GSDLOS
-
-# Establish cpu architecture
-# 32-bit or 64-bit?
-UNAME_HW_MACH=`uname -m`
-
-# Following test came from VirtualBox's Guest Additions autostart.sh
-# (adapted for use in Greenstone)
-case "$UNAME_HW_MACH" in
-i[3456789]86|x86|i86pc)
-    GSDLARCH='32'                                                                                                
-    ;;
-x86_64|amd64|AMD64)
-    GSDLARCH='64'
-    ;;
-*)
-    echo "Unknown architecture: $UNAME_HW_MACH" >&2
-    ;;
-esac
-
-# Only want non-trival GSDLARCH value set if there is evidence of
-# the installed bin (lib, ...) directories using linux32, linux64
-# (otherwise probably looking at an SVN compiled up version for single OS)
-if test ! -d "$GSDLHOME/bin/$GSDLOS$GSDLARCH" ;
-then
-    GSDLARCH=""
-fi
-
-export GSDLARCH
-
-# Workaround for perl >= 5.18
-PERL_PERTURB_KEYS=0
-export PERL_PERTURB_KEYS
-
-
-PATH="$GSDLHOME/bin/script:$GSDLHOME/bin/$GSDLOS$GSDLARCH:$PATH"
-export PATH
-LD_LIBRARY_PATH="$GSDLHOME/gs2build/lib/$GSDLOS$GSDLARCH:$GSDLHOME/lib/$GSDLOS$GSDLARCH:$LD_LIBRARY_PATH"
-export LD_LIBRARY_PATH
-
-if test -n "$interactive" -a -z "$GSDL3HOME" ; then
-    echo "Where are the collections? [/srv/gsdl/]" >&2
-    echo -n " > " >&2
-    read GSDL3HOME
-fi
-if test -z "$GSDL3HOME" ; then
-    echo "Setting collections location to the default" >&2
-    GSDL3HOME=/srv/gsdl
-fi
-export GSDL3HOME
-
-test -d "$GSDL3HOME/sites/localsite/collect" || mkdir -p "$GSDL3HOME/sites/localsite/collect"
-
-if test -n "$interactive" -a -n "$use_shell" ; then
-    test -z $SHELL && SHELL=sh
-    echo "Starting an interactive shell for GSDL management" >&2
-    $SHELL
-fi
Index: main/trunk/package-kits/linux/greenstone3.xml
===================================================================
--- main/trunk/package-kits/linux/greenstone3.xml	(revision 29474)
+++ 	(revision )
@@ -1,8 +1,0 @@
-<Context path="/greenstone3" docBase="/srv/gsdl/" reloadable="true">
-    <Realm className="org.apache.catalina.realm.JDBCRealm" 
-        driverName="org.apache.derby.jdbc.EmbeddedDriver"
-        connectionURL="jdbc:derby:/srv/gsdl/etc/usersDB"
-        userTable="users" userNameCol="username" userCredCol="password"
-        userRoleTable="roles" roleNameCol="role"
-    />
-</Context>
Index: main/trunk/package-kits/linux/gs2build.patch
===================================================================
--- main/trunk/package-kits/linux/gs2build.patch	(revision 29474)
+++ 	(revision )
@@ -1,87 +1,0 @@
---- gs2build/build-src/configure.in.orig	2014-11-14 17:39:39.863383460 +1300
-+++ gs2build/build-src/configure.in	2014-11-14 17:40:52.845299057 +1300
-@@ -88,18 +88,6 @@
- AC_SUBST(ENABLE_JAVA)
- 
- dnl
--dnl Set use of wvware (enabled by default)
--dnl
--AC_ARG_ENABLE(wvware, [  --disable-wvware          Disable wvWare compilation], USE_WVWARE=$enableval, USE_WVWARE=yes)
--if test $USE_WVWARE = "yes" -o $USE_WVWARE = "1" ; then
--  USE_WVWARE=1
--  AC_DEFINE(USE_WVWARE,[])
--else
--  USE_WVWARE=0
--fi
--AC_SUBST(USE_WVWARE)
--
--dnl
- dnl Set use of JDBM (enabled by default)
- dnl
- AC_ARG_ENABLE(jdbm, [  --disable-jdbm          Disable JDBM compilation], USE_JDBM=$enableval, USE_JDBM=yes)
-@@ -472,50 +460,13 @@
-   AC_SUBST(MODULEDIRS)
- fi
- 
--#----------------------------------------------------------------------------
--# GS3 uses this to set up gnome-lib env, GS2 uses the configure in gs2build/toplevel GS2 installation
--# For gnome-lib-minimal need to source its ./devel.bash before wvware can even be configured
--# For a gnome-lib that's already compiled, don't need to its source ./devel.bash to configure wvware
--# If a gnome-lib is not yet compiled, we compile it first with CASCADE-MAKE.sh
--# Need to make sure that the gnome-lib-minimal is not the cut-down gnome-lib-minimal (which contains
--# only the linux/lib subfolder) that's included with linux and mac binaries, because we can't compile 
--# wvware with the cut-down one, only run wvware with it. The test for the cut-down version is that 
--# it does not contain devel.bash.
--
--if test $ENABLE_GNOMELIB_EXT = 1; then
--
--   if test -z "$GSDLHOME"; then
--      cd ..
--      gshome=`pwd`
--      cd build-src
--   else 
--      gshome=$GSDLHOME  
--   fi
--
--   if test -f $gshome/ext/gnome-lib-minimal/devel.bash; then
--      echo "*** gnome-lib (minimal) detected. Sourcing the gnomelib env for configuring wvware..."
--      cd $gshome/ext/gnome-lib-minimal
--      source ./devel.bash
--      cd $gshome/build-src
--   elif test -d $gshome/ext/gnome-lib; then
--     if test -d $gshome/ext/gnome-lib/$gsdlos; then
--        echo "*** Sourcing the gnomelib env for configuring wvware..."
--	cd $gshome/ext/gnome-lib
--      	source ./devel.bash
--      	cd $gshome/build-src	
--     fi 
--   fi
--
--fi
--
- # ---------------------------------------------------------------------------
--AC_CONFIG_SUBDIRS(packages)
- 
- # the list of folders in the src folder
- srclist="src/hashfile/Makefile \
-          src/phind/generate/Makefile \
-          src/java/org/nzdl/gsdl/Makefile"
- 
--AC_OUTPUT(packages/Makefile Makefile $srclist $moduleDirs)
-+AC_OUTPUT(Makefile $srclist $moduleDirs)
- 
- 
---- gs2build/build-src/Makefile.in.orig	2014-11-14 17:52:15.848644058 +1300
-+++ gs2build/build-src/Makefile.in	2014-11-14 17:52:27.558644340 +1300
-@@ -48,9 +48,9 @@
- ALLFILES = $(OBJECTS)
- 
- # all directories should be compiled
--COMPILEDIRS = packages src/hashfile src/phind/generate src/java/org/nzdl/gsdl
-+COMPILEDIRS = src/hashfile src/phind/generate src/java/org/nzdl/gsdl
- # a subset of the directories get installed
--INSTALLDIRS = packages src/hashfile src/phind/generate 
-+INSTALLDIRS = src/hashfile src/phind/generate 
- 
- MODULEDIRS = @MODULEDIRS@
- 
Index: main/trunk/package-kits/linux/perl-util.patch
===================================================================
--- main/trunk/package-kits/linux/perl-util.patch	(revision 29474)
+++ 	(revision )
@@ -1,11 +1,0 @@
---- gs2build/perllib/util.pm.orig	2014-11-19 15:54:32.017195491 +1300
-+++ gs2build/perllib/util.pm	2014-11-19 15:56:10.850531232 +1300
-@@ -213,7 +213,7 @@
- 	}
-     }
- 
--    my $tmpdir = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "tmp");
-+    my $tmpdir = "/tmp/greenstone-build";
-     &FileUtils::makeAllDirectories ($tmpdir) unless -e $tmpdir;
- 
-     my $count = 1000;
Index: main/trunk/package-kits/linux/pkg.in/files/build-demo.sh
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/build-demo.sh	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/build-demo.sh	(revision 29481)
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+GSDL3HOME=$(pwd)
+export GSDL3HOME
+. greenstone --no-interactive
+mv -T src sites/localsite/collect
+find sites/localsite/collect/ -mindepth 1 -maxdepth 1 -not -name ".*" -execdir bash -c 'col="$(basename $1)"; import.pl -removeold -site localsite "$col"; buildcol.pl -removeold -site localsite "$col"; mv "${col}/building" "${col}/index"' -- {} \;
+mv -T sites/localsite/collect src
+rm -rf sites
Index: main/trunk/package-kits/linux/pkg.in/files/build.properties
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/build.properties	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/build.properties	(revision 29481)
@@ -0,0 +1,139 @@
+#### properties file for Greenstone3 building using ANT. See the README for more 
+#### information
+
+## Tomcat installation
+# Set this to the internet/intranet name of the machine that Tomcat is/will be 
+# run on. localhost is fine for accessing the server from the local machine, 
+# but not remotely
+tomcat.server=localhost
+# The port number that tomcat is/will be run on
+tomcat.port=8383
+# Tomcat's shutdown port - this may need to be changed if you are running two or more Tomcats
+tomcat.shutdown.port=8305
+# If tomcat is already running, enter the path to the base directory here
+tomcat.installed.path=
+# uncomment the following if you have moved the greenstone3 web directory to tomcats webapps dir 
+#web.home=${tomcat.installed.path}/webapps/greenstone3
+
+## Collection building options
+# uncomment if you don't want to have collection building enabled
+#disable.collection.building=true
+#
+# uncomment (and edit) if you want to control where perl is found
+#perl.path=/usr/bin
+
+## Greenstone 3 server program options
+# does running the server automatically start up Tomcat and a browser
+server.auto.start=false
+# if set to true, won't try other ports if the specified port is not available
+server.keep.port=false
+# default servlet to start with
+server.default.servlet=/library
+
+# The context name of your GS3 digital library. By default this will be "greenstone3". 
+# Ensure this has a value. If you change this multiple times, you need to remove the old versions
+# of <custom.context>.xml from GS3/packages/tomcat/conf/Catalina/localhost
+# does not contain previous 
+custom.context=greenstone3
+
+##Browser setup
+browser.path=
+
+## Proxy setup - Greenstone installation will attempt to download extra packages. Set the proxy information here if you are behind a firewall.
+# The proxy server name 
+proxy.host=
+# The proxy server port
+proxy.port=
+# A user name to use when talking to the proxy server (optional, will prompt if not entered here)
+proxy.user=
+# A password to use when talking to the proxy server (optional, will prompt if not entered here)
+proxy.password=
+
+## java compilation properties - for javac
+# Should compilation include the debug option?
+compile.debug=true
+# Should compilation include the deprecation option?
+compile.deprecation=true
+# Should compilation include the optimize option?
+compile.optimize=true
+
+# Properties that control cross-compiling
+compile.cross        = false
+#cross.os             = windows
+#cross.host           = i686-w64-mingw32
+#cross.build          = i686-pc-linux-gnu
+#cross.configure.extraargs =
+
+#cross.os             = android
+#cross.host           = arm-linux-androideabi
+#cross.build          = i686-pc-linux-gnu
+#cross.configure.extraargs = gl_cv_header_working_stdint_h=yes
+
+
+# Control whether or not JNI bindings are used
+#   e.g. MG, MG++ and GDBM and the like
+# Setting this false means these components are not available to the install
+# The expectation is that collections will be build from 100% Java components:
+#   e.g Lucene and JDBM
+# 
+# Ant 1.7.1 and before only test for *existence* so this needs to be commented
+# in or out to control whether jni is used or not
+with.jni=true
+
+## Controls whether or not we want GLI and GEMS to be checked out and compiled
+#with.gli.and.gems=true
+
+## Control if compilation of gs2 is static or not. Used, for example, for distributions
+# Same issue as 'with.jni' for how this gets used in ant 1.7.1 and before
+#compile.static=true
+
+# A flag used by the release-kit to compile with gnomelib
+# (Previously this flag was called use.support.lib but got conflated with
+# the property checkout.gnomelib.ext below)
+#use.gnomelib.ext=true
+
+## Uncomment these lines if enabling compilation with the gnome-lib extension
+## and if compiling imagemagick
+## These extensions should be in the [gsdl3home]/gs2build/ext directory
+#checkout.gnomelib.ext=true
+#checkout.imagemagick.ext=true
+
+# By default, GS3 will check out the pdfbox extension from SVN
+checkout.pdfbox.ext=true
+
+# The following two properties are automatically overridden by gs3-server
+# when running off a read-only medium such as a DVD ...
+#
+# The 'writable' home default is to be the same location as gsdl3.home
+gsdl3home.isreadonly=false
+gsdl3.writablehome=${basedir}/web
+
+# ... alternative the above can be changed to
+#
+#  gsdl3home.isreadonly=true
+#  gsdl3.writablehome=${java.io.tmpdir}/greenstone/web
+#
+# ... or else provided on the command line, e.g.:
+#   ant -Dgsdl3home.isreadonly=true gsdl3.writablehome=/tmp/greenstone/web start
+
+## windows c++ compilation
+# The following property does not help in build.xml. 
+# The user needs to run Visual Studio's vcvars32.bat script from the
+# MSDOS prompt before compiling Greenstone3 (before "ant prepare install")
+#compile.windows.c++.setup=C:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT
+
+##Flax stuff##
+##uncomment if you want to install flax
+#install.flax=true
+#flax.checkout.path=${flax.svn.root}/trunk/flaxmain
+
+##These need to be uncommented if using Fedora and Fedora GSearch with Greenstone's tomcat
+#fedora.home=#${basedir}/ext/fedora3
+#fedora.maxpermsize=-XX:MaxPermSize=128m
+#fedora.password=pounamu
+#index.writelock.timeout=10000
+
+##Web services related constants##
+base.webservice.name=SOAPServer
+##listing and description of all the web services deployable on GS3##
+web.services.list=${base.webservice.name} for Greenstone3's core web services, QBR${base.webservice.name} for Query, Browse and Retrieve services
Index: main/trunk/package-kits/linux/pkg.in/files/gli
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/gli	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/gli	(revision 29481)
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+if test -z "$JAVA_HOME"; then
+    for dir in /usr/lib/jvm/default/ /usr/lib/jvm/default-java/; do
+        if test -d $dir; then
+            JAVA_HOME=$dir
+            break
+        fi
+    done
+fi
+if test -z "$JAVA_HOME"; then
+    echo -e "Could not find JAVA_HOME.\nPlease export JAVA_HOME=<jre_location>" >&2
+    exit 1
+fi
+
+export JAVA_HOME
+
+. greenstone --no-interactive
+
+/opt/gli/gli.sh
Index: main/trunk/package-kits/linux/pkg.in/files/greenstone
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/greenstone	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/greenstone	(revision 29481)
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+interactive=1
+sourced=1
+unset use_shell
+case $* in
+    *--no-interactive*)
+        unset interactive
+        ;;
+esac
+
+fail() {
+    echo $* >&2
+    exit 1
+}
+
+# make sure we are sourced, and not run
+if test "`basename $0`" = "greenstone" ; then
+# if $0 is "greenstone" we've been run... $0 is shellname if sourced.
+# One exception is zsh has an option to set it temporarily to the script name
+    if test -z "$ZSH_NAME" ; then
+        # we aren't using zsh
+        unset sourced
+    fi
+fi
+
+if test -z "$sourced" ; then
+    test -z "$interactive" && fail "Script must be sourced for non-interactive use"
+    echo "Script was not sourced" >&2
+    echo -n "Use a new shell? (y/[n]) " >&2
+    read use_shell
+    test "$use_shell" != "y" -a "$use_shell" != "Y" && fail "Script must either be sourced, or allowed to start an interactive shell"
+    use_shell=1
+fi
+
+GSDLHOME=/opt/greenstone/gs2build
+export GSDLHOME
+
+GSDLOS=linux
+export GSDLOS
+
+# Establish cpu architecture
+# 32-bit or 64-bit?
+UNAME_HW_MACH=`uname -m`
+
+# Following test came from VirtualBox's Guest Additions autostart.sh
+# (adapted for use in Greenstone)
+case "$UNAME_HW_MACH" in
+i[3456789]86|x86|i86pc)
+    GSDLARCH='32'                                                                                                
+    ;;
+x86_64|amd64|AMD64)
+    GSDLARCH='64'
+    ;;
+*)
+    echo "Unknown architecture: $UNAME_HW_MACH" >&2
+    ;;
+esac
+
+# Only want non-trival GSDLARCH value set if there is evidence of
+# the installed bin (lib, ...) directories using linux32, linux64
+# (otherwise probably looking at an SVN compiled up version for single OS)
+if test ! -d "$GSDLHOME/bin/$GSDLOS$GSDLARCH" ;
+then
+    GSDLARCH=""
+fi
+
+export GSDLARCH
+
+# Workaround for perl >= 5.18
+PERL_PERTURB_KEYS=0
+export PERL_PERTURB_KEYS
+
+
+PATH="$GSDLHOME/bin/script:$GSDLHOME/bin/$GSDLOS$GSDLARCH:$PATH"
+export PATH
+LD_LIBRARY_PATH="$GSDLHOME/gs2build/lib/$GSDLOS$GSDLARCH:$GSDLHOME/lib/$GSDLOS$GSDLARCH:$LD_LIBRARY_PATH"
+export LD_LIBRARY_PATH
+
+if test -n "$interactive" -a -z "$GSDL3HOME" ; then
+    echo "Where are the collections? [/srv/gsdl/]" >&2
+    echo -n " > " >&2
+    read GSDL3HOME
+fi
+if test -z "$GSDL3HOME" ; then
+    echo "Setting collections location to the default" >&2
+    GSDL3HOME=/srv/gsdl
+fi
+export GSDL3HOME
+
+test -d "$GSDL3HOME/sites/localsite/collect" || mkdir -p "$GSDL3HOME/sites/localsite/collect"
+
+if test -n "$interactive" -a -n "$use_shell" ; then
+    test -z $SHELL && SHELL=sh
+    echo "Starting an interactive shell for GSDL management" >&2
+    $SHELL
+fi
Index: main/trunk/package-kits/linux/pkg.in/files/greenstone3.xml
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/greenstone3.xml	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/greenstone3.xml	(revision 29481)
@@ -0,0 +1,8 @@
+<Context path="/greenstone3" docBase="/srv/gsdl/" reloadable="true">
+    <Realm className="org.apache.catalina.realm.JDBCRealm" 
+        driverName="org.apache.derby.jdbc.EmbeddedDriver"
+        connectionURL="jdbc:derby:/srv/gsdl/etc/usersDB"
+        userTable="users" userNameCol="username" userCredCol="password"
+        userRoleTable="roles" roleNameCol="role"
+    />
+</Context>
Index: main/trunk/package-kits/linux/pkg.in/files/gs2build.patch
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/gs2build.patch	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/gs2build.patch	(revision 29481)
@@ -0,0 +1,87 @@
+--- gs2build/build-src/configure.in.orig	2014-11-14 17:39:39.863383460 +1300
++++ gs2build/build-src/configure.in	2014-11-14 17:40:52.845299057 +1300
+@@ -88,18 +88,6 @@
+ AC_SUBST(ENABLE_JAVA)
+ 
+ dnl
+-dnl Set use of wvware (enabled by default)
+-dnl
+-AC_ARG_ENABLE(wvware, [  --disable-wvware          Disable wvWare compilation], USE_WVWARE=$enableval, USE_WVWARE=yes)
+-if test $USE_WVWARE = "yes" -o $USE_WVWARE = "1" ; then
+-  USE_WVWARE=1
+-  AC_DEFINE(USE_WVWARE,[])
+-else
+-  USE_WVWARE=0
+-fi
+-AC_SUBST(USE_WVWARE)
+-
+-dnl
+ dnl Set use of JDBM (enabled by default)
+ dnl
+ AC_ARG_ENABLE(jdbm, [  --disable-jdbm          Disable JDBM compilation], USE_JDBM=$enableval, USE_JDBM=yes)
+@@ -472,50 +460,13 @@
+   AC_SUBST(MODULEDIRS)
+ fi
+ 
+-#----------------------------------------------------------------------------
+-# GS3 uses this to set up gnome-lib env, GS2 uses the configure in gs2build/toplevel GS2 installation
+-# For gnome-lib-minimal need to source its ./devel.bash before wvware can even be configured
+-# For a gnome-lib that's already compiled, don't need to its source ./devel.bash to configure wvware
+-# If a gnome-lib is not yet compiled, we compile it first with CASCADE-MAKE.sh
+-# Need to make sure that the gnome-lib-minimal is not the cut-down gnome-lib-minimal (which contains
+-# only the linux/lib subfolder) that's included with linux and mac binaries, because we can't compile 
+-# wvware with the cut-down one, only run wvware with it. The test for the cut-down version is that 
+-# it does not contain devel.bash.
+-
+-if test $ENABLE_GNOMELIB_EXT = 1; then
+-
+-   if test -z "$GSDLHOME"; then
+-      cd ..
+-      gshome=`pwd`
+-      cd build-src
+-   else 
+-      gshome=$GSDLHOME  
+-   fi
+-
+-   if test -f $gshome/ext/gnome-lib-minimal/devel.bash; then
+-      echo "*** gnome-lib (minimal) detected. Sourcing the gnomelib env for configuring wvware..."
+-      cd $gshome/ext/gnome-lib-minimal
+-      source ./devel.bash
+-      cd $gshome/build-src
+-   elif test -d $gshome/ext/gnome-lib; then
+-     if test -d $gshome/ext/gnome-lib/$gsdlos; then
+-        echo "*** Sourcing the gnomelib env for configuring wvware..."
+-	cd $gshome/ext/gnome-lib
+-      	source ./devel.bash
+-      	cd $gshome/build-src	
+-     fi 
+-   fi
+-
+-fi
+-
+ # ---------------------------------------------------------------------------
+-AC_CONFIG_SUBDIRS(packages)
+ 
+ # the list of folders in the src folder
+ srclist="src/hashfile/Makefile \
+          src/phind/generate/Makefile \
+          src/java/org/nzdl/gsdl/Makefile"
+ 
+-AC_OUTPUT(packages/Makefile Makefile $srclist $moduleDirs)
++AC_OUTPUT(Makefile $srclist $moduleDirs)
+ 
+ 
+--- gs2build/build-src/Makefile.in.orig	2014-11-14 17:52:15.848644058 +1300
++++ gs2build/build-src/Makefile.in	2014-11-14 17:52:27.558644340 +1300
+@@ -48,9 +48,9 @@
+ ALLFILES = $(OBJECTS)
+ 
+ # all directories should be compiled
+-COMPILEDIRS = packages src/hashfile src/phind/generate src/java/org/nzdl/gsdl
++COMPILEDIRS = src/hashfile src/phind/generate src/java/org/nzdl/gsdl
+ # a subset of the directories get installed
+-INSTALLDIRS = packages src/hashfile src/phind/generate 
++INSTALLDIRS = src/hashfile src/phind/generate 
+ 
+ MODULEDIRS = @MODULEDIRS@
+ 
Index: main/trunk/package-kits/linux/pkg.in/files/perl-util.patch
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/perl-util.patch	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/perl-util.patch	(revision 29481)
@@ -0,0 +1,11 @@
+--- gs2build/perllib/util.pm.orig	2014-11-19 15:54:32.017195491 +1300
++++ gs2build/perllib/util.pm	2014-11-19 15:56:10.850531232 +1300
+@@ -213,7 +213,7 @@
+ 	}
+     }
+ 
+-    my $tmpdir = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "tmp");
++    my $tmpdir = "/tmp/greenstone-build";
+     &FileUtils::makeAllDirectories ($tmpdir) unless -e $tmpdir;
+ 
+     my $count = 1000;
Index: main/trunk/package-kits/linux/pkg.in/files/wvWare
===================================================================
--- main/trunk/package-kits/linux/pkg.in/files/wvWare	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/files/wvWare	(revision 29481)
@@ -0,0 +1,5 @@
+#!/bin/sh
+# remove current directory from path
+dir=$(dirname $0 | sed -e 's/\//\\\//g')
+PATH=$(echo $PATH | sed -e "s/:$dir:/:/")
+wvWare $@
Index: main/trunk/package-kits/linux/pkg.in/packages/demo
===================================================================
--- main/trunk/package-kits/linux/pkg.in/packages/demo	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/packages/demo	(revision 29481)
@@ -0,0 +1,8 @@
+build-demo.sh
+
+SVN_LOCATION=http://svn.greenstone.org/main/trunk/greenstone3/web/sites/localsite/collect
+
+base
+src
+clean
+demo
Index: main/trunk/package-kits/linux/pkg.in/packages/gli
===================================================================
--- main/trunk/package-kits/linux/pkg.in/packages/gli	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/packages/gli	(revision 29481)
@@ -0,0 +1,8 @@
+gli
+
+SVN_LOCATION=http://svn.greenstone.org/main/trunk/gli
+
+base
+src
+clean
+gli
Index: main/trunk/package-kits/linux/pkg.in/packages/main
===================================================================
--- main/trunk/package-kits/linux/pkg.in/packages/main	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/packages/main	(revision 29481)
@@ -0,0 +1,14 @@
+build.properties
+greenstone
+greenstone3.xml
+gs2build.patch
+perl-util.patch
+wvWare
+
+SVN_LOCATION=http://svn.greenstone.org/main/trunk/greenstone3
+
+base
+src
+clean
+build-core
+main
Index: main/trunk/package-kits/linux/pkg.in/packages/tools
===================================================================
--- main/trunk/package-kits/linux/pkg.in/packages/tools	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/packages/tools	(revision 29481)
@@ -0,0 +1,14 @@
+build.properties
+greenstone
+greenstone3.xml
+gs2build.patch
+perl-util.patch
+wvWare
+
+SVN_LOCATION=http://svn.greenstone.org/main/trunk/greenstone3
+
+base
+src
+clean
+build-core
+tools
Index: main/trunk/package-kits/linux/pkg.in/platforms/arch
===================================================================
--- main/trunk/package-kits/linux/pkg.in/platforms/arch	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/platforms/arch	(revision 29481)
@@ -0,0 +1,7 @@
+SYSTEMLIB=/usr/lib
+SYSTEMBIN=/usr/bin
+SYSTEMJAVA=%SYSTEMLIB%/jvm/default
+GSSRV=/srv/gsdl
+TOMCATLIB=/usr/share/java/tomcat7
+TOMCATCONF=/etc/tomcat7/Catalina/localhost
+GSTOOLS=/opt/greenstone
Index: main/trunk/package-kits/linux/pkg.in/platforms/fedora
===================================================================
--- main/trunk/package-kits/linux/pkg.in/platforms/fedora	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/platforms/fedora	(revision 29481)
@@ -0,0 +1,7 @@
+SYSTEMLIB=/usr/lib
+SYSTEMBIN=/usr/bin
+SYSTEMJAVA=%SYSTEMLIB%/jvm/java
+GSSRV=/srv/gsdl
+TOMCATLIB=/usr/share/tomcat7/lib
+TOMCATCONF=/etc/tomcat7/Catalina/localhost
+GSTOOLS=/opt/greenstone
Index: main/trunk/package-kits/linux/pkg.in/platforms/ubuntu
===================================================================
--- main/trunk/package-kits/linux/pkg.in/platforms/ubuntu	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/platforms/ubuntu	(revision 29481)
@@ -0,0 +1,7 @@
+SYSTEMLIB=/usr/lib
+SYSTEMBIN=/usr/bin
+SYSTEMJAVA=%SYSTEMLIB%/jvm/default-java
+GSSRV=/srv/gsdl
+TOMCATLIB=/usr/share/tomcat7/lib
+TOMCATCONF=/etc/tomcat7/Catalina/localhost
+GSTOOLS=/opt/greenstone
Index: main/trunk/package-kits/linux/pkg.in/segments/base
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/base	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/base	(revision 29481)
@@ -0,0 +1,13 @@
+systemlib  := %SYSTEMLIB%
+systembin  := %SYSTEMBIN%
+java       := %SYSTEMJAVA%
+gssrv      := %GSSRV%
+tomcatlib  := %TOMCATLIB%
+tomcatconf := %TOMCATCONF%
+gstools    := %GSTOOLS%
+
+DESTDIR    ?= /
+
+all: build
+
+.PHONY: all svn clean cleanall install
Index: main/trunk/package-kits/linux/pkg.in/segments/build-core
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/build-core	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/build-core	(revision 29481)
@@ -0,0 +1,23 @@
+prepare: src
+	cp -L *.properties *.patch src/
+	cd src ; \
+	export JAVA_HOME=$(java) ; \
+	yes | ant prepare
+	patch -d src/ -p0 -N -i gs2build.patch || :
+	cd src/gs2build/build-src ; \
+	autoconf
+	rm -rf src/packages/*.zip
+	rm -rf src/packages/axis/docs
+	rm -rf src/gs2build/build-src/packages
+	touch prepare
+
+build: prepare
+	cd src ; \
+	JAVA_HOME=$(java) ant install
+	mv src/lib/jni/*.jar src/web/WEB-INF/lib/
+	# patch for gs2build tempdir
+	patch -d src/ -p0 -N -i perl-util.patch || :
+	# delete windows/mac stuff
+	find src/ -type d \( -iname "win32" -o -iname "windows" -o -iname "winutil" -o -iname "darwin" \) -exec rm -rf {} \; 2> /dev/null || :
+	find src/ \( -iname "*.dll" -o -iname "*.exe" \) -exec rm -rf {} \; || :
+	touch build
Index: main/trunk/package-kits/linux/pkg.in/segments/clean
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/clean	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/clean	(revision 29481)
@@ -0,0 +1,8 @@
+clean:
+	@echo "Cleaning src"
+	rm -rf src
+	rm -f build prepare
+
+cleanall: clean
+	@echo "Cleaning svn"
+	rm -rf svn
Index: main/trunk/package-kits/linux/pkg.in/segments/deb
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/deb	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/deb	(revision 29481)
@@ -0,0 +1,2 @@
+deb:
+	dpkg-buildpackage -rfakeroot
Index: main/trunk/package-kits/linux/pkg.in/segments/demo
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/demo	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/demo	(revision 29481)
@@ -0,0 +1,9 @@
+build: src
+	rm -f $(wildcard src/*/index.zip)
+	./build-demo.sh
+	touch build
+
+install: build
+	@echo "Building demo collections"
+	install -d $(DESTDIR)/$(gssrv)/sites/localsite
+	rsync -a --info=STATS --exclude .svn src/ $(DESTDIR)/$(gssrv)/sites/localsite/collect/
Index: main/trunk/package-kits/linux/pkg.in/segments/gli
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/gli	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/gli	(revision 29481)
@@ -0,0 +1,12 @@
+build: src
+	cd src ; \
+	JAVA_HOME=$(java) ./makegli.sh
+	# delete windows stuff
+	rm -rf src/winutil src/*.bat
+	# don't run again
+	touch build
+
+install: build
+	install -d $(DESTDIR)/$(gli)
+	rsync -a --info=STATS --exclude src --exclude .svn src/ $(DESTDIR)/$(gli)
+	install -Dm755 gli $(DESTDIR)/$(systembin)/gli
Index: main/trunk/package-kits/linux/pkg.in/segments/main
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/main	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/main	(revision 29481)
@@ -0,0 +1,7 @@
+install: build
+	install -d $(DESTDIR)/$(gssrv) $(DESTDIR)/$(systemlib) $(DESTDIR)/$(tomcatlib)
+	install -dm775 $(DESTDIR)/$(tomcatlib)
+	install -Dm755 src/lib/jni/*.so $(DESTDIR)/$(systemlib)
+	rsync -a --info=STATS --exclude sites/localsite/collect/ --exclude .svn src/web/ $(DESTDIR)/$(gssrv)/
+	install -Dm644 greenstone3.xml $(DESTDIR)/$(tomcatconf)/greenstone3.xml
+	mv $(DESTDIR)/$(gssrv)/WEB-INF/lib/derby.jar $(DESTDIR)/$(tomcatlib)
Index: main/trunk/package-kits/linux/pkg.in/segments/src
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/src	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/src	(revision 29481)
@@ -0,0 +1,12 @@
+svn:
+	@echo "Getting latest source"
+	svn co %SVN_LOCATION% svn
+
+src: svn
+	$(eval svnver := $(shell cd svn && svnversion -c | grep -o '[[:digit:]:]*'))
+	$(eval srcver := $(shell if test -d src; then cd src && svnversion -c | grep -o '[[:digit:]:]*'; else echo "nope"; fi))
+	if test $(svnver) != $(srcver); then \
+	$(MAKE) clean ; \
+	echo "Making copy of source" ; \
+	cp -rT svn src ; \
+	fi
Index: main/trunk/package-kits/linux/pkg.in/segments/tools
===================================================================
--- main/trunk/package-kits/linux/pkg.in/segments/tools	(revision 29481)
+++ main/trunk/package-kits/linux/pkg.in/segments/tools	(revision 29481)
@@ -0,0 +1,5 @@
+install: build
+	install -d $(DESTDIR)/$(gstools)
+	rsync -a --info=STATS --exclude build-src --exclude common-src --exclude collect/demo --exclude .svn src/gs2build $(DESTDIR)/$(gstools)/
+	rsync -a --info=STATS --exclude build-src --exclude common-src --exclude collect/demo --exclude .svn src/bin $(DESTDIR)/$(gstools)/
+	install -Dm755 greenstone $(DESTDIR)/$(systembin)/greenstone
Index: main/trunk/package-kits/linux/wvWare
===================================================================
--- main/trunk/package-kits/linux/wvWare	(revision 29474)
+++ 	(revision )
@@ -1,5 +1,0 @@
-#!/bin/sh
-# remove current directory from path
-dir=$(dirname $0 | sed -e 's/\//\\\//g')
-PATH=$(echo $PATH | sed -e "s/:$dir:/:/")
-wvWare $@
