Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2007 15:37:42 GMT
From:      Andrew Pantyukhin <sat@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 125270 for review
Message-ID:  <200708171537.l7HFbgWv057318@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125270

Change 125270 by sat@sat_amilo on 2007/08/17 15:37:08

	- Drop support for pre-5.6 versioning scheme to simplify perl_level
	  generation
	- Be more determined when choosing a variable to look for wanted
	  perl version
	- Rename some vars for more readability
	- Mask perl_level when minor or patch components are not specified
	  in wanted perl version. E.g. this way 5.8 matches any 5.8.x
	  version
	- Do not build_depend on perl if onlt use_perl5_run is set

Affected files ...

.. //depot/projects/soc2007/gabor_perlmk/Mk/bsd.perl.mk#23 edit

Differences ...

==== //depot/projects/soc2007/gabor_perlmk/Mk/bsd.perl.mk#23 (text+ko) ====

@@ -83,16 +83,11 @@
 PERL_VER?=		5.8.8
 
 .if !defined(PERL_LEVEL) && defined(PERL_VERSION)
-perl_major=		${PERL_VERSION:C|^([1-9]+).*|\1|}
-_perl_minor=	00${PERL_VERSION:C|^([1-9]+)\.([0-9]+).*|\2|}
-perl_minor=		${_perl_minor:C|^.*(...)|\1|}
-.if ${perl_minor} >= 100
-perl_minor=		${PERL_VERSION:C|^([1-9]+)\.([0-9][0-9][0-9]).*|\2|}
-perl_patch=		${PERL_VERSION:C|^.*(..)|\1|}
-.else # ${perl_minor} < 100
-_perl_patch=	0${PERL_VERSION:C|^([1-9]+)\.([0-9]+)\.*|0|}
-perl_patch=		${_perl_patch:C|^.*(..)|\1|}
-.endif # ${perl_minor} < 100
+perl_major=		${PERL_VERSION:C|\..*||}
+_perl_minor=	${PERL_VERSION:S|^${perl_major}||:S|^.||:C|\..*||}
+_perl_patch=	${PERL_VERSION:S|^${perl_major}||:S|^.${_perl_minor}||:S|^.||:C|\..*||}
+perl_minor=		${_perl_minor:S|^|000|:C|.*(...)|\1|}
+perl_patch=		${_perl_patch:S|^|00|:C|.*(..)|\1|}
 PERL_LEVEL=		${perl_major}${perl_minor}${perl_patch}
 .else
 PERL_LEVEL=		0
@@ -106,51 +101,60 @@
 PERL_PORT?=	perl5
 .endif
 
-.if defined(USE_PERL5) && ${USE_PERL5} != "yes"
-__prefix=${USE_PERL5:C/[^[:digit:].]+$//}
-__suffix=${USE_PERL5:C/^[0-9.]+//}
+# Decide where to look for the version string
+.ifdef USE_PERL5
+USE_PERL5_STRING=	${USE_PERL5}
+.elifdef USE_PERL5_BUILD
+USE_PERL5_STRING=	${USE_PERL5_BUILD}
+.elifdef USE_PERL5_RUN
+USE_PERL5_STRING=	${USE_PERL5_RUN}
+.elifdef PERL_CONFIGURE
+USE_PERL5_STRING=	${PERL_CONFIGURE}
+.elifdef PERL_MODBUILD
+USE_PERL5_STRING=	${PERL_MODBUILD}
+.else
+USE_PERL5_STRING=	yes
+.endif
+
+.if ${USE_PERL5_STRING} != "yes"
+want_perl_sign=		${USE_PERL5_STRING:C|^[0-9.]+||}
+want_perl_ver=		${USE_PERL5_STRING:S|${want_perl_sign}$||}
+want_perl_major=	${want_perl_ver:C|\..*||}
+_want_perl_minor=	${want_perl_ver:S|^${want_perl_major}||:S|^.||:C|\..*||}
+_want_perl_patch=	${want_perl_ver:S|^${want_perl_major}||:S|^.${_want_perl_minor}||:S|^.||:C|\..*||}
+want_perl_minor=	${_want_perl_minor:S|^|000|:C|.*(...)|\1|}
+want_perl_patch=	${_want_perl_patch:S|^|00|:C|.*(..)|\1|}
+USE_PERL5_LEVEL=	${want_perl_major}${want_perl_minor}${want_perl_patch}
 
-_u_perl_major=		${__prefix:C|^([1-9]+).*|\1|}
-_u__perl_minor=		00${__prefix:C|^([1-9]+)\.([0-9]+).*|\2|}
-_u_perl_minor=		${_u__perl_minor:C|^.*(...)|\1|}
-.if ${_u_perl_minor} >= 100
-_u_perl_minor=		${__prefix:C|^([1-9]+)\.([0-9][0-9][0-9]).*|\2|}
-_u_perl_patch=		${__prefix:C|^.*(..)|\1|}
-.else # ${_u_perl_minor} < 100
-_u__perl_patch=		0${__prefix:C|^([1-9]+)\.([0-9]+)\.*|0|}
-_u_perl_patch=		${_u__perl_patch:C|^.*(..)|\1|}
-.endif # ${_u_perl_minor} < 100
-USE_PERL5_LEVEL=	${_u_perl_major}${_u_perl_minor}${_u_perl_patch}
+# Mask unspecified components. E.g. this way "5" will match any "5.x.x".
+.if empty(_want_perl_minor)
+masked_PERL_LEVEL=	${PERL_LEVEL:C|(.....)$|00000|}
+.elif empty(_want_perl_patch)
+masked_PERL_LEVEL=	${PERL_LEVEL:C|(..)$|00|}
+.else
+masked_PERL_LEVEL=	${PERL_LEVEL}
+.endif
 
-.if ${__suffix} == "+"
-.if ${USE_PERL5_LEVEL} > ${PERL_LEVEL}
-USE_PERL5_REASON?=	requires Perl ${__prefix} or later, install lang/perl5.8 and try again
+.if ${want_perl_sign} == "+"
+.if ${USE_PERL5_LEVEL} > ${masked_PERL_LEVEL}
+USE_PERL5_REASON?=	requires Perl ${want_perl_ver} or later, install lang/perl5.8 and try again
 IGNORE=	${USE_PERL5_REASON}
-.endif # ${USE_PERL5_LEVEL} > ${PERL_LEVEL}
-.elif ${__suffix} == ""
-.if ${USE_PERL5_LEVEL} != ${PERL_LEVEL}
-USE_PERL5_REASON?=	requires Perl ${__prefix} exactly
+.endif # ${USE_PERL5_LEVEL} > ${masked_PERL_LEVEL}
+.elif ${want_perl_sign} == ""
+.if ${USE_PERL5_LEVEL} != ${masked_PERL_LEVEL}
+USE_PERL5_REASON?=	requires Perl ${want_perl_ver} exactly
 IGNORE=	${USE_PERL5_REASON}
-.endif # ${USE_PERL5_LEVEL} != ${PERL_LEVEL}
-.elif ${__suffix} == "-"
-.if ${USE_PERL5_LEVEL} <= ${PERL_LEVEL}
-USE_PERL5_REASON?=	requires a Perl version earlier than ${__prefix}
+.endif # ${USE_PERL5_LEVEL} != ${masked_PERL_LEVEL}
+.elif ${want_perl_sign} == "-"
+.if ${USE_PERL5_LEVEL} <= ${masked_PERL_LEVEL}
+USE_PERL5_REASON?=	requires a Perl version earlier than ${want_perl_ver}
 IGNORE=	${USE_PERL5_REASON}
-.endif # ${USE_PERL5_LEVEL} <= ${PERL_LEVEL}
+.endif # ${USE_PERL5_LEVEL} <= ${masked_PERL_LEVEL}
 .else # wrong suffix
-.BEGIN:
-	@${ECHO_MSG} "${PKGNAME}: Makefile error: inproper use of USE_PERL5"
-	@${FALSE}
+IGNORE=	improper use of USE_PERL5
 .endif
-.endif #defined(USE_PERL5) && ${USE_PERL5} != "yes"
+.endif #${USE_PERL5_STRING} != "yes"
 
-.if defined(USE_PERL5_RUN)
-USE_PERL5=	${USE_PERL5_RUN}
-.endif
-.if defined(USE_PERL5_BUILD)
-USE_PERL5=	${USE_PERL5_BUILD}
-.endif
-
 SITE_PERL_REL?=	lib/perl5/site_perl/${PERL_VER}
 SITE_PERL?=	${LOCALBASE}/${SITE_PERL_REL}
 
@@ -163,7 +167,7 @@
 			SITE_PERL=${SITE_PERL_REL}
 
 .if defined(PERL_MODBUILD)
-PERL_CONFIGURE=		${PERL_MODBUILD}
+PERL_CONFIGURE=		yes
 CONFIGURE_SCRIPT?=	Build.PL
 .if ${PORTNAME} != Module-Build
 BUILD_DEPENDS+=		${SITE_PERL}/Module/Build.pm:${PORTSDIR}/devel/p5-Module-Build
@@ -183,15 +187,16 @@
 .endif # defined(PERL_MODBUILD)
 
 .if defined(PERL_CONFIGURE)
-USE_PERL5=	${PERL_CONFIGURE}
 .if defined(BATCH) && !defined(IS_INTERACTIVE)
 CONFIGURE_ENV+=	PERL_MM_USE_DEFAULT="YES"
 .endif # defined(BATCH) && !defined(IS_INTERACTIVE)
 .endif # defined(PERL_CONFIGURE)
 
+.if defined(USE_PERL5) || defined(USE_PERL5_BUILD)
 EXTRACT_DEPENDS+=	${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
 PATCH_DEPENDS+=		${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
 BUILD_DEPENDS+=		${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
+.endif
 .if defined(USE_PERL5) || defined(USE_PERL5_RUN)
 RUN_DEPENDS+=		${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708171537.l7HFbgWv057318>