Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/ncurses.mk
Show All 18 Lines | |||||
# BUILD_DEPENDS - are added if needed | # BUILD_DEPENDS - are added if needed | ||||
# RUN_DEPENDS - are added if needed | # RUN_DEPENDS - are added if needed | ||||
# | # | ||||
# MAINTAINER: ports@FreeBSD.org | # MAINTAINER: ports@FreeBSD.org | ||||
.if !defined(_INCLUDE_USES_NCURSES_MK) | .if !defined(_INCLUDE_USES_NCURSES_MK) | ||||
_INCLUDE_USES_NCURSES_MK= yes | _INCLUDE_USES_NCURSES_MK= yes | ||||
.if empty(ncurses_ARGS) | . if empty(ncurses_ARGS) | ||||
. if !exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so) && exists(${DESTDIR}/usr/lib/libncursesw.so) | . if !exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so) && exists(${DESTDIR}/usr/lib/libncursesw.so) | ||||
ncurses_ARGS= base | ncurses_ARGS= base | ||||
. else | . else | ||||
ncurses_ARGS= port | ncurses_ARGS= port | ||||
. endif | . endif | ||||
.endif | . endif | ||||
.if ${ncurses_ARGS} == base | . if ${ncurses_ARGS} == base | ||||
NCURSESBASE= /usr | NCURSESBASE= /usr | ||||
NCURSESINC= ${NCURSESBASE}/include | NCURSESINC= ${NCURSESBASE}/include | ||||
. if exists(${LOCALBASE}/lib/libncurses.so) | . if exists(${LOCALBASE}/lib/libncurses.so) | ||||
_USES_sanity+= 400:check-depends-ncurses | _USES_sanity+= 400:check-depends-ncurses | ||||
check-depends-ncurses: | check-depends-ncurses: | ||||
@${ECHO_CMD} "Dependency error: this port wants the ncurses library from the FreeBSD" | @${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} "base system. You can't build against it, while a newer" | ||||
@${ECHO_CMD} "version is installed by a port." | @${ECHO_CMD} "version is installed by a port." | ||||
@${ECHO_CMD} "Please deinstall the port or undefine WITH_NCURSES_BASE." | @${ECHO_CMD} "Please deinstall the port or undefine WITH_NCURSES_BASE." | ||||
@${FALSE} | @${FALSE} | ||||
. endif | . endif | ||||
.elif ${ncurses_ARGS} == port | . elif ${ncurses_ARGS} == port | ||||
NCURSESBASE= ${LOCALBASE} | NCURSESBASE= ${LOCALBASE} | ||||
NCURSESINC= ${LOCALBASE}/include/ncurses | NCURSESINC= ${LOCALBASE}/include/ncurses | ||||
. if !defined(NCURSES_PORT) && exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so) | . if !defined(NCURSES_PORT) && exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so) | ||||
PKG_DBDIR?= ${DESTDIR}/var/db/pkg | PKG_DBDIR?= ${DESTDIR}/var/db/pkg | ||||
. if defined(DESTDIR) | . if defined(DESTDIR) | ||||
PKGARGS= -c ${DESTDIR} | PKGARGS= -c ${DESTDIR} | ||||
. endif | . endif | ||||
PKGARGS?= | PKGARGS?= | ||||
NCURSES_INSTALLED!= ${PKG_BIN} ${PKGARGS} which -qo ${LOCALBASE}/lib/libncurses.so || : | NCURSES_INSTALLED!= ${PKG_BIN} ${PKGARGS} which -qo ${LOCALBASE}/lib/libncurses.so || : | ||||
. endif | . endif | ||||
NCURSES_INSTALLED?= | NCURSES_INSTALLED?= | ||||
.if ${NCURSES_INSTALLED} != "" | . if ${NCURSES_INSTALLED} != "" | ||||
NCURSES_PORT= ${NCURSES_INSTALLED} | NCURSES_PORT= ${NCURSES_INSTALLED} | ||||
NCURSES_SHLIBFILE!= ${PKG_INFO} -ql ${NCURSES_INSTALLED} | grep -m 1 "^`${PKG_QUERY} "%p" ${NCURSES_INSTALLED}`/lib/libncurses.so." | NCURSES_SHLIBFILE!= ${PKG_INFO} -ql ${NCURSES_INSTALLED} | grep -m 1 "^`${PKG_QUERY} "%p" ${NCURSES_INSTALLED}`/lib/libncurses.so." | ||||
NCURSES_SHLIBVER?= ${NCURSES_SHLIBFILE:E} | NCURSES_SHLIBVER?= ${NCURSES_SHLIBFILE:E} | ||||
.endif | . endif | ||||
NCURSES_PORT?= devel/ncurses | NCURSES_PORT?= devel/ncurses | ||||
NCURSES_SHLIBVER?= 6 | NCURSES_SHLIBVER?= 6 | ||||
BUILD_DEPENDS+= ${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${NCURSES_PORT} | BUILD_DEPENDS+= ${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${NCURSES_PORT} | ||||
RUN_DEPENDS+= ${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${NCURSES_PORT} | RUN_DEPENDS+= ${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${NCURSES_PORT} | ||||
NCURSESRPATH= ${NCURSESBASE}/lib | NCURSESRPATH= ${NCURSESBASE}/lib | ||||
TINFO_LIB= -ltinfo | TINFO_LIB= -ltinfo | ||||
NCURSES_LIB= -lncurses | NCURSES_LIB= -lncurses | ||||
.if defined(NCURSES_RPATH) | . if defined(NCURSES_RPATH) | ||||
CFLAGS+= -Wl,-rpath,${NCURSESRPATH} | CFLAGS+= -Wl,-rpath,${NCURSESRPATH} | ||||
.endif | . endif | ||||
LDFLAGS+= -Wl,-rpath=${NCURSESRPATH} | LDFLAGS+= -Wl,-rpath=${NCURSESRPATH} | ||||
.else | . else | ||||
.error USES=ncurses only accept 'port' and 'base' as arguments, got ${ncurses_ARGS} | .error USES=ncurses only accept 'port' and 'base' as arguments, got ${ncurses_ARGS} | ||||
.endif | . endif | ||||
NCURSESLIB= ${NCURSESBASE}/lib | NCURSESLIB= ${NCURSESBASE}/lib | ||||
NCURSES_IMPL?= ncursesw | NCURSES_IMPL?= ncursesw | ||||
TINFO_LIB?= -ltinfow | TINFO_LIB?= -ltinfow | ||||
NCURSES_LIB?= -lncursesw | NCURSES_LIB?= -lncursesw | ||||
NCURSESLIBS= ${NCURSES_LIB} ${TINFO_LIB} | NCURSESLIBS= ${NCURSES_LIB} ${TINFO_LIB} | ||||
.endif | .endif |