sagemath/sagemath-rpmbuild.patch
2013-04-22 14:11:03 -03:00

154 lines
6.7 KiB
Diff

diff -up sage-5.8/spkg/build/sage-5.8/module_list.py.orig sage-5.8/spkg/build/sage-5.8/module_list.py
--- sage-5.8/spkg/build/sage-5.8/module_list.py.orig 2013-03-19 18:08:36.523974698 -0300
+++ sage-5.8/spkg/build/sage-5.8/module_list.py 2013-03-19 18:08:39.383974808 -0300
@@ -48,10 +48,11 @@ else:
### Commonly used definitions
#########################################################
-numpy_include_dirs = [SAGE_LOCAL + '/lib/python/site-packages/numpy/core/include']
+from distutils.sysconfig import get_python_lib
+numpy_include_dirs = [get_python_lib(1) + '/numpy/core/include']
# We pick a file from numpy which is autogenerated so it has the
# timestamp of the numpy build.
-numpy_depends = [SAGE_LOCAL + '/lib/python/site-packages/numpy/core/include/numpy/_numpyconfig.h']
+numpy_depends = [get_python_lib(1) + '/numpy/core/include/numpy/_numpyconfig.h']
flint_depends = [SAGE_INC + 'FLINT/flint.h']
singular_depends = [SAGE_INC + 'libsingular.h', SAGE_INC + 'givaro/givconfig.h']
@@ -1771,7 +1772,7 @@ ext_modules = [
Extension('sage.rings.polynomial.pbori',
sources = ['sage/rings/polynomial/pbori.pyx'],
- libraries=['polybori', 'polybori_groebner', 'gd', 'png12', 'm4ri'],
+ libraries=['polybori', 'polybori_groebner', 'cudd', 'gd', 'png12', 'm4ri'],
include_dirs = [SAGE_INC, "sage/libs/polybori"],
depends = [SAGE_INC + "polybori/" + hd + ".h" for hd in ["polybori", "config"] ] + \
[SAGE_INC + 'm4ri/m4ri.h'],
diff -up sage-5.8/spkg/build/sage-5.8/sage/numerical/backends/glpk_backend.pxd.orig sage-5.8/spkg/build/sage-5.8/sage/numerical/backends/glpk_backend.pxd
--- sage-5.8/spkg/build/sage-5.8/sage/numerical/backends/glpk_backend.pxd.orig 2013-03-19 18:08:36.526974699 -0300
+++ sage-5.8/spkg/build/sage-5.8/sage/numerical/backends/glpk_backend.pxd 2013-03-19 18:08:39.383974808 -0300
@@ -16,7 +16,7 @@ cdef extern from *:
cdef extern from "float.h":
cdef double DBL_MAX
-cdef extern from "../../../local/include/glpk.h":
+cdef extern from "glpk.h":
ctypedef struct c_glp_prob "glp_prob":
pass
ctypedef struct c_glp_iocp "glp_iocp":
diff -up sage-5.8/spkg/build/sage-5.8/setup.py.orig sage-5.8/spkg/build/sage-5.8/setup.py
--- sage-5.8/spkg/build/sage-5.8/setup.py.orig 2013-03-20 03:54:28.401811272 -0300
+++ sage-5.8/spkg/build/sage-5.8/setup.py 2013-03-20 03:54:53.892811608 -0300
@@ -37,6 +37,11 @@ else:
SAGE_DEVEL = SAGE_ROOT + '/devel'
SAGE_INC = SAGE_LOCAL + '/include/'
+if os.environ.has_key('DESTDIR'):
+ DESTDIR = os.environ['DESTDIR']
+else:
+ DESTDIR = ''
+
if not os.environ.has_key('SAGE_VERSION'):
SAGE_VERSION=0
else:
@@ -49,21 +54,13 @@ except KeyError:
compile_result_dir = None
keep_going = False
-SITE_PACKAGES = '%s/lib/python%s/site-packages/'%(SAGE_LOCAL,platform.python_version().rsplit('.', 1)[0])
+SITE_PACKAGES = '%s/lib/python%s/site-packages'%(SAGE_LOCAL,platform.python_version().rsplit('.', 1)[0])
if not os.path.exists(SITE_PACKAGES):
raise RuntimeError, "Unable to find site-packages directory (see setup.py file in sage python code)."
-if not os.path.exists('build/sage'):
- os.makedirs('build/sage')
-
-sage_link = SITE_PACKAGES + '/sage'
-if not os.path.islink(sage_link) or not os.path.exists(sage_link):
- os.system('rm -rf "%s"'%sage_link)
- os.system('cd %s; ln -sf ../../../../devel/sage/build/sage .'%SITE_PACKAGES)
-
# search for dependencies and add to gcc -I<path>
include_dirs = ['%s/include'%SAGE_LOCAL,
- '%s/include/csage'%SAGE_LOCAL,
+ 'c_lib/include',
'%s/sage/sage/ext'%SAGE_DEVEL]
# search for dependencies only
@@ -173,11 +170,11 @@ for m in ext_modules:
# FIMXE: Do NOT link the following libraries to each and
# every module (regardless of the language btw.):
- m.libraries = ['csage'] + m.libraries + ['stdc++', 'ntl']
+ m.libraries = ['csage'] + m.libraries + ['stdc++', 'ntl', 'gmp', 'm', 'dl']
m.extra_compile_args += extra_compile_args
m.extra_link_args += extra_link_args
- m.library_dirs += ['%s/lib' % SAGE_LOCAL]
+ m.library_dirs += ['c_lib', '%s/lib' % SAGE_LOCAL]
@@ -507,8 +504,8 @@ class sage_build_ext(build_ext):
#############################################
CYTHON_INCLUDE_DIRS=[
- SAGE_LOCAL + '/lib/python/site-packages/Cython/Includes/',
- SAGE_LOCAL + '/lib/python/site-packages/Cython/Includes/Deprecated/',
+ SAGE_LOCAL + '/lib/python2.7/site-packages/Cython/Includes/',
+ SAGE_LOCAL + '/lib/python2.7/site-packages/Cython/Includes/Deprecated/',
]
# matches any dependency
@@ -534,7 +531,7 @@ class DependencyTree:
self._timestamps = {}
self._deps = {}
self._deps_all = {}
- self.root = "%s/devel/sage/" % SAGE_ROOT
+ self.root = "%s/devel/sage" % SAGE_ROOT
def __getstate__(self):
"""
@@ -555,7 +552,7 @@ class DependencyTree:
self.__dict__.update(state)
self._timestamps = {}
self._deps_all = {}
- self.root = "%s/devel/sage/" % SAGE_ROOT
+ self.root = "%s/devel/sage" % SAGE_ROOT
def timestamp(self, filename):
"""
@@ -642,11 +639,8 @@ class DependencyTree:
# so we really couldn't find the dependency -- raise
# an exception.
if not found_include:
- msg = 'could not find dependency %s included in %s.'%(path, filename)
- if is_cython_file(path):
- raise IOError, msg
- else:
- warnings.warn(msg+' I will assume it is a system C/C++ header.')
+ if path[-2:] != '.h' and path[-4:] != '.hpp' and path[-4:] != '.pxd': # there are implicit headers from distutils, etc
+ raise IOError, "could not find dependency %s included in %s."%(path, filename)
f.close()
return list(deps)
@@ -738,6 +732,10 @@ def compile_command0(p):
outfile += ".c"
cplus = ''
+ # speed up if doing an incremental builds
+ if os.path.exists(outfile) and os.path.getmtime(outfile) > os.path.getmtime(f):
+ return 0
+
if os.environ.get('SAGE_DEBUG', None)=='no':
debug = ''
else:
@@ -750,7 +748,7 @@ def compile_command0(p):
return r
# if cython worked, copy the file to the build directory
- pyx_inst_file = '%s/%s'%(SITE_PACKAGES, f)
+ pyx_inst_file = '%s%s/%s'%(DESTDIR, SITE_PACKAGES, f)
retval = os.system('cp %s %s 2>/dev/null'%(f, pyx_inst_file))
# we could do this more elegantly -- load the files, use
# os.path.exists to check that they exist, etc. ... but the