From 0bd21a1f02ef0a74782f66aba621f40c3eb68467 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 3 Jun 2020 11:08:11 -0700 Subject: [PATCH] src/module_list.py: Implement uname_specific flags using cython_aliases --- src/module_list.py | 13 +------------ src/sage/env.py | 12 ++++++++++++ src/sage/libs/libecm.pyx | 2 ++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/module_list.py b/src/module_list.py index d7b5f459cf0..bea455a3b90 100644 --- a/src/module_list.py +++ b/src/module_list.py @@ -116,14 +116,6 @@ ############################################################# from sage_setup.optional_extension import OptionalExtension -UNAME = os.uname() - -def uname_specific(name, value, alternative): - if name in UNAME[0]: - return value - else: - return alternative - ext_modules = [ @@ -573,10 +565,7 @@ def uname_specific(name, value, alternative): language = 'c++'), Extension('sage.libs.libecm', - sources = ['sage/libs/libecm.pyx'], - libraries = ['ecm'], - extra_link_args = uname_specific("Linux", ["-Wl,-z,noexecstack"], - [])), + sources = ['sage/libs/libecm.pyx']), Extension('sage.libs.lrcalc.lrcalc', sources = ["sage/libs/lrcalc/lrcalc.pyx"]), diff --git a/src/sage/env.py b/src/sage/env.py index 18d86fe6c49..1aba25a1ed1 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -424,6 +424,18 @@ def cython_aliases(): aliases[var + "LIBEXTRA"] = list(filter(lambda s: not s.startswith(('-l','-L')), pkgconfig.libs(lib).split())) aliases[var + "LIBRARIES"] = pc['libraries'] + # uname-specific flags + UNAME = os.uname() + + def uname_specific(name, value, alternative): + if name in UNAME[0]: + return value + else: + return alternative + + aliases["LINUX_NOEXECSTACK"] = uname_specific("Linux", ["-Wl,-z,noexecstack"], + []) + # LinBox needs special care because it actually requires C++11 with # GNU extensions: -std=c++11 does not work, you need -std=gnu++11 # (this is true at least with GCC 7.2.0). diff --git a/src/sage/libs/libecm.pyx b/src/sage/libs/libecm.pyx index 41a788aca3f..1deacb45b39 100644 --- a/src/sage/libs/libecm.pyx +++ b/src/sage/libs/libecm.pyx @@ -1,3 +1,5 @@ +# distutils: libraries = ecm +# distutils: extra_link_args = LINUX_NOEXECSTACK r""" The Elliptic Curve Method for Integer Factorization (ECM)