#7188: GNUism in $SAGE_ROOT/spkg/install
------------------------+---------------------------------------------------
Reporter: drkirkby | Owner: tbd
Type: defect | Status: new
Priority: major | Milestone: sage-4.1.3
Component: porting | Keywords: GNUism AIX HP-UX Solaris
Work_issues: | Author: David Kirkby
Reviewer: | Merged:
------------------------+---------------------------------------------------
Once one runs make it runs the script $SAGE_ROOT/spkg/install.
Unfortunately, the very first command in there, the result of ticket #6744
has a GNUism.
{{{
echo `date -u "+%s"` > .BUILDSTART
}}}
The '%s is '''not''' part of the current POSIX standard and fails to work
on both the latest version of Solaris (which is a supported operating
system), and with HP-UX 11i, which is not supported
by Sage, but I think we should try to build Sage in such a way
that is should run on any decent operating system.
There are at least two ways around this issue of find the number of
seconds since 1//1/1970:
http://shell.cfajohnson.com/cus-faq.html#Q6
One requires 'perl' (which is not tested for at this point), the other
relies on 'awk' being POSIX complaint, which we can't assume, but is
probably the safer of the two assumptions. A third way would be a way to
make it work with any 'date' command using some maths with 'bc' but that
looks like a lot of work, for little gain.
{{{
# The method below looks a bit odd, as one uses a
# random number generator to get the time! However,
# it will work with any 'awk' supporting the
# POSIX spec for srand().
# David Kirkby has tested this on the following operating systems.
# AIX, HP-UX, Linux, OS X and Solaris. (versions as available).
# The trick is to first seed the srand random number generator
# generator with the default value (which is the number
# of seconds since 1/1/1970) then call srand() again, to give the
# first random number, which will be the seed. Neat I think!
# See http://shell.cfajohnson.com/cus-faq.html#Q6
if [ `uname` = "SunOS" ] ; then
# The standard awk in Solaris is not POSIX complaint, and so will not be
# acceptable. But Sun ship a POSIX complient version at nawk (new awk)
nawk 'BEGIN {srand(); printf("%d\n", srand())}' > .BUILDSTART
else
awk 'BEGIN {srand(); printf("%d\n", srand())}' > .BUILDSTART
fi
}}}
The updated install script, can be found at
http://sage.math.washington.edu/home/kirkby/Solaris-fixes/top-level-
install-script/
I've tested this on
* AIX 6.1, compliments of http://www.metamodul.com/10.html
* HP-UX 11i (my own HP C3600)
* Linux (sage.math)
* Solaris 10 update 7 SPARC (t2.math)
* OpenSolaris 2008.11 (disk.math)
* OS X (bsd.math)
According to #6744 this needs to be manually integrated into Sage. Note I
stuck a readme file in the directory highlighting the fact this needs to
have execute permissions too.
Dave
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7188>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---