Hi list
I have done a similar effort for debian some time back (greater than 6
months). An alioth pkg-sage project
(http://alioth.debian.org/projects/pkg-sage/) was even set up to begin
a real attempt at packaging up sage for debian. Unfortunately, the
alioth build machine crashed and the small amount of work that had
been done was lost.
Anyway, I've attached my relatively detailed listing of how to go
about preparing sage for debianization - at the moment, it is a true
hack. The main packaging issue is similar to Mark's comment just above
- the linking of build directory to run time directory. This is most
problematic for .spkg's that install python files. The solution I had
was to patch the spkg-install files to change "python setup.py
install" to ""python setup.py install --install-lib <appropriate
relative path for debian installation>"
where for me that appropriate path was
"../../debian/python-sage/usr/lib/python2.4/site-packages"
I believe it would be easy enough to modify the spkg-install script to
have this appropriate relative directory passed in from the main
install script. William, would that be possible?
Anyway, any successful build of sage on debian will also have the
problems with un-sage-patched versions of some software so runtime
issues will/may occur. But, if sage was to ever be incorporated into
debian proper (rather than existing as a package installed from
outside of debian) it would need to rely mainly on existing debian
packages. Maybe only those that are truly forked from upstream (pari
is a good example) would remain included with sage. All generic stuff
(bzip, readline etc) would be pulled from the sage build process and
package.
If anyone is interested in signing up to the debian sage-package
project just register at the alioth link above. I'll make people
administrators so that the alioth webpage can be modified, files
added, and progress made!
Great work on the gentoo packaging effort Mark. I suspect that any
future efforts from either gentoo or debian packaging efforts will be
of mutual benefit to each other and sage upstream.
Cheers
James McCaw
On 18/03/07, Mark <[EMAIL PROTECTED]> wrote:
>
> Quote:
> **********************************************************************************
> > 1) Simple ebuild that just runs the sage build process and
> install
> > all of the sage stuff out of the way (/opt/sage). The
> difficult
> > step would be divorcing the build time location from the run
> time
> > location (b/c portage does a build to a dummy location and
> then
> > copies it to the live filesystem).
>
> One option is to just copy the build directory over to the run-time
> location at the end of the build, i.e., as make install. This should
> work
> if you run SAGE once from the target location. Let me know when
> you succeed at doing this. It would be a significant step forward
> for SAGE.
> **********************************************************************************
>
> So, I'm not sure how easy this is ... for example, when you build
> sage, you set SAGE_ROOT and this is used throughout the build process
> and the runtime usage (right? I could well be wrong). This coupling
> of the build time and run time environments is my biggest concern.
>
> Now, in gentoo, the builds are all done in /var/tmp/portage/
> packagename/work. Then, make install is pointed to (with either --
> prefix and/or DESTDIR) /var/tmp/portage/packagename/image. Under
> image, there might be image/usr image/share/doc image/include and so
> forth. For what I'm talking about using /opt for sage, we'd have
> image/opt/sage/<all the sage stuff>. This is done in a "sandbox" that
> prevents writing anywhere else in the system. So, any hardcoded paths
> will pose a problem (everything has to be relative to --prefix and/or
> DESTDIR). Finally, this gets copied into the live filesystem: for
> us, this would be into /opt/sage/. And this point, we have to make
> sure all the references in sage are relative to /opt/sage ... NOT to /
> var/tmp/portage/sage/image/opt/sage.
>
> Regards,
> Mark
>
>
> >
>
--
James McCaw
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---
This file is Copyright James McCaw ([EMAIL PROTECTED]) August -- November
2006 and is released under the terms of the GPL.
File edited: 20 Nov 2006
==============================================================================
This file documents the steps taken to get a (more or less) working SAGE
package for debian. You certainly wouldn't want to rely on output from this
version of SAGE as no effort has been made to ensure that the debian
versions of various maths/scientific packages (e.g. maxima, gap) are
appropriate (in terms of SAGE specific patches etc). That said, I did
successfully create and use a debianized SAGE 1.3.2.1 package. The last
time I tried this process, with SAGE 1.3.7.2, the build failed. See below
for further details.
Happy debian SAGE hacking.
==============================================================================
STEP 1: Prepare the upstream source and debuild system.
a. $cp sage-{$version}.tar.gz ~/src
b. $cd ~/src
c. $tar -zxvf sage-{$version}.tar.gz
d. $cd sage-{$version}
e. $dh_make -e [EMAIL PROTECTED] -f ../sage-{$version}.tar.gz # answer s
STEP 2: Move modifications into build directory
a. Modify debian/{control,rules}. I'm sure I've got incorrect entries in
debian/control (missing and/or unrequired) dependencies. My debian/rules
file is completely botched as I don't fully understand Makefiles.
Apologies for the horrible hacks, but they got me going.
---START debian/control---
Source: sage
Section: python
Priority: optional
Maintainer: James McCaw <[EMAIL PROTECTED]>
Build-Depends: debhelper (>= 5), python-dev, python, ipython-dev,
python-pexpectd, python-gnuplot, octave, python-zodb, python-matplotlib,
python-numpy, python-numeric, clisp-dev, libmpfr-dev, gap-dev, linpng12-dev,
zlib1g-dev, gsl-dev, libpari-dev, mercurial
Standards-Version: 3.7.2
Package: python-sage
Architecture: any
Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, maxima, gap,
gsl-bin, pari-gp, python-matplotlib, ipython, python-pexpect, python-gnuplot,
python-zodb, python-numpy, python-numeric, octave, mercurial
Description: SAGE mathematical environment
SAGE is an integrated python environment for a range of mathematical
software packages, including maxima, gap, octave and singular. It provides
both an ipython derived sage shell, and the ability to be integrated into
python in the standard way.
.
This package is built for the default Python version.
---END debian/control---
---START debian/rules---
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
configure: configure-stamp
configure-stamp: remove-guff
dh_testdir
# Add here commands to configure the package.
touch configure-stamp
remove-guff:
dh_testdir
touch spkg/base/bzip2-1.0.3-install
touch spkg/base/bzip2-1.0.3.tar.gz
touch spkg/standard/clisp-2.40.spkg
touch spkg/standard/ecm-6.0.1.p0.spkg
touch spkg/standard/freetype-2.1.10.spkg
touch spkg/standard/gap-4.4.8.spkg
# touch spkg/standard/genus2reduction-0.3.spkg
touch spkg/standard/gmp-4.2.1.spkg
touch spkg/standard/gnuplotpy-1.7.p1.spkg
touch spkg/standard/gsl-1.8.spkg
touch spkg/standard/ipython-20061015.spkg
# touch spkg/standard/lcalc-2006.09.19.spkg
touch spkg/standard/libpng-1.2.8.p0.spkg
touch spkg/standard/matplotlib-0.87.6.spkg
touch spkg/standard/maxima-5.10.0.spkg
touch spkg/standard/mercurial-0.9.1.p2.spkg
touch spkg/standard/mpfr-20061015.spkg
touch spkg/standard/numeric-24.2.spkg
touch spkg/standard/pari-2.3.1.spkg
touch spkg/standard/pexpect-2.0.spkg
# touch spkg/standard/pyrex-20061005.spkg
touch spkg/standard/python-2.5.p2.spkg
touch spkg/standard/readline-5.0.1.spkg
touch spkg/standard/termcap-1.3.1.spkg
touch spkg/standard/twisted-2.4.0.p1.spkg
touch spkg/standard/zlib-1.2.3.p1.spkg
touch spkg/standard/zodb3-3.6.0.spkg
rm spkg/base/bzip2-1.0.3-install
rm spkg/base/bzip2-1.0.3.tar.gz
rm spkg/standard/clisp-2.40.spkg
rm spkg/standard/ecm-6.0.1.p0.spkg
rm spkg/standard/freetype-2.1.10.spkg
rm spkg/standard/gap-4.4.8.spkg
# rm spkg/standard/genus2reduction-0.3.spkg
rm spkg/standard/gmp-4.2.1.spkg
rm spkg/standard/gnuplotpy-1.7.p1.spkg
rm spkg/standard/gsl-1.8.spkg
rm spkg/standard/ipython-20061015.spkg
# rm spkg/standard/lcalc-2006.09.19.spkg
rm spkg/standard/libpng-1.2.8.p0.spkg
rm spkg/standard/matplotlib-0.87.6.spkg
rm spkg/standard/maxima-5.10.0.spkg
rm spkg/standard/mercurial-0.9.1.p2.spkg
rm spkg/standard/mpfr-20061015.spkg
rm spkg/standard/numeric-24.2.spkg
rm spkg/standard/pari-2.3.1.spkg
rm spkg/standard/pexpect-2.0.spkg
# rm spkg/standard/pyrex-20061005.spkg
rm spkg/standard/python-2.5.p2.spkg
rm spkg/standard/readline-5.0.1.spkg
rm spkg/standard/termcap-1.3.1.spkg
rm spkg/standard/twisted-2.4.0.p1.spkg
rm spkg/standard/zlib-1.2.3.p1.spkg
rm spkg/standard/zodb3-3.6.0.spkg
build: build-stamp
build-stamp: configure-stamp
dh_testdir
# Add here commands to compile the package.
$(MAKE)
#docbook-to-man debian/sage.sgml > sage.1
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
-$(MAKE) clean
dh_clean
install: build
dh_testdir
dh_testroot
# dh_clean -k # This was deleting site-packages stuff! Crazy!
dh_installdirs
# Add here commands to install the package into debian/python-sage.
$(MAKE)
# This stuff should not be here...but it sort of works for the time
being
# Make a python symlink for sage.bin to point at
ln -sf /usr/bin/python2.4 local/bin/python
ln -sf /usr/bin/gp local/bin/gp
# Now put stuff into the debian directory
cp -a data debian/python-sage/usr/lib/sage
cp -a examples debian/python-sage/usr/share/doc/sage
cp -a local debian/python-sage/usr/lib/sage
cp ipython/ipythonrc debian/python-sage/usr/lib/sage
cp matplotlibrc debian/python-sage/usr/lib/sage
cp sage debian/python-sage/usr/bin
cp sage-python debian/python-sage/usr/bin
cp example.sage debian/python-sage/usr/lib/sage
# It wants the following dir (this is such a hack because I don't know
# how to write makefiles)
touch debian/python-sage/usr/lib/sage/tmp
rm -rf debian/python-sage/usr/lib/sage/tmp
mkdir debian/python-sage/usr/lib/sage/tmp
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs changelog.txt
dh_installdocs
dh_installexamples
# dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
# dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
---END debian/rules---
You may also need to set up the debian/dirs file.
This sets up the minimal debian build configuration but much more needs
to be done (see 5. TODO). The rules file deletes as many unrequired spkg
packages as possible (they are in debian so let's use them). At the
moment (1.3.7.2), it also removes genus2reduction and lcalc as there is
a build error (can't find pari.h) which I can't be bothered fixing at
the moment.
Unfortunately, sage-1.3.7.2 doesn't build - there is a pyrex error. This
is fatal. It didn't happen with 1.3.2.1. Ahh, but pyrex in SAGE is
heavily modified so don't use the debian version anyway.
b. For all packages that install python files, the spkg-install file
needs to be modified (hidden in the spkg file): Change the line
"python setup.py install" to "python setup.py install --install-lib
../../debian/python-sage/usr/lib/python2.4/site-packages". At this
moment, this requires modifications to: sage-{$version}.spkg,
sage_user-{$version}.spkg and pyrex-{$version}.spkg
c. Remove all traces of BZIP2 from the spkg/standard/deps file (maybe we
could instead just delete the bzip2-{$version}.spkg file at spkg/base?)
d. Edit ./sage to set SAGE_ROOT="/usr/lib/sage" as required once the deb
is installed
STEP 3: Begin the build
a. fakeroot debian/rules binary
STEP 4: Install the deb
a. Use sage :-) But there are some things wrong with it...
i. It complains about something when we run sage.
ii. If you wish to use it within a python script you need to set
SAGE_ROOT and LD_LIBRARY_PATH.
STEP 5: TODO
Fix the debian/rules file...specifically...
a. Separate out the documentation, examples etc. into new packages
b. Get upstream to allow for a parameter to be passed to python setup.py
calls (needed to avoid hand editing sage, sage_user and pyrex spkg
spkg-install files at 2b above)
c. Make patches for all the changes that are manually put in
d. Attempt to get sage packages to build into debian/python-sage rather
than moving the files in afterwards (extremely hacky part of the
debian/rules file)
e. In any case, fix the /usr/lib/sage/local/... structure
f. Understand the error when running sage
g. Tighten up build deps and deps in debian/control (educated guesses
at the
moment)
h. Ensure information in debian/* files etc. is accurate and remove
uneeded debian/*.ex files
i. Get the build lintian happy