Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jul 2015 12:11:17 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r391051 - in head: . Mk
Message-ID:  <201507011211.t61CBHk9085251@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Wed Jul  1 12:11:16 2015
New Revision: 391051
URL: https://svnweb.freebsd.org/changeset/ports/391051

Log:
  Introduce target option helpers.
  
  With hat:	portmgr
  Sponsored by:	Absolight
  Differential Revision:	https://reviews.freebsd.org/D2944

Modified:
  head/CHANGES
  head/Mk/bsd.options.mk
  head/Mk/bsd.port.mk

Modified: head/CHANGES
==============================================================================
--- head/CHANGES	Wed Jul  1 11:11:21 2015	(r391050)
+++ head/CHANGES	Wed Jul  1 12:11:16 2015	(r391051)
@@ -10,6 +10,38 @@ in the release notes and/or placed into 
 
 All ports committers are allowed to commit to this file.
 
+20150701:
+AUTHOR: mat@FreeBSD.org
+
+  Make option target helpers have been added, it allows replacing:
+
+    .include <bsd.port.options.mk>
+
+    post-patch:
+      ${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
+	${WRKSRC}/Configure ${WRKSRC}/hints/freebsd.sh
+    .if ${PORT_OPTIONS:MPTHREAD}
+      ${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|-lpthread|g;' \
+	${WRKSRC}/hints/freebsd.sh
+    .else
+      ${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%||g;' \
+	${WRKSRC}/hints/freebsd.sh
+    .endif
+
+  with:
+
+    post-patch:
+      ${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
+	${WRKSRC}/Configure ${WRKSRC}/hints/freebsd.sh
+
+    post-patch-PTHREAD-on:
+      ${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|-lpthread|g;' \
+	${WRKSRC}/hints/freebsd.sh
+
+    post-patch-PTHREAD-off:
+      ${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%||g;' \
+	${WRKSRC}/hints/freebsd.sh
+
 20150622:
 AUTHOR: bapt@FreeBSD.org
 

Modified: head/Mk/bsd.options.mk
==============================================================================
--- head/Mk/bsd.options.mk	Wed Jul  1 11:11:21 2015	(r391050)
+++ head/Mk/bsd.options.mk	Wed Jul  1 12:11:16 2015	(r391051)
@@ -135,6 +135,7 @@ _OPTIONS_FLAGS= ALL_TARGET CATEGORIES CF
 		MAKE_ENV PATCHFILES PATCH_SITES PLIST_DIRS PLIST_DIRSTRY \
 		PLIST_FILES PLIST_SUB SUB_FILES SUB_LIST USES
 _OPTIONS_DEPENDS=	PKG FETCH EXTRACT PATCH BUILD LIB RUN
+_OPTIONS_TARGETS=	fetch extract patch configure build install package stage
 
 # Set the default values for the global options, as defined by portmgr
 .if !defined(NOPORTDOCS)
@@ -410,6 +411,12 @@ WITH_DEBUG=	yes
 ALL_OPTIONS=	${OPTIONS_DEFINE}
 .endif
 
+.for target in ${_OPTIONS_TARGETS}
+.for prepost in pre post
+_OPTIONS_${prepost}_${target}?=
+.endfor
+.endfor
+
 .for opt in ${COMPLETE_OPTIONS_LIST} ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE}
 # PLIST_SUB
 PLIST_SUB?=
@@ -463,6 +470,11 @@ ${flags}+=	${${opt}_${flags}}
 ${deptype}_DEPENDS+=	${${opt}_${deptype}_DEPENDS}
 .      endif
 .    endfor
+.    for target in ${_OPTIONS_TARGETS}
+.      for prepost in pre post
+_OPTIONS_${prepost}_${target}+= ${prepost}-${target}-${opt}-on
+.      endfor
+.    endfor
 .  else
 .    if defined(${opt}_USE_OFF)
 .      for option in ${${opt}_USE_OFF}
@@ -495,6 +507,11 @@ ${flags}+=	${${opt}_${flags}_OFF}
 ${deptype}_DEPENDS+=	${${opt}_${deptype}_DEPENDS_OFF}
 .      endif
 .    endfor
+.    for target in ${_OPTIONS_TARGETS}
+.      for prepost in pre post
+_OPTIONS_${prepost}_${target}+= ${prepost}-${target}-${opt}-off
+.      endfor
+.    endfor
 .  endif
 .endfor
 

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Wed Jul  1 11:11:21 2015	(r391050)
+++ head/Mk/bsd.port.mk	Wed Jul  1 12:11:16 2015	(r391051)
@@ -5721,33 +5721,33 @@ _SANITY_SEQ=	post-chroot pre-everything 
 _PKG_DEP=		check-sanity
 _PKG_SEQ=		pkg-depends
 _FETCH_DEP=		pkg
-_FETCH_SEQ=		fetch-depends pre-fetch pre-fetch-script \
-				do-fetch fetch-specials post-fetch post-fetch-script
+_FETCH_SEQ=		fetch-depends pre-fetch ${_OPTIONS_pre_fetch} pre-fetch-script \
+				do-fetch fetch-specials post-fetch ${_OPTIONS_post_fetch} post-fetch-script
 _EXTRACT_DEP=	fetch
 _EXTRACT_SEQ=	check-build-conflicts extract-message checksum extract-depends \
-				clean-wrkdir ${WRKDIR} pre-extract pre-extract-script do-extract \
-				post-extract post-extract-script
+				clean-wrkdir ${WRKDIR} pre-extract ${_OPTIONS_pre_extract} pre-extract-script do-extract \
+				post-extract ${_OPTIONS_post_extract} post-extract-script
 _PATCH_DEP=		extract
 _PATCH_SEQ=		ask-license patch-message patch-depends pathfix dos2unix fix-shebang \
-				pre-patch \
-				pre-patch-script do-patch charsetfix-post-patch post-patch post-patch-script
+				pre-patch ${_OPTIONS_pre_patch} \
+				pre-patch-script do-patch charsetfix-post-patch post-patch ${_OPTIONS_post_patch} post-patch-script
 _CONFIGURE_DEP=	patch
 _CONFIGURE_SEQ=	build-depends lib-depends configure-message \
-				pre-configure pre-configure-script \
+				pre-configure ${_OPTIONS_pre_configure} pre-configure-script \
 				run-autotools do-autoreconf patch-libtool run-autotools-fixup do-configure \
-				post-configure post-configure-script
+				post-configure ${_OPTIONS_post_configure} post-configure-script
 _BUILD_DEP=		configure
-_BUILD_SEQ=		build-message pre-build pre-build-script do-build \
-				post-build post-build-script
+_BUILD_SEQ=		build-message pre-build ${_OPTIONS_pre_build} pre-build-script do-build \
+				post-build ${_OPTIONS_post_build} post-build-script
 
 _STAGE_DEP=		build
-_STAGE_SEQ=		stage-message stage-dir run-depends lib-depends apply-slist pre-install generate-plist \
+_STAGE_SEQ=		stage-message stage-dir run-depends lib-depends apply-slist pre-install ${_OPTIONS_pre_install} ${_OPTIONS_pre_stage} generate-plist \
 				pre-su-install
 # ${POST_PLIST} must be after anything that modifies TMPPLIST
 _STAGE_SEQ+=	create-users-groups do-install \
 				kmod-post-install fix-perl-things \
-				webplugin-post-install post-install post-install-script \
-				move-uniquefiles patch-lafiles post-stage compress-man \
+				webplugin-post-install post-install ${_OPTIONS_post_install} post-install-script \
+				move-uniquefiles patch-lafiles post-stage ${_OPTIONS_post_stage} compress-man \
 				install-rc-script install-ldconfig-file install-license \
 				install-desktop-entries add-plist-info add-plist-docs \
 				add-plist-examples add-plist-data add-plist-post \
@@ -5760,7 +5760,7 @@ _INSTALL_SEQ=	install-message run-depend
 _INSTALL_SUSEQ=	fake-pkg security-check
 
 _PACKAGE_DEP=	stage
-_PACKAGE_SEQ=	package-message pre-package pre-package-script do-package post-package-script
+_PACKAGE_SEQ=	package-message pre-package ${_OPTIONS_pre_package} pre-package-script do-package ${_OPTIONS_post_package} post-package-script
 
 # Enforce order for -jN builds
 



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