1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-30 01:15:52 +00:00
freebsd-ports/Mk/Uses/localbase.mk
Tijl Coosemans 1ee4da6dd1 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)
2016-09-30 19:24:30 +00:00

32 lines
843 B
Makefile

# $FreeBSD$
#
# handle enforcing localbase in path
#
# Feature: localbase
# 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.
CONFIGURE_ENV+= CMAKE_PREFIX_PATH="${LOCALBASE}"
.endif