diff options
-rw-r--r-- | docs/markdown/Porting-from-autotools.md | 6 | ||||
-rw-r--r-- | docs/markdown/Python-module.md | 4 | ||||
-rw-r--r-- | docs/markdown/Quick-guide.md | 2 | ||||
-rw-r--r-- | docs/markdown/Reference-manual.md | 4 | ||||
-rw-r--r-- | docs/markdown/Reference-tables.md | 30 | ||||
-rw-r--r-- | docs/markdown/Running-Meson.md | 257 | ||||
-rw-r--r-- | docs/markdown/howtox.md | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 3 | ||||
-rw-r--r-- | mesonbuild/environment.py | 9 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 4 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 2 | ||||
-rw-r--r-- | mesonbuild/modules/rpm.py | 104 |
12 files changed, 226 insertions, 203 deletions
diff --git a/docs/markdown/Porting-from-autotools.md b/docs/markdown/Porting-from-autotools.md index 5c4c35d..b60ecfe 100644 --- a/docs/markdown/Porting-from-autotools.md +++ b/docs/markdown/Porting-from-autotools.md @@ -450,9 +450,9 @@ AM_CPPFLAGS = \ `meson.build`: ```meson -add_global_arguments('-DG_LOG_DOMAIN="As"', language : 'c') -add_global_arguments('-DAS_COMPILATION', language : 'c') -add_global_arguments('-DLOCALSTATEDIR="/var"', language : 'c') +add_project_arguments('-DG_LOG_DOMAIN="As"', language : 'c') +add_project_arguments('-DAS_COMPILATION', language : 'c') +add_project_arguments('-DLOCALSTATEDIR="/var"', language : 'c') ``` ### Tests diff --git a/docs/markdown/Python-module.md b/docs/markdown/Python-module.md index a50a33d..a963a32 100644 --- a/docs/markdown/Python-module.md +++ b/docs/markdown/Python-module.md @@ -220,7 +220,7 @@ It exposes the same methods as its parent class. [shared_module]: Reference-manual.md#shared_module [external program]: Reference-manual.md#external-program-object [dependency]: Reference-manual.md#dependency -[install_data]: Reference-manual.md#install-data -[configure_file]: Reference-manual.md#configure-file +[install_data]: Reference-manual.md#install_data +[configure_file]: Reference-manual.md#configure_file [dependency object]: Reference-manual.md#dependency-object [buildtarget object]: Reference-manual.md#build-target-object diff --git a/docs/markdown/Quick-guide.md b/docs/markdown/Quick-guide.md index 549dcfc..8c6da69 100644 --- a/docs/markdown/Quick-guide.md +++ b/docs/markdown/Quick-guide.md @@ -82,7 +82,7 @@ build and install Meson projects are the following. ```console $ cd /path/to/source/root -$ CFLAGS=... CXXFLAGS=... LDFLAGS=.. meson --prefix /usr --buildtype=plain builddir +$ meson --prefix /usr --buildtype=plain builddir -Dc_args=... -Dcpp_args=... -Dc_link_args=... -Dcpp_link_args=... $ ninja -v -C builddir $ ninja -C builddir test $ DESTDIR=/path/to/staging/root ninja -C builddir install diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 1e0a11c..3d4379a 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1109,8 +1109,8 @@ This function prints its argument to stdout prefixed with WARNING:. The first argument to this function must be a string defining the name of this project. It is followed by programming languages that the project uses. Supported values for languages are `c`, `cpp` (for -`C++`), `d`, `objc`, `objcpp`, `fortran`, `java`, `cs` (for `C#`) and -`vala`. In versions before `0.40.0` you must have at least one +`C++`), `d`, `objc`, `objcpp`, `fortran`, `java`, `cs` (for `C#`), +`vala` and `rust`. In versions before `0.40.0` you must have at least one language listed. The project name can be any string you want, it's not used for diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index fa913f5..9688bf8 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -99,24 +99,30 @@ future releases. These are the parameter names for passing language specific arguments to your build target. -| Language | Parameter name | -| ----- | ----- | -| C | c_args | -| C++ | cpp_args | -| C# | cs_args | -| D | d_args | -| Fortran | fortran_args | -| Java | java_args | -| Objective C | objc_args | -| Objective C++ | objcpp_args | -| Rust | rust_args | -| Vala | vala_args | +| Language | compiler name | linker name | +| ------------- | ------------- | ----------------- | +| C | c_args | c_link_args | +| C++ | cpp_args | cpp_link_args | +| C# | cs_args | cs_link_args | +| D | d_args | d_link_args | +| Fortran | fortran_args | fortran_link_args | +| Java | java_args | java_link_args | +| Objective C | objc_args | objc_link_args | +| Objective C++ | objcpp_args | objcpp_link_args | +| Rust | rust_args | rust_link_args | +| Vala | vala_args | vala_link_args | ## Compiler and linker flag environment variables These environment variables will be used to modify the compiler and linker flags. +It is recommended that you **do not use these**. They are provided purely to +for backwards compatibility with other build systems. There are many caveats to +their use, especially when rebuilding the project. It is **highly** recommended +that you use [the command line arguments](#language-arguments-parameters-names) +instead. + | Name | Comment | | ----- | ------- | | CFLAGS | Flags for the C compiler | diff --git a/docs/markdown/Running-Meson.md b/docs/markdown/Running-Meson.md index 426e87d..910513c 100644 --- a/docs/markdown/Running-Meson.md +++ b/docs/markdown/Running-Meson.md @@ -4,49 +4,45 @@ short-description: Building a project with Meson # Running Meson -There are two different ways of invoking Meson. First, you can run it -directly from the source tree with the command -`/path/to/source/meson.py`. Meson may also be installed in which case -the command is simply `meson`. In this manual we only use the latter -format for simplicity. +There are two different ways of invoking Meson. First, you can run it directly +from the source tree with the command `/path/to/source/meson.py`. Meson may +also be installed in which case the command is simply `meson`. In this manual +we only use the latter format for simplicity. -Additionally, the invocation can pass options to meson. -The list of options is documented [here](Builtin-options.md). +Additionally, the invocation can pass options to meson. The list of options is +documented [here](Builtin-options.md). -At the time of writing only a command line version of Meson is -available. This means that Meson must be invoked using the -terminal. If you wish to use the MSVC compiler, you need to run Meson -under "Visual Studio command prompt". +At the time of writing only a command line version of Meson is available. This +means that Meson must be invoked using the terminal. If you wish to use the +MSVC compiler, you need to run Meson under "Visual Studio command prompt". -Configuring the source -== +## Configuring the build directory -Let us assume that we have a source tree that has a Meson build -system. This means that at the topmost directory has a file called -`meson.build`. We run the following commands to get the build started. +Let us assume that we have a source tree that has a Meson build system. This +means that at the topmost directory has a file called `meson.build`. We run the +following commands to get the build started. +```sh +cd /path/to/source/root +meson setup builddir +``` - cd /path/to/source/root - mkdir builddir - cd builddir - meson .. +We invoke Meson with the `setup` command, giving it the location of the build +directory. Meson uses [out of source +builds](http://voices.canonical.com/jussi.pakkanen/2013/04/16/why-you-should-consider-using-separate-build-directories/). -First we create a directory to hold all files generated during the -build. Then we go into it and invoke Meson, giving it the location of -the source root. +Hint: The syntax of meson is `meson [command] [arguments] [options]`. The +`setup` command takes a `builddir` and a `srcdir` argument. If no `srcdir` is +given Meson will deduce the `srcdir` based on `pwd` and the location of +`meson.build`. -Hint: The syntax of meson is `meson [options] [srcdir] [builddir]`, -but you may omit either `srcdir` or `builddir`. Meson will deduce the -`srcdir` by the location of `meson.build`. The other one will be your -`pwd`. +Meson then loads the build configuration file and writes the corresponding +build backend in the build directory. By default Meson generates a *debug +build*, which turns on basic warnings and debug information and disables +compiler optimizations. -Meson then loads the build configuration file and writes the -corresponding build backend in the build directory. By default Meson -generates a *debug build*, which turns on basic warnings and debug -information and disables compiler optimizations. - -You can specify a different type of build with the `--buildtype` -command line argument. It can have one of the following values. +You can specify a different type of build with the `--buildtype` command line +argument. It can have one of the following values. | value | meaning | | ------ | -------- | @@ -55,122 +51,123 @@ command line argument. It can have one of the following values. | `debugoptimized` | debug info is generated and the code is optimized (on most compilers this means `-g -O2`) | | `release` | full optimization, no debug info | -The build directory is mandatory. The reason for this is that it -simplifies the build process immensely. Meson will not under any -circumstances write files inside the source directory (if it does, it -is a bug and should be fixed). This means that the user does not need -to add a bunch of files to their revision control's ignore list. It -also means that you can create arbitrarily many build directories for -any given source tree. If we wanted to test building the source code -with the Clang compiler instead of the system default, we could just -type the following commands. - - cd /path/to/source/root - mkdir buildclang - cd buildclang - CC=clang CXX=clang++ meson .. - -This separation is even more powerful if your code has multiple -configuration options (such as multiple data backends). You can create -a separate subdirectory for each of them. You can also have build -directories for optimized builds, code coverage, static analysis and -so on. They are all neatly separated and use the same source -tree. Changing between different configurations is just a question of -changing to the corresponding directory. - -Unless otherwise mentioned, all following command line invocations are -meant to be run in the build directory. - -By default Meson will use the Ninja backend to build your project. If -you wish to use any of the other backends, you need to pass the -corresponding argument during configuration time. As an example, here -is how you would use Meson to generate a Visual studio solution. - - meson <source dir> <build dir> --backend=vs2010 - -You can then open the generated solution with Visual Studio and -compile it in the usual way. A list of backends can be obtained with -`meson --help`. - -Environment Variables --- - -Sometimes you want to add extra compiler flags, this can be done by -passing them in environment variables when calling meson. See [the -reference -tables](Reference-tables.md#compiler-and-linker-flag-envrionment-variables) -for a list of all the environment variables. Be aware however these -environment variables are only used for the native compiler and will -not affect the compiler used for cross-compiling, where the flags -specified in the cross file will be used. - -Furthermore it is possible to stop meson from adding flags itself by -using the `--buildtype=plain` option, in this case you must provide -the full compiler and linker arguments needed. - -Building the source -== +The build directory is mandatory. The reason for this is that it simplifies the +build process immensely. Meson will not under any circumstances write files +inside the source directory (if it does, it is a bug and should be fixed). This +means that the user does not need to add a bunch of files to their revision +control's ignore list. It also means that you can create arbitrarily many build +directories for any given source tree. + +For example, if we wanted to test building the source code with the Clang +compiler instead of the system default, we could just type the following +commands: + +```sh +cd /path/to/source/root +CC=clang CXX=clang++ meson setup buildclang +``` + +This separation is even more powerful if your code has multiple configuration +options (such as multiple data backends). You can create a separate +subdirectory for each of them. You can also have build directories for +optimized builds, code coverage, static analysis and so on. They are all neatly +separated and use the same source tree. Changing between different +configurations is just a question of changing to the corresponding directory. + +Unless otherwise mentioned, all following command line invocations are meant to +be run in the source directory. + +By default Meson will use the Ninja backend to build your project. If you wish +to use any of the other backends, you need to pass the corresponding argument +during configuration time. As an example, here is how you would use Meson to +generate a Visual studio solution. + +```sh +meson setup <build dir> --backend=vs2010 +``` + +You can then open the generated solution with Visual Studio and compile it in +the usual way. A list of backends can be obtained with `meson setup --help`. + +## Environment variables + +Sometimes you want to add extra compiler flags, this can be done by passing +them in environment variables when calling meson. See [the reference +tables](Reference-tables.md#compiler-and-linker-flag-envrionment-variables) for +a list of all the environment variables. Be aware however these environment +variables are only used for the native compiler and will not affect the +compiler used for cross-compiling, where the flags specified in the cross file +will be used. + +Furthermore it is possible to stop meson from adding flags itself by using the +`--buildtype=plain` option, in this case you must provide the full compiler and +linker arguments needed. + +## Building from the source If you are not using an IDE, Meson uses the [Ninja build -system](https://ninja-build.org/) to actually build the code. To start -the build, simply type the following command. +system](https://ninja-build.org/) to actually build the code. To start the +build, simply type the following command. - ninja +```sh +ninja -C builddir +``` -The main usability difference between Ninja and Make is that Ninja -will automatically detect the number of CPUs in your computer and -parallelize itself accordingly. You can override the amount of -parallel processes used with the command line argument `-j <num -processes>`. +The main usability difference between Ninja and Make is that Ninja will +automatically detect the number of CPUs in your computer and parallelize itself +accordingly. You can override the amount of parallel processes used with the +command line argument `-j <num processes>`. -It should be noted that after the initial configure step `ninja` is -the only command you ever need to type to compile. No matter how you -alter your source tree (short of moving it to a completely new -location), Meson will detect the changes and regenerate itself -accordingly. This is especially handy if you have multiple build -directories. Often one of them is used for development (the "debug" -build) and others only every now and then (such as a "static analysis" -build). Any configuration can be built just by `cd`'ing to the -corresponding directory and running Ninja. +It should be noted that after the initial configure step `ninja` is the only +command you ever need to type to compile. No matter how you alter your source +tree (short of moving it to a completely new location), Meson will detect the +changes and regenerate itself accordingly. This is especially handy if you have +multiple build directories. Often one of them is used for development (the +"debug" build) and others only every now and then (such as a "static analysis" +build). Any configuration can be built just by `cd`'ing to the corresponding +directory and running Ninja. -Running tests -== +## Running tests -Meson provides native support for running tests. The command to do -that is simple. +Meson provides native support for running tests. The command to do that is +simple. - ninja test +```sh +ninja -C builddir test +``` -Meson does not force the use of any particular testing framework. You -are free to use GTest, Boost Test, Check or even custom executables. +Meson does not force the use of any particular testing framework. You are free +to use GTest, Boost Test, Check or even custom executables. -Installing -== +## Installing Installing the built software is just as simple. - ninja install +```sh +ninja -C builddir install +``` Note that Meson will only install build targets explicitly tagged as -installable, as detailed in the [installing targets documentation](Installing.md). +installable, as detailed in the [installing targets +documentation](Installing.md). -By default Meson installs to `/usr/local`. This can be changed by -passing the command line argument `--prefix /your/prefix` to Meson -during configure time. Meson also supports the `DESTDIR` variable used -in e.g. building packages. It is used like this: +By default Meson installs to `/usr/local`. This can be changed by passing the +command line argument `--prefix /your/prefix` to Meson during configure time. +Meson also supports the `DESTDIR` variable used in e.g. building packages. It +is used like this: - DESTDIR=/path/to/staging ninja install +```sh +DESTDIR=/path/to/staging ninja -C builddir install +``` -Command line help -== +## Command line help -Meson has a standard command line help feature. It can be accessed -with the following command. +Meson has a standard command line help feature. It can be accessed with the +following command. meson --help -Exit status -== +## Exit status -Meson exits with status 0 if successful, 1 for problems with the command line or -meson.build file, and 2 for internal errors. +Meson exits with status 0 if successful, 1 for problems with the command line +or meson.build file, and 2 for internal errors. diff --git a/docs/markdown/howtox.md b/docs/markdown/howtox.md index adcec7c..3d8515f 100644 --- a/docs/markdown/howtox.md +++ b/docs/markdown/howtox.md @@ -52,7 +52,9 @@ executable(..., dependencies : thread_dep) ## Set extra compiler and linker flags from the outside (when e.g. building distro packages) -The behavior is the same as with other build systems, with environment variables during first invocation. +The behavior is the same as with other build systems, with environment +variables during first invocation. Do not use these when you need to rebuild +the source ```console $ CFLAGS=-fsomething LDFLAGS=-Wl,--linker-flag meson <options> diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 6350eee..f7864c0 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -1659,6 +1659,9 @@ class CcrxCCompiler(CcrxCompiler, CCompiler): def get_linker_output_args(self, outputname): return ['-output=%s' % outputname] + def get_werror_args(self): + return ['-change_message=error'] + def get_include_args(self, path, is_system): if path == '': path = '.' diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index e99174c..26d3f15 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -220,6 +220,8 @@ def detect_cpu_family(compilers): trial = 'arm' elif trial.startswith('ppc64'): trial = 'ppc64' + elif trial == 'macppc': + trial = 'ppc' elif trial == 'powerpc': trial = 'ppc' # FreeBSD calls both ppc and ppc64 "powerpc". @@ -246,6 +248,10 @@ def detect_cpu_family(compilers): trial = 'arm' # Add more quirks here as bugs are reported. Keep in sync with detect_cpu() # below. + elif trial == 'parisc64': + # ATM there is no 64 bit userland for PA-RISC. Thus always + # report it as 32 bit for simplicity. + trial = 'parisc' if trial not in known_cpu_families: mlog.warning('Unknown CPU family {!r}, please report this at ' @@ -1019,7 +1025,8 @@ class Environment: return comp, cross_comp def detect_static_linker(self, compiler): - linker = self.binaries.host.lookup_entry('ar') + for_machine = MachineChoice.HOST if compiler.is_cross else MachineChoice.BUILD + linker = self.binaries[for_machine].lookup_entry('ar') if linker is not None: linkers = [linker] else: diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 9ebce70..2a9d96e 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1032,7 +1032,7 @@ class CompilerHolder(InterpreterObject): typename = args[0] prefix = kwargs.get('prefix', '') if not isinstance(prefix, str): - raise InterpreterException('Prefix argument of sizeof must be a string.') + raise InterpreterException('Prefix argument of alignment must be a string.') extra_args = mesonlib.stringlistify(kwargs.get('args', [])) deps, msg = self.determine_dependencies(kwargs) result = self.compiler.alignment(typename, prefix, self.environment, @@ -2713,8 +2713,6 @@ external dependencies (including libraries) must go to "dependencies".''') mlog.log('Cross', cross_comp.get_display_language(), 'compiler:', mlog.bold(' '.join(cross_comp.get_exelist())), version_string) self.build.add_cross_compiler(cross_comp) - if self.environment.is_cross_build() and not need_cross_compiler: - self.build.add_cross_compiler(comp) self.add_base_options(comp) return success diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 233136e..829a05f 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -212,7 +212,7 @@ class BuildoptionsInterperter(astinterpreter.AstInterpreter): return flattend_args def add_languages(self, args): - need_cross_compiler = self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler() + need_cross_compiler = self.environment.is_cross_build() for lang in sorted(args, key=compilers.sort_clink): lang = lang.lower() if lang not in self.coredata.compilers: diff --git a/mesonbuild/modules/rpm.py b/mesonbuild/modules/rpm.py index ba5bcaa..9774286 100644 --- a/mesonbuild/modules/rpm.py +++ b/mesonbuild/modules/rpm.py @@ -29,39 +29,16 @@ import os class RPMModule(ExtensionModule): @noKwargs - def generate_spec_template(self, state, args, kwargs): - compiler_deps = set() - for compiler in state.compilers.values(): - # Elbrus has one 'lcc' package for every compiler - if isinstance(compiler, compilers.GnuCCompiler): - compiler_deps.add('gcc') - elif isinstance(compiler, compilers.GnuCPPCompiler): - compiler_deps.add('gcc-c++') - elif isinstance(compiler, compilers.ElbrusCCompiler): - compiler_deps.add('lcc') - elif isinstance(compiler, compilers.ElbrusCPPCompiler): - compiler_deps.add('lcc') - elif isinstance(compiler, compilers.ElbrusFortranCompiler): - compiler_deps.add('lcc') - elif isinstance(compiler, compilers.ValaCompiler): - compiler_deps.add('vala') - elif isinstance(compiler, compilers.GnuFortranCompiler): - compiler_deps.add('gcc-gfortran') - elif isinstance(compiler, compilers.GnuObjCCompiler): - compiler_deps.add('gcc-objc') - elif compiler == compilers.GnuObjCPPCompiler: - compiler_deps.add('gcc-objc++') - else: - mlog.log('RPM spec file will not created, generating not allowed for:', - mlog.bold(compiler.get_id())) - return - proj = state.project_name.replace(' ', '_').replace('\t', '_') + def generate_spec_template(self, coredata, args, kwargs): + self.coredata = coredata + required_compilers = self.__get_required_compilers() + proj = coredata.project_name.replace(' ', '_').replace('\t', '_') so_installed = False devel_subpkg = False files = set() files_devel = set() to_delete = set() - for target in state.targets.values(): + for target in coredata.targets.values(): if isinstance(target, build.Executable) and target.need_install: files.add('%%{_bindir}/%s' % target.get_filename()) elif isinstance(target, build.SharedLibrary) and target.need_install: @@ -80,18 +57,19 @@ class RPMModule(ExtensionModule): files_devel.add('%%{_datadir}/gir-1.0/%s' % target.get_filename()[0]) elif isinstance(target, TypelibTarget) and target.should_install(): files.add('%%{_libdir}/girepository-1.0/%s' % target.get_filename()[0]) - for header in state.headers: + for header in coredata.headers: if len(header.get_install_subdir()) > 0: files_devel.add('%%{_includedir}/%s/' % header.get_install_subdir()) else: for hdr_src in header.get_sources(): files_devel.add('%%{_includedir}/%s' % hdr_src) - for man in state.man: + for man in coredata.man: for man_file in man.get_sources(): files.add('%%{_mandir}/man%u/%s.*' % (int(man_file.split('.')[-1]), man_file)) if len(files_devel) > 0: devel_subpkg = True - filename = os.path.join(state.environment.get_build_dir(), + + filename = os.path.join(coredata.environment.get_build_dir(), '%s.spec' % proj) with open(filename, 'w+') as fn: fn.write('Name: %s\n' % proj) @@ -102,24 +80,28 @@ class RPMModule(ExtensionModule): fn.write('\n') fn.write('Source0: %{name}-%{version}.tar.xz # FIXME\n') fn.write('\n') - for compiler in compiler_deps: + fn.write('BuildRequires: meson\n') + for compiler in required_compilers: fn.write('BuildRequires: %s\n' % compiler) - for dep in state.environment.coredata.deps: + for dep in coredata.environment.coredata.deps: fn.write('BuildRequires: pkgconfig(%s)\n' % dep[0]) - for lib in state.environment.coredata.ext_libs.values(): - name = lib.get_name() - fn.write('BuildRequires: {} # FIXME\n'.format(name)) - mlog.warning('replace', mlog.bold(name), 'with the real package.', - 'You can use following command to find package which ' - 'contains this lib:', - mlog.bold("dnf provides '*/lib{}.so'".format(name))) - for prog in state.environment.coredata.ext_progs.values(): - if not prog.found(): - fn.write('BuildRequires: %%{_bindir}/%s # FIXME\n' % - prog.get_name()) - else: - fn.write('BuildRequires: {}\n'.format(prog.get_path())) - fn.write('BuildRequires: meson\n') +# ext_libs and ext_progs have been removed from coredata so the following code +# no longer works. It is kept as a reminder of the idea should anyone wish +# to re-implement it. +# +# for lib in state.environment.coredata.ext_libs.values(): +# name = lib.get_name() +# fn.write('BuildRequires: {} # FIXME\n'.format(name)) +# mlog.warning('replace', mlog.bold(name), 'with the real package.', +# 'You can use following command to find package which ' +# 'contains this lib:', +# mlog.bold("dnf provides '*/lib{}.so'".format(name))) +# for prog in state.environment.coredata.ext_progs.values(): +# if not prog.found(): +# fn.write('BuildRequires: %%{_bindir}/%s # FIXME\n' % +# prog.get_name()) +# else: +# fn.write('BuildRequires: {}\n'.format(prog.get_path())) fn.write('\n') fn.write('%description\n') fn.write('\n') @@ -167,5 +149,33 @@ class RPMModule(ExtensionModule): mlog.log('RPM spec template written to %s.spec.\n' % proj) return ModuleReturnValue(None, []) + def __get_required_compilers(self): + required_compilers = set() + for compiler in self.coredata.compilers.values(): + # Elbrus has one 'lcc' package for every compiler + if isinstance(compiler, compilers.GnuCCompiler): + required_compilers.add('gcc') + elif isinstance(compiler, compilers.GnuCPPCompiler): + required_compilers.add('gcc-c++') + elif isinstance(compiler, compilers.ElbrusCCompiler): + required_compilers.add('lcc') + elif isinstance(compiler, compilers.ElbrusCPPCompiler): + required_compilers.add('lcc') + elif isinstance(compiler, compilers.ElbrusFortranCompiler): + required_compilers.add('lcc') + elif isinstance(compiler, compilers.ValaCompiler): + required_compilers.add('vala') + elif isinstance(compiler, compilers.GnuFortranCompiler): + required_compilers.add('gcc-gfortran') + elif isinstance(compiler, compilers.GnuObjCCompiler): + required_compilers.add('gcc-objc') + elif compiler == compilers.GnuObjCPPCompiler: + required_compilers.add('gcc-objc++') + else: + mlog.log('RPM spec file not created, generation not allowed for:', + mlog.bold(compiler.get_id())) + return required_compilers + + def initialize(*args, **kwargs): return RPMModule(*args, **kwargs) |