meme: Fix compilation with arm and nvhpc compilers (#24883)

* Fix compilation with `arm` and `nvhpc` compilers

* Update package.py
This commit is contained in:
Ricardo Jesus 2021-10-05 10:55:12 +01:00 committed by GitHub
parent 7f2fd50d20
commit 4ee74c01e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,36 @@
--- a/src/mtwist.h 2021-07-14 12:18:25.848290454 +0000
+++ b/src/mtwist.h 2021-07-14 12:37:35.581368981 +0000
@@ -285,6 +285,7 @@
prototypes using the ifdef.
*/
#ifndef __APPLE__
+#ifndef __ARM_LINUX_COMPILER__
extern uint32_t mts_lrand(mt_state* state);
/* Generate 32-bit value, any gen. */
#ifdef UINT64_MAX
@@ -310,6 +311,7 @@
/* Generate floating value */
/* Slower, with 64-bit precision */
#endif
+#endif
/*
* Tempering parameters. These are perhaps the most magic of all the magic
@@ -381,10 +383,14 @@
#ifdef __cplusplus
#define MT_EXTERN /* C++ doesn't need static */
#else /* __cplusplus */
-#ifndef __APPLE__
-#define MT_EXTERN extern /* C (at least gcc) needs extern */
-#else
+#ifdef __APPLE__
#define MT_EXTERN static /* The apple compiler freaks out if the definitions are not static */
+#else /* __APPLE__ */
+#ifdef __ARM_LINUX_COMPILER__
+#define MT_EXTERN static /* The Arm compiler complains if the definitions are not static */
+#else /* __ARM_LINUX_COMPILER__ */
+#define MT_EXTERN extern /* C (at least gcc) needs extern */
+#endif /* __ARM_LINUX_COMPILER__ */
#endif /* __APPLE__ */
#endif /* __cplusplus */
#endif /* MT_EXTERN */

View File

@ -31,6 +31,10 @@ class Meme(AutotoolsPackage):
depends_on('mpi', when='+mpi')
depends_on('imagemagick', type=('build', 'run'), when='+image-magick')
depends_on('perl-xml-parser', type=('build', 'run'))
depends_on('libxml2', type=('build', 'run'))
depends_on('libxslt', type=('build', 'run'))
patch('arm.patch', when='%arm')
def url_for_version(self, version):
url = 'http://meme-suite.org/meme-software/{0}/meme{1}{2}.tar.gz'
@ -39,8 +43,13 @@ def url_for_version(self, version):
def configure_args(self):
spec = self.spec
# have meme build its own versions of libxml2/libxslt, see #6736
args = ['--enable-build-libxml2', '--enable-build-libxslt']
args = []
if '~mpi' in spec:
args += ['--enable-serial']
return args
def patch(self):
# Remove flags not recognized by the NVIDIA compiler
if self.spec.satisfies('%nvhpc'):
filter_file('-fno-common', '', 'configure')
filter_file('-Wno-unused', '', 'configure')