You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
py-meson: simplify reinplace, remove Tiger-specific code
This commit is contained in:
@@ -74,26 +74,6 @@ if {${subport} ne ${name}} {
|
||||
# see: https://trac.macports.org/ticket/71165
|
||||
patchfiles-append patch-meson-appleframeworks.diff
|
||||
|
||||
platform darwin 8 {
|
||||
|
||||
github.setup mesonbuild meson 1.6.1
|
||||
github.tarball_from releases
|
||||
revision 0
|
||||
|
||||
checksums rmd160 b7c38c2626e32a40c1989a54f7bffca1a4a01a28 \
|
||||
sha256 1eca49eb6c26d58bbee67fd3337d8ef557c0804e30a6d16bfdf269db997464de \
|
||||
size 2276144
|
||||
|
||||
patchfiles patch-meson161-remove-Wl,-no_weak_imports.diff \
|
||||
patch-meson161-32bit-apple.diff \
|
||||
patch-meson161-gcc-appleframeworks.diff \
|
||||
patch-meson161-gnome.diff \
|
||||
patch-meson161-gnome-dont-set-cc-for-gir-scanner.diff \
|
||||
patch-meson161-clang-unknown-optimization-error.diff \
|
||||
patch-meson161-search-prefix-for-cross-files.diff \
|
||||
patch-meson161-tiger-no-rpath-fix.diff
|
||||
}
|
||||
|
||||
post-patch {
|
||||
reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/data/shell-completions/bash/meson \
|
||||
${worksrcpath}/mesonbuild/coredata.py
|
||||
@@ -144,16 +124,12 @@ if {${subport} ne ${name}} {
|
||||
|
||||
pre-test {
|
||||
reinplace "s|/usr/bin/env python3$|${python.bin}|" \
|
||||
${worksrcpath}/run_tests.py \
|
||||
${worksrcpath}/run_cross_test.py \
|
||||
${worksrcpath}/run_meson_command_tests.py \
|
||||
${worksrcpath}/run_project_tests.py \
|
||||
${worksrcpath}/run_unittests.py
|
||||
{*}[glob ${worksrcpath}/run_*.py]
|
||||
|
||||
set testpath "${worksrcpath}/test\\ cases"
|
||||
fs-traverse f ${testpath} {
|
||||
if { [string match *.py ${f}] } {
|
||||
reinplace "s|/usr/bin/env python3$|${python.bin}|" ${f}
|
||||
reinplace -q "s|/usr/bin/env python3$|${python.bin}|" ${f}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
--- mesonbuild/environment.py.orig 2023-12-01 21:19:37
|
||||
+++ mesonbuild/environment.py 2023-12-01 21:24:12
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
import itertools
|
||||
import os, platform, re, sys, shutil
|
||||
+import subprocess
|
||||
import typing as T
|
||||
import collections
|
||||
|
||||
@@ -283,6 +284,21 @@
|
||||
if compiler.id == 'gcc' and compiler.has_builtin_define('__i386__'):
|
||||
return 'x86'
|
||||
return os_arch
|
||||
+
|
||||
+def detect_osx_arch() -> str:
|
||||
+ """
|
||||
+ per #6187, handle early Mac 64-bit Intel CPU with 64-bit OSX using a **32-bit kernel**
|
||||
+ testing this requires old MacOS and hardware, not easily available for cloud CI,
|
||||
+ so users needing this functionality may kindly need to help with debugging info.
|
||||
+ """
|
||||
+ try:
|
||||
+ ret = subprocess.run(['sysctl', '-n', 'hw.cpu64bit_capable'],
|
||||
+ universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).stdout
|
||||
+ trial = 'x86_64' if ret.strip() == '1' else 'x86'
|
||||
+ except subprocess.SubprocessError:
|
||||
+ # very old MacOS version with implicit 32-bit CPU due to calling if-elif stack
|
||||
+ trial = 'x86'
|
||||
+ return trial
|
||||
|
||||
def any_compiler_has_define(compilers: CompilersDict, define: str) -> bool:
|
||||
for c in compilers.values():
|
||||
@@ -308,7 +324,11 @@
|
||||
else:
|
||||
trial = platform.machine().lower()
|
||||
if trial.startswith('i') and trial.endswith('86'):
|
||||
- trial = 'x86'
|
||||
+ if mesonlib.is_osx():
|
||||
+ # handle corner case with early Mac 64-bit CPU and older OSX
|
||||
+ trial = detect_osx_arch()
|
||||
+ else:
|
||||
+ trial = 'x86'
|
||||
elif trial == 'bepc':
|
||||
trial = 'x86'
|
||||
elif trial == 'arm64':
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git mesonbuild/compilers/mixins/clang.py.orig mesonbuild/compilers/mixins/clang.py
|
||||
index acdb352..0a3e879 100644
|
||||
--- mesonbuild/compilers/mixins/clang.py.orig
|
||||
+++ mesonbuild/compilers/mixins/clang.py
|
||||
@@ -81,7 +81,7 @@ class ClangCompiler(GnuLikeCompiler):
|
||||
myargs = [] # type: T.List[str]
|
||||
if mode is CompileCheckMode.COMPILE:
|
||||
myargs.extend(['-Werror=unknown-warning-option', '-Werror=unused-command-line-argument'])
|
||||
- if mesonlib.version_compare(self.version, '>=3.6.0'):
|
||||
+ if mesonlib.version_compare(self.version, '>=9.6.0'):
|
||||
myargs.append('-Werror=ignored-optimization-argument')
|
||||
return super().get_compiler_check_args(mode) + myargs
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
--- mesonbuild/compilers/mixins/clike.py.orig 2022-01-03 04:12:32.000000000 +0800
|
||||
+++ mesonbuild/compilers/mixins/clike.py 2022-04-06 05:50:19.000000000 +0800
|
||||
@@ -1123,9 +1123,6 @@
|
||||
unless you select a particular macOS SDK with the -isysroot flag.
|
||||
You can also add to this by setting -F in CFLAGS.
|
||||
'''
|
||||
- # TODO: this really needs to be *AppleClang*, not just any clang.
|
||||
- if self.id != 'clang':
|
||||
- raise mesonlib.MesonException('Cannot find framework path with non-clang compiler')
|
||||
# Construct the compiler command-line
|
||||
commands = self.get_exelist() + ['-v', '-E', '-']
|
||||
commands += self.get_always_args()
|
||||
@@ -1,12 +0,0 @@
|
||||
--- ./mesonbuild/modules/gnome.py2 2023-12-21 20:03:04
|
||||
+++ ./mesonbuild/modules/gnome.py 2023-12-21 20:04:34
|
||||
@@ -983,7 +983,8 @@
|
||||
run_env = PkgConfigInterface.get_env(state.environment, MachineChoice.HOST, uninstalled=True)
|
||||
# g-ir-scanner uses Python's distutils to find the compiler, which uses 'CC'
|
||||
cc_exelist = state.environment.coredata.compilers.host['c'].get_exelist()
|
||||
- run_env.set('CC', [quote_arg(x) for x in cc_exelist], ' ')
|
||||
+ # MACPORTS MOD -- do not set CC here. MacPorts sets it directly, with modifications
|
||||
+ # run_env.set('CC', [quote_arg(x) for x in cc_exelist], ' ')
|
||||
run_env.merge(kwargs['env'])
|
||||
|
||||
return GirTarget(
|
||||
@@ -1,34 +0,0 @@
|
||||
Due to a presumed bug in MP's g-ir-scanner[1], generated typelib files often
|
||||
point to the dylib's relative build path. E.g. running
|
||||
|
||||
g-ir-inspect --print-shlibs Pango
|
||||
|
||||
Will print something like
|
||||
|
||||
shlib: ./pango/libpango-1.0.0.dylib
|
||||
|
||||
At run-time, the GObject Introspection infrastructure won't be able to find the
|
||||
libpango dylib, and panic ensues. This patch ensures that the full install
|
||||
paths are specified in the typelib file. You can ensure correct operation with
|
||||
the above command, which should print something like
|
||||
|
||||
shlib: /opt/local/lib/libpango-1.0.0.dylib
|
||||
|
||||
[1] https://trac.macports.org/ticket/62391
|
||||
|
||||
--- mesonbuild/modules/gnome.py.orig 2022-03-22 05:17:35.000000000 +0800
|
||||
+++ mesonbuild/modules/gnome.py 2022-04-06 05:54:44.000000000 +0800
|
||||
@@ -1177,6 +1177,13 @@
|
||||
for incdir in typelib_includes:
|
||||
typelib_cmd += ["--includedir=" + incdir]
|
||||
|
||||
+ for target in girtargets:
|
||||
+ if isinstance(target, build.SharedLibrary):
|
||||
+ typelib_cmd += ["--shared-library=" +
|
||||
+ os.path.join(state.environment.get_prefix(),
|
||||
+ state.environment.get_shared_lib_dir(),
|
||||
+ target.filename)]
|
||||
+
|
||||
typelib_target = self._make_typelib_target(state, typelib_output, typelib_cmd, generated_files, T.cast('T.Dict[str, T.Any]', kwargs))
|
||||
|
||||
self._devenv_prepend('GI_TYPELIB_PATH', os.path.join(state.environment.get_build_dir(), state.subdir))
|
||||
@@ -1,23 +0,0 @@
|
||||
Don't use -Wl,-no_weak_imports when checking function existence.
|
||||
|
||||
This patch should only be applied on Snow Leopard and earlier because
|
||||
the version of ld64 that MacPorts uses by default on Snow Leopard and
|
||||
earlier doesn't understand that option.
|
||||
|
||||
Temporary workaround for https://github.com/mesonbuild/meson/issues/7204
|
||||
--- mesonbuild/compilers/mixins/clang.py.orig 2024-09-20 13:16:26.000000000 -0500
|
||||
+++ mesonbuild/compilers/mixins/clang.py 2024-09-28 13:47:23.000000000 -0500
|
||||
@@ -115,13 +115,6 @@
|
||||
dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]:
|
||||
if extra_args is None:
|
||||
extra_args = []
|
||||
- # Starting with XCode 8, we need to pass this to force linker
|
||||
- # visibility to obey OS X/iOS/tvOS minimum version targets with
|
||||
- # -mmacosx-version-min, -miphoneos-version-min, -mtvos-version-min etc.
|
||||
- # https://github.com/Homebrew/homebrew-core/issues/3727
|
||||
- # TODO: this really should be communicated by the linker
|
||||
- if isinstance(self.linker, AppleDynamicLinker) and mesonlib.version_compare(self.version, '>=8.0'):
|
||||
- extra_args.append('-Wl,-no_weak_imports')
|
||||
return super().has_function(funcname, prefix, env, extra_args=extra_args,
|
||||
dependencies=dependencies)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
--- data/shell-completions/bash/meson.orig 2024-09-20 13:16:21.000000000 -0500
|
||||
+++ data/shell-completions/bash/meson 2024-09-28 13:50:32.000000000 -0500
|
||||
@@ -183,6 +183,7 @@
|
||||
cross-file)
|
||||
_filedir
|
||||
COMPREPLY+=($(_filedir_in "$XDG_DATA_DIRS"/meson/cross))
|
||||
+ COMPREPLY+=($(_filedir_in @@PREFIX@@/share/@@SUBPORT@@/meson/cross))
|
||||
COMPREPLY+=($(_filedir_in /usr/local/share/meson/cross))
|
||||
COMPREPLY+=($(_filedir_in /usr/share/meson/cross))
|
||||
COMPREPLY+=($(_filedir_in "$XDG_DATA_HOME"/meson/cross))
|
||||
--- mesonbuild/coredata.py.orig 2024-09-20 13:16:26.000000000 -0500
|
||||
+++ mesonbuild/coredata.py 2024-09-28 13:50:32.000000000 -0500
|
||||
@@ -328,7 +328,7 @@
|
||||
if sys.platform != 'win32':
|
||||
paths = [
|
||||
os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share')),
|
||||
- ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
|
||||
+ ] + os.environ.get('XDG_DATA_DIRS', '@@PREFIX@@/share/@@SUBPORT@@:/usr/local/share:/usr/share').split(':')
|
||||
for path in paths:
|
||||
path_to_try = os.path.join(path, 'meson', ftype, f)
|
||||
if os.path.isfile(path_to_try):
|
||||
@@ -1,109 +0,0 @@
|
||||
diff --git mesonbuild/build.py mesonbuild/build.py
|
||||
index cf71dc2..1118830 100644
|
||||
--- mesonbuild/build.py
|
||||
+++ mesonbuild/build.py
|
||||
@@ -131,7 +131,7 @@ def _process_install_tag(install_tag: T.Optional[T.List[T.Optional[str]]],
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def get_target_macos_dylib_install_name(ld) -> str:
|
||||
- name = ['@rpath/', ld.prefix, ld.name]
|
||||
+ name = ['@loader_path/', ld.prefix, ld.name]
|
||||
if ld.soversion is not None:
|
||||
name.append('.' + ld.soversion)
|
||||
name.append('.dylib')
|
||||
diff --git mesonbuild/linkers/linkers.py mesonbuild/linkers/linkers.py
|
||||
index c4df0fa..88a04c1 100644
|
||||
--- mesonbuild/linkers/linkers.py
|
||||
+++ mesonbuild/linkers/linkers.py
|
||||
@@ -705,7 +705,7 @@ class GnuLikeDynamicLinkerMixin(DynamicLinkerBase):
|
||||
paths = padding
|
||||
else:
|
||||
paths = paths + ':' + padding
|
||||
- args.extend(self._apply_prefix('-rpath,' + paths))
|
||||
+ #KEN args.extend(self._apply_prefix('-rpath,' + paths))
|
||||
|
||||
# TODO: should this actually be "for solaris/sunos"?
|
||||
# NOTE: Remove the zigcc check once zig support "-rpath-link"
|
||||
@@ -808,7 +808,7 @@ class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
|
||||
|
||||
def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
|
||||
suffix: str, soversion: str, darwin_versions: T.Tuple[str, str]) -> T.List[str]:
|
||||
- install_name = ['@rpath/', prefix, shlib_name]
|
||||
+ install_name = ['@loader_path/', prefix, shlib_name]
|
||||
if soversion is not None:
|
||||
install_name.append('.' + soversion)
|
||||
install_name.append('.dylib')
|
||||
@@ -834,7 +834,7 @@ class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
|
||||
all_paths.update(build_rpath.split(':'))
|
||||
for rp in all_paths:
|
||||
rpath_dirs_to_remove.add(rp.encode('utf8'))
|
||||
- args.extend(self._apply_prefix('-rpath,' + rp))
|
||||
+ #KEN args.extend(self._apply_prefix('-rpath,' + rp))
|
||||
|
||||
return (args, rpath_dirs_to_remove)
|
||||
|
||||
@@ -1204,8 +1204,8 @@ class NAGDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
|
||||
all_paths = mesonlib.OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
|
||||
if build_rpath != '':
|
||||
all_paths.add(build_rpath)
|
||||
- for rp in all_paths:
|
||||
- args.extend(self._apply_prefix('-Wl,-Wl,,-rpath,,' + rp))
|
||||
+ #KEN for rp in all_paths:
|
||||
+ #KEN args.extend(self._apply_prefix('-Wl,-Wl,,-rpath,,' + rp))
|
||||
|
||||
return (args, set())
|
||||
|
||||
diff --git mesonbuild/modules/gnome.py mesonbuild/modules/gnome.py
|
||||
index a1513c6..92b8147 100644
|
||||
--- mesonbuild/modules/gnome.py
|
||||
+++ mesonbuild/modules/gnome.py
|
||||
@@ -625,8 +625,8 @@ class GnomeModule(ExtensionModule):
|
||||
if isinstance(lib, build.SharedLibrary):
|
||||
libdir = os.path.join(state.environment.get_build_dir(), state.backend.get_target_dir(lib))
|
||||
link_command.append('-L' + libdir)
|
||||
- if include_rpath:
|
||||
- link_command.append('-Wl,-rpath,' + libdir)
|
||||
+ #KEN if include_rpath:
|
||||
+ #KEN link_command.append('-Wl,-rpath,' + libdir)
|
||||
new_depends.append(lib)
|
||||
# Needed for the following binutils bug:
|
||||
# https://github.com/mesonbuild/meson/issues/1911
|
||||
@@ -635,8 +635,8 @@ class GnomeModule(ExtensionModule):
|
||||
for d in state.backend.determine_rpath_dirs(lib):
|
||||
d = os.path.join(state.environment.get_build_dir(), d)
|
||||
link_command.append('-L' + d)
|
||||
- if include_rpath:
|
||||
- link_command.append('-Wl,-rpath,' + d)
|
||||
+ #KEN if include_rpath:
|
||||
+ #KEN link_command.append('-Wl,-rpath,' + d)
|
||||
if use_gir_args and self._gir_has_option('--extra-library'):
|
||||
link_command.append('--extra-library=' + lib.name)
|
||||
else:
|
||||
@@ -701,8 +701,8 @@ class GnomeModule(ExtensionModule):
|
||||
getattr(dep, 'is_libtool', False)):
|
||||
lib_dir = os.path.dirname(flag)
|
||||
external_ldflags.update([f'-L{lib_dir}'])
|
||||
- if include_rpath:
|
||||
- external_ldflags.update([f'-Wl,-rpath {lib_dir}'])
|
||||
+ #KEN if include_rpath:
|
||||
+ #KEN external_ldflags.update([f'-Wl,-rpath {lib_dir}'])
|
||||
libname = os.path.basename(flag)
|
||||
if libname.startswith("lib"):
|
||||
libname = libname[3:]
|
||||
diff --git mesonbuild/scripts/depfixer.py mesonbuild/scripts/depfixer.py
|
||||
index db9c97d..77e8feb 100644
|
||||
--- mesonbuild/scripts/depfixer.py
|
||||
+++ mesonbuild/scripts/depfixer.py
|
||||
@@ -420,9 +420,9 @@ def fix_darwin(fname: str, rpath_dirs_to_remove: T.Set[bytes], new_rpath: str, f
|
||||
args = []
|
||||
# compute diff, translate it into -delete_rpath and -add_rpath
|
||||
# calls
|
||||
- for path in new_rpaths:
|
||||
- if path not in old_rpaths:
|
||||
- args += ['-add_rpath', path]
|
||||
+ #KEN for path in new_rpaths:
|
||||
+ #KEN if path not in old_rpaths:
|
||||
+ #KEN args += ['-add_rpath', path]
|
||||
for path in old_rpaths:
|
||||
if path not in new_rpaths:
|
||||
args += ['-delete_rpath', path]
|
||||
Reference in New Issue
Block a user