9e385a4
diff -ur globus_common-10.2.orig/library/globus_common_paths.c globus_common-10.2/library/globus_common_paths.c
9e385a4
--- globus_common-10.2.orig/library/globus_common_paths.c	2006-01-19 06:54:14.000000000 +0100
9e385a4
+++ globus_common-10.2/library/globus_common_paths.c	2009-08-04 16:43:07.208220052 +0200
9e385a4
@@ -111,8 +111,7 @@
9e385a4
     p = globus_libc_getenv(name);
9e385a4
     if (!p || strlen(p)==0)
9e385a4
     {
9e385a4
-	globus_libc_sprintf(errmsg,_GCSL("Environment variable %s is not set"), name);
9e385a4
-	return GLOBUS_COMMON_PATH_ERROR_INSTANCE(errmsg);
9e385a4
+	return GLOBUS_SUCCESS;
9e385a4
     }
9e385a4
 
9e385a4
     *bufp = globus_libc_strdup(p);
9e385a4
@@ -199,17 +198,17 @@
9e385a4
     if (!deploy && (result=globus_location(&deploy)))
9e385a4
 	return result;
9e385a4
 
9e385a4
-    filename = globus_malloc(strlen(deploy) +
9e385a4
+    filename = globus_malloc( ( deploy ? strlen(deploy) : 0 ) +
9e385a4
 			     strlen(file_location) + 1 + 1 );
9e385a4
     if (!filename)
9e385a4
 	return GLOBUS_COMMON_PATH_ERROR_INSTANCE(_GCSL("malloc error"));
9e385a4
     
9e385a4
     globus_libc_sprintf(filename,
9e385a4
 			"%s/%s",
9e385a4
-			deploy,
9e385a4
+			deploy ? deploy : "",
9e385a4
 			file_location);
9e385a4
 
9e385a4
-    if (!deploy_path)
9e385a4
+    if (!deploy_path && deploy)
9e385a4
 	globus_free(deploy);
9e385a4
 
9e385a4
     fp = fopen(filename,"r");
9e385a4
diff -ur globus_common-10.2.orig/library/globus_extension.c globus_common-10.2/library/globus_extension.c
9e385a4
--- globus_common-10.2.orig/library/globus_extension.c	2008-03-12 20:01:05.000000000 +0100
9e385a4
+++ globus_common-10.2/library/globus_extension.c	2009-08-03 19:57:22.077217655 +0200
9e385a4
@@ -195,14 +195,17 @@
9e385a4
         
9e385a4
         if(globus_location(&tmp) == GLOBUS_SUCCESS)
9e385a4
         {
9e385a4
+            if(tmp)
9e385a4
+            {
9e385a4
 #if defined(TARGET_ARCH_WIN32)
9e385a4
-            globus_l_globus_location =
9e385a4
-                globus_common_create_string("%s\\lib", tmp);
9e385a4
+                globus_l_globus_location =
9e385a4
+                    globus_common_create_string("%s\\lib", tmp);
9e385a4
 #else
9e385a4
-            globus_l_globus_location =
9e385a4
-                globus_common_create_string("%s/lib", tmp);
9e385a4
+                globus_l_globus_location =
9e385a4
+                    globus_common_create_string("%s/lib", tmp);
9e385a4
 #endif
9e385a4
-            globus_free(tmp);
9e385a4
+                globus_free(tmp);
9e385a4
+            }
9e385a4
         }
9e385a4
         
9e385a4
         initialized = GLOBUS_TRUE;
d4f6665
diff -ur globus_common-10.2.orig/Makefile.am globus_common-10.2/Makefile.am
d4f6665
--- globus_common-10.2.orig/Makefile.am	2004-10-11 14:53:32.000000000 +0200
9e385a4
+++ globus_common-10.2/Makefile.am	2009-08-03 12:31:55.267481653 +0200
d4f6665
@@ -9,7 +9,7 @@
d4f6665
 	config \
d4f6665
 	doxygen
d4f6665
 
d4f6665
-sbin_SCRIPTS= \
d4f6665
+libexec_SCRIPTS= \
d4f6665
 	config.guess
d4f6665
 
d4f6665
 EXTRA_DIST = \
d4f6665
diff -ur globus_common-10.2.orig/programs/globus-sh-exec.in globus_common-10.2/programs/globus-sh-exec.in
d4f6665
--- globus_common-10.2.orig/programs/globus-sh-exec.in	2006-01-19 06:54:19.000000000 +0100
9e385a4
+++ globus_common-10.2/programs/globus-sh-exec.in	2009-08-03 12:31:55.268482825 +0200
d4f6665
@@ -17,7 +17,11 @@
d4f6665
 # 
d4f6665
 
d4f6665
 
d4f6665
-. ${GLOBUS_LOCATION}/libexec/globus-script-initializer
d4f6665
+if test -f ${GLOBUS_LOCATION:-/usr}/share/globus/globus-script-initializer ; then
d4f6665
+. ${GLOBUS_LOCATION:-/usr}/share/globus/globus-script-initializer
d4f6665
+else
d4f6665
+. ${GLOBUS_LOCATION:-/usr}/libexec/globus-script-initializer
d4f6665
+fi
d4f6665
 globus_source ${libexecdir}/globus-sh-tools.sh
d4f6665
 
d4f6665
 # This was done by the script initializer before V2.0
d4f6665
diff -ur globus_common-10.2.orig/programs/globus-version.in globus_common-10.2/programs/globus-version.in
d4f6665
--- globus_common-10.2.orig/programs/globus-version.in	2008-09-29 23:20:05.000000000 +0200
9e385a4
+++ globus_common-10.2/programs/globus-version.in	2009-08-03 12:31:55.269484149 +0200
d4f6665
@@ -43,7 +43,11 @@
d4f6665
 
d4f6665
 usage()
d4f6665
 {
d4f6665
-    . ${GLOBUS_LOCATION}/libexec/globus-script-initializer
d4f6665
+    if test -f ${GLOBUS_LOCATION:-/usr}/share/globus/globus-script-initializer ; then
d4f6665
+    . ${GLOBUS_LOCATION:-/usr}/share/globus/globus-script-initializer
d4f6665
+    else
d4f6665
+    . ${GLOBUS_LOCATION:-/usr}/libexec/globus-script-initializer
d4f6665
+    fi
d4f6665
     globus_source ${libexecdir}/globus-sh-tools.sh
d4f6665
 
d4f6665
     ${GLOBUS_SH_CAT-cat} 1>&2 <
d4f6665
diff -ur globus_common-10.2.orig/programs/Makefile.am globus_common-10.2/programs/Makefile.am
d4f6665
--- globus_common-10.2.orig/programs/Makefile.am	2005-12-07 10:37:44.000000000 +0100
9e385a4
+++ globus_common-10.2/programs/Makefile.am	2009-08-03 12:31:55.269484149 +0200
d4f6665
@@ -3,7 +3,7 @@
d4f6665
 if ENABLE_PROGRAMS
d4f6665
 bin_SCRIPTS = globus-sh-exec globus-version
d4f6665
 
d4f6665
-libexec_PROGRAMS = globus-libc-hostname globus-is-local-user
d4f6665
+sbin_PROGRAMS = globus-libc-hostname globus-is-local-user
d4f6665
 
d4f6665
 EXTRA_DIST = globus-sh-exec.in globus-version.in
d4f6665
 
d4f6665
diff -ur globus_common-10.2.orig/scripts/globus-hostname globus_common-10.2/scripts/globus-hostname
d4f6665
--- globus_common-10.2.orig/scripts/globus-hostname	2006-01-19 06:54:22.000000000 +0100
9e385a4
+++ globus_common-10.2/scripts/globus-hostname	2009-08-03 12:31:55.270483512 +0200
d4f6665
@@ -23,13 +23,12 @@
d4f6665
 # domainname
d4f6665
 
d4f6665
 
d4f6665
-if test "x$GLOBUS_LOCATION" = "x"; then
d4f6665
-    echo "ERROR Please specify GLOBUS_LOCATION" >&2
d4f6665
-    exit 1
d4f6665
+if test -f ${GLOBUS_LOCATION:-/usr}/share/globus/globus-script-initializer ; then
d4f6665
+. ${GLOBUS_LOCATION:-/usr}/share/globus/globus-script-initializer
d4f6665
+else
d4f6665
+. ${GLOBUS_LOCATION:-/usr}/libexec/globus-script-initializer
d4f6665
 fi
d4f6665
 
d4f6665
-. ${GLOBUS_LOCATION}/libexec/globus-script-initializer
d4f6665
-
d4f6665
 PROGRAM_NAME=`echo $0 | ${GLOBUS_SH_SED-sed} -e 's|.*/||g'`
d4f6665
 PROGRAM_VERSION=`echo '$Revision: 1.3 $' | ${GLOBUS_SH_CUT-cut} -d' ' -f2`
d4f6665
 
d4f6665
@@ -67,7 +66,7 @@
d4f6665
 EOF
d4f6665
 }
d4f6665
 
d4f6665
-. ${GLOBUS_LOCATION}/libexec/globus-args-parser-header
d4f6665
+. ${libexecdir}/globus-args-parser-header
d4f6665
 
d4f6665
 if [ -n "$1" ]; then
d4f6665
     globus_args_unrecognized_option "$1"
d4f6665
@@ -79,8 +78,8 @@
d4f6665
 if [ -z "${GLOBUS_HOSTNAME}" ] ; then
d4f6665
 
d4f6665
   # Set the _fullname based upon Globus's hostname command
d4f6665
-  if [ -x "${libexecdir}/globus-libc-hostname" ]; then
d4f6665
-    _fullname="`${libexecdir}/globus-libc-hostname`"
d4f6665
+  if [ -x "${sbindir}/globus-libc-hostname" ]; then
d4f6665
+    _fullname="`${sbindir}/globus-libc-hostname`"
d4f6665
   fi
d4f6665
 
d4f6665
   # if failed to set, use the system's hostname command
d4f6665
diff -ur globus_common-10.2.orig/scripts/globus-makefile-header globus_common-10.2/scripts/globus-makefile-header
d4f6665
--- globus_common-10.2.orig/scripts/globus-makefile-header	2008-02-20 17:03:35.000000000 +0100
9e385a4
+++ globus_common-10.2/scripts/globus-makefile-header	2009-08-03 12:31:55.271483490 +0200
d4f6665
@@ -25,29 +25,15 @@
d4f6665
 
d4f6665
 my $gpt_path = $ENV{GPT_LOCATION};
d4f6665
 my $globus_path = $ENV{GLOBUS_LOCATION};
d4f6665
-my $gpath;
d4f6665
 
d4f6665
-if ( !defined($gpt_path) && !defined($globus_path) )
d4f6665
+if ( !defined($gpt_path) )
d4f6665
 {
d4f6665
-    die("ERROR: GPT_LOCATION or GLOBUS_LOCATION needs to be set before running this script");
d4f6665
+    $gpt_path = "/usr";
d4f6665
 }
d4f6665
 
d4f6665
-if ( defined($gpt_path) )
d4f6665
+if ( !defined($globus_path) )
d4f6665
 {
d4f6665
-    $gpath = $gpt_path;
d4f6665
-    if ( ! -d $gpath )
d4f6665
-    {
d4f6665
-        die("ERROR: $gpath doesn't exist!\n");
d4f6665
-    }
d4f6665
-}
d4f6665
-
d4f6665
-if ( !defined($gpath) && defined($globus_path) )
d4f6665
-{
d4f6665
-    $gpath = $globus_path;
d4f6665
-    if ( ! -d $gpath )
d4f6665
-    {
d4f6665
-        die("ERROR: $gpath doesn't exist!\n");
d4f6665
-    }
d4f6665
+    $globus_path = "/usr";
d4f6665
 }
d4f6665
 
d4f6665
 
d4f6665
@@ -60,7 +46,7 @@
d4f6665
 #
d4f6665
 
d4f6665
 my($environment);
d4f6665
-@INC = ("$gpath/lib/perl", "$gpath/lib/perl/$Config{'archname'}", @INC);
d4f6665
+@INC = ("$gpt_path/lib/perl", "$gpt_path/lib/perl/$Config{'archname'}", @INC);
d4f6665
 
d4f6665
 if ( defined eval "require Grid::GPT::V1::Package" )
d4f6665
 {
d4f6665
@@ -240,7 +226,9 @@
d4f6665
     # point our installation object at our globus location
d4f6665
     #
d4f6665
 
d4f6665
-    $installation = new Grid::GPT::Installation(pkgdir => "$globus_path/etc/globus_packages");
d4f6665
+    $installation = -d "$globus_path/share/globus/packages" ?
d4f6665
+        new Grid::GPT::Installation(pkgdir => "$globus_path/share/globus/packages") :
d4f6665
+        new Grid::GPT::Installation(pkgdir => "$globus_path/etc/globus_packages");
d4f6665
     $installation->set_depenv('Build');
d4f6665
 
d4f6665
     #
d4f6665
@@ -313,10 +301,17 @@
d4f6665
     # push all of our entries onto our header array
d4f6665
     #
d4f6665
 
d4f6665
+    @INC = ("$globus_path/lib/perl", @INC);
d4f6665
+
d4f6665
+    require Globus::Core::Paths;
d4f6665
+    my $includedir = $Globus::Core::Paths::includedir;
d4f6665
+    my $flavorincludedir = $Globus::Core::Paths::flavorincludedir;
d4f6665
+    my $libdir = $Globus::Core::Paths::libdir;
d4f6665
+
d4f6665
     push(@$header, "GLOBUS_CFLAGS=\"$cflagslist\"");
d4f6665
-    push(@$header, "GLOBUS_INCLUDES=\"-I${globus_path}/include/$flavor $includeslist\"");
d4f6665
+    push(@$header, "GLOBUS_INCLUDES=\"-I${includedir} -I${flavorincludedir} $includeslist\"");
d4f6665
     push(@$header, "GLOBUS_LIBS=\"$libslist\"");
d4f6665
-    push(@$header, "GLOBUS_LDFLAGS=\"-L${globus_path}/lib\"");
d4f6665
+    push(@$header, "GLOBUS_LDFLAGS=\"-L${libdir}\"");
d4f6665
     push(@$header, "GLOBUS_PKG_LIBS=\"$pkglibslist $extlibslist\"");
d4f6665
     push(@$header, "GLOBUS_LIBTOOL=\"$globus_path/sbin/libtool-$flavor\"");
d4f6665
 }
d4f6665
@@ -332,7 +327,9 @@
d4f6665
     my($header) = @_;
d4f6665
     my($copy);
d4f6665
 
d4f6665
-    open(IN, "$globus_path/libexec/globus-build-env-$flavor.sh") || die "ERROR: Cannot open $globus_path/libexec/globus-build-env-$flavor.sh!\n$common_error\n";
d4f6665
+    open(IN, "$globus_path/share/globus/globus-build-env-$flavor.sh") ||
d4f6665
+      open(IN, "$globus_path/libexec/globus-build-env-$flavor.sh") ||
d4f6665
+      die "ERROR: Cannot open globus-build-env-$flavor.sh!\n$common_error\n";
d4f6665
 
d4f6665
     while (<IN>)
d4f6665
     { 
d4f6665
@@ -370,7 +367,9 @@
d4f6665
     my($header) = @_;
d4f6665
     my($copy);
d4f6665
 
d4f6665
-    open(IN, "$globus_path/libexec/globus-sh-tools-vars.sh") || die "ERROR: Cannot open $globus_path/libexec/globus-sh-tools-vars.sh!\n$common_error\n";
d4f6665
+    open(IN, "$globus_path/share/globus/globus-sh-tools-vars.sh") ||
d4f6665
+      open(IN, "$globus_path/libexec/globus-sh-tools-vars.sh") ||
d4f6665
+      die "ERROR: Cannot open globus-sh-tools-vars.sh!\n$common_error\n";
d4f6665
 
d4f6665
     while (<IN>) 
d4f6665
     {
d4f6665
diff -ur globus_common-10.2.orig/scripts/globus-makefile-header.gpt1 globus_common-10.2/scripts/globus-makefile-header.gpt1
d4f6665
--- globus_common-10.2.orig/scripts/globus-makefile-header.gpt1	2003-02-05 03:48:31.000000000 +0100
9e385a4
+++ globus_common-10.2/scripts/globus-makefile-header.gpt1	2009-08-03 12:31:55.272482892 +0200
d4f6665
@@ -15,18 +15,13 @@
d4f6665
 
d4f6665
 my $flavor;
d4f6665
 my $link="static";
d4f6665
-my $gpt=$ENV{GPT_LOCATION};
d4f6665
+
d4f6665
 my $gpath = $ENV{GPT_LOCATION};
d4f6665
 if (!defined($gpath))
d4f6665
 {
d4f6665
-	  $gpath = $ENV{GLOBUS_LOCATION};
d4f6665
-	   
d4f6665
-  }
d4f6665
-  if (!defined($gpath))
d4f6665
-  {
d4f6665
-	     die "ERROR: GPT_LOCATION or GLOBUS_LOCATION needs to be set before running this script"
d4f6665
-     }
d4f6665
-      
d4f6665
+  $gpath = "/usr";
d4f6665
+}
d4f6665
+
d4f6665
      @INC = (@INC, "$gpath/lib/perl");
d4f6665
 
d4f6665
 require Grid::GPT::Dependencies;
d4f6665
@@ -40,20 +35,10 @@
d4f6665
 my $pgm_linkslist;
d4f6665
 my $lib_linkslist;
d4f6665
 
d4f6665
-if(!defined($gpt))
d4f6665
-{
d4f6665
-  $gpt=$ENV{GLOBUS_LOCATION};
d4f6665
-}
d4f6665
-if(!defined($gpt))
d4f6665
-{
d4f6665
-  die "ERROR: GPT_LOCATION or GLOBUS_LOCATION needs to be set before running this script\n";
d4f6665
-}
d4f6665
-
d4f6665
 my $globus=$ENV{GLOBUS_LOCATION};
d4f6665
-
d4f6665
 if(!defined($globus))
d4f6665
 {
d4f6665
-  die "ERROR: GLOBUS_LOCATION needs to be set before running this script\n";
d4f6665
+  $globus = "/usr";
d4f6665
 }
d4f6665
 
d4f6665
 my %hash;
d4f6665
@@ -102,14 +87,23 @@
d4f6665
 
d4f6665
 	assemble_link_lines($fakepkg, $flavor, $link);
d4f6665
 	  
d4f6665
+@INC = ("$globus/lib/perl", @INC);
d4f6665
+
d4f6665
+require Globus::Core::Paths;
d4f6665
+my $includedir = $Globus::Core::Paths::includedir;
d4f6665
+my $flavorincludedir = $Globus::Core::Paths::flavorincludedir;
d4f6665
+my $libdir = $Globus::Core::Paths::libdir;
d4f6665
+
d4f6665
 push @temp_header,  "GLOBUS_CFLAGS=\"$cflagslist\"\n";
d4f6665
-push @temp_header,  "GLOBUS_INCLUDES=\" -I$ENV{GLOBUS_LOCATION}/include/$flavor $includeslist\"\n";
d4f6665
+push @temp_header,  "GLOBUS_INCLUDES=\"-I$includedir -I$flavorincludedir $includeslist\"\n";
d4f6665
 push @temp_header, "GLOBUS_LIBS=\"$libslist\"\n";
d4f6665
-push @temp_header, "GLOBUS_LDFLAGS=\" -L$ENV{GLOBUS_LOCATION}/lib\n";
d4f6665
+push @temp_header, "GLOBUS_LDFLAGS=\"-L$libdir\"\n";
d4f6665
 push @temp_header, "GLOBUS_PKG_LIBS=\"$pkglibslist\"\n";
d4f6665
 push @temp_header, "GLOBUS_LIBTOOL=$globus/sbin/libtool-$flavor\n";
d4f6665
 
d4f6665
-open(IN, "$globus/libexec/globus-build-env-$flavor.sh") || die "ERROR: Cannot open GLOBUS_LOCATION/libexec/globus-build-env-$flavor.sh\n";
d4f6665
+open(IN, "$globus/share/globus/globus-build-env-$flavor.sh") ||
d4f6665
+  open(IN, "$globus/libexec/globus-build-env-$flavor.sh") ||
d4f6665
+  die "ERROR: Cannot open globus-build-env-$flavor.sh\n";
d4f6665
 
d4f6665
 while(<IN>)
d4f6665
 { 
d4f6665
@@ -130,7 +124,9 @@
d4f6665
 
d4f6665
 #END of Section one:  prepending GLOBUS_
d4f6665
 close (IN);
d4f6665
-open(IN, "$globus/libexec/globus-sh-tools-vars.sh") || die "ERROR: Cannot open GLOBUS_LOCATION/libexec/globus-sh-tools-vars.sh\n";
d4f6665
+open(IN, "$globus/share/globus/globus-sh-tools-vars.sh") ||
d4f6665
+  open(IN, "$globus/libexec/globus-sh-tools-vars.sh") ||
d4f6665
+  die "ERROR: Cannot open globus-sh-tools-vars.sh\n";
d4f6665
 while(<IN>) 
d4f6665
 {
d4f6665
 	if(m!\S!)  
d4f6665
diff -ur globus_common-10.2.orig/scripts/globus-sh-tools.sh globus_common-10.2/scripts/globus-sh-tools.sh
d4f6665
--- globus_common-10.2.orig/scripts/globus-sh-tools.sh	2006-01-19 06:54:22.000000000 +0100
9e385a4
+++ globus_common-10.2/scripts/globus-sh-tools.sh	2009-08-03 12:31:55.273482271 +0200
d4f6665
@@ -18,7 +18,11 @@
d4f6665
 
d4f6665
 if test -z "$GLOBUS_SH_VARIABLES_SET" ; then
d4f6665
     
d4f6665
-    . ${GLOBUS_LOCATION}/libexec/globus-sh-tools-vars.sh
d4f6665
+    if test -f ${GLOBUS_LOCATION:-/usr}/share/globus/globus-sh-tools-vars.sh ; then
d4f6665
+    . ${GLOBUS_LOCATION:-/usr}/share/globus/globus-sh-tools-vars.sh
d4f6665
+    else
d4f6665
+    . ${GLOBUS_LOCATION:-/usr}/libexec/globus-sh-tools-vars.sh
d4f6665
+    fi
d4f6665
     
d4f6665
     # export all commands:
d4f6665