Index: head/devel/meson/Makefile =================================================================== --- head/devel/meson/Makefile (revision 505002) +++ head/devel/meson/Makefile (revision 505003) @@ -1,21 +1,21 @@ # Created by: Ting-Wei Lan # $FreeBSD$ PORTNAME= meson -PORTVERSION= 0.50.0 +PORTVERSION= 0.51.0 CATEGORIES= devel python MASTER_SITES= https://github.com/mesonbuild/${PORTNAME}/releases/download/${PORTVERSION}/ MAINTAINER= gnome@FreeBSD.org COMMENT= High performance build system LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/COPYING RUN_DEPENDS= ninja:devel/ninja USES= python:3.5+ USE_PYTHON= autoplist distutils noflavors NO_ARCH= yes .include Index: head/devel/meson/distinfo =================================================================== --- head/devel/meson/distinfo (revision 505002) +++ head/devel/meson/distinfo (revision 505003) @@ -1,3 +1,3 @@ -TIMESTAMP = 1554794341 -SHA256 (meson-0.50.0.tar.gz) = 2a1bc42dda58206fb922cda5e1ca95cc03ad126321d26acc47d3493ec4e7021f -SIZE (meson-0.50.0.tar.gz) = 1399202 +TIMESTAMP = 1561108166 +SHA256 (meson-0.51.0.tar.gz) = 2f75fdf6d586d3595c03a07afcd0eaae11f68dd33fea5906a434d22a409ed63f +SIZE (meson-0.51.0.tar.gz) = 1449724 Index: head/devel/meson/files/patch-mesonbuild_dependencies_base.py =================================================================== --- head/devel/meson/files/patch-mesonbuild_dependencies_base.py (revision 505002) +++ head/devel/meson/files/patch-mesonbuild_dependencies_base.py (revision 505003) @@ -1,100 +1,101 @@ https://github.com/mesonbuild/meson/pull/4325 -From 158d627c141859e28bbca2c2126b5306608aac6e Mon Sep 17 00:00:00 2001 +From c4686de2612157a4040766738a700b710d866da4 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Thu, 4 Oct 2018 23:30:28 +0800 Subject: [PATCH] PkgConfigDependency: Sort -L flags according to PKG_CONFIG_PATH When there is more than one path in PKG_CONFIG_PATH. It is almost always preferred to find things in the order specified by PKG_CONFIG_PATH instead of assuming pkg-config returns flags in a meaningful order. For example: /usr/local/lib/libgtk-3.so.0 /usr/local/lib/pkgconfig/gtk+-3.0.pc /usr/local/lib/libcanberra-gtk3.so /usr/local/lib/pkgconfig/libcanberra-gtk3.pc /home/mesonuser/.local/lib/libgtk-3.so.0 /home/mesonuser/.local/lib/pkgconfig/gtk+-3.0.pc PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig:/usr/local/lib/pkgconfig" libcanberra-gtk3 is a library which depends on gtk+-3.0. The dependency is mentioned in the .pc file with 'Requires', so flags from gtk+-3.0 are used in both dynamic and static linking. Assume the user wants to compile an application which needs both libcanberra-gtk3 and gtk+-3.0. The application depends on features added in the latest version of gtk+-3.0, which can be found in the home directory of the user but not in /usr/local. When meson asks pkg-config for linker flags of libcanberra-gtk3, pkg-config picks /usr/local/lib/pkgconfig/libcanberra-gtk3.pc and /home/mesonuser/.local/lib/pkgconfig/gtk+-3.0.pc. Since these two libraries come from different prefixes, there will be two -L arguments in the output of pkg-config. If -L/usr/local/lib is put before -L/home/mesonuser/.local/lib, meson will find both libraries in /usr/local/lib instead of picking libgtk-3.so.0 from the home directory. This can result in linking failure such as undefined references error when meson decides to put linker arguments of libcanberra-gtk3 before linker arguments of gtk+-3.0. When both /usr/local/lib/libgtk-3.so.0 and /home/mesonuser/.local/lib/libgtk-3.so.0 are present on the command line, the linker chooses the first one and ignores the second one. If the application needs new symbols that are only available in the second one, the linker will throw an error because of missing symbols. To resolve the issue, we should reorder -L flags according to PKG_CONFIG_PATH ourselves before using it to find the full path of library files. This makes sure that we always follow the preferences of users, without depending on the unreliable part of pkg-config output. Fixes https://github.com/mesonbuild/meson/issues/4271. ---- mesonbuild/dependencies/base.py.orig 2018-09-22 13:22:03 UTC + +--- mesonbuild/dependencies/base.py.orig +++ mesonbuild/dependencies/base.py -@@ -604,6 +604,21 @@ class PkgConfigDependency(ExternalDepend +@@ -706,6 +706,21 @@ def _set_cargs(self): (self.name, out)) self.compile_args = self._convert_mingw_paths(shlex.split(out)) + def _sort_libpaths(self, libpaths, refpaths): + if len(refpaths) == 0: + return list(libpaths) + + def key_func(libpath): + common_lengths = [] + for refpath in refpaths: + common_path = os.path.commonpath([libpath, refpath]) + common_lengths.append(len(common_path)) + max_length = max(common_lengths) + max_index = common_lengths.index(max_length) + reversed_max_length = len(refpaths[max_index]) - max_length + return (max_index, reversed_max_length) + return sorted(libpaths, key=key_func) + def _search_libs(self, out, out_raw): ''' @out: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 pkg-config --libs -@@ -635,6 +650,22 @@ class PkgConfigDependency(ExternalDepend - for arg in raw_link_args: - if arg.startswith('-L') and not arg.startswith(('-L-l', '-L-L')): - prefix_libpaths.add(arg[2:]) +@@ -741,6 +756,22 @@ def _search_libs(self, out, out_raw): + # Resolve the path as a compiler in the build directory would + path = os.path.join(self.env.get_build_dir(), path) + prefix_libpaths.add(path) + # Library paths are not always ordered in a meaningful way + # + # Instead of relying on pkg-config or pkgconf to provide -L flags in a + # specific order, we reorder library paths ourselves, according to th + # order specified in PKG_CONFIG_PATH. See: + # https://github.com/mesonbuild/meson/issues/4271 + # + # Only prefix_libpaths are reordered here because there should not be + # too many system_libpaths to cause library version issues. + pkg_config_path = os.environ.get('PKG_CONFIG_PATH') + if pkg_config_path: + pkg_config_path = pkg_config_path.split(os.pathsep) + else: + pkg_config_path = [] + pkg_config_path = self._convert_mingw_paths(pkg_config_path) + prefix_libpaths = self._sort_libpaths(prefix_libpaths, pkg_config_path) system_libpaths = OrderedSet() full_args = self._convert_mingw_paths(shlex.split(out)) for arg in full_args: Index: head/shells/ksh93/Makefile =================================================================== --- head/shells/ksh93/Makefile (revision 505002) +++ head/shells/ksh93/Makefile (revision 505003) @@ -1,50 +1,48 @@ # $FreeBSD$ PORTNAME= ksh93 DISTVERSION=2020.0.0-alpha1 PORTEPOCH= 1 CATEGORIES= shells MAINTAINER= cy@freebsd.org COMMENT= AT&T KornShell 93 LICENSE= EPL USES= compiler:c11 meson ninja python:build USE_GITHUB= yes GH_ACCOUNT= att GH_PROJECT= ast GH_TAGNAME= ${HASH} KSH_CONFLICTS= pdksh-* KSH93_CONFLICTS= ksh93-devel-* ast-ksh-* -LDFLAGS+= -lm MESON_BUILD_DIR= build -MAKE_ENV= CCFLAGS="${CFLAGS}" OPTIONS_DEFAULT= KSH93 OPTIONS_SINGLE= BIN_KSH OPTIONS_SINGLE_BIN_KSH= KSH KSH93 KSH_DESC= Install to ${PREFIX}/bin/ksh KSH93_DESC= Install to ${PREFIX}/bin/ksh93 KSH93_EXTRA_PATCHES= ${FILESDIR}/extra-patch-install-as-ksh93 KSH_PLIST_SUB= 93="" KSH93_PLIST_SUB= 93="93" .include post-patch: @${REINPLACE_CMD} -e '/for name in/ s|python.*|${PYTHON_CMD}|g' ${WRKSRC}/scripts/python.sh @${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c .if ${PORT_OPTIONS:MKSH93} @${MV} ${WRKSRC}/src/cmd/ksh93/ksh.1 ${WRKSRC}/src/cmd/ksh93/ksh93.1 .endif .if ${PORT_OPTIONS:MKSH} @# Keep portlint happy .endif .include Index: head/shells/ksh93-devel/Makefile =================================================================== --- head/shells/ksh93-devel/Makefile (revision 505002) +++ head/shells/ksh93-devel/Makefile (revision 505003) @@ -1,53 +1,51 @@ # $FreeBSD$ PORTNAME= ksh93 PORTVERSION= ${AST_COMMIT_DATE} CATEGORIES= shells PKGNAMESUFFIX= -devel MAINTAINER= cy@FreeBSD.org COMMENT= Development branch of AT&T KornShell 93 LICENSE= EPL USES= compiler:c11 meson ninja python:build HASH= 9560ca1 AST_COMMIT_DATE= 2019.06.22 USE_GITHUB= yes GH_ACCOUNT= att GH_PROJECT= ast GH_TAGNAME= ${HASH} KSH_CONFLICTS= pdksh-* KSH93_CONFLICTS= ksh93-2* ast-ksh-* -LDFLAGS+= -lm MESON_BUILD_DIR= build -MAKE_ENV= CCFLAGS="${CFLAGS}" OPTIONS_DEFAULT= KSH93 OPTIONS_SINGLE= BIN_KSH OPTIONS_SINGLE_BIN_KSH= KSH KSH93 KSH_DESC= Install to ${PREFIX}/bin/ksh KSH93_DESC= Install to ${PREFIX}/bin/ksh93 KSH93_EXTRA_PATCHES= ${FILESDIR}/extra-patch-install-as-ksh93 KSH_PLIST_SUB= 93="" KSH93_PLIST_SUB= 93="93" .include post-patch: @${REINPLACE_CMD} -e '/for name in/ s|python.*|${PYTHON_CMD}|g' ${WRKSRC}/scripts/python.sh @${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c .if ${PORT_OPTIONS:MKSH93} @${MV} ${WRKSRC}/src/cmd/ksh93/ksh.1 ${WRKSRC}/src/cmd/ksh93/ksh93.1 .endif .if ${PORT_OPTIONS:MKSH} @# Keep portlint happy .endif .include Index: head/x11/terminology/Makefile =================================================================== --- head/x11/terminology/Makefile (revision 505002) +++ head/x11/terminology/Makefile (revision 505003) @@ -1,27 +1,27 @@ # Created by: Grzegorz Blach # $FreeBSD$ PORTNAME= terminology DISTVERSION= 1.4.1 CATEGORIES= x11 enlightenment MASTER_SITES= http://download.enlightenment.org/rel/apps/${PORTNAME}/ DIST_SUBDIR= enlightenment MAINTAINER= enlightenment@FreeBSD.org COMMENT= EFL Terminal Emulator LICENSE= BSD2CLAUSE LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libefl.so:devel/efl USES= compiler:c11 meson pkgconfig tar:xz OPTIONS_DEFINE= NLS OPTIONS_SUB= yes NLS_USES= gettext NLS_MESON_TRUE= nls -NLS_LDFLAGS= -lintl +NLS_LDFLAGS= -L${LOCALBASE}/lib -lintl .include