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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# $NetBSD: module.mk,v 1.45 2005/05/18 22:42:07 jlam Exp $
#
# This Makefile fragment is intended to be included by packages that build
# and install perl5 modules.
#
# The following targets are provided by this file:
#
# perl5-configure runs the standard perl configuration in
# each of the directories specified in
# ${PERL5_CONFIGURE_DIRS}.
#
# do-configure runs the perl5-configure target; if PERL5_CONFIGURE
# is set to "YES", then this target overrides the
# default do-configure provided by bsd.pkg.mk.
#
# The following variables may be set prior to including this file:
#
# PERL5_CONFIGURE if "YES", then for do-configure, run the standard
# perl configuration assuming Makefile.PL exists;
# defaults to "YES".
#
# PERL5_CONFIGURE_DIRS list of directories in which to run the
# standard perl configuration; defaults to
# ${CONFIGURE_DIRS}.
#
# PERL5_LDFLAGS extra linker flags to pass on to the build
# process.
#
# PERL5_MODULE_TYPE "MakeMaker" or "Module::Build" depending on which
# framework is used to build/install the module.
.if !defined(_PERL5_MODULE_MK)
_PERL5_MODULE_MK= # defined
.include "../../mk/bsd.prefs.mk"
BUILDLINK_DEPMETHOD.perl+= full
BUILDING_PERL5?= no
BUILDING_MODULE_BUILD?= no
PERL5_MODULE_TYPE?= MakeMaker
.if (${PERL5_MODULE_TYPE} != "MakeMaker") && \
(${PERL5_MODULE_TYPE} != "Module::Build")
PKG_FAIL_REASON+= "\`\`${PERL5_MODULE_TYPE}'' is not a supported PERL5_MODULE_TYPE."
.endif
.if empty(BUILDING_PERL5:M[yY][eE][sS])
. include "../../lang/perl5/buildlink3.mk"
.endif
.if empty(BUILDING_MODULE_BUILD:M[yY][eE][sS]) && \
(${PERL5_MODULE_TYPE} == "Module::Build")
BUILD_DEPENDS+= p5-Module-Build>=0.2608nb1:../../devel/p5-Module-Build
.endif
.include "../../lang/perl5/vars.mk"
PERL5_CONFIGURE?= YES
PERL5_CONFIGURE_DIRS?= ${CONFIGURE_DIRS}
# All pkgsrc-install perl modules are installed into the "site"
# directories.
#
MAKE_PARAMS+= INSTALLDIRS=site
.include "../../mk/compiler.mk"
.if ${OPSYS} == "AIX"
.if !empty(CC_VERSION:Mgcc*)
BROKEN= Perl does not like building with gcc on AIX, please use a different compiler
.endif
.endif
MAKE_ENV+= LC_ALL=C
.if ${PERL5_MODULE_TYPE} == "Module::Build"
_CONF_ARG= Build.PL
.elif ${PERL5_MODULE_TYPE} == "MakeMaker"
_CONF_ARG= Makefile.PL ${MAKE_PARAMS}
.endif
.PHONY: perl5-configure
perl5-configure:
${_PKG_SILENT}${_PKG_DEBUG} \
for dir in ${PERL5_CONFIGURE_DIRS}; do \
if [ -f $$dir/Makefile.PL ]; then \
( cd $$dir && ${SETENV} ${MAKE_ENV} \
${PERL5} ${_CONF_ARG}); \
fi; \
done
.if defined(PERL5_CONFIGURE) && !empty(PERL5_CONFIGURE:M[yY][eE][sS])
. if target(do-configure)
do-configure: perl5-configure
. else
do-configure: perl5-configure
${_PKG_SILENT}${_PKG_DEBUG}${DO_NADA}
. endif
.endif
# Repoint all of the site-specific variables to be under the perl5
# module's ${PREFIX}.
#
.for _var_ in ${_PERL5_SITEVARS} INSTALLSCRIPT
PERL5_${_var_}= ${PREFIX}/${PERL5_SUB_${_var_}}
PERL5_MAKE_FLAGS+= ${_var_}="${PERL5_${_var_}}"
.endfor
.if ${PERL5_MODULE_TYPE} == "MakeMaker"
#
# The PREFIX in the generated Makefile will point to ${_PERL5_PREFIX},
# so override its value to the module's ${PREFIX}.
#
PERL5_MAKE_FLAGS+= PREFIX="${PREFIX}"
.endif
.if ${PERL5_MODULE_TYPE} == "Module::Build"
do-build:
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build
do-test:
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build test
do-install:
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build install
.endif
.if defined(DEFAULT_VIEW.perl)
DEFAULT_VIEW.${PKGBASE}= ${DEFAULT_VIEW.perl}
.endif
.if defined(PERL5_LDFLAGS) && !empty(PERL5_LDFLAGS)
FIX_RPATH+= PERL5_LDFLAGS
LDFLAGS+= ${PERL5_LDFLAGS}
.endif
# MakeMaker provides two hooks, OPTIMIZE and OTHERLDFLAGS, to
# customize the arguments passed to the preprocessor and linker,
# respectively.
#
PERL5_MAKE_FLAGS+= OPTIMIZE="${CFLAGS} ${CPPFLAGS}"
.if ${OBJECT_FMT} == "a.out"
PERL5_MAKE_FLAGS+= OTHERLDFLAGS="${LDFLAGS:S/-Wl,//g}"
.else
PERL5_MAKE_FLAGS+= OTHERLDFLAGS="${LDFLAGS}"
.endif
PLIST_SUBST+= PERL5_SITELIB=${PERL5_SUB_INSTALLSITELIB}
PLIST_SUBST+= PERL5_SITEARCH=${PERL5_SUB_INSTALLSITEARCH}
PLIST_SUBST+= PERL5_ARCHLIB=${PERL5_SUB_INSTALLARCHLIB}
# Generate the PLIST from the files listed in PERL5_PACKLIST.
.if defined(PERL5_PACKLIST)
PERL5_PLIST_COMMENT= \
( ${ECHO} "@comment The following lines are automatically generated"; \
${ECHO} "@comment from the installed .packlist files." )
PERL5_PLIST_FILES= \
( ${CAT} ${PERL5_PACKLIST}; for f in ${PERL5_PACKLIST}; do [ ! -f $$f ] || ${ECHO} $$f; done ) \
| ${SED} -e "s,[ ].*,," -e "s,/\./,/,g" -e "s,${PREFIX}/,," \
| ${SORT} -u
PERL5_PLIST_DIRS= \
( ${CAT} ${PERL5_PACKLIST}; for f in ${PERL5_PACKLIST}; do [ ! -f $$f ] || ${ECHO} $$f; done ) \
| ${SED} -e "s,[ ].*,," -e "s,/\./,/,g" -e "s,${PREFIX}/,," \
-e "s,^,@unexec \${RMDIR} -p %D/," \
-e "s,/[^/]*$$, 2>/dev/null || ${TRUE}," \
| ${SORT} -ur
PERL5_GENERATE_PLIST= ${PERL5_PLIST_COMMENT}; \
${PERL5_PLIST_FILES}; \
${PERL5_PLIST_DIRS}
GENERATE_PLIST+= ${PERL5_GENERATE_PLIST};
.endif
# The build and install stages require slightly different values for
# INSTALLARCHLIB. During the build, INSTALLARCHLIB refers to the
# directory where libperl.so may be found, which should point into the
# default view. During the install, INSTALLARCHLIB refers to the
# directory where the perllocal.pod file should be installed, which
# should point into the package prefix.
#
.if empty(BUILDING_PERL5:M[yY][eE][sS])
MAKE_FLAGS+= ${PERL5_MAKE_FLAGS}
BUILD_MAKE_FLAGS= ${MAKE_FLAGS}
BUILD_MAKE_FLAGS+= INSTALLARCHLIB="${VIEWBASE}/${PERL5_SUB_INSTALLARCHLIB}"
INSTALL_MAKE_FLAGS= ${MAKE_FLAGS}
INSTALL_MAKE_FLAGS+= INSTALLARCHLIB="${PREFIX}/${PERL5_SUB_INSTALLARCHLIB}"
.endif
# Remove the perllocal.pod file from the installation since we don't
# bother keeping the file contents up-to-date anyway.
#
.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
post-install: perl5-post-install
.endif
.PHONY: perl5-post-install
perl5-post-install:
${_PKG_SILENT}${_PKG_DEBUG} \
for dir in \
${PREFIX}/${PERL5_SUB_INSTALLARCHLIB} \
${PERL5_INSTALLSITEARCH}; \
do \
if [ -f $$dir/perllocal.pod ]; then \
${RM} -f $$dir/perllocal.pod; \
fi; \
done
# Default test target for perl5 modules
TEST_TARGET?= test
.endif # _PERL5_MODULE_MK
|