pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Split cwrappers from legacy wrappers. We no longer...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7077ba2410c8
branches:  trunk
changeset: 650889:7077ba2410c8
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Mon Apr 27 19:59:07 2015 +0000

description:
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:

 mk/bsd.pkg.mk             |   7 ++-
 mk/cwrappers.mk           |  83 +++++++++++++++++++++++++++++++++++++++++-----
 mk/wrapper/bsd.wrapper.mk |   4 +-
 3 files changed, 79 insertions(+), 15 deletions(-)

diffs (161 lines):

diff -r 9683f32dff11 -r 7077ba2410c8 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Mon Apr 27 19:38:03 2015 +0000
+++ b/mk/bsd.pkg.mk     Mon Apr 27 19:59:07 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.2011 2015/03/07 21:14:32 tnn Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.2012 2015/04/27 19:59:07 jperkin Exp $
 #
 # This file is in the public domain.
 #
@@ -406,10 +406,11 @@
 ${FAKEHOMEDIR}:
        ${RUN} ${MKDIR} ${.TARGET}
 
-.include "wrapper/bsd.wrapper.mk"
-
+# Use C-based wrappers or legacy shell versions.
 .if ${USE_CWRAPPERS:tl} != "no"
 .include "cwrappers.mk"
+.else
+.include "wrapper/bsd.wrapper.mk"
 .endif
 
 .if defined(ABI_DEPENDS) || defined(BUILD_ABI_DEPENDS)
diff -r 9683f32dff11 -r 7077ba2410c8 mk/cwrappers.mk
--- a/mk/cwrappers.mk   Mon Apr 27 19:38:03 2015 +0000
+++ b/mk/cwrappers.mk   Mon Apr 27 19:59:07 2015 +0000
@@ -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 @@
 
 .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 @@
        ${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}
diff -r 9683f32dff11 -r 7077ba2410c8 mk/wrapper/bsd.wrapper.mk
--- a/mk/wrapper/bsd.wrapper.mk Mon Apr 27 19:38:03 2015 +0000
+++ b/mk/wrapper/bsd.wrapper.mk Mon Apr 27 19:59:07 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.92 2015/04/27 19:38:03 jperkin Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.93 2015/04/27 19:59:07 jperkin Exp $
 #
 # Copyright (c) 2005 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -56,9 +56,7 @@
 # Prepend ${WRAPPER_BINDIR} to the PATH so that the wrappers are found
 # first when searching for executables.
 #
-.if ${USE_CWRAPPERS:tl} == "no"
 PREPEND_PATH+=         ${WRAPPER_BINDIR}
-.endif
 
 ###
 ### BEGIN: after the barrier



Home | Main Index | Thread Index | Old Index