/[ports]/head/Mk/Uses/perl5.mk
ViewVC logotype

Contents of /head/Mk/Uses/perl5.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 473539 - (show annotations) (download)
Fri Jun 29 10:10:35 2018 UTC (6 years ago) by mat
File MIME type: text/plain
File size: 11997 byte(s)
Fix a few Perl ports with Perl 5.28.

Starting at ExtUtils::MakeMaker 7.31_06 and Perl 5.27.1, the base
README.pod is no longer installed. So stop installing them altogether.

PR:		229112
Reported by:	many
Sponsored by:	Absolight
Differential Revision:	https://reviews.freebsd.org/D15946

1 # $FreeBSD$
2 #
3 # Provide support to use perl5
4 #
5 # PERL5 - Set to full path of perl5, either in the system or
6 # installed from a port.
7 # PERL - Set to full path of perl5, either in the system or
8 # installed from a port, but without the version number.
9 # Use this if you need to replace "#!" lines in scripts.
10 # PERL_VERSION - Full version of perl5 (see below for current value).
11 #
12 # PERL_VER - Short version of perl5 (major.minor without patchlevel)
13 #
14 # PERL_LEVEL - Perl version as an integer of the form MNNNPP, where
15 # M is major version, N is minor version, and P is
16 # the patch level. E.g., PERL_VERSION=5.14.4 would give
17 # a PERL_LEVEL of 501404. This can be used in comparisons
18 # to determine if the version of perl is high enough,
19 # whether a particular dependency is needed, etc.
20 # PERL_ARCH - Directory name of architecture dependent libraries
21 # (value: mach).
22 # PERL_PORT - Name of the perl port that is installed
23 # (for example: perl5.24)
24 # SITE_PERL - Directory name where site specific perl packages go.
25 # This value is added to PLIST_SUB.
26 # SITE_ARCH - Directory name where arch site specific perl packages go.
27 # This value is added to PLIST_SUB.
28 # USE_PERL5 - If set, this port uses perl5 in one or more of the extract,
29 # patch, build, run or test phases.
30 # It can also have configure, modbuild and modbuildtiny when
31 # the port needs to run Makefile.PL, Build.PL and a
32 # Module::Build::Tiny flavor of Build.PL.
33 #
34 # MAINTAINER: perl@FreeBSD.org
35
36 .if !defined(_INCLUDE_USES_PERL5_MK)
37 _INCLUDE_USES_PERL5_MK= yes
38
39 . if !empty(perl5_ARGS)
40 IGNORE= Incorrect 'USES+=perl5:${perl5_ARGS}' perl5 takes no arguments
41 . endif
42
43 USE_PERL5?= run build
44
45 # When adding a version, please keep the comment in
46 # Mk/bsd.default-versions.mk in sync.
47 . if ${PERL5_DEFAULT} == 5.24
48 .include "${PORTSDIR}/lang/perl5.24/version.mk"
49 . elif ${PERL5_DEFAULT} == 5.26
50 .include "${PORTSDIR}/lang/perl5.26/version.mk"
51 . elif ${PERL5_DEFAULT} == 5.28
52 .include "${PORTSDIR}/lang/perl5.28/version.mk"
53 . elif ${PERL5_DEFAULT} == devel
54 .include "${PORTSDIR}/lang/perl5-devel/version.mk"
55 # Force PERL_PORT here in case two identical PERL_VERSION.
56 PERL_PORT?= perl5-devel
57 . else
58 IGNORE= Invalid perl5 version ${PERL5_DEFAULT}
59 . endif
60
61 PERL_VER?= ${PERL_VERSION:C/\.[0-9]+$//}
62
63 . if !defined(PERL_LEVEL) && defined(PERL_VERSION)
64 perl_major= ${PERL_VERSION:C|^([1-9]+).*|\1|}
65 _perl_minor= 00${PERL_VERSION:C|^([1-9]+)\.([0-9]+).*|\2|}
66 perl_minor= ${_perl_minor:C|^.*(...)|\1|}
67 . if ${perl_minor} >= 100
68 perl_minor= ${PERL_VERSION:C|^([1-9]+)\.([0-9][0-9][0-9]).*|\2|}
69 perl_patch= ${PERL_VERSION:C|^.*(..)|\1|}
70 . else # ${perl_minor} < 100
71 _perl_patch= 0${PERL_VERSION:C|^([1-9]+)\.([0-9]+)\.*|0|}
72 perl_patch= ${_perl_patch:C|^.*(..)|\1|}
73 . endif # ${perl_minor} < 100
74 PERL_LEVEL= ${perl_major}${perl_minor}${perl_patch}
75 . else
76 PERL_LEVEL=0
77 . endif # !defined(PERL_LEVEL) && defined(PERL_VERSION)
78
79 PERL_ARCH?= mach
80
81 # there must always be a default to prevent dependency failures such
82 # as "ports/lang: not found". Also, perl5-devel is taken care in the
83 # perl5_default file, or up there in the default versions selection.
84 # When adding a version, please keep the comment in
85 # Mk/bsd.default-versions.mk in sync.
86 . if ${PERL_LEVEL} >= 502800
87 PERL_PORT?= perl5.28
88 . elif ${PERL_LEVEL} >= 502600
89 PERL_PORT?= perl5.26
90 . else # ${PERL_LEVEL} < 502600
91 PERL_PORT?= perl5.24
92 . endif
93
94 SITE_PERL_REL?= lib/perl5/site_perl
95 SITE_PERL?= ${LOCALBASE}/${SITE_PERL_REL}
96 SITE_ARCH_REL?= ${SITE_PERL_REL}/${PERL_ARCH}/${PERL_VER}
97 SITE_ARCH?= ${LOCALBASE}/${SITE_ARCH_REL}
98 SITE_MAN3_REL?= ${SITE_PERL_REL}/man/man3
99 SITE_MAN3?= ${PREFIX}/${SITE_MAN3_REL}
100 SITE_MAN1_REL?= ${SITE_PERL_REL}/man/man1
101 SITE_MAN1?= ${PREFIX}/${SITE_MAN1_REL}
102
103 PERL5?= ${LOCALBASE}/bin/perl${PERL_VERSION}
104 PERL?= ${LOCALBASE}/bin/perl
105 CONFIGURE_ENV+= ac_cv_path_PERL=${PERL} ac_cv_path_PERL_PATH=${PERL} \
106 PERL_USE_UNSAFE_INC=1
107
108 MAKE_ENV+= PERL_USE_UNSAFE_INC=1
109
110 QA_ENV+= SITE_ARCH_REL=${SITE_ARCH_REL} LIBPERL=libperl.so.${PERL_VER}
111
112 # Define the want perl first if defined
113 . if ${USE_PERL5:M5*}
114 want_perl_sign= ${USE_PERL5:M5*:C|^[0-9.]+||}
115 want_perl_ver= ${USE_PERL5:M5*:S|${want_perl_sign}$||}
116 want_perl_major= ${want_perl_ver:C|\..*||}
117 _want_perl_minor= ${want_perl_ver:S|^${want_perl_major}||:S|^.||:C|\..*||}
118 _want_perl_patch= ${want_perl_ver:S|^${want_perl_major}||:S|^.${_want_perl_minor}||:S|^.||:C|\..*||}
119 want_perl_minor= ${_want_perl_minor:S|^|000|:C|.*(...)|\1|}
120 want_perl_patch= ${_want_perl_patch:S|^|00|:C|.*(..)|\1|}
121 USE_PERL5_LEVEL= ${want_perl_major}${want_perl_minor}${want_perl_patch}
122 . endif
123
124 # All but version
125 _USE_PERL5= ${USE_PERL5:N5*}
126
127 # Mask unspecified components. E.g. this way "5" will match any "5.x.x".
128 . if empty(_want_perl_minor)
129 masked_PERL_LEVEL= ${PERL_LEVEL:C|(.....)$|00000|}
130 . elif empty(_want_perl_patch)
131 masked_PERL_LEVEL= ${PERL_LEVEL:C|(..)$|00|}
132 . else
133 masked_PERL_LEVEL= ${PERL_LEVEL}
134 . endif
135
136 . if defined(want_perl_sign)
137 . if ${want_perl_sign} == "+"
138 . if ${USE_PERL5_LEVEL} > ${masked_PERL_LEVEL}
139 USE_PERL5_REASON?= requires Perl ${want_perl_ver} or later, install lang/perl${want_perl_major}.${want_perl_minor:C|^0||} and try again
140 IGNORE= ${USE_PERL5_REASON}
141 . endif # ${USE_PERL5_LEVEL} > ${masked_PERL_LEVEL}
142 . elif ${want_perl_sign} == ""
143 . if ${USE_PERL5_LEVEL} != ${masked_PERL_LEVEL}
144 USE_PERL5_REASON?= requires Perl ${want_perl_ver} exactly
145 IGNORE= ${USE_PERL5_REASON}
146 . endif # ${USE_PERL5_LEVEL} != ${masked_PERL_LEVEL}
147 . elif ${want_perl_sign} == "-"
148 . if ${USE_PERL5_LEVEL} <= ${masked_PERL_LEVEL}
149 USE_PERL5_REASON?= requires a Perl version earlier than ${want_perl_ver}
150 IGNORE= ${USE_PERL5_REASON}
151 . endif # ${USE_PERL5_LEVEL} <= ${masked_PERL_LEVEL}
152 . else # wrong suffix
153 IGNORE= improper use of USE_PERL5
154 . endif
155 . endif
156
157 _USES_POST+= perl5
158 .endif
159
160 .if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_PERL5_POST_MK)
161 _INCLUDE_USES_PERL5_POST_MK= yes
162
163 PLIST_SUB+= PERL_VERSION=${PERL_VERSION} \
164 PERL_VER=${PERL_VER} \
165 PERL5_MAN1=${SITE_MAN1_REL} \
166 PERL5_MAN3=${SITE_MAN3_REL} \
167 SITE_PERL=${SITE_PERL_REL} \
168 SITE_ARCH=${SITE_ARCH_REL}
169
170 # handle perl5 specific manpages
171 . for sect in 3
172 . if defined(P5MAN${sect})
173 _MANPAGES+= ${P5MAN${sect}:S%^%${PREFIX}/lib/perl5/${PERL_VER}/man/man${sect}/%}
174 . endif
175 . endfor
176 MANDIRS+= ${PREFIX}/${SITE_PERL_REL}/man
177
178 . if ${_USE_PERL5:Mmodbuild} || ${_USE_PERL5:Mmodbuildtiny}
179 _USE_PERL5+= configure
180 ALL_TARGET?= # empty
181 CONFIGURE_ARGS+=--install_path lib="${PREFIX}/${SITE_PERL_REL}" \
182 --install_path arch="${PREFIX}/${SITE_ARCH_REL}" \
183 --install_path script="${PREFIX}/bin" \
184 --install_path bin="${PREFIX}/bin" \
185 --install_path libdoc="${MAN3PREFIX}/man/man3" \
186 --install_path bindoc="${MAN1PREFIX}/man/man1"
187 CONFIGURE_SCRIPT?= Build.PL
188 PL_BUILD?= Build
189 CONFIGURE_ARGS+=--destdir ${STAGEDIR}
190 DESTDIRNAME= --destdir
191 . if ${_USE_PERL5:Mmodbuild}
192 CONFIGURE_ARGS+=--perl="${PERL}"
193 . if ${PORTNAME} != Module-Build
194 BUILD_DEPENDS+= p5-Module-Build>=0.4206:devel/p5-Module-Build
195 . endif
196 CONFIGURE_ARGS+=--create_packlist 1
197 . endif
198 . if ${_USE_PERL5:Mmodbuildtiny}
199 . if ${PORTNAME} != Module-Build-Tiny
200 BUILD_DEPENDS+= p5-Module-Build-Tiny>=0.039:devel/p5-Module-Build-Tiny
201 . endif
202 CONFIGURE_ARGS+=--create_packlist 1
203 . endif
204 . elif ${_USE_PERL5:Mconfigure}
205 CONFIGURE_ARGS+=INSTALLDIRS="site"
206 . endif # modbuild
207
208 . if ${_USE_PERL5:Mconfigure}
209 _USE_PERL5+= build run
210 # Disable AutoInstall from attempting to install from CPAN directly in
211 # the case of missing dependencies. This causes the build to loop on
212 # the build cluster asking for interactive input.
213 CONFIGURE_ENV+= PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
214 . if defined(BATCH) && !defined(IS_INTERACTIVE)
215 CONFIGURE_ENV+= PERL_MM_USE_DEFAULT="YES"
216 . endif # defined(BATCH) && !defined(IS_INTERACTIVE)
217 . endif # configure
218
219 . if ${_USE_PERL5:Mextract}
220 EXTRACT_DEPENDS+= ${PERL5_DEPEND}:lang/${PERL_PORT}
221 . endif
222
223 . if ${_USE_PERL5:Mpatch}
224 PATCH_DEPENDS+= ${PERL5_DEPEND}:lang/${PERL_PORT}
225 . endif
226
227 . if ${_USE_PERL5:Mbuild}
228 BUILD_DEPENDS+= ${PERL5_DEPEND}:lang/${PERL_PORT}
229 . endif
230
231 . if ${_USE_PERL5:Mrun}
232 RUN_DEPENDS+= ${PERL5_DEPEND}:lang/${PERL_PORT}
233 . endif
234
235 . if ${_USE_PERL5:Mtest}
236 TEST_DEPENDS+= ${PERL5_DEPEND}:lang/${PERL_PORT}
237 . endif
238
239 . if ${_USE_PERL5:Mconfigure}
240 CONFIGURE_ARGS+= CC="${CC}" CCFLAGS="${CFLAGS}" LD="${CC}" PREFIX="${PREFIX}" \
241 INSTALLPRIVLIB="${PREFIX}/lib" INSTALLARCHLIB="${PREFIX}/lib"
242 CONFIGURE_SCRIPT?= Makefile.PL
243 MAN3PREFIX?= ${PREFIX}/${SITE_PERL_REL}
244 MAN1PREFIX?= ${PREFIX}/${SITE_PERL_REL}
245 .undef HAS_CONFIGURE
246
247 . if !target(do-configure)
248 do-configure:
249 @if [ -f ${SCRIPTDIR}/configure ]; then \
250 cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
251 ${SCRIPTDIR}/configure; \
252 fi
253 @cd ${CONFIGURE_WRKSRC} && \
254 ${SETENV} ${CONFIGURE_ENV} \
255 ${PERL5} ${CONFIGURE_CMD} ${CONFIGURE_ARGS}
256 . if !${_USE_PERL5:Mmodbuild*}
257 @cd ${CONFIGURE_WRKSRC} && \
258 ${PERL5} -pi -e 's/ doc_(perl|site|\$$\(INSTALLDIRS\))_install$$//' Makefile
259 . endif # ! modbuild
260 . endif # !target(do-configure)
261 . endif # configure
262
263 . if ${_USE_PERL5:Mmodbuild*}
264 . if !target(do-build)
265 do-build:
266 @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PERL5} ${PL_BUILD} ${ALL_TARGET} ${MAKE_ARGS})
267 . endif # !target(do-build)
268
269 . if !${USES:Mgmake}
270 . if !target(do-install)
271 do-install:
272 @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PERL5} ${PL_BUILD} ${INSTALL_TARGET} ${MAKE_ARGS})
273 . endif # !target(do-install)
274 . endif # ! USES=gmake
275 . endif # modbuild
276
277 PACKLIST_DIR?= ${PREFIX}/${SITE_ARCH_REL}/auto
278
279 # In all those, don't use - before the command so that the user does
280 # not wonder what has been ignored by this message "*** Error code 1 (ignored)"
281 _USES_install+= 560:fix-perl-things
282 fix-perl-things:
283 # Remove STAGEDIR from .packlist and add the file to the plist.
284 @(if [ -d ${STAGEDIR}${PACKLIST_DIR} ] ; then \
285 ${FIND} ${STAGEDIR}${PACKLIST_DIR} -name .packlist | while read f ; do \
286 ${SED} -i '' 's|^${STAGEDIR}||' "$$f"; \
287 ${ECHO} $$f | ${SED} -e 's|^${STAGEDIR}||' >> ${TMPPLIST}; \
288 done \
289 fi) || :
290
291 # Starting with perl 5.20, the empty bootstrap files are not installed any more
292 # by ExtUtils::MakeMaker. As we don't need them anyway, remove them.
293 # Module::Build continues to install them, so remove the files unconditionally.
294 @${FIND} ${STAGEDIR} -name '*.bs' -size 0 -delete || :
295
296 # Some ports use their own way of building perl modules and generate
297 # perllocal.pod, remove it here so that those ports don't include it
298 # by mistake in their plists. It is sometime compressed, so use a
299 # shell glob for the removal. Also, remove the directories that
300 # contain it to not leave orphans directories around.
301 @${RM} ${STAGEDIR}${PREFIX}/lib/perl5/${PERL_VER}/${PERL_ARCH}/perllocal.pod* || :
302 @${RMDIR} -p ${STAGEDIR}${PREFIX}/lib/perl5/${PERL_VER}/${PERL_ARCH} 2>/dev/null || :
303 # Starting at ExtUtils::MakeMaker 7.06 and Perl 5.25.1, the base README.pod is
304 # no longer manified into a README.3, as the README.pod is installed and can be
305 # read with perldoc, remove the README.3 files that may be generated.
306 @[ -d "${STAGEDIR}${SITE_MAN3}" ] && \
307 ${FIND} ${STAGEDIR}${SITE_MAN3} -name '*::README.3' -delete || :
308 # Starting at ExtUtils::MakeMaker 7.31_06 and Perl 5.27.1, the base README.pod is
309 # no longer installed. So remove any that can be there.
310 @${FIND} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL} -name README.pod -delete || :
311
312 . if !target(do-test) && (!empty(USE_PERL5:Mmodbuild*) || !empty(USE_PERL5:Mconfigure))
313 TEST_TARGET?= test
314 TEST_WRKSRC?= ${BUILD_WRKSRC}
315 do-test:
316 . if ${USE_PERL5:Mmodbuild*}
317 @cd ${TEST_WRKSRC}/ && ${SETENV} ${TEST_ENV} ${PERL5} ${PL_BUILD} ${TEST_TARGET} ${TEST_ARGS}
318 . elif ${USE_PERL5:Mconfigure}
319 @cd ${TEST_WRKSRC}/ && ${SETENV} ${TEST_ENV} ${MAKE_CMD} ${TEST_ARGS} ${TEST_TARGET}
320 . endif # USE_PERL5:Mmodbuild*
321 . endif # do-test
322 .endif # defined(_POSTMKINCLUDED)

Properties

Name Value
svn:eol-style native
svn:keywords FreeBSD=%H
svn:mime-type text/plain

  ViewVC Help
Powered by ViewVC 1.1.27