Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 May 2013 15:31:45 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r317523 - in head: . Mk/Uses
Message-ID:  <201305061531.r46FVj7Q046867@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Mon May  6 15:31:45 2013
New Revision: 317523
URL: http://svnweb.freebsd.org/changeset/ports/317523

Log:
  Add new USES: ncurses and readline

Added:
  head/Mk/Uses/ncurses.mk   (contents, props changed)
  head/Mk/Uses/readline.mk   (contents, props changed)
Modified:
  head/CHANGES

Modified: head/CHANGES
==============================================================================
--- head/CHANGES	Mon May  6 15:22:57 2013	(r317522)
+++ head/CHANGES	Mon May  6 15:31:45 2013	(r317523)
@@ -10,6 +10,22 @@ in the release notes and/or placed into 
 
 All ports committers are allowed to commit to this file.
 
+20130506:
+AUTHOR: bapt@FreeBSD.org
+
+  * New USES macro to handle linking on ncurses and on readline
+
+  USES= ncurses will set env and make the port link to base version of ncurses
+  if no port version is installed otherwise it will link against port version
+  USES= ncurses:port will for the port to link against the ports version of
+  ncurses
+  USES= ncurses:base will force to link against base version of ncurses.
+
+  USES= readline will make the port link against base version of readline except
+  on 10+ where it will force dependency on the port version of readline
+  USES= readline:port will anyway force dependency on the port version of
+  readline.
+
 20130426:
 AUTHOR: mva@FreeBSD.org
 

Added: head/Mk/Uses/ncurses.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/Mk/Uses/ncurses.mk	Mon May  6 15:31:45 2013	(r317523)
@@ -0,0 +1,102 @@
+# $FreeBSD$
+#
+# handle dependency on the ncurses port
+#
+# MAINTAINER: portmgr@FreeBSD.org
+#
+# Feature:	ncurses
+# Usage:	USES=ncurses
+# Valid ARGS:	base port
+#
+# use/port can now set this options to the makefiles
+# NCURSES_RPATH= yes	- pass RFLAGS options to CFLAGS
+#
+# Overridable defaults:
+# NCURSES_PORT=	devel/ncurses
+#
+# The makefile sets this variables:
+# NCURSESBASE		- "/usr" or ${LOCALBASE}
+# NCURSESLIB		- path to the libs
+# NCURSESINC		- path to the matching includes
+# NCURSESRPATH		- rpath for dynamic linker
+#
+# BUILD_DEPENDS		- are added if needed
+# RUN_DEPENDS		- are added if needed
+
+.if !defined(_INCLUDE_USES_NCURSES_MK)
+_INCLUDE_USES_NCURSES_MK=	yes
+
+.if !defined(ncurses_ARGS)
+.  if !exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so) && exists(${DESTDIR}/usr/include/ncurses.h)
+ncurses_ARGS=	base
+.  endif
+ncurses_ARGS?=	port
+.endif
+
+.if ${ncurses_ARGS} == base
+NCURSESBASE=	/usr
+NCURSESINC=	${NCURSESBASE}/include
+
+.  if exists(${LOCALBASE}/lib/libncurses.so)
+check-depends::
+	@${ECHO_CMD} "Dependency error: this port wants the ncurses library from the FreeBSD"
+	@${ECHO_CMD} "base system. You can't build against it, while a newer"
+	@${ECHO_CMD} "version is installed by a port."
+	@${ECHO_CMD} "Please deinstall the port or undefine WITH_NCURSES_BASE."
+	@${FALSE}
+.  endif
+
+NCURSESPATH=	/usr/lib:${LOCALBASE}/lib
+
+.elif ${ncurses_ARGS} == port
+NCURSESBASE=	${LOCALBASE}
+NCURSESINC=	${LOCALBASE}/include/ncurses
+
+.  if !defined(NCURSES_PORT) && exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so)
+PKG_DBDIR?=	${DESTDIR}/var/db/pkg
+.    if defined(WITH_PKGNG)
+.      if defined(DESTDIR)
+PKGARGS=	-c ${DESTDIR}
+.      endif
+PKGARGS?=
+NCURSES_INSTALLED!=	${PKG_BIN} ${PKGARGS} which -qo ${LOCALBASE}/lib/libncurses.so || :
+.    else
+NCURSES_INSTALLED!=	find "${PKG_DBDIR}/" -type f -name "+CONTENTS" -print0 | \
+			xargs -0 grep -l "^lib/libncurses.so." | \
+			while read contents; do \
+				ncursesprefix=`grep "^@cwd " "$${contents}" | ${HEAD} -n 1`; \
+				if test "$${ncursesprefix}" = "@cwd ${LOCALBASE}" ; then \
+					echo "$${contents}"; break; fi; done; ${ECHO_CMD}
+.    endif
+.  endif
+.else
+.error		USES=ncurses only accept 'port' and 'base' as arguments, got ${ncurses_ARGS}
+.endif
+NCURSES_INSTALLED?=
+
+.if ${NCURSES_INSTALLED} != ""
+.  if defined(WITH_PKGNG)
+NCURSES_PORT=	${NCURSES_INSTALLED}
+NCURSES_SHLIBFILE!=	${PKG_INFO} -ql ${NCURSES_INSTALLED} | grep -m 1 "^`pkg query "%p" ${NCURSES_INSTALLED}`/lib/libncurses.so."
+.  else
+NCURSES_PORT!=		grep "^@comment ORIGIN:" "${NCURSES_INSTALLED}" | ${CUT} -d : -f 2
+NCURSES_SHLIBFILE!=	grep -m 1 "^lib/libncurses.so." "${NCURSES_INSTALLED}"
+.  endif
+NCURSES_SHLIBVER?=	${NCURSES_SHLIBFILE:E}
+.endif
+
+NCURSES_PORT?=		devel/ncurses
+NCURSES_SHLIBVER?=	5
+
+BUILD_DEPENDS+=		${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${PORTSDIR}/${NCURSES_PORT}
+RUN_DEPENDS+=		${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${PORTSDIR}/${NCURSES_PORT}
+NCURSESRPATH=		${LOCALBASE}/lib
+
+NCURSESLIB=	${NCURSESBASE}/lib
+
+.if defined(NCURSES_RPATH)
+CFLAGS+=	-Wl,-rpath,${NCURSESRPATH}
+.endif
+LDFLAGS+=	-Wl,-rpath=${NCURSESPATH}
+
+.endif

Added: head/Mk/Uses/readline.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/Mk/Uses/readline.mk	Mon May  6 15:31:45 2013	(r317523)
@@ -0,0 +1,25 @@
+# $FreeBSD$
+#
+# handle dependency on the readline port
+#
+# MAINTAINER: portmgr@FreeBSD.org
+#
+# Feature:	readline
+# Usage:	USES=readline
+# Valid ARGS:	port
+#
+
+.if !defined(_INCLUDE_USES_READLINE_MK)
+_INCLUDE_USES_READLINE_MK=	yes
+
+.if ${OSVERSION} > 1000000
+readline_ARGS=	port
+.endif
+
+.if defined(readline_ARGS) && ${readline_ARGS} == port
+LIB_DEPENDS+=		readline.6:${PORTSDIR}/devel/readline
+CPPFLAGS+=		-I${LOCALBASE}/include
+LDFLAGS+=		-L${LOCALBASE}/lib -lreadline
+.endif
+
+.endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305061531.r46FVj7Q046867>