blob: 980fa67c35f5766b010b6db23c15f40f207a1676 (
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# $NetBSD: buildlink.mk,v 1.8 2001/06/10 00:09:30 jlam Exp $
#
# This Makefile fragment is included by packages that use readline().
#
# 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 BUILDLINK_INCDIR and BUILDLINK_LIBDIR,
# (5) Add ${BUILDLINK_INCDIR} to the front of the C preprocessor's header
# search path, and
# (6) Add ${BUILDLINK_LIBDIR} 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.
.if !defined(READLINE_BUILDLINK_MK)
READLINE_BUILDLINK_MK= # defined
READLINE_REQD?= 2.2
.if defined(USE_GNU_READLINE)
_NEED_GNU_READLINE= YES
.elif exists(/usr/include/readline.h) || \
exists(/usr/include/readline/readline.h)
_NEED_GNU_READLINE= NO
.else
_NEED_GNU_READLINE= YES
.endif
.if ${_NEED_GNU_READLINE} == "YES"
DEPENDS+= readline>=${READLINE_REQD}:../../devel/readline
READLINE_HEADERS= ${LOCALBASE}/include/readline/*
READLINE_LIBS= ${LOCALBASE}/lib/libreadline.*
HISTORY_LIBS+= ${LOCALBASE}/lib/libhistory.*
.else
.if exists(/usr/include/readline.h)
HAVE_LIBEDIT_READLINE= # defined
READLINE_HEADERS= /usr/include/readline.h
READLINE_HEADERS+= /usr/include/history.h
READLINE_LIBS= /usr/lib/libedit.*
HISTORY_LIBS= /usr/lib/libedit.*
.else # exists(/usr/include/readline/readline.h)
HAVE_LIBEDIT_READLINE= # defined
READLINE_HEADERS= /usr/include/readline/*
READLINE_LIBS= /usr/lib/libedit.*
HISTORY_LIBS= /usr/lib/libedit.*
.endif
.endif
BUILDLINK_INCDIR?= ${WRKDIR}/include
BUILDLINK_LIBDIR?= ${WRKDIR}/lib
READLINE_BUILDLINK_COOKIE= ${WRKDIR}/.readline_buildlink_done
READLINE_BUILDLINK_TARGETS= link-readline-headers
.if defined(HAVE_LIBEDIT_READLINE) && defined(USE_LIBTOOL)
READLINE_BUILDLINK_TARGETS+= editline-libtool-archive
.endif
READLINE_BUILDLINK_TARGETS+= link-readline-libs
BUILDLINK_TARGETS+= ${READLINE_BUILDLINK_COOKIE}
pre-configure: ${READLINE_BUILDLINK_COOKIE}
${READLINE_BUILDLINK_COOKIE}: ${READLINE_BUILDLINK_TARGETS}
@${TOUCH} ${TOUCH_FLAGS} ${READLINE_BUILDLINK_COOKIE}
# This target links the headers into ${BUILDLINK_INCDIR}, which should
# be searched first by the C preprocessor.
#
link-readline-headers:
@${ECHO} "Linking readline headers into ${BUILDLINK_INCDIR}."
@${MKDIR} ${BUILDLINK_INCDIR}/readline
@${RM} -f ${BUILDLINK_INCDIR}/readline/*
@for inc in ${READLINE_HEADERS}; do \
dest=${BUILDLINK_INCDIR}/readline/`${BASENAME} $${inc}`; \
if [ -f $${inc} ]; then \
${RM} -f $${dest}; \
${LN} -sf $${inc} $${dest}; \
fi; \
done
# This target links the libraries into ${BUILDLINK_LIBDIR}, which should
# be searched first by the linker.
#
link-readline-libs:
@${ECHO} "Linking readline libraries into ${BUILDLINK_LIBDIR}."
@${MKDIR} ${BUILDLINK_LIBDIR}
@for lib in ${READLINE_LIBS}; do \
name=`${BASENAME} $${lib} | ${SED} "s|libedit|libreadline|"`; \
dest=${BUILDLINK_LIBDIR}/$${name}; \
if [ -f $${lib} ]; then \
${RM} -f $${dest}; \
${LN} -sf $${lib} $${dest}; \
fi; \
done
@for lib in ${HISTORY_LIBS}; do \
name=`${BASENAME} $${lib} | ${SED} "s|libedit|libhistory|"`; \
dest=${BUILDLINK_LIBDIR}/$${name}; \
if [ -f $${lib} ]; then \
${RM} -f $${dest}; \
${LN} -sf $${lib} $${dest}; \
fi; \
done
.if defined(HAVE_LIBEDIT_READLINE) && defined(USE_LIBTOOL)
editline-libtool-archive:
@${ECHO} "Creating editline libtool archive in ${BUILDLINK_LIBDIR}."
@${MKDIR} ${BUILDLINK_LIBDIR}
@cd /usr/lib; for lib in libedit.so.*.*; do \
major=`${ECHO} $$lib | ${SED} "s|.*\.so\.||;s|\..*||"`; \
minor=`${ECHO} $$lib | ${SED} "s|.*\.||"`; \
done; \
cd ${BUILDLINK_LIBDIR}; \
${LIBTOOL} --quiet --mode=link ${CC} -o libedit.la \
-version-info $$major:$$minor -rpath /usr/lib; \
${LIBTOOL} --quiet --mode=install ${CP} libedit.la \
${BUILDLINK_LIBDIR} 2>/dev/null; \
${RM} -f libedit.a; \
${RM} -f libreadline.la; \
${LN} -sf libedit.la libreadline.la
.endif
.endif # READLINE_BUILDLINK_MK
|