1 |
commit: 491b50cf718ca492e2d3329545b6709783264a5e |
2 |
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 22 01:10:11 2021 +0000 |
4 |
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 22 01:10:11 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=491b50cf |
7 |
|
8 |
sci-mathematics/flint: new revision to fix x86 gmp detection. |
9 |
|
10 |
The FindGMP routine in upstream's CMake is using voodoo to determine |
11 |
the version of gmp that's installed. The sorcery succeeds quite |
12 |
accidentally on amd64, but fails on x86. We patch their cmake |
13 |
to do something more reliable. |
14 |
|
15 |
Bug: https://bugs.gentoo.org/771663 |
16 |
Package-Manager: Portage-3.0.17, Repoman-3.0.2 |
17 |
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org> |
18 |
|
19 |
.../files/flint-2.7.1-fix-cmake-findgmp.patch | 152 +++++++++++++++++++++ |
20 |
.../{flint-2.7.1.ebuild => flint-2.7.1-r1.ebuild} | 2 + |
21 |
2 files changed, 154 insertions(+) |
22 |
|
23 |
diff --git a/sci-mathematics/flint/files/flint-2.7.1-fix-cmake-findgmp.patch b/sci-mathematics/flint/files/flint-2.7.1-fix-cmake-findgmp.patch |
24 |
new file mode 100644 |
25 |
index 00000000000..d94d65c08d7 |
26 |
--- /dev/null |
27 |
+++ b/sci-mathematics/flint/files/flint-2.7.1-fix-cmake-findgmp.patch |
28 |
@@ -0,0 +1,152 @@ |
29 |
+From 9f1ef23f34a7ceca1063606cfc749e4d32bef81c Mon Sep 17 00:00:00 2001 |
30 |
+From: Michael Orlitzky <michael@××××××××.com> |
31 |
+Date: Mon, 19 Apr 2021 16:56:54 -0400 |
32 |
+Subject: [PATCH 1/1] CMake/FindGMP.cmake: compile a test program to check the |
33 |
+ gmp version. |
34 |
+ |
35 |
+The existing GMP version check consists of grepping the contents of |
36 |
+the gmp.h header to parse out a few constants. This test fails, at |
37 |
+least, on Gentoo, where the usual header file is a wrapper that |
38 |
+includes the true header (to allow for simultaneous 32/64-bit |
39 |
+support). |
40 |
+ |
41 |
+This commit updates the FindGMP check to compile a test program |
42 |
+against gmp.h that compares the version bounds within C, and reports |
43 |
+success or failure as the return value from main(). |
44 |
+--- |
45 |
+ CMake/FindGMP.cmake | 97 +++++++++++++++++++++++++-------------------- |
46 |
+ 1 file changed, 53 insertions(+), 44 deletions(-) |
47 |
+ |
48 |
+diff --git a/CMake/FindGMP.cmake b/CMake/FindGMP.cmake |
49 |
+index ce4df70f5..bd2871ca3 100644 |
50 |
+--- a/CMake/FindGMP.cmake |
51 |
++++ b/CMake/FindGMP.cmake |
52 |
+@@ -2,28 +2,23 @@ |
53 |
+ # https://gmplib.org/ |
54 |
+ # |
55 |
+ # This module supports requiring a minimum version, e.g. you can do |
56 |
+-# find_package(GMP 6.0.0) |
57 |
+-# to require version 6.0.0 to newer of GMP. |
58 |
++# find_package(GMP 6.2.1) |
59 |
++# to require version 6.2.1 to newer of GMP. |
60 |
+ # |
61 |
+ # Once done this will define |
62 |
+ # |
63 |
+ # GMP_FOUND - system has GMP lib with correct version |
64 |
+ # GMP_INCLUDE_DIRS - the GMP include directory |
65 |
+ # GMP_LIBRARIES - the GMP library |
66 |
+-# GMP_VERSION - GMP version |
67 |
+ # |
68 |
+-# Copyright (c) 2016 Jack Poulson, <jack.poulson@×××××.com> |
69 |
+-# Redistribution and use is allowed according to the terms of the BSD license. |
70 |
+ |
71 |
+-find_path(GMP_INCLUDE_DIRS NAMES gmp.h PATHS $ENV{GMPDIR} ${INCLUDE_INSTALL_DIR}) |
72 |
+- |
73 |
+-# Set GMP_FIND_VERSION to 5.1.0 if no minimum version is specified |
74 |
++# Set GMP_FIND_VERSION to 6.0.0 if no minimum version is specified |
75 |
+ if(NOT GMP_FIND_VERSION) |
76 |
+ if(NOT GMP_FIND_VERSION_MAJOR) |
77 |
+- set(GMP_FIND_VERSION_MAJOR 5) |
78 |
++ set(GMP_FIND_VERSION_MAJOR 6) |
79 |
+ endif() |
80 |
+ if(NOT GMP_FIND_VERSION_MINOR) |
81 |
+- set(GMP_FIND_VERSION_MINOR 1) |
82 |
++ set(GMP_FIND_VERSION_MINOR 0) |
83 |
+ endif() |
84 |
+ if(NOT GMP_FIND_VERSION_PATCH) |
85 |
+ set(GMP_FIND_VERSION_PATCH 0) |
86 |
+@@ -32,43 +27,57 @@ if(NOT GMP_FIND_VERSION) |
87 |
+ "${GMP_FIND_VERSION_MAJOR}.${GMP_FIND_VERSION_MINOR}.${GMP_FIND_VERSION_PATCH}") |
88 |
+ endif() |
89 |
+ |
90 |
+-if(GMP_INCLUDE_DIRS) |
91 |
+- # Since the GMP version macros may be in a file included by gmp.h of the form |
92 |
+- # gmp-.*[_]?.*.h (e.g., gmp-x86_64.h), we search each of them. |
93 |
+- file(GLOB GMP_HEADERS "${GMP_INCLUDE_DIRS}/gmp.h" "${GMP_INCLUDE_DIRS}/gmp-*.h" |
94 |
+- "${GMP_INCLUDE_DIRS}/x86*/gmp.h") |
95 |
+- foreach(gmp_header_filename ${GMP_HEADERS}) |
96 |
+- file(READ "${gmp_header_filename}" _gmp_version_header) |
97 |
+- string(REGEX MATCH |
98 |
+- "define[ \t]+__GNU_MP_VERSION[ \t]+([0-9]+)" _gmp_major_version_match |
99 |
+- "${_gmp_version_header}") |
100 |
+- if(_gmp_major_version_match) |
101 |
+- set(GMP_MAJOR_VERSION "${CMAKE_MATCH_1}") |
102 |
+- string(REGEX MATCH "define[ \t]+__GNU_MP_VERSION_MINOR[ \t]+([0-9]+)" |
103 |
+- _gmp_minor_version_match "${_gmp_version_header}") |
104 |
+- set(GMP_MINOR_VERSION "${CMAKE_MATCH_1}") |
105 |
+- string(REGEX MATCH "define[ \t]+__GNU_MP_VERSION_PATCHLEVEL[ \t]+([0-9]+)" |
106 |
+- _gmp_patchlevel_version_match "${_gmp_version_header}") |
107 |
+- set(GMP_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}") |
108 |
+- set(GMP_VERSION |
109 |
+- ${GMP_MAJOR_VERSION}.${GMP_MINOR_VERSION}.${GMP_PATCHLEVEL_VERSION}) |
110 |
+- endif() |
111 |
+- endforeach() |
112 |
++find_path(GMP_INCLUDE_DIRS |
113 |
++ NAMES gmp.h |
114 |
++ PATHS $ENV{GMPDIR} ${INCLUDE_INSTALL_DIR}) |
115 |
+ |
116 |
+- # Check whether found version exists and exceeds the minimum requirement |
117 |
+- if(NOT GMP_VERSION) |
118 |
+- set(GMP_VERSION_OK FALSE) |
119 |
+- message(STATUS "GMP version was not detected") |
120 |
+- elseif(${GMP_VERSION} VERSION_LESS ${GMP_FIND_VERSION}) |
121 |
+- set(GMP_VERSION_OK FALSE) |
122 |
+- message(STATUS "GMP version ${GMP_VERSION} found in ${GMP_INCLUDE_DIRS}, " |
123 |
+- "but at least version ${GMP_FIND_VERSION} is required") |
124 |
+- else() |
125 |
+- set(GMP_VERSION_OK TRUE) |
126 |
+- endif() |
127 |
++find_library(GMP_LIBRARIES |
128 |
++ gmp |
129 |
++ PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR}) |
130 |
++ |
131 |
++if(GMP_INCLUDE_DIRS AND GMP_LIBRARIES) |
132 |
++ |
133 |
++ # Return "1" if the version is OK, or "0" otherwise. This is |
134 |
++ # opposite the usual C program conventions, but makes the purpose of |
135 |
++ # the result variable semantically clear. We create an integer using |
136 |
++ # a few basic GMP functions to ensure that we can actually link against |
137 |
++ # the GMP library. |
138 |
++ file(WRITE ${PROJECT_BINARY_DIR}/gmp-version-check.c "" |
139 |
++ "#include <gmp.h>\n" |
140 |
++ "\n" |
141 |
++ "int main(int argc, char **argv) {\n" |
142 |
++ " mpz_t x;\n" |
143 |
++ " mpz_init_set_str(x, \"7612058254738945\", 10);\n" |
144 |
++ " mpz_clear(x);\n" |
145 |
++ " if (__GNU_MP_VERSION < ${GMP_FIND_VERSION_MAJOR}) {\n" |
146 |
++ " return 0;\n" |
147 |
++ " }\n" |
148 |
++ " else {\n" |
149 |
++ " if (__GNU_MP_VERSION_MINOR < ${GMP_FIND_VERSION_MINOR}) {\n" |
150 |
++ " return 0;\n" |
151 |
++ " }\n" |
152 |
++ " else {\n" |
153 |
++ " if (__GNU_MP_VERSION_PATCHLEVEL < ${GMP_FIND_VERSION_PATCH}) {\n" |
154 |
++ " return 0;\n" |
155 |
++ " }\n" |
156 |
++ " }\n" |
157 |
++ " }\n" |
158 |
++ " return 1;\n" |
159 |
++ "}\n") |
160 |
++ |
161 |
++ # Try to run the test program above with the appropriate version |
162 |
++ # strings substituted in. |
163 |
++ try_run(GMP_VERSION_OK |
164 |
++ GMP_VERSION_COMPILE_OK |
165 |
++ "${PROJECT_BINARY_DIR}" |
166 |
++ "${PROJECT_BINARY_DIR}/gmp-version-check.c" |
167 |
++ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${GMP_INCLUDE_DIRS}" |
168 |
++ LINK_LIBRARIES "${GMP_LIBRARIES}") |
169 |
+ endif() |
170 |
+ |
171 |
+-find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR}) |
172 |
++if(NOT GMP_VERSION_OK) |
173 |
++ message(STATUS "No sufficient GMP version detected") |
174 |
++endif() |
175 |
+ |
176 |
+ include(FindPackageHandleStandardArgs) |
177 |
+ find_package_handle_standard_args(GMP DEFAULT_MSG |
178 |
+-- |
179 |
+2.26.3 |
180 |
+ |
181 |
|
182 |
diff --git a/sci-mathematics/flint/flint-2.7.1.ebuild b/sci-mathematics/flint/flint-2.7.1-r1.ebuild |
183 |
similarity index 95% |
184 |
rename from sci-mathematics/flint/flint-2.7.1.ebuild |
185 |
rename to sci-mathematics/flint/flint-2.7.1-r1.ebuild |
186 |
index 92eb4e95a2c..912adc940b1 100644 |
187 |
--- a/sci-mathematics/flint/flint-2.7.1.ebuild |
188 |
+++ b/sci-mathematics/flint/flint-2.7.1-r1.ebuild |
189 |
@@ -36,6 +36,8 @@ DEPEND="dev-libs/gmp:= |
190 |
virtual/cblas" |
191 |
RDEPEND="${DEPEND}" |
192 |
|
193 |
+PATCHES=( "${FILESDIR}/${P}-fix-cmake-findgmp.patch" ) |
194 |
+ |
195 |
src_configure() { |
196 |
local mycmakeargs=( |
197 |
-DWITH_NTL="$(usex ntl)" |