[Apologies, I hit "Send" too soon]

I'm not sure how to write this since it seems to be so "easy" to me.
I'll start from the beginning, ie I won't worry about dumbing it down
too much and stating obvious things.

Q: what is a SAGE package?
A: A SAGE package (spkg) is a script that builds an install a piece of
software for your SAGE installation. Thus an spkg usually has 2 things
in it:
- The source code of the software
- The script that will build and install the software into SAGE.

Q: What does one look like?
A: Look in SAGE_ROOT/spkg/standard and you'll find a bunch of files
with .spkg extensions. For example box-1.0.spkg might be a package
living there. An spkg is just a tar ball. If you decompress
box-1.0.spkg, you'll see something that looks like this:
box-1.0/
spkg-install      -- (required) shell script run to install the package
spkg-check      -- (optional) runs the packages test suite after
                            spkg-install succeeds
SAGE.txt          -- Any modification done to the src/ directory are
recorded here
  /patches        -- (optional) any files needed by spkg-install for patching
  /src                -- the software that has to be installed.
  /.hg                -- A mercurial repository that has
spkg-install, spkg-rebuild,
       spkg-check, SAGE.txt and all contents patches.

Q: What's new about this format? What's all the fuss about?
A: It was decided that:
--  Having the installation scripts under version control would be a
good idea for people that have to make and modify spkg's frequently.
-- Separating source code and our patches would  would keep
us from the temptation of forking other projects. I also think this
will force us to send patches upstream when we're tired of managing
too much of them.

Q: OK, so how do I create one?
A: Suppose you have a piece of software called pa-1.0.tar.gz written
in C/C++ that you've downloaded from sourceforge. Here's how I would
do it:
-- make a fresh directory. I'll call mine new/
-- save pa-1.0.tar.gz in it
-- untar  pa-1.0.tar.gz
-- rename  pa-1.0/ to src/
-- create a spkg-install script. This is a shell script that will run
./configure, make, make install.  You want to install the library in
SAGE_ROOT/local/lib/, so might want to set
--prefix=SAGE_ROOT/local/lib/ for the configure script. Header files
go into SAGE_ROOT/local/include. Any additional libraries that you
want to compile  pa-1.0 against are in  SAGE_ROOT/local/lib/ , BTW.
-- if you have to modify pa-1.0 's source itself in any way, don't do
it directly. Instead, put the file you've modified in the patches/
directory, and in your spkg-install script, run something like
cp patches/file.c src/file.c
before configuring and building.
-- put spkg-install and patches/ under version control:
hg init ; hg add spkg-install patches; hg ci -m "new spkg created for pa!"
-- rename new/ to pa-1.0/
-- run: sage -spkg pa-1.0/ and it will create for you pa-1.0.spkg. You're done!

Special thanks to Brian, William and Joel for the discussion and feedback.

didier

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to