From 8d8925c725491cf028ef6c1b93e431dcb200f439 Mon Sep 17 00:00:00 2001
From: Kai Torben Ohlhus <k.ohlhus@gmail.com>
Date: Tue, 25 Feb 2020 18:36:54 +0900
Subject: [PATCH] qrupdate: ILP64 support (#15104)

- When compiling qrupdate with `FFLAGS=-fdefault-integer-8` it can be perfectly used for larger problem dimensions.
- Improved the readability of the file with the added rules.
---
 .../builtin/packages/qrupdate/package.py      | 26 ++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/var/spack/repos/builtin/packages/qrupdate/package.py b/var/spack/repos/builtin/packages/qrupdate/package.py
index 185bd1f421..3f21501711 100644
--- a/var/spack/repos/builtin/packages/qrupdate/package.py
+++ b/var/spack/repos/builtin/packages/qrupdate/package.py
@@ -29,17 +29,31 @@ def edit(self, spec, prefix):
         return
 
     def install(self, spec, prefix):
+
         lapack_blas = spec['lapack'].libs + spec['blas'].libs
-        # Build static and dynamic libraries
-        make('lib', 'solib',
-             'BLAS={0}'.format(lapack_blas.ld_flags),
-             'LAPACK={0}'.format(lapack_blas.ld_flags))
-        # "INSTALL" confuses "make install" on case-insensitive filesystems
+
+        make_args = [
+            'BLAS={0}'.format(lapack_blas.ld_flags),
+            'LAPACK={0}'.format(lapack_blas.ld_flags)
+        ]
+
+        # If 64-bit BLAS is used:
+        if (spec.satisfies('^openblas+ilp64') or
+            spec.satisfies('^intel-mkl+ilp64') or
+            spec.satisfies('^intel-parallel-studio+mkl+ilp64')):
+            make_args.append('FFLAGS=-fdefault-integer-8')
+
+        # Build static and dynamic libraries:
+        make('lib', 'solib', *make_args)
+
+        # "INSTALL" confuses "make install" on case-insensitive filesystems:
         if os.path.isfile("INSTALL"):
             os.remove("INSTALL")
-        # create lib folder:
+
+        # Create lib folder:
         if (sys.platform == 'darwin'):
             mkdirp(prefix.lib)
+
         make("install", "PREFIX=%s" % prefix)
 
     @run_after('install')
-- 
GitLab