sagemath/sagemath-scons.patch
2015-04-03 20:10:52 -03:00

38 lines
2 KiB
Diff

diff -up src/c_lib/SConstruct.orig src/c_lib/SConstruct
--- src/c_lib/SConstruct.orig 2015-04-03 14:44:19.695348682 -0300
+++ src/c_lib/SConstruct 2015-04-03 14:44:30.359349090 -0300
@@ -126,8 +126,8 @@ env['PYV']=platform.python_version().rsp
# The SCons convenience function Split is the only strange thing
# to python programmers. It just makes a list by splitting on
# whitespace without the syntax clutter of lists of strings.
-includes = ['$SAGE_LOCAL/include/', '$SAGE_LOCAL/include/python$PYV/',
- '$SAGE_LOCAL/include/NTL/', 'include']
+includes = ['@@includedir@@', '@@includedir@@/python$PYV/',
+ '@@includedir@@/NTL/', 'include']
cFiles = Split( "convert.c interrupt.c memory.c mpn_pylong.c mpz_pylong.c") + \
Split( "mpz_longlong.c stdsage.c" )
cppFiles = Split( "ZZ_pylong.cpp ntl_wrap.cpp" )
@@ -136,9 +136,22 @@ incFiles = Split( "ccobject.h convert.h
Split( "interrupt.h memory.h mpn_pylong.h mpz_longlong.h" ) + \
Split( "mpz_pylong.h ntl_wrap.h parisage.h stdsage.h ZZ_pylong.h" )
+env.Append(CFLAGS='@@optflags@@')
+env.Append(CXXFLAGS='@@optflags@@')
+env.Append(LINKFLAGS='@@__global_ldflags@@')
+
+libname = "libcsage"
+major = "0"
+shlib_suffix = '.so.' + major
+shlink_flags = [ '@@__global_ldflags@@', '-shared', '-fPIC' ]
+soname = libname + shlib_suffix
+shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ]
+
lib = env.SharedLibrary( "csage", [ "src/" + x for x in srcFiles ],
LIBS=['ntl', 'pari', 'gmp', 'python$PYV'],
- LIBPATH=['$SAGE_LOCAL/lib','$SAGE_LOCAL/lib/python$PYV/config/'],
+ LIBPATH=['@@libdir@@','@@libdir@@/python$PYV/config/'],
+ SHLIBSUFFIX=shlib_suffix,
+ SHLINKFLAGS=shlink_flags,
CPPPATH=includes )
env.Install("$SAGE_LOCAL/lib", lib)
env.Install("$SAGE_LOCAL/include/csage", [ os.path.join('include',x) for x in incFiles ])