Skip to content

Commit a2de302

Browse files
author
Release Manager
committed
sagemathgh-38993: Meson: find more dependencies via pkg-config <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Use pkg-config to find more dependencies, and add version constraints (mostly) as specified in the `spkg-configure` scripts. Now only the packages without pkg-config info use `find_library` (refs sagemath#39064) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies - sagemath#37447 for the updated conda lock files <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#38993 Reported by: Tobias Diez Reviewer(s): Antonio Rojas, Dima Pasechnik
2 parents a796b44 + 41280d7 commit a2de302

File tree

2 files changed

+37
-20
lines changed

2 files changed

+37
-20
lines changed

src/meson.build

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ print(cypari2.__file__.replace('__init__.py', ''))
5656
check: true,
5757
).stdout().strip()
5858
cypari2 = declare_dependency(include_directories: inc_cypari2)
59+
# Cannot be found via pkg-config
5960
pari = cc.find_library('pari')
6061

61-
mpfr = cc.find_library('mpfr')
62+
mpfr = dependency('mpfr')
6263

6364
flint = dependency('flint', version: '>=3.0.0')
6465
if flint.version().version_compare('<3.1')
@@ -78,35 +79,47 @@ endif
7879
# that too to make the fallback detection with CMake work
7980
blas_order += ['cblas', 'openblas', 'OpenBLAS', 'flexiblas', 'blis', 'blas']
8081
blas = dependency(blas_order)
81-
gsl = dependency('gsl', version: '>=2.5', required: true)
82-
gd = cc.find_library('gd')
82+
gsl = dependency('gsl', version: '>=2.5')
83+
gd = dependency('gdlib', required: false, version: '>=2.1')
84+
if not gd.found()
85+
gd = cc.find_library('gd', required: true)
86+
endif
8387
# Only some platforms have a standalone math library (https://mesonbuild.com/howtox.html#add-math-library-lm-portably)
8488
m = cc.find_library('m', required: false)
85-
m4ri = cc.find_library('m4ri')
86-
m4rie = cc.find_library('m4rie')
87-
mtx = cc.find_library('mtx', required: false, disabler: true)
88-
png = cc.find_library('png', required: false)
89-
if not png.found()
90-
png = cc.find_library('png16')
89+
m4ri = dependency('m4ri', version: '>=20140914')
90+
m4rie = dependency('m4rie', required: false)
91+
if not m4rie.found()
92+
# For some reason, m4rie is not found via pkg-config on some systems (eg Conda)
93+
m4rie = cc.find_library('m4rie')
9194
endif
92-
zlib = cc.find_library('z')
9395
# Cannot be found via pkg-config
94-
ec = cc.find_library('ec')
96+
mtx = cc.find_library('mtx', required: false, disabler: true)
97+
png = dependency(['libpng', 'png', 'png16'], version: '>=1.2')
98+
zlib = dependency('zlib', version: '>=1.2.11')
99+
# We actually want >= 20231212, but the version number is not updated in the pkgconfig
100+
# https://github.com/conda-forge/eclib-feedstock/issues/48
101+
ec = dependency('eclib', version: '>=20231211')
102+
# Cannot be found via pkg-config
95103
ecm = cc.find_library('ecm')
104+
# Cannot be found via pkg-config
96105
ppl = cc.find_library('ppl')
97-
gmpxx = cc.find_library('gmpxx')
98-
fflas = dependency('fflas-ffpack')
106+
gmpxx = dependency('gmpxx')
107+
fflas = dependency('fflas-ffpack', version: '>=2.5.0')
99108
fplll = dependency('fplll')
100-
givaro = cc.find_library('givaro')
101-
linbox = dependency('linbox', required: false)
109+
givaro = dependency('givaro', version: '>=4.2.0')
110+
linbox = dependency('linbox', required: false, version: '>=1.7.0')
102111
if not linbox.found()
103112
linbox = cc.find_library('linbox')
104113
endif
105114
mpc = cc.find_library('mpc')
106115
mpfi = cc.find_library('mpfi')
107-
# Cannot be found via pkg-config (pkg-config file will be added in 4.13)
108-
# Test for common.h header that was added in 4.12 as a indirect version check
109-
gap = cc.find_library('gap', has_headers: ['gap/common.h'])
116+
117+
gap = dependency('libgap', version: '>=4.13.0', required: false)
118+
if not gap.found()
119+
# Fallback in case pkg-config info is not available
120+
# Test for common.h header that was added in 4.12 as a indirect version check
121+
gap = cc.find_library('gap', has_headers: ['gap/common.h'])
122+
endif
110123
singular = dependency('Singular')
111124
maxima = find_program('maxima', required: true)
112125
# Cannot be found via pkg-config

src/sage/libs/meson.build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
sirocco = cc.find_library('sirocco', required: false, disabler: true)
22
# cannot be found via pkg-config
33
ecl = cc.find_library('ecl')
4-
braiding = cc.find_library('braiding')
5-
gc = cc.find_library('gc')
4+
braiding = dependency('libbraiding', required: false)
5+
if not braiding.found()
6+
# Fallback since pkg-config support was only added in v1.3.1
7+
braiding = cc.find_library('braiding')
8+
endif
9+
gc = dependency(['bdw-gc-threaded', 'bdw-gc'], version: '>=7.6.4')
610
homfly = cc.find_library('homfly', has_headers: ['homfly.h'])
711

812
py.install_sources(

0 commit comments

Comments
 (0)