# HG changeset patch
# User R. Andrew Ohana
# Date 1347409617 25200
# Node ID 971006536398caeaa4f6f5ccdee19ad8ee7e6c92
# Parent 829f209f54506a4e58b96795b1fd7d610672cf0e
source sageenv in spkg/install
diff git a/Makefile b/Makefile
 a/Makefile
+++ b/Makefile
@@ 13,10 +13,9 @@
all: start doc # indirectly depends on build
build:
 cd spkg && \
 "../$(PIPE)" \
 "env SAGE_PARALLEL_SPKG_BUILD='$(SAGE_PARALLEL_SPKG_BUILD)' ./install all 2>&1" \
 "tee a ../install.log"
+ "$(PIPE)" \
+ "env SAGE_PARALLEL_SPKG_BUILD='$(SAGE_PARALLEL_SPKG_BUILD)' ./spkg/install all 2>&1" \
+ "tee a install.log"
./sage b
# ssl: build Sage, and also install pyOpenSSL. This is necessary for
diff git a/spkg/bin/sagespkg b/spkg/bin/sagespkg
 a/spkg/bin/sagespkg
+++ b/spkg/bin/sagespkg
@@ 91,13 +91,8 @@
# Set environment variables
##################################################################
# The following sets environment variables for building packages.
# Since this is sourced, it returns a nonzero value on errors rather
# than exiting. Using dot suggested by W. Cheung.
. "$SAGE_ROOT/spkg/bin/sageenv"

if [ $? ne 0 ]; then
 echo >&2 "Error setting environment variables by sourcing '$SAGE_ROOT/spkg/bin/sageenv';"
+if [ z "$SAGE_ROOT" ]; then
+ echo >&2 "It does not appear sagespkg has been run from withen the Sage environment;"
echo >&2 "possibly contact sagedevel (see http://groups.google.com/group/sagedevel)."
exit 1
fi
diff git a/spkg/install b/spkg/install
 a/spkg/install
+++ b/spkg/install
@@ 1,17 +1,22 @@
#!/usr/bin/env bash
########################################################################
# Set various environment variables
+# Set environment variables
########################################################################
# Assume current directory is SAGE_ROOT/spkg
SAGE_ROOT=`cd .. && pwd P`
SAGE_LOCAL="$SAGE_ROOT/local"
SAGE_SHARE="$SAGE_LOCAL/share"
SAGE_LOGS="$SAGE_ROOT/spkg/logs"
PATH="$SAGE_ROOT/spkg/bin:$SAGE_LOCAL/bin:$PATH"
PYTHONPATH="$SAGE_LOCAL"
export SAGE_ROOT SAGE_LOCAL SAGE_LOGS PATH PYTHONPATH
+# The following sets environment variables for building sage.
+# Since this is sourced, it returns a nonzero value on errors rather
+# than exiting. Using dot suggested by W. Cheung.
+. spkg/bin/sageenv
+
+if [ $? ne 0 ]; then
+ echo >&2 "Error setting environment variables by sourcing '$SAGE_ROOT/spkg/bin/sageenv';"
+ echo >&2 "possibly contact sagedevel (see http://groups.google.com/group/sagedevel)."
+ exit 1
+fi
+
+# move into the spkg directory for the rest of the installation process
+cd spkg
# Storing the start time of the build process. The time is stored in
# seconds since 19700101 in a hidden file called