From d46537921ef7f3fdb9bd3ade5071b70276110bdd Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 29 Sep 2023 00:47:14 +1100 Subject: [PATCH] override use_linker_args --- recipe/meta.yaml | 4 +-- ...erride-FlangCompiler.use_linker_args.patch | 26 +++++++++++++++++++ .../0004-use-msvc-syntax-for-flang.patch | 24 ----------------- 3 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 recipe/patches/0004-override-FlangCompiler.use_linker_args.patch delete mode 100644 recipe/patches/0004-use-msvc-syntax-for-flang.patch diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 80e2db7..56945f6 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -12,10 +12,10 @@ source: - patches/0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch - patches/0002-minimal-adaptations-for-llvm-flang.patch - patches/0003-mark-gnu-like-lld-as-not-supporting-rsp.patch - - patches/0004-use-msvc-syntax-for-flang.patch + - patches/0004-override-FlangCompiler.use_linker_args.patch build: - number: 4 + number: 5 script: {{ PYTHON }} -m pip install . -vv noarch: python entry_points: diff --git a/recipe/patches/0004-override-FlangCompiler.use_linker_args.patch b/recipe/patches/0004-override-FlangCompiler.use_linker_args.patch new file mode 100644 index 0000000..5430790 --- /dev/null +++ b/recipe/patches/0004-override-FlangCompiler.use_linker_args.patch @@ -0,0 +1,26 @@ +From ad1cdd319ed939c6af41607e3ee6647f7d45a119 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Fri, 29 Sep 2023 00:45:58 +1100 +Subject: [PATCH 4/4] override FlangCompiler.use_linker_args + +--- + mesonbuild/compilers/fortran.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py +index 9915f6912..d4884f51b 100644 +--- a/mesonbuild/compilers/fortran.py ++++ b/mesonbuild/compilers/fortran.py +@@ -471,6 +471,12 @@ class FlangFortranCompiler(ClangCompiler, FortranCompiler): + def get_module_outdir_args(self, path: str) -> T.List[str]: + return ['-module-dir', path] + ++ @classmethod ++ def use_linker_args(cls, linker: str, version: str) -> T.List[str]: ++ # ensure we don't fall through to ClangCompiler.use_linker_args ++ # --> GnuLikeCompiler.use_linker_args, which doesn't support lld-link ++ return [f'-fuse-ld={linker}'] ++ + def language_stdlib_only_link_flags(self, env: 'Environment') -> T.List[str]: + # We need to apply the search prefix here, as these link arguments may + # be passed to a different compiler with a different set of default diff --git a/recipe/patches/0004-use-msvc-syntax-for-flang.patch b/recipe/patches/0004-use-msvc-syntax-for-flang.patch deleted file mode 100644 index 4d5db22..0000000 --- a/recipe/patches/0004-use-msvc-syntax-for-flang.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 3790454592aef67c625bc8e3aaa1b4b8c8d2c188 Mon Sep 17 00:00:00 2001 -From: "H. Vetinari" -Date: Thu, 28 Sep 2023 22:50:24 +1100 -Subject: [PATCH 4/4] use msvc syntax for flang - ---- - mesonbuild/compilers/fortran.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py -index 9915f6912..de1fb9de0 100644 ---- a/mesonbuild/compilers/fortran.py -+++ b/mesonbuild/compilers/fortran.py -@@ -471,6 +471,10 @@ class FlangFortranCompiler(ClangCompiler, FortranCompiler): - def get_module_outdir_args(self, path: str) -> T.List[str]: - return ['-module-dir', path] - -+ # try using flang (based on clang-cl) with msvc syntax -+ def get_argument_syntax(self) -> str: -+ return 'msvc' -+ - def language_stdlib_only_link_flags(self, env: 'Environment') -> T.List[str]: - # We need to apply the search prefix here, as these link arguments may - # be passed to a different compiler with a different set of default