diff --git a/.gitignore b/.gitignore index 090d3a1..51be512 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/meson-0.49.2.tar.gz +SOURCES/meson-0.55.3.tar.gz diff --git a/.meson.metadata b/.meson.metadata index d23a5a4..f31018c 100644 --- a/.meson.metadata +++ b/.meson.metadata @@ -1 +1 @@ -33953ef212e533a93004306924d85f1698dfb814 SOURCES/meson-0.49.2.tar.gz +6a6ca4d36eb8cdf954beff08c653fc72cf336527 SOURCES/meson-0.55.3.tar.gz diff --git a/SOURCES/0001_use_PIE_objects_for_static_libraries.patch b/SOURCES/0001_use_PIE_objects_for_static_libraries.patch new file mode 100644 index 0000000..5cff687 --- /dev/null +++ b/SOURCES/0001_use_PIE_objects_for_static_libraries.patch @@ -0,0 +1,92 @@ +From a57d1aaafe47dadaa5fad8b73ec9e2e31bb5f123 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Thu, 8 Oct 2020 15:30:24 +0200 +Subject: [PATCH] build: use PIE objects for static libraries if + b_staticpic=false but b_pie=true + +If static_library is used as a convenience library (e.g. for link_whole) +it should in principle not need position independent code. +However, if the executables that the libraries is linked to are PIE, +the non-PIC objects in the static library will cause linker errors. +To avoid this, obey b_pie for static libraries if either b_staticpic=false +or they use "pic: false". + +Without this patch, QEMU cannot use b_staticpic, which causes a slowdown +on some QEMU benchmarks up to 20%. + +(cherry picked from commit 021d242f9ce8e6cd804af0c1eb4179b8c83fd470) +Signed-off-by: Danilo C. L. de Paula +--- + mesonbuild/backend/backends.py | 2 +- + mesonbuild/build.py | 18 +++++++++++------- + 2 files changed, 12 insertions(+), 8 deletions(-) + +diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py +index c84bb7534..f67efe370 100644 +--- a/mesonbuild/backend/backends.py ++++ b/mesonbuild/backend/backends.py +@@ -694,7 +694,7 @@ class Backend: + # Set -fPIC for static libraries by default unless explicitly disabled + if isinstance(target, build.StaticLibrary) and target.pic: + commands += compiler.get_pic_args() +- if isinstance(target, build.Executable) and target.pie: ++ elif isinstance(target, (build.StaticLibrary, build.Executable)) and target.pie: + commands += compiler.get_pie_args() + # Add compile args needed to find external dependencies. Link args are + # added while generating the link command. +diff --git a/mesonbuild/build.py b/mesonbuild/build.py +index a06979cea..90cbd1aa6 100644 +--- a/mesonbuild/build.py ++++ b/mesonbuild/build.py +@@ -972,13 +972,13 @@ This will become a hard error in a future Meson release.''') + if m.is_darwin() or m.is_windows(): + self.pic = True + else: +- self.pic = self._extract_pic_pie(kwargs, 'pic') +- if isinstance(self, Executable): ++ self.pic = self._extract_pic_pie(kwargs, 'pic', environment, 'b_staticpic') ++ if isinstance(self, Executable) or (isinstance(self, StaticLibrary) and not self.pic): + # Executables must be PIE on Android + if self.environment.machines[self.for_machine].is_android(): + self.pie = True + else: +- self.pie = self._extract_pic_pie(kwargs, 'pie') ++ self.pie = self._extract_pic_pie(kwargs, 'pie', environment, 'b_pie') + self.implicit_include_directories = kwargs.get('implicit_include_directories', True) + if not isinstance(self.implicit_include_directories, bool): + raise InvalidArguments('Implicit_include_directories must be a boolean.') +@@ -990,14 +990,20 @@ This will become a hard error in a future Meson release.''') + if self.gnu_symbol_visibility not in permitted: + raise InvalidArguments('GNU symbol visibility arg {} not one of: {}'.format(self.symbol_visibility, ', '.join(permitted))) + +- def _extract_pic_pie(self, kwargs, arg): ++ def _extract_pic_pie(self, kwargs, arg, environment, option): + # Check if we have -fPIC, -fpic, -fPIE, or -fpie in cflags + all_flags = self.extra_args['c'] + self.extra_args['cpp'] + if '-f' + arg.lower() in all_flags or '-f' + arg.upper() in all_flags: + mlog.warning("Use the '{}' kwarg instead of passing '{}' manually to {!r}".format(arg, '-f' + arg, self.name)) + return True + +- val = kwargs.get(arg, False) ++ if arg in kwargs: ++ val = kwargs[arg] ++ elif option in environment.coredata.base_options: ++ val = environment.coredata.base_options[option].value ++ else: ++ val = False ++ + if not isinstance(val, bool): + raise InvalidArguments('Argument {} to {!r} must be boolean'.format(arg, self.name)) + return val +@@ -1611,8 +1617,6 @@ class StaticLibrary(BuildTarget): + + def __init__(self, name, subdir, subproject, for_machine: MachineChoice, sources, objects, environment, kwargs): + self.typename = 'static library' +- if 'pic' not in kwargs and 'b_staticpic' in environment.coredata.base_options: +- kwargs['pic'] = environment.coredata.base_options['b_staticpic'].value + super().__init__(name, subdir, subproject, for_machine, sources, objects, environment, kwargs) + if 'cs' in self.compilers: + raise InvalidArguments('Static libraries not supported for C#.') +-- +2.27.0 + diff --git a/SPECS/meson.spec b/SPECS/meson.spec index 10d9e7a..b611322 100644 --- a/SPECS/meson.spec +++ b/SPECS/meson.spec @@ -1,23 +1,31 @@ %global libname mesonbuild +# Don’t run the tests by default, since they are rather flaky. +# I’ll get to getting them running eventually, but free time is sparse. +# — ekulik %bcond_with check Name: meson -Version: 0.49.2 -Release: 1%{?dist} +Version: 0.55.3 +Release: 3%{?dist} Summary: High productivity build system License: ASL 2.0 -URL: http://mesonbuild.com/ -Source0: https://github.com/mesonbuild/meson/archive/%{version}/%{name}-%{version}.tar.gz +URL: https://mesonbuild.com/ +Source: https://github.com/mesonbuild/meson/releases/download/%{version}/%{name}-%{version}.tar.gz BuildArch: noarch -Obsoletes: %{name}-gui < 0.31.0-3 -BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python3-devel +BuildRequires: python3-setuptools +Requires: python%{python3_version}dist(setuptools) +Requires: ninja-build +Requires: python3-devel + %if %{with check} BuildRequires: ninja-build +# Some tests expect the unversioned executable +BuildRequires: /usr/bin/python # Various languages BuildRequires: gcc BuildRequires: libasan @@ -26,25 +34,22 @@ BuildRequires: gcc-gfortran BuildRequires: gcc-objc BuildRequires: gcc-objc++ BuildRequires: java-devel +BuildRequires: libomp-devel BuildRequires: mono-core mono-devel BuildRequires: rust -# No ldc as of RHEL7 and on non-ldc arches -%if ! 0%{?rhel} || 0%{?rhel} > 7 # Since the build is noarch, we can't use %%ifarch #%%ifarch %%{ldc_arches} #BuildRequires: ldc #%%endif -%endif # Various libs support BuildRequires: boost-devel BuildRequires: gtest-devel BuildRequires: gmock-devel BuildRequires: qt5-qtbase-devel +BuildRequires: qt5-qtbase-private-devel +BuildRequires: qt5-linguist BuildRequires: vala -# In recent versions it's merged into vala -%if (0%{?fedora} && 0%{?fedora} <= 24) || (0%{?rhel} && 0%{?rhel} <= 7) -BuildRequires: vala-tools -%endif +BuildRequires: python3-gobject-base BuildRequires: wxGTK3-devel BuildRequires: flex BuildRequires: bison @@ -56,21 +61,18 @@ BuildRequires: pkgconfig(protobuf) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(glib-sharp-2.0) BuildRequires: pkgconfig(gobject-introspection-1.0) -%if ! 0%{?rhel} || 0%{?rhel} > 7 -BuildRequires: python3-gobject-base -%endif BuildRequires: gtk-doc BuildRequires: itstool BuildRequires: pkgconfig(zlib) -BuildRequires: python%{python3_pkgversion}-Cython +BuildRequires: python3dist(cython) BuildRequires: pkgconfig(sdl2) BuildRequires: %{_bindir}/pcap-config BuildRequires: pkgconfig(vulkan) BuildRequires: llvm-devel BuildRequires: cups-devel %endif -Requires: ninja-build -Requires: python3-devel + +patch0001: 0001_use_PIE_objects_for_static_libraries.patch %description Meson is a build system designed to optimize programmer @@ -80,21 +82,24 @@ unit tests, coverage reports, Valgrind, CCache and the like. %prep %autosetup -p1 -find -type f -name '*.py' -executable -exec sed -i -e '1s|.*|#!%{__python3}|' {} ';' -# Remove MPI tests for now because it is complicated to run -rm -rf "test cases/frameworks/17 mpi" +# Macro should not change when we are redefining bindir +sed -i -e "/^%%__meson /s| .*$| %{_bindir}/%{name}|" data/macros.%{name} %build %py3_build %install %py3_install -install -Dpm0644 data/macros.%{name} %{buildroot}%{rpmmacrodir}/macros.%{name} +install -Dpm0644 -t %{buildroot}%{rpmmacrodir} data/macros.%{name} %if %{with check} %check +# Remove Boost tests for now, because it requires Python 2 +rm -rf "test cases/frameworks/1 boost" +# Remove MPI tests for now because it is complicated to run +rm -rf "test cases/frameworks/17 mpi" export MESON_PRINT_TEST_OUTPUT=1 -%{__python3} ./run_tests.py %{?rhel:|| :} +%{__python3} ./run_tests.py %endif %files @@ -110,6 +115,19 @@ export MESON_PRINT_TEST_OUTPUT=1 %changelog +* Tue Dec 15 2020 Danilo C. L. de Paula - 0.55.3-3 +- build: use PIE objects for static libraries + Resolves: rhbz#1899620 + (meson builds QEMU with PIC objects instead of PIE) + +* Thu Oct 15 2020 Danilo C. L. de Paula - 0.55.3-2 +- Add python3-devel dependency, as asked by the BZ.. +- Resolves: rhbz#1872692 + +* Thu Oct 08 2020 Danilo de Paula - 0.55.3-1 +- Update to 0.55.3, based on upstream Fedora +- Resolves: rhbz#1872692 + * Mon Feb 04 2019 Stephen Gallagher - 0.49.2-1 - Update to 0.49.2 - Drop upstreamed patch