Index: head/CHANGES =================================================================== --- head/CHANGES +++ head/CHANGES @@ -10,6 +10,38 @@ 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 + + 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 Index: head/Mk/bsd.options.mk =================================================================== --- head/Mk/bsd.options.mk +++ head/Mk/bsd.options.mk @@ -135,6 +135,7 @@ 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 @@ 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 @@ ${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 @@ ${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 Index: head/Mk/bsd.port.mk =================================================================== --- head/Mk/bsd.port.mk +++ head/Mk/bsd.port.mk @@ -5721,33 +5721,33 @@ _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_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