From 37cd007c746c282d809b1a8eb005df7f7c6c2aeb Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Apr 16 2019 05:07:56 +0000 Subject: Backport patch to revert ld binary method change (#1699099) --- diff --git a/0002-Fix-5046.patch b/0002-Fix-5046.patch new file mode 100644 index 0000000..4578b24 --- /dev/null +++ b/0002-Fix-5046.patch @@ -0,0 +1,43 @@ +From d4257000014ade5d8dc2e7baf281ceababf11a36 Mon Sep 17 00:00:00 2001 +From: Ninja-Koala +Date: Sun, 17 Mar 2019 15:31:14 +0100 +Subject: [PATCH 1/2] Fix #5046 + +--- + mesonbuild/modules/gnome.py | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py +index 4473bcbf..8833a214 100644 +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -189,9 +189,13 @@ class GnomeModule(ExtensionModule): + gresource_ld_binary = True + + gresource = kwargs.pop('gresource_bundle', False) +- if gresource or gresource_ld_binary: ++ ++ if gresource: + g_output = args[0] + '.gresource' + g_name = args[0] + '_gresource' ++ elif gresource_ld_binary: ++ g_output = args[0] + '_ld_binary.gresource' ++ g_name = args[0] + '_ld_binary_gresource' + + output = args[0] + '.c' + name = args[0] + '_c' +@@ -240,10 +244,7 @@ class GnomeModule(ExtensionModule): + if gresource or gresource_ld_binary: + target_g = GResourceTarget(g_name, state.subdir, state.subproject, g_kwargs) + if gresource: # Only one target for .gresource files +- if target_g.get_id() not in self.interpreter.build.targets: +- return ModuleReturnValue(target_g, [target_g]) +- else: +- return ModuleReturnValue(target_g, []) ++ return ModuleReturnValue(target_g, [target_g]) + + target_c = GResourceTarget(name, state.subdir, state.subproject, kwargs) + +-- +2.21.0 + diff --git a/0003-Revert-gnome.compile_resources-Add-ld-binary-method.patch b/0003-Revert-gnome.compile_resources-Add-ld-binary-method.patch new file mode 100644 index 0000000..ee1723d --- /dev/null +++ b/0003-Revert-gnome.compile_resources-Add-ld-binary-method.patch @@ -0,0 +1,252 @@ +From 4ccd9782386b646b99007c1472ab28a61b52bb5d Mon Sep 17 00:00:00 2001 +From: Jussi Pakkanen +Date: Mon, 25 Mar 2019 20:33:55 +0200 +Subject: [PATCH 2/2] Revert "gnome.compile_resources: Add ld binary method" + +This reverts commit 59791fc56966901038aaaac23942bc8ac6e11494, reversing +changes made to e26b5a119e0b3f76cc93f65ecf4251dc6d52ecfe. +--- + mesonbuild/modules/__init__.py | 4 - + mesonbuild/modules/gnome.py | 158 +++------------------------------ + 2 files changed, 14 insertions(+), 148 deletions(-) + +diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py +index 2df4d7c3..6b6aa8ba 100644 +--- a/mesonbuild/modules/__init__.py ++++ b/mesonbuild/modules/__init__.py +@@ -58,10 +58,6 @@ class GResourceHeaderTarget(build.CustomTarget): + def __init__(self, name, subdir, subproject, kwargs): + super().__init__(name, subdir, subproject, kwargs) + +-class GResourceObjectTarget(build.CustomTarget): +- def __init__(self, name, subdir, subproject, kwargs): +- super().__init__(name, subdir, subproject, kwargs) +- + class GirTarget(build.CustomTarget): + def __init__(self, name, subdir, subproject, kwargs): + super().__init__(name, subdir, subproject, kwargs) +diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py +index 8833a214..2d169560 100644 +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -16,8 +16,6 @@ + functionality such as gobject-introspection, gresources and gtk-doc''' + + import os +-import re +-import sys + import copy + import shlex + import subprocess +@@ -27,7 +25,7 @@ from .. import mlog + from .. import mesonlib + from .. import compilers + from .. import interpreter +-from . import GResourceTarget, GResourceHeaderTarget, GResourceObjectTarget, GirTarget, TypelibTarget, VapiTarget ++from . import GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, VapiTarget + from . import get_include_args + from . import ExtensionModule + from . import ModuleReturnValue +@@ -44,8 +42,6 @@ from ..interpreterbase import noKwargs, permittedKwargs, FeatureNew, FeatureNewK + # https://bugzilla.gnome.org/show_bug.cgi?id=774368 + gresource_dep_needed_version = '>= 2.51.1' + +-gresource_ld_binary_needed_version = '>= 2.60' +- + native_glib_version = None + girwarning_printed = False + gdbuswarning_printed = False +@@ -170,10 +166,7 @@ class GnomeModule(ExtensionModule): + cmd += ['--sourcedir', source_dir] + + if 'c_name' in kwargs: +- c_name = kwargs.pop('c_name') +- cmd += ['--c-name', c_name] +- else: +- c_name = None ++ cmd += ['--c-name', kwargs.pop('c_name')] + export = kwargs.pop('export', False) + if not export: + cmd += ['--internal'] +@@ -182,23 +175,13 @@ class GnomeModule(ExtensionModule): + + cmd += mesonlib.stringlistify(kwargs.pop('extra_args', [])) + +- gresource_ld_binary = False +- if mesonlib.is_linux() and mesonlib.version_compare(glib_version, gresource_ld_binary_needed_version) and not state.environment.is_cross_build(): +- ld_obj = self.interpreter.find_program_impl('ld', required=False) +- if ld_obj.found(): +- gresource_ld_binary = True +- + gresource = kwargs.pop('gresource_bundle', False) +- + if gresource: +- g_output = args[0] + '.gresource' +- g_name = args[0] + '_gresource' +- elif gresource_ld_binary: +- g_output = args[0] + '_ld_binary.gresource' +- g_name = args[0] + '_ld_binary_gresource' +- +- output = args[0] + '.c' +- name = args[0] + '_c' ++ output = args[0] + '.gresource' ++ name = args[0] + '_gresource' ++ else: ++ output = args[0] + '.c' ++ name = args[0] + '_c' + + if kwargs.get('install', False) and not gresource: + raise MesonException('The install kwarg only applies to gresource bundles, see install_header') +@@ -212,42 +195,19 @@ class GnomeModule(ExtensionModule): + kwargs['input'] = args[1] + kwargs['output'] = output + kwargs['depends'] = depends +- if gresource or gresource_ld_binary: +- g_kwargs = copy.deepcopy(kwargs) +- g_kwargs['input'] = args[1] +- g_kwargs['output'] = g_output +- g_kwargs['depends'] = depends + if not mesonlib.version_compare(glib_version, gresource_dep_needed_version): + # This will eventually go out of sync if dependencies are added + kwargs['depend_files'] = depend_files +- if gresource_ld_binary: +- kwargs['command'] = copy.copy(cmd) + ['--external-data'] +- else: +- kwargs['command'] = cmd +- if gresource or gresource_ld_binary: +- # This will eventually go out of sync if dependencies are added +- g_kwargs['depend_files'] = depend_files +- g_kwargs['command'] = cmd ++ kwargs['command'] = cmd + else: + depfile = kwargs['output'] + '.d' +- if gresource_ld_binary: +- depfile2 = kwargs['output'] + '.2.d' +- kwargs['depfile'] = depfile2 +- kwargs['command'] = copy.copy(cmd) + ['--external-data', '--dependency-file', '@DEPFILE@'] +- else: +- kwargs['depfile'] = depfile +- kwargs['command'] = copy.copy(cmd) + ['--dependency-file', '@DEPFILE@'] +- if gresource or gresource_ld_binary: +- g_kwargs['depfile'] = depfile +- g_kwargs['command'] = copy.copy(cmd) + ['--dependency-file', '@DEPFILE@'] +- +- if gresource or gresource_ld_binary: +- target_g = GResourceTarget(g_name, state.subdir, state.subproject, g_kwargs) +- if gresource: # Only one target for .gresource files +- return ModuleReturnValue(target_g, [target_g]) +- ++ kwargs['depfile'] = depfile ++ kwargs['command'] = copy.copy(cmd) + ['--dependency-file', '@DEPFILE@'] + target_c = GResourceTarget(name, state.subdir, state.subproject, kwargs) + ++ if gresource: # Only one target for .gresource files ++ return ModuleReturnValue(target_c, [target_c]) ++ + h_kwargs = { + 'command': cmd, + 'input': args[1], +@@ -262,99 +222,9 @@ class GnomeModule(ExtensionModule): + h_kwargs['install_dir'] = kwargs.get('install_dir', + state.environment.coredata.get_builtin_option('includedir')) + target_h = GResourceHeaderTarget(args[0] + '_h', state.subdir, state.subproject, h_kwargs) +- +- if gresource_ld_binary: +- return self._create_gresource_ld_binary_targets(args, state, ifile, ld_obj, c_name, target_g, g_output, target_c, target_h) +- else: +- rv = [target_c, target_h] +- ++ rv = [target_c, target_h] + return ModuleReturnValue(rv, rv) + +- def _create_gresource_ld_binary_targets(self, args, state, ifile, ld_obj, c_name, target_g, g_output, target_c, target_h): +- if c_name is None: +- # Create proper c identifier from filename in the way glib-compile-resources does +- c_name = os.path.basename(ifile).partition('.')[0] +- c_name = c_name.replace('-', '_') +- c_name = re.sub(r'^([^(_a-zA-Z)])+', '', c_name) +- c_name = re.sub(r'([^(_a-zA-Z0-9)])', '', c_name) +- +- c_name_no_underscores = re.sub(r'^_+', '', c_name) +- +- ld = ld_obj.get_command() +- objcopy_object = self.interpreter.find_program_impl('objcopy', required=False) +- if objcopy_object.found(): +- objcopy = objcopy_object.get_command() +- else: +- objcopy = None +- +- o_kwargs = { +- 'command': [ld, '-r', '-b', 'binary', '@INPUT@', '-o', '@OUTPUT@'], +- 'input': target_g, +- 'output': args[0] + '1.o' +- } +- +- target_o = GResourceObjectTarget(args[0] + '1_o', state.subdir, state.subproject, o_kwargs) +- +- builddir = os.path.join(state.environment.get_build_dir(), state.subdir) +- linkerscript_name = args[0] + '_map.ld' +- linkerscript_path = os.path.join(builddir, linkerscript_name) +- linkerscript_file = open(linkerscript_path, 'w') +- +- # Create symbol name the way bfd does +- binary_name = os.path.join(state.subdir, g_output) +- encoding = sys.getfilesystemencoding() +- symbol_name = re.sub(rb'([^(_a-zA-Z0-9)])', b'_', binary_name.encode(encoding)).decode(encoding) +- +- linkerscript_string = '''SECTIONS +-{{ +- .gresource.{} : ALIGN(8) +- {{ +- {}_resource_data = _binary_{}_start; +- }} +- .data : +- {{ +- *(.data) +- }} +-}}'''.format(c_name_no_underscores, c_name, symbol_name) +- +- linkerscript_file.write(linkerscript_string) +- +- o2_kwargs = { +- 'command': [ld, '-r', '-T', os.path.join(state.subdir, linkerscript_name), '@INPUT@', '-o', '@OUTPUT@'], +- 'input': target_o, +- 'output': args[0] + '2.o', +- } +- target_o2 = GResourceObjectTarget(args[0] + '2_o', state.subdir, state.subproject, o2_kwargs) +- +- if objcopy is not None: +- objcopy_cmd = [objcopy, '--set-section-flags', '.gresource.' + c_name + '=readonly,alloc,load,data'] +- objcopy_cmd += ['-N', '_binary_' + symbol_name + '_start'] +- objcopy_cmd += ['-N', '_binary_' + symbol_name + '_end'] +- objcopy_cmd += ['-N', '_binary_' + symbol_name + '_size'] +- objcopy_cmd += ['@INPUT@', '@OUTPUT@'] +- +- o3_kwargs = { +- 'command': objcopy_cmd, +- 'input': target_o2, +- 'output': args[0] + '3.o' +- } +- +- target_o3 = GResourceObjectTarget(args[0] + '3_o', state.subdir, state.subproject, o3_kwargs) +- +- rv1 = [target_c, target_h, target_o3] +- if target_g.get_id() not in self.interpreter.build.targets: +- rv2 = rv1 + [target_g, target_o, target_o2] +- else: +- rv2 = rv1 + [target_o, target_o2] +- else: +- rv1 = [target_c, target_h, target_o2] +- if target_g.get_id() not in self.interpreter.build.targets: +- rv2 = rv1 + [target_g, target_o] +- else: +- rv2 = rv1 + [target_o] +- +- return ModuleReturnValue(rv1, rv2) +- + def _get_gresource_dependencies(self, state, input_file, source_dirs, dependencies): + + cmd = ['glib-compile-resources', +-- +2.21.0 + diff --git a/meson.spec b/meson.spec index f3cac5c..69ad929 100644 --- a/meson.spec +++ b/meson.spec @@ -2,7 +2,7 @@ Name: meson Version: 0.50.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: High productivity build system License: ASL 2.0 @@ -10,6 +10,15 @@ URL: http://mesonbuild.com/ Source: https://github.com/mesonbuild/meson/archive/%{version}/%{name}-%{version}.tar.gz # https://github.com/mesonbuild/meson/commit/d88bf0eb80e2531a8017de4efd4eb02f1e3081ec Patch0001: 0001-compilers-n_debug-if-release-and-buildtype-plain-sho.patch +# https://github.com/mesonbuild/meson/pull/5095 +# https://github.com/mesonbuild/meson/issues/5046 +# needed for the next patch to apply cleanly, fixes a bug anyway +Patch0002: 0002-Fix-5046.patch +# https://github.com/mesonbuild/meson/pull/5144 , but the real reason +# for this revert in Fedora is this execstack problem: +# https://github.com/mesonbuild/meson/issues/5268 +# https://bugzilla.redhat.com/show_bug.cgi?id=1699099 +Patch0003: 0003-Revert-gnome.compile_resources-Add-ld-binary-method.patch BuildArch: noarch Obsoletes: %{name}-gui < 0.31.0-3 @@ -49,6 +58,9 @@ install -Dpm0644 -t %{buildroot}%{rpmmacrodir} data/macros.%{name} %{_datadir}/polkit-1/actions/com.mesonbuild.install.policy %changelog +* Mon Apr 15 2019 Adam Williamson - 0.50.0-4 +- Backport patch to revert ld binary method change (#1699099) + * Mon Apr 08 2019 Igor Gnatenko - 0.50.0-3 - Drop -Db_ndebug=true and just fix it instead