3 # handle dependency on the ncurses port
7 # Valid ARGS: base port
9 # use/port can now set this options to the makefiles
10 # NCURSES_RPATH= yes - pass RFLAGS options to CFLAGS
12 # Overridable defaults:
13 # NCURSES_PORT= devel/ncurses
15 # The makefile sets the following variables:
16 # NCURSESBASE - "/usr" or ${LOCALBASE}
17 # NCURSESLIB - path to the libs
18 # NCURSESINC - path to the matching includes
19 # NCURSESRPATH - rpath for dynamic linker
21 # BUILD_DEPENDS - are added if needed
22 # RUN_DEPENDS - are added if needed
24 # MAINTAINER: portmgr@FreeBSD.org
26 .if !defined(_INCLUDE_USES_NCURSES_MK)
27 _INCLUDE_USES_NCURSES_MK= yes
29 .if empty(ncurses_ARGS)
30 . if !exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so) && exists(${DESTDIR}/usr/lib/libncurses.so)
37 .if ${ncurses_ARGS} == base
39 NCURSESINC= ${NCURSESBASE}/include
41 . if exists(${LOCALBASE}/lib/libncurses.so)
42 _USES_sanity+= 400:check-depends-ncurses
43 check-depends-ncurses:
44 @${ECHO_CMD} "Dependency error: this port wants the ncurses library from the FreeBSD"
45 @${ECHO_CMD} "base system. You can't build against it, while a newer"
46 @${ECHO_CMD} "version is installed by a port."
47 @${ECHO_CMD} "Please deinstall the port or undefine WITH_NCURSES_BASE."
51 NCURSESRPATH= /usr/lib:${LOCALBASE}/lib
53 .elif ${ncurses_ARGS} == port
54 NCURSESBASE= ${LOCALBASE}
55 NCURSESINC= ${LOCALBASE}/include/ncurses
57 . if !defined(NCURSES_PORT) && exists(${DESTDIR}/${LOCALBASE}/lib/libncurses.so)
58 PKG_DBDIR?= ${DESTDIR}/var/db/pkg
60 PKGARGS= -c ${DESTDIR}
63 NCURSES_INSTALLED!= ${PKG_BIN} ${PKGARGS} which -qo ${LOCALBASE}/lib/libncurses.so || :
67 . if ${NCURSES_INSTALLED} != ""
68 NCURSES_PORT= ${NCURSES_INSTALLED}
69 NCURSES_SHLIBFILE!= ${PKG_INFO} -ql ${NCURSES_INSTALLED} | grep -m 1 "^`pkg query "%p" ${NCURSES_INSTALLED}`/lib/libncurses.so."
70 NCURSES_SHLIBVER?= ${NCURSES_SHLIBFILE:E}
73 NCURSES_PORT?= devel/ncurses
74 . if exists (/usr/lib/priv/libprivate_ncursesw.so)
80 BUILD_DEPENDS+= ${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${NCURSES_PORT}
81 RUN_DEPENDS+= ${LOCALBASE}/lib/libncurses.so.${NCURSES_SHLIBVER}:${NCURSES_PORT}
82 NCURSESRPATH= ${NCURSESBASE}/lib
83 LDFLAGS+= -L${NCURSESRPATH} -Wl,-rpath=${NCURSESRPATH}
84 CFLAGS+= -I${NCURSESBASE}/include -I${NCURSESINC}
86 . if defined(NCURSES_RPATH)
87 CFLAGS+= -Wl,-rpath,${NCURSESRPATH}
91 .error USES=ncurses only accept 'port' and 'base' as arguments, got ${ncurses_ARGS}
94 NCURSESLIB= ${NCURSESBASE}/lib