diff options
author | jperkin <jperkin@pkgsrc.org> | 2015-04-27 19:59:07 +0000 |
---|---|---|
committer | jperkin <jperkin@pkgsrc.org> | 2015-04-27 19:59:07 +0000 |
commit | 23e56c0e2820b59c46b2e1e0b28f2a5ed42e959a (patch) | |
tree | 0c048ea23e21ffbc04b595ccab1dfa0120d912c5 /mk/cwrappers.mk | |
parent | bc1f6b39fb9a6ce90ad6657a7d5e14b279d08149 (diff) | |
download | pkgsrc-23e56c0e2820b59c46b2e1e0b28f2a5ed42e959a.tar.gz |
Split cwrappers from legacy wrappers. We no longer generate the legacy
wrappers when USE_CWRAPPERS is enabled, saving a reasonable amount of
I/O during builds, mostly due to avoiding the transform/untransform sed
file generations.
WRAPPER_DIR and WRAPPER_BINDIR are used by various packages to override
or point to specific wrappers, and these now point to the cwrappers
directory when enabled, removing the need for CWRAPPERS_BIN_DIR
duplication and fixing packages which previously were using legacy
wrappers by accident.
A number of targets are now duplicated between bsd.wrapper.mk and
cwrappers.mk, the intention being that the legacy wrappers will be
deprecated once cwrappers is verified on all supported platforms. If
that turns out to take longer than expected, we will probably want to
introduce a wrapper.mk to abstract them away before loading the
appropriate back-end.
Diffstat (limited to 'mk/cwrappers.mk')
-rw-r--r-- | mk/cwrappers.mk | 83 |
1 files changed, 74 insertions, 9 deletions
diff --git a/mk/cwrappers.mk b/mk/cwrappers.mk index 18779b1f2f4..5a80afe4449 100644 --- a/mk/cwrappers.mk +++ b/mk/cwrappers.mk @@ -1,12 +1,17 @@ -# $NetBSD: cwrappers.mk,v 1.22 2015/03/17 18:41:20 jperkin Exp $ +# $NetBSD: cwrappers.mk,v 1.23 2015/04/27 19:59:07 jperkin Exp $ # # This Makefile fragment implements integration of pkgtools/cwrappers. +.include "../../mk/buildlink3/bsd.buildlink3.mk" + BUILD_DEPENDS+= cwrappers>=20150314:../../pkgtools/cwrappers +# Public variables used by pkgsrc infrastructure and packages. +WRAPPER_DIR= ${WRKDIR}/.cwrapper +WRAPPER_BINDIR= ${WRAPPER_DIR}/bin + # XXX This should be PREFIX, but USE_CROSSBASE overrides it. CWRAPPERS_SRC_DIR= ${LOCALBASE}/libexec/cwrappers -CWRAPPERS_BIN_DIR= ${WRKDIR}/.cwrapper/bin CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config CONFIGURE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} MAKE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} @@ -57,15 +62,17 @@ CWRAPPERS_APPEND.imake+= ${IMAKEOPTS} .PHONY: generate-cwrappers -do-wrapper: generate-cwrappers +.for _target_ in ${WRAPPER_TARGETS} +generate-cwrappers: ${_target_} +.endfor generate-cwrappers: - ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${CWRAPPERS_BIN_DIR} + ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${WRAPPER_BINDIR} .for wrappee in as cxx cc cpp f77 imake ld libtool shlibtool ${RUN}echo worklog=${WRKLOG:Q} > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} ${RUN}echo wrksrc=${WRKSRC:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} ${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_ORIG:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac - ${RUN}echo exec_path=${CWRAPPERS_BIN_DIR}/${CWRAPPERS_ALIASES.${wrappee}:[1]} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} + ${RUN}echo exec_path=${WRAPPER_BINDIR}/${CWRAPPERS_ALIASES.${wrappee}:[1]} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} ${RUN}echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} . for cmd in ${WRAPPER_REORDER_CMDS} ${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} @@ -80,12 +87,70 @@ generate-cwrappers: ${RUN}echo unwrap=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} . endfor . for alias in ${CWRAPPERS_ALIASES.${wrappee}} - ${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${CWRAPPERS_BIN_DIR}/${alias} + ${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${WRAPPER_BINDIR}/${alias} . endfor .endfor .if defined(USE_LIBTOOL) -_LIBTOOL= ${CWRAPPERS_BIN_DIR}/libtool -_SHLIBTOOL= ${CWRAPPERS_BIN_DIR}/shlibtool +_LIBTOOL= ${WRAPPER_BINDIR}/libtool +_SHLIBTOOL= ${WRAPPER_BINDIR}/shlibtool +.endif +PREPEND_PATH+= ${WRAPPER_BINDIR} + +_COOKIE.wrapper= ${WRKDIR}/.wrapper_done + +.PHONY: wrapper +.if !target(wrapper) +. if exists(${_COOKIE.wrapper}) +wrapper: + @${DO_NADA} +. elif defined(_PKGSRC_BARRIER) +wrapper: check-vulnerable patch acquire-wrapper-lock ${_COOKIE.wrapper} release-wrapper-lock +. else +wrapper: barrier +. endif +.endif + +.PHONY: acquire-wrapper-lock release-wrapper-lock +acquire-wrapper-lock: acquire-lock +release-wrapper-lock: release-lock + +.if exists(${_COOKIE.wrapper}) +${_COOKIE.wrapper}: + @${DO_NADA} +.else +${_COOKIE.wrapper}: real-wrapper .endif -PREPEND_PATH+= ${CWRAPPERS_BIN_DIR} + +.PHONY: real-wrapper +real-wrapper: wrapper-message wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie error-check + +.PHONY: wrapper-message + +wrapper-message: + @${PHASE_MSG} "Creating toolchain wrappers for ${PKGNAME}" + +.PHONY: pre-wrapper do-wrapper post-wrapper + +do-wrapper: generate-cwrappers + +.if !target(do-wrapper) +do-wrapper: + @${DO_NADA} +.endif + +.if !target(pre-wrapper) +pre-wrapper: + @${DO_NADA} +.endif + +.if !target(post-wrapper) +post-wrapper: + @${DO_NADA} +.endif + +.PHONY: wrapper-cookie +wrapper-cookie: + ${RUN} [ ! -f ${_COOKIE.wrapper} ] + ${RUN} ${MKDIR} ${_COOKIE.wrapper:H} + ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.wrapper} |