aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2016-10-01 03:24:30 +0800
committertijl <tijl@FreeBSD.org>2016-10-01 03:24:30 +0800
commitf493fce6a3261de0136fe170a7b704c4fe236b88 (patch)
tree8b44219153a720f367633c8fe248933750735b7d /Mk
parent70cc79c60e2f5a9e208b1727c67b6fe406e80c61 (diff)
downloadfreebsd-ports-gnome-f493fce6a3261de0136fe170a7b704c4fe236b88.tar.gz
freebsd-ports-gnome-f493fce6a3261de0136fe170a7b704c4fe236b88.tar.zst
freebsd-ports-gnome-f493fce6a3261de0136fe170a7b704c4fe236b88.zip
Let USES=localbase add -L${LOCALBASE}/lib to LIBS instead of LDFLAGS.
USES=localbase:ldflags can be used to set LDFLAGS. Normally LDFLAGS appears too early on the command line causing some ports to link with their own libraries in LOCALBASE (if installed) instead of WRKSRC. Also make use of _USES_POST so -L${LOCALBASE}/lib is added as late as possible after anything a port Makefile might set. Use _USES_POST instead of .include in libedit.mk and libarchive.mk so things like 'USES=libedit localbase:ldflags' work correctly. Fix some issues with LIBS in some ports. Switch ports that don't support LIBS to localbase:ldflags. PR: 212987 Exp-run by: antoine Approved by: portmgr (antoine)
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/libarchive.mk2
-rw-r--r--Mk/Uses/libedit.mk2
-rw-r--r--Mk/Uses/localbase.mk13
3 files changed, 13 insertions, 4 deletions
diff --git a/Mk/Uses/libarchive.mk b/Mk/Uses/libarchive.mk
index 894e753a1a0d..d5519a98faf1 100644
--- a/Mk/Uses/libarchive.mk
+++ b/Mk/Uses/libarchive.mk
@@ -10,7 +10,7 @@
.if !defined(_INCLUDE_USES_LIBARCHIVE_MK)
_INCLUDE_USES_LIBARCHIVE_MK= yes
-.include "${USESDIR}/localbase.mk"
+_USES_POST+= localbase
LIB_DEPENDS+= libarchive.so.13:archivers/libarchive
.endif
diff --git a/Mk/Uses/libedit.mk b/Mk/Uses/libedit.mk
index 4108d7e6ef0c..876b386663ed 100644
--- a/Mk/Uses/libedit.mk
+++ b/Mk/Uses/libedit.mk
@@ -10,7 +10,7 @@
.if !defined(_INCLUDE_USES_LIBEDIT_MK)
_INCLUDE_USES_LIBEDIT_MK= yes
-.include "${USESDIR}/localbase.mk"
+_USES_POST+= localbase
LIB_DEPENDS+= libedit.so.0:devel/libedit
.endif
diff --git a/Mk/Uses/localbase.mk b/Mk/Uses/localbase.mk
index 8f0c3c61db0a..c620e64a0563 100644
--- a/Mk/Uses/localbase.mk
+++ b/Mk/Uses/localbase.mk
@@ -3,18 +3,27 @@
# handle enforcing localbase in path
#
# Feature: localbase
-# Usage: USES=localbase
-# Valid ARGS: none
+# Usage: USES=localbase or USES=localbase:args
+# Valid ARGS: ldflags Set LDFLAGS instead of LIBS
#
# MAINTAINER: portmgr@FreeBSD.org
.if !defined(_INCLUDE_USES_LOCALBASE_MK)
_INCLUDE_USES_LOCALBASE_MK= yes
+_USES_POST+= localbase
+.endif
+
+.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_LOCALBASE_POST_MK)
+_INCLUDE_USES_LOCALBASE_POST_MK=yes
CPPFLAGS+= -isystem ${LOCALBASE}/include
CFLAGS+= -isystem ${LOCALBASE}/include
CXXFLAGS+= -isystem ${LOCALBASE}/include
+.if ${localbase_ARGS:Mldflags}
LDFLAGS+= -L${LOCALBASE}/lib
+.else
+LIBS+= -L${LOCALBASE}/lib
+.endif
# Use CONFIGURE_ENV instead of CMAKE_ARGS because devel/cmake itself also needs
# this, and CMAKE_ARGS is not used when bootstrapping CMake.