public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-build/meson/files/, dev-build/meson/
@ 2024-01-18 20:43 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2024-01-18 20:43 UTC (permalink / raw
  To: gentoo-commits

commit:     e538accf3e4cb33b8537290de31ce4fc503047c8
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Thu Jan 18 20:26:51 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 18 20:43:22 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e538accf

dev-build/meson: backport macos Prefix fix

Followup to commit 791e631e0121da91676113928a3e4070453c2449. The patch
has been integrated upstream and will be backported to meson 1.3.2; the
issues with including it here have been resolved, so bring it back.

Closes: https://bugs.gentoo.org/868516
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../meson/files/meson-1.3.1-xtools-support.patch   | 39 ++++++++++++++++++++++
 .../{meson-1.3.1.ebuild => meson-1.3.1-r1.ebuild}  |  3 ++
 2 files changed, 42 insertions(+)

diff --git a/dev-build/meson/files/meson-1.3.1-xtools-support.patch b/dev-build/meson/files/meson-1.3.1-xtools-support.patch
new file mode 100644
index 000000000000..dfb9b3f6be68
--- /dev/null
+++ b/dev-build/meson/files/meson-1.3.1-xtools-support.patch
@@ -0,0 +1,39 @@
+From 33527630f1bd0e51093044016557cb44e7bb6547 Mon Sep 17 00:00:00 2001
+From: Fabian Groffen <grobian@gentoo.org>
+Date: Wed, 17 Jan 2024 17:04:45 +0100
+Subject: [PATCH] linkers_detect: detect xtools (Apple ld64 derivative)
+
+xtools is in use on Gentoo Prefix x86_64 and ppc based Darwin installs.
+Pick it up as a valid linker.
+
+Since xtools is answering with a version to --version, as opposed to
+ld64, detection of xtools in the ld64 handling block is not possible,
+since --version already succeeded.
+
+Bug: https://bugs.gentoo.org/868516
+Bug: https://github.com/mesonbuild/meson/issues/10805
+Signed-off-by: Fabian Groffen <grobian@gentoo.org>
+Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
+---
+ mesonbuild/linkers/detect.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/mesonbuild/linkers/detect.py b/mesonbuild/linkers/detect.py
+index 918f2e634..1bce413f4 100644
+--- a/mesonbuild/linkers/detect.py
++++ b/mesonbuild/linkers/detect.py
+@@ -174,6 +174,11 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
+             v = search_version(o)
+ 
+         linker = linkers.LLVMDynamicLinker(compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v)
++    # detect xtools first, bug #10805
++    elif 'xtools-' in o.split('\n', maxsplit=1)[0]:
++        xtools = o.split(' ', maxsplit=1)[0]
++        v = xtools.split('-', maxsplit=2)[1]
++        linker = linkers.AppleDynamicLinker(compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v)
+     # First might be apple clang, second is for real gcc, the third is icc.
+     # Note that "ld: unknown option: " sometimes instead is "ld: unknown options:".
+     elif e.endswith('(use -v to see invocation)\n') or 'macosx_version' in e or 'ld: unknown option' in e:
+-- 
+2.43.0
+

diff --git a/dev-build/meson/meson-1.3.1.ebuild b/dev-build/meson/meson-1.3.1-r1.ebuild
similarity index 96%
rename from dev-build/meson/meson-1.3.1.ebuild
rename to dev-build/meson/meson-1.3.1-r1.ebuild
index 2498ea56a83a..6a86fb79dedb 100644
--- a/dev-build/meson/meson-1.3.1.ebuild
+++ b/dev-build/meson/meson-1.3.1-r1.ebuild
@@ -60,6 +60,9 @@ PATCHES=(
 
 	# backport revert for broken rpath changes: https://github.com/mesonbuild/meson/pull/12672
 	"${FILESDIR}"/0001-Revert-clike-Deduplicate-rpath-linker-flags.patch
+
+	# backport macos Prefix fix: https://github.com/mesonbuild/meson/pull/12747
+	"${FILESDIR}"/meson-1.3.1-xtools-support.patch
 )
 
 python_prepare_all() {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-build/meson/files/, dev-build/meson/
@ 2024-12-06 20:35 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2024-12-06 20:35 UTC (permalink / raw
  To: gentoo-commits

commit:     3b7577e8c9cccd46728eea2eddb94e8818e793fb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  6 20:34:34 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  6 20:34:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b7577e8

dev-build/meson: backport generate_gir fix (fixes glib build)

As discussed with Eli.

Closes: https://bugs.gentoo.org/945769
Closes: https://bugs.gentoo.org/945770
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../meson-1.6.0-generate_git-both-libraries.patch  | 345 +++++++++++++++++++++
 dev-build/meson/meson-1.6.0-r1.ebuild              | 191 ++++++++++++
 2 files changed, 536 insertions(+)

diff --git a/dev-build/meson/files/meson-1.6.0-generate_git-both-libraries.patch b/dev-build/meson/files/meson-1.6.0-generate_git-both-libraries.patch
new file mode 100644
index 000000000000..ed4d4ef7303f
--- /dev/null
+++ b/dev-build/meson/files/meson-1.6.0-generate_git-both-libraries.patch
@@ -0,0 +1,345 @@
+https://bugs.gentoo.org/945770
+https://bugs.gentoo.org/945769
+https://github.com/mesonbuild/meson/issues/13850
+https://github.com/mesonbuild/meson/commit/d8ea5c4d8875bf198f088c603868edf66a3c7c65
+
+From d8ea5c4d8875bf198f088c603868edf66a3c7c65 Mon Sep 17 00:00:00 2001
+From: Charles Brunet <charles.brunet@optelgroup.com>
+Date: Tue, 29 Oct 2024 16:51:36 -0400
+Subject: [PATCH] fix generate_gir with BothLibraries dependency
+
+Co-authored-by: Xavier Claessens <xclaesse@gmail.com>
+---
+ mesonbuild/build.py                           | 52 ++++++++++++-------
+ mesonbuild/interpreter/interpreter.py         | 22 ++++----
+ mesonbuild/interpreter/interpreterobjects.py  | 10 ++--
+ .../frameworks/38 gir both_libraries/bar.c    |  7 +++
+ .../frameworks/38 gir both_libraries/bar.h    |  1 +
+ .../frameworks/38 gir both_libraries/foo.c    |  6 +++
+ .../frameworks/38 gir both_libraries/foo.h    |  1 +
+ .../38 gir both_libraries/meson.build         | 42 +++++++++++++++
+ .../38 gir both_libraries/test.json           |  3 ++
+ 9 files changed, 111 insertions(+), 33 deletions(-)
+ create mode 100644 test cases/frameworks/38 gir both_libraries/bar.c
+ create mode 100644 test cases/frameworks/38 gir both_libraries/bar.h
+ create mode 100644 test cases/frameworks/38 gir both_libraries/foo.c
+ create mode 100644 test cases/frameworks/38 gir both_libraries/foo.h
+ create mode 100644 test cases/frameworks/38 gir both_libraries/meson.build
+ create mode 100644 test cases/frameworks/38 gir both_libraries/test.json
+
+diff --git a/mesonbuild/build.py b/mesonbuild/build.py
+index a00209ad45a8..35f1f24a42f8 100644
+--- a/mesonbuild/build.py
++++ b/mesonbuild/build.py
+@@ -774,6 +774,7 @@ def __init__(
+         }
+         self.pic = False
+         self.pie = False
++        self.both_lib: T.Optional[T.Union[StaticLibrary, SharedLibrary]] = None
+         # Track build_rpath entries so we can remove them at install time
+         self.rpath_dirs_to_remove: T.Set[bytes] = set()
+         self.process_sourcelist(sources)
+@@ -1740,16 +1741,20 @@ def process_vs_module_defs_kw(self, kwargs: T.Dict[str, T.Any]) -> None:
+     def extract_targets_as_list(self, kwargs: T.Dict[str, T.Union[LibTypes, T.Sequence[LibTypes]]], key: T.Literal['link_with', 'link_whole']) -> T.List[LibTypes]:
+         bl_type = self.environment.coredata.get_option(OptionKey('default_both_libraries'))
+         if bl_type == 'auto':
+-            bl_type = 'static' if isinstance(self, StaticLibrary) else 'shared'
+-
+-        def _resolve_both_libs(lib: LibTypes) -> LibTypes:
+-            if isinstance(lib, BothLibraries):
+-                return lib.get(bl_type)
+-            return lib
++            if isinstance(self, StaticLibrary):
++                bl_type = 'static'
++            elif isinstance(self, SharedLibrary):
++                bl_type = 'shared'
+ 
+         self_libs: T.List[LibTypes] = self.link_targets if key == 'link_with' else self.link_whole_targets
+-        lib_list = listify(kwargs.get(key, [])) + self_libs
+-        return [_resolve_both_libs(t) for t in lib_list]
++
++        lib_list = []
++        for lib in listify(kwargs.get(key, [])) + self_libs:
++            if isinstance(lib, (Target, BothLibraries)):
++                lib_list.append(lib.get(bl_type))
++            else:
++                lib_list.append(lib)
++        return lib_list
+ 
+     def get(self, lib_type: T.Literal['static', 'shared', 'auto']) -> LibTypes:
+         """Base case used by BothLibraries"""
+@@ -2204,6 +2209,14 @@ def is_linkable_target(self):
+     def is_internal(self) -> bool:
+         return not self.install
+ 
++    def set_shared(self, shared_library: SharedLibrary) -> None:
++        self.both_lib = shared_library
++
++    def get(self, lib_type: T.Literal['static', 'shared', 'auto']) -> LibTypes:
++        if lib_type == 'shared':
++            return self.both_lib or self
++        return self
++
+ class SharedLibrary(BuildTarget):
+     known_kwargs = known_shlib_kwargs
+ 
+@@ -2470,6 +2483,14 @@ def type_suffix(self):
+     def is_linkable_target(self):
+         return True
+ 
++    def set_static(self, static_library: StaticLibrary) -> None:
++        self.both_lib = static_library
++
++    def get(self, lib_type: T.Literal['static', 'shared']) -> LibTypes:
++        if lib_type == 'static':
++            return self.both_lib or self
++        return self
++
+ # A shared library that is meant to be used with dlopen rather than linking
+ # into something else.
+ class SharedModule(SharedLibrary):
+@@ -2506,7 +2527,7 @@ def get_default_install_dir(self) -> T.Union[T.Tuple[str, str], T.Tuple[None, No
+         return self.environment.get_shared_module_dir(), '{moduledir_shared}'
+ 
+ class BothLibraries(SecondLevelHolder):
+-    def __init__(self, shared: SharedLibrary, static: StaticLibrary, preferred_library: Literal['shared', 'static', 'auto']) -> None:
++    def __init__(self, shared: SharedLibrary, static: StaticLibrary, preferred_library: Literal['shared', 'static']) -> None:
+         self._preferred_library = preferred_library
+         self.shared = shared
+         self.static = static
+@@ -2914,23 +2935,14 @@ class AliasTarget(RunTarget):
+ 
+     typename = 'alias'
+ 
+-    def __init__(self, name: str, dependencies: T.Sequence[T.Union[Target, BothLibraries]],
++    def __init__(self, name: str, dependencies: T.Sequence[Target],
+                  subdir: str, subproject: str, environment: environment.Environment):
+-        super().__init__(name, [], list(self._deps_generator(dependencies)), subdir, subproject, environment)
++        super().__init__(name, [], dependencies, subdir, subproject, environment)
+ 
+     def __repr__(self):
+         repr_str = "<{0} {1}>"
+         return repr_str.format(self.__class__.__name__, self.get_id())
+ 
+-    @staticmethod
+-    def _deps_generator(dependencies: T.Sequence[T.Union[Target, BothLibraries]]) -> T.Iterator[Target]:
+-        for dep in dependencies:
+-            if isinstance(dep, BothLibraries):
+-                yield dep.shared
+-                yield dep.static
+-            else:
+-                yield dep
+-
+ class Jar(BuildTarget):
+     known_kwargs = known_jar_kwargs
+ 
+diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
+index 58385c58c5f7..10ca3e6bb2e8 100644
+--- a/mesonbuild/interpreter/interpreter.py
++++ b/mesonbuild/interpreter/interpreter.py
+@@ -31,7 +31,7 @@
+ from ..interpreterbase import Disabler, disablerIfNotFound
+ from ..interpreterbase import FeatureNew, FeatureDeprecated, FeatureBroken, FeatureNewKwargs
+ from ..interpreterbase import ObjectHolder, ContextManagerObject
+-from ..interpreterbase import stringifyUserArguments, resolve_second_level_holders
++from ..interpreterbase import stringifyUserArguments
+ from ..modules import ExtensionModule, ModuleObject, MutableModuleObject, NewExtensionModule, NotFoundExtensionModule
+ from ..optinterpreter import optname_regex
+ 
+@@ -681,7 +681,6 @@ def func_files(self, node: mparser.FunctionNode, args: T.Tuple[T.List[str]], kwa
+         KwargInfo('version', (str, NoneType)),
+         KwargInfo('objects', ContainerTypeInfo(list, build.ExtractedObjects), listify=True, default=[], since='1.1.0'),
+     )
+-    @noSecondLevelHolderResolving
+     def func_declare_dependency(self, node: mparser.BaseNode, args: T.List[TYPE_var],
+                                 kwargs: kwtypes.FuncDeclareDependency) -> dependencies.Dependency:
+         deps = kwargs['dependencies']
+@@ -1906,15 +1905,12 @@ def func_jar(self, node: mparser.BaseNode,
+     @permittedKwargs(known_build_target_kwargs)
+     @typed_pos_args('build_target', str, varargs=SOURCES_VARARGS)
+     @typed_kwargs('build_target', *BUILD_TARGET_KWS, allow_unknown=True)
+-    @noSecondLevelHolderResolving
+     def func_build_target(self, node: mparser.BaseNode,
+                           args: T.Tuple[str, SourcesVarargsType],
+                           kwargs: kwtypes.BuildTarget
+                           ) -> T.Union[build.Executable, build.StaticLibrary, build.SharedLibrary,
+                                        build.SharedModule, build.BothLibraries, build.Jar]:
+         target_type = kwargs['target_type']
+-        if target_type not in {'both_libraries', 'library'}:
+-            args, kwargs = resolve_second_level_holders(args, kwargs)
+ 
+         if target_type == 'executable':
+             return self.build_target(node, args, kwargs, build.Executable)
+@@ -2176,13 +2172,19 @@ def func_run_target(self, node: mparser.FunctionNode, args: T.Tuple[str],
+     @FeatureNew('alias_target', '0.52.0')
+     @typed_pos_args('alias_target', str, varargs=(build.Target, build.BothLibraries), min_varargs=1)
+     @noKwargs
+-    @noSecondLevelHolderResolving
+     def func_alias_target(self, node: mparser.BaseNode, args: T.Tuple[str, T.List[T.Union[build.Target, build.BothLibraries]]],
+                           kwargs: TYPE_kwargs) -> build.AliasTarget:
+         name, deps = args
+         if any(isinstance(d, build.RunTarget) for d in deps):
+             FeatureNew.single_use('alias_target that depends on run_targets', '0.60.0', self.subproject)
+-        tg = build.AliasTarget(name, deps, self.subdir, self.subproject, self.environment)
++        real_deps: T.List[build.Target] = []
++        for d in deps:
++            if isinstance(d, build.BothLibraries):
++                real_deps.append(d.shared)
++                real_deps.append(d.static)
++            else:
++                real_deps.append(d)
++        tg = build.AliasTarget(name, real_deps, self.subdir, self.subproject, self.environment)
+         self.add_target(name, tg)
+         return tg
+ 
+@@ -3286,16 +3288,18 @@ def build_both_libraries(self, node: mparser.BaseNode, args: T.Tuple[str, Source
+             # Keep only compilers used for linking
+             static_lib.compilers = {k: v for k, v in static_lib.compilers.items() if k in compilers.clink_langs}
+ 
++        # Cross reference them to implement as_shared() and as_static() methods.
++        shared_lib.set_static(static_lib)
++        static_lib.set_shared(shared_lib)
++
+         return build.BothLibraries(shared_lib, static_lib, preferred_library)
+ 
+     def build_library(self, node: mparser.BaseNode, args: T.Tuple[str, SourcesVarargsType], kwargs: kwtypes.Library):
+         default_library = self.coredata.get_option(OptionKey('default_library', subproject=self.subproject))
+         assert isinstance(default_library, str), 'for mypy'
+         if default_library == 'shared':
+-            args, kwargs = resolve_second_level_holders(args, kwargs)
+             return self.build_target(node, args, T.cast('kwtypes.StaticLibrary', kwargs), build.SharedLibrary)
+         elif default_library == 'static':
+-            args, kwargs = resolve_second_level_holders(args, kwargs)
+             return self.build_target(node, args, T.cast('kwtypes.SharedLibrary', kwargs), build.StaticLibrary)
+         elif default_library == 'both':
+             return self.build_both_libraries(node, args, kwargs)
+diff --git a/mesonbuild/interpreter/interpreterobjects.py b/mesonbuild/interpreter/interpreterobjects.py
+index a919102607be..f4a2b4107ed3 100644
+--- a/mesonbuild/interpreter/interpreterobjects.py
++++ b/mesonbuild/interpreter/interpreterobjects.py
+@@ -1001,8 +1001,6 @@ class SharedLibraryHolder(BuildTargetHolder[build.SharedLibrary]):
+ 
+ class BothLibrariesHolder(BuildTargetHolder[build.BothLibraries]):
+     def __init__(self, libs: build.BothLibraries, interp: 'Interpreter'):
+-        # FIXME: This build target always represents the shared library, but
+-        # that should be configurable.
+         super().__init__(libs, interp)
+         self.methods.update({'get_shared_lib': self.get_shared_lib_method,
+                              'get_static_lib': self.get_static_lib_method,
+@@ -1017,12 +1015,16 @@ def __repr__(self) -> str:
+     @noPosargs
+     @noKwargs
+     def get_shared_lib_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> build.SharedLibrary:
+-        return self.held_object.shared
++        lib = copy.copy(self.held_object.shared)
++        lib.both_lib = None
++        return lib
+ 
+     @noPosargs
+     @noKwargs
+     def get_static_lib_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> build.StaticLibrary:
+-        return self.held_object.static
++        lib = copy.copy(self.held_object.static)
++        lib.both_lib = None
++        return lib
+ 
+ class SharedModuleHolder(BuildTargetHolder[build.SharedModule]):
+     pass
+diff --git a/test cases/frameworks/38 gir both_libraries/bar.c b/test cases/frameworks/38 gir both_libraries/bar.c
+new file mode 100644
+index 000000000000..4cb41f798294
+--- /dev/null
++++ b/test cases/frameworks/38 gir both_libraries/bar.c	
+@@ -0,0 +1,7 @@
++#include "bar.h"
++#include "foo.h"
++
++int bar_func(void)
++{
++    return foo_func() + 42;
++}
+diff --git a/test cases/frameworks/38 gir both_libraries/bar.h b/test cases/frameworks/38 gir both_libraries/bar.h
+new file mode 100644
+index 000000000000..d22827b837f7
+--- /dev/null
++++ b/test cases/frameworks/38 gir both_libraries/bar.h	
+@@ -0,0 +1 @@
++int bar_func(void);
+diff --git a/test cases/frameworks/38 gir both_libraries/foo.c b/test cases/frameworks/38 gir both_libraries/foo.c
+new file mode 100644
+index 000000000000..b88aa91dabb4
+--- /dev/null
++++ b/test cases/frameworks/38 gir both_libraries/foo.c	
+@@ -0,0 +1,6 @@
++#include "foo.h"
++
++int foo_func(void)
++{
++    return 42;
++}
+diff --git a/test cases/frameworks/38 gir both_libraries/foo.h b/test cases/frameworks/38 gir both_libraries/foo.h
+new file mode 100644
+index 000000000000..2a0867249307
+--- /dev/null
++++ b/test cases/frameworks/38 gir both_libraries/foo.h	
+@@ -0,0 +1 @@
++int foo_func(void);
+diff --git a/test cases/frameworks/38 gir both_libraries/meson.build b/test cases/frameworks/38 gir both_libraries/meson.build
+new file mode 100644
+index 000000000000..cb9cdd31f3ed
+--- /dev/null
++++ b/test cases/frameworks/38 gir both_libraries/meson.build	
+@@ -0,0 +1,42 @@
++project('gir both libraries', 'c')
++
++gir = dependency('gobject-introspection-1.0', required: false)
++if not gir.found()
++  error('MESON_SKIP_TEST gobject-introspection not found.')
++endif
++
++if host_machine.system() == 'cygwin'
++  # FIXME: g-ir-scanner seems broken on cygwin:
++  # ERROR: can't resolve libraries to shared libraries: foo++
++  error('MESON_SKIP_TEST g-ir-scanner is broken on cygwin.')
++endif
++
++gnome = import('gnome')
++
++# Regression test simulating how GStreamer generate its GIRs.
++# Generated gobject-introspection binaries for every GStreamer libraries must
++# first call gst_init() defined in the main libgstreamer, which means they need
++# to link on that lib.
++# A regression caused by https://github.com/mesonbuild/meson/pull/12632 made
++# Meson not link the binary generated for bar with libfoo in the case it uses
++# both_libraries().
++
++libfoo = both_libraries('foo', 'foo.c')
++foo_gir = gnome.generate_gir(libfoo,
++  namespace: 'foo',
++  nsversion: '1.0',
++  sources: ['foo.c', 'foo.h'],
++)
++foo_dep = declare_dependency(
++  link_with: libfoo,
++  sources: foo_gir,
++)
++
++libbar = both_libraries('bar', 'bar.c', dependencies: foo_dep)
++gnome.generate_gir(libbar,
++  namespace: 'bar',
++  nsversion: '1.0',
++  sources: ['bar.c', 'bar.h'],
++  extra_args: '--add-init-section=extern void foo_func(void);foo_func();',
++  dependencies: foo_dep,
++)
+diff --git a/test cases/frameworks/38 gir both_libraries/test.json b/test cases/frameworks/38 gir both_libraries/test.json
+new file mode 100644
+index 000000000000..82ac42a293b3
+--- /dev/null
++++ b/test cases/frameworks/38 gir both_libraries/test.json	
+@@ -0,0 +1,3 @@
++{
++    "expect_skip_on_jobname": ["azure", "macos", "msys2", "cygwin"]
++}
+\ No newline at end of file
+

diff --git a/dev-build/meson/meson-1.6.0-r1.ebuild b/dev-build/meson/meson-1.6.0-r1.ebuild
new file mode 100644
index 000000000000..22ac4ec4621b
--- /dev/null
+++ b/dev-build/meson/meson-1.6.0-r1.ebuild
@@ -0,0 +1,191 @@
+# Copyright 2016-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} pypy3 )
+DISTUTILS_USE_PEP517=setuptools
+
+inherit bash-completion-r1 edo distutils-r1 flag-o-matic toolchain-funcs
+
+if [[ ${PV} = *9999* ]]; then
+	EGIT_REPO_URI="https://github.com/mesonbuild/meson"
+	inherit ninja-utils git-r3
+
+	BDEPEND="
+		${NINJA_DEPEND}
+		$(python_gen_any_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]')
+	"
+
+else
+	inherit verify-sig
+
+	MY_PV=${PV/_/}
+	MY_P=${P/_/}
+	S=${WORKDIR}/${MY_P}
+
+	SRC_URI="
+		https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz
+		verify-sig? ( https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz.asc )
+		https://github.com/mesonbuild/meson/releases/download/${MY_PV}/meson-reference.3 -> meson-reference-${MY_PV}.3
+	"
+	BDEPEND="verify-sig? ( sec-keys/openpgp-keys-jpakkane )"
+	VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/jpakkane.gpg
+
+	if [[ ${PV} != *_rc* ]] ; then
+		KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+	fi
+fi
+
+DESCRIPTION="Open source build system"
+HOMEPAGE="https://mesonbuild.com/"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+	test? (
+		dev-libs/glib:2
+		dev-libs/gobject-introspection
+		app-alternatives/ninja
+		dev-vcs/git
+		sys-libs/zlib[static-libs(+)]
+		virtual/pkgconfig
+	)
+"
+RDEPEND="
+	!<dev-build/muon-0.2.0-r2[man(-)]
+	virtual/pkgconfig
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.2.1-python-path.patch
+	"${FILESDIR}"/${P}-generate_git-both-libraries.patch
+)
+
+src_unpack() {
+	if [[ ${PV} = *9999* ]]; then
+		git-r3_src_unpack
+	else
+		default
+		use verify-sig && verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.asc}
+	fi
+}
+
+python_prepare_all() {
+	local disable_unittests=(
+		# ASAN and sandbox both want control over LD_PRELOAD
+		# https://bugs.gentoo.org/673016
+		-e 's/test_generate_gir_with_address_sanitizer/_&/'
+
+		# ASAN is unsupported on some targets
+		# https://bugs.gentoo.org/692822
+		-e 's/test_pch_with_address_sanitizer/_&/'
+
+		# clippy-driver fails, but only when run via portage.
+		#
+		#   error[E0463]: can't find crate for `std`
+		#   error: requires `sized` lang_item
+		-e 's/test_rust_clippy/_&/'
+	)
+
+	sed -i "${disable_unittests[@]}" unittests/*.py || die
+
+	# Broken due to python2 script created by python_wrapper_setup
+	rm -r "test cases/frameworks/1 boost" || die
+	# nvcc breaks on essentially any LDFLAGS
+	# https://bugs.gentoo.org/936757
+	# https://github.com/mesonbuild/meson/issues/11234
+	rm -r "test cases/cuda"/* || die
+
+	distutils-r1_python_prepare_all
+}
+
+python_check_deps() {
+	if [[ ${PV} = *9999* ]]; then
+		python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
+	fi
+}
+
+python_configure_all() {
+	if [[ ${PV} = *9999* ]]; then
+		# We use the unsafe_yaml loader because strictyaml is not packaged. In
+		# theory they produce the same results, but pyyaml is faster and
+		# without safety checks.
+		edo ./meson.py setup \
+			--prefix "${EPREFIX}/usr" \
+			-Dhtml=false \
+			-Dunsafe_yaml=true \
+			docs/ docs/builddir
+	fi
+}
+
+python_compile_all() {
+	if [[ ${PV} = *9999* ]]; then
+		eninja -C docs/builddir
+	fi
+}
+
+src_test() {
+	tc-export PKG_CONFIG
+	if ${PKG_CONFIG} --exists Qt5Core && ! ${PKG_CONFIG} --exists Qt5Gui; then
+		ewarn "Found Qt5Core but not Qt5Gui; skipping tests"
+	else
+		distutils-r1_src_test
+	fi
+}
+
+python_test() {
+	(
+		# meson has its own tests for LTO support. We don't need to verify that
+		# all tests work when they happen to use it. And in particular, this
+		# breaks rust.
+		filter-lto
+
+		# remove unwanted python_wrapper_setup contents
+		# We actually do want to non-error if python2 is installed and tested.
+		remove="${T}/${EPYTHON}/bin:"
+		PATH=${PATH/${remove}/}
+
+		# test_meson_installed
+		unset PYTHONDONTWRITEBYTECODE
+
+		# https://bugs.gentoo.org/687792
+		unset PKG_CONFIG
+
+		# test_cross_file_system_paths
+		unset XDG_DATA_HOME
+
+		# 'test cases/unit/73 summary' expects 80 columns
+		export COLUMNS=80
+
+		# If JAVA_HOME is not set, meson looks for javac in PATH.
+		# If javac is in /usr/bin, meson assumes /usr/include is a valid
+		# JDK include path. Setting JAVA_HOME works around this broken
+		# autodetection. If no JDK is installed, we should end up with an empty
+		# value in JAVA_HOME, and the tests should get skipped.
+		export JAVA_HOME=$(java-config -O 2>/dev/null)
+
+		${EPYTHON} -u run_tests.py
+	) || die "Testing failed with ${EPYTHON}"
+}
+
+python_install_all() {
+	distutils-r1_python_install_all
+
+	insinto /usr/share/vim/vimfiles
+	doins -r data/syntax-highlighting/vim/{ftdetect,indent,syntax}
+
+	insinto /usr/share/zsh/site-functions
+	doins data/shell-completions/zsh/_meson
+
+	dobashcomp data/shell-completions/bash/meson
+
+	if [[ ${PV} = *9999* ]]; then
+		DESTDIR="${ED}" eninja -C docs/builddir install
+	else
+		newman "${DISTDIR}"/meson-reference-${MY_PV}.3 meson-reference.3
+	fi
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-06 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 20:35 [gentoo-commits] repo/gentoo:master commit in: dev-build/meson/files/, dev-build/meson/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-01-18 20:43 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox