blob: 5865048c298b497ca67cd6a1c268e9c868bafb7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# $NetBSD: Makefile.readline,v 1.3 2001/05/22 05:57:04 jlam Exp $
#
# This Makefile fragment is included by packages that use readline().
#
# If readline() is not present in the base system through libedit, then a
# dependency on devel/readline is added, the appropriate headers are linked
# into ${WRKINCDIR} (${WRKSRC}/include), and the appropriate libraries are
# linked into ${WRKLIBDIR} (${WRKSRC}/lib).
#
# To use this Makefile fragment, simply:
#
# (1) Optionally define USE_GNU_READLINE to force use of GNU readline.
# (2) Optionally define READLINE_REQD to the version of GNU readline desired.
# (3) Include this Makefile fragment in the package Makefile,
# (4) Optionally define WRKINCDIR and WRKLIBDIR,
# (5) Add link-readline-headers and link-readline-libs to the prerequisite
# targets for pre-configure,
# (6) Add ${WRKINCDIR} to the front of the C preprocessor's header search
# path, and
# (7) Add ${WRKLIBDIR} to the front of the linker's library search path.
#
# NOTE: You may need to do some more work to get libedit recognized over
# libreadline, especially by GNU configure scripts.
READLINE_REQD?= 2.2
.if defined(USE_GNU_READLINE)
READLINE_INCDIR= ${LOCALBASE}/include/readline
LIBREADLINE= ${LOCALBASE}/lib/libreadline.a
LIBREADLINE+= ${LOCALBASE}/lib/libreadline.so*
LIBHISTORY= ${LOCALBASE}/lib/libhistory.a
LIBHISTORY+= ${LOCALBASE}/lib/libhistory.so*
DEPENDS+= readline>=${READLINE_REQD}:../../devel/readline
.else
.if exists(/usr/include/readline.h)
READLINE_H= /usr/include/readline.h
HISTORY_H= /usr/include/history.h
LIBREADLINE= /usr/lib/libedit.a
LIBREADLINE+= /usr/lib/libedit.so*
LIBHISTORY= /usr/lib/libedit.a
LIBHISTORY+= /usr/lib/libedit.so*
HAVE_LIBEDIT_READLINE= # defined
.elif exists(/usr/include/readline/readline.h)
READLINE_INCDIR= /usr/include/readline
LIBREADLINE= /usr/lib/libedit.a
LIBREADLINE+= /usr/lib/libedit.so*
LIBHISTORY= /usr/lib/libedit.a
LIBHISTORY+= /usr/lib/libedit.so*
HAVE_LIBEDIT_READLINE= # defined
.else
READLINE_INCDIR= ${LOCALBASE}/include/readline
LIBREADLINE= ${LOCALBASE}/lib/libreadline.a
LIBREADLINE+= ${LOCALBASE}/lib/libreadline.so*
LIBHISTORY= ${LOCALBASE}/lib/libhistory.a
LIBHISTORY+= ${LOCALBASE}/lib/libhistory.so*
DEPENDS+= readline>=${READLINE_REQD}:../../devel/readline
.endif
.endif
WRKINCDIR?= ${WRKDIR}/include
WRKLIBDIR?= ${WRKDIR}/lib
# This target links the readline and history headers into ${WRKINCDIR},
# which should be searched first by the C preprocessor.
#
link-readline-headers:
${MKDIR} -p ${WRKINCDIR}/readline
${RM} -f ${WRKINCDIR}/readline/*
.if defined(READLINE_INCDIR)
for inc in ${READLINE_INCDIR}/*; do \
${LN} -sf $${inc} ${WRKINCDIR}/readline; \
done
.else
${LN} -sf ${READLINE_H} ${WRKINCDIR}/readline
${LN} -sf ${HISTORY_H} ${WRKINCDIR}/readline
.endif
# This target links the readline and history libraries into ${WRKLIBDIR},
# which should be searched first by the linker.
#
link-readline-libs:
${MKDIR} -p ${WRKLIBDIR}
for lib in ${LIBREADLINE}; do \
dest=`${BASENAME} $${lib} | ${SED} "s|libedit|libreadline|"`; \
${LN} -sf $${lib} ${WRKLIBDIR}/$${dest}; \
done
for lib in ${LIBHISTORY}; do \
dest=`${BASENAME} $${lib} | ${SED} "s|libedit|libhistory|"`; \
${LN} -sf $${lib} ${WRKLIBDIR}/$${dest}; \
done
|