Skip to content

Commit 1eac0d7

Browse files
cosminbascatimfel
authored andcommitted
ginstall: add patch for meson 1.0.0
- add support for flang-new
1 parent c8c6b29 commit 1eac0d7

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ def lightfm(**kwargs):
452452
requests(**kwargs)
453453
install_from_pypi("lightfm==1.15", **kwargs)
454454

455+
@pip_package()
456+
def meson(**kwargs):
457+
install_from_pypi("meson==1.0.0", **kwargs)
458+
455459
@pip_package()
456460
def pytz(**kwargs):
457461
install_from_pypi("pytz==2022.2.1", **kwargs)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
2+
index 367bcf9..3c5faa3 100644
3+
--- a/mesonbuild/compilers/detect.py
4+
+++ b/mesonbuild/compilers/detect.py
5+
@@ -56,7 +56,7 @@ if is_windows():
6+
defaults['c'] = ['icl', 'cl', 'cc', 'gcc', 'clang', 'clang-cl', 'pgcc']
7+
# There is currently no pgc++ for Windows, only for Mac and Linux.
8+
defaults['cpp'] = ['icl', 'cl', 'c++', 'g++', 'clang++', 'clang-cl']
9+
- defaults['fortran'] = ['ifort', 'gfortran', 'flang', 'pgfortran', 'g95']
10+
+ defaults['fortran'] = ['ifort', 'gfortran', 'flang-new', 'flang', 'pgfortran', 'g95']
11+
# Clang and clang++ are valid, but currently unsupported.
12+
defaults['objc'] = ['cc', 'gcc']
13+
defaults['objcpp'] = ['c++', 'g++']
14+
@@ -72,7 +72,7 @@ else:
15+
defaults['cpp'] = ['c++', 'g++', 'clang++', 'nvc++', 'pgc++', 'icpc', 'icpx']
16+
defaults['objc'] = ['cc', 'gcc', 'clang']
17+
defaults['objcpp'] = ['c++', 'g++', 'clang++']
18+
- defaults['fortran'] = ['gfortran', 'flang', 'nvfortran', 'pgfortran', 'ifort', 'ifx', 'g95']
19+
+ defaults['fortran'] = ['gfortran', 'flang-new', 'flang', 'nvfortran', 'pgfortran', 'ifort', 'ifx', 'g95']
20+
defaults['cs'] = ['mcs', 'csc']
21+
defaults['d'] = ['ldc2', 'ldc', 'gdc', 'dmd']
22+
defaults['java'] = ['javac']
23+
@@ -743,6 +743,14 @@ def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> C
24+
compiler, version, for_machine, is_cross, info, exe_wrap,
25+
full_version=full_version, linker=linker)
26+
27+
+ if 'flang-new' in out:
28+
+ cls = fortran.FlangNewFortranCompiler
29+
+ linker = guess_nix_linker(env,
30+
+ compiler, cls, version, for_machine)
31+
+ return cls(
32+
+ compiler, version, for_machine, is_cross, info,
33+
+ exe_wrap, full_version=full_version, linker=linker)
34+
+
35+
if 'flang' in out or 'clang' in out:
36+
cls = fortran.FlangFortranCompiler
37+
linker = guess_nix_linker(env,
38+
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
39+
index 90ca010..1b01913 100644
40+
--- a/mesonbuild/compilers/fortran.py
41+
+++ b/mesonbuild/compilers/fortran.py
42+
@@ -544,3 +544,50 @@ class NAGFortranCompiler(FortranCompiler):
43+
44+
def openmp_flags(self) -> T.List[str]:
45+
return ['-openmp']
46+
+
47+
+
48+
+class FlangNewFortranCompiler(ClangCompiler, FortranCompiler):
49+
+
50+
+ id = 'flang-new'
51+
+
52+
+ def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
53+
+ info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None,
54+
+ linker: T.Optional['DynamicLinker'] = None,
55+
+ full_version: T.Optional[str] = None):
56+
+ FortranCompiler.__init__(self, exelist, version, for_machine,
57+
+ is_cross, info, exe_wrapper, linker=linker,
58+
+ full_version=full_version)
59+
+ ClangCompiler.__init__(self, {})
60+
+ default_warn_args = ['-Wall']
61+
+ self.warn_args = {'0': [],
62+
+ '1': default_warn_args,
63+
+ '2': default_warn_args + ['-Wextra'],
64+
+ '3': default_warn_args + ['-Wextra', '-pedantic', '-fimplicit-none'],
65+
+ 'everything': default_warn_args + ['-Wextra', '-pedantic', '-fimplicit-none']}
66+
+
67+
+ def get_option_compile_args(self, options: 'KeyedOptionDictType') -> T.List[str]:
68+
+ args = []
69+
+ key = OptionKey('std', machine=self.for_machine, lang=self.language)
70+
+ std = options[key]
71+
+ if std.value != 'none':
72+
+ args.append('-std=' + std.value)
73+
+ return args
74+
+
75+
+ def get_module_outdir_args(self, path: str) -> T.List[str]:
76+
+ return ['-module-dir', path]
77+
+
78+
+ def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
79+
+ # Disabled until this is fixed:
80+
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62162
81+
+ # return ['-cpp', '-MD', '-MQ', outtarget]
82+
+ return []
83+
+
84+
+ def language_stdlib_only_link_flags(self, env: 'Environment') -> T.List[str]:
85+
+ # We need to apply the search prefix here, as these link arguments may
86+
+ # be passed to a different compiler with a different set of default
87+
+ # search paths, such as when using Clang for C/C++ and gfortran for
88+
+ # fortran,
89+
+ search_dirs: T.List[str] = []
90+
+ for d in self.get_compiler_dirs(env, 'libraries'):
91+
+ search_dirs.append(f'-L{d}')
92+
+ return search_dirs + ['-lm']

0 commit comments

Comments
 (0)