Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/module_list.py: Implement uname_specific flags using cython_aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 3, 2020
1 parent 860e4dc commit 0bd21a1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
13 changes: 1 addition & 12 deletions src/module_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [

Expand Down Expand Up @@ -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"]),
Expand Down
12 changes: 12 additions & 0 deletions src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 2 additions & 0 deletions src/sage/libs/libecm.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# distutils: libraries = ecm
# distutils: extra_link_args = LINUX_NOEXECSTACK
r"""
The Elliptic Curve Method for Integer Factorization (ECM)
Expand Down

0 comments on commit 0bd21a1

Please sign in to comment.