summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2014-11-24 00:32:31 +0000
committerjoerg <joerg@pkgsrc.org>2014-11-24 00:32:31 +0000
commitc4d60ea08ceb02c9c9bb850c722116168b2317df (patch)
tree26597f2d5441486aec548dbd8297821dbbe17292
parentc92e3542dcba1b8b5e022768c38bc2107b88beae (diff)
downloadpkgsrc-c4d60ea08ceb02c9c9bb850c722116168b2317df.tar.gz
Add cwrappers glue as developed during Google's Summer of Code 2007.
-rw-r--r--mk/bsd.pkg.mk6
-rw-r--r--mk/buildlink3/bsd.buildlink3.mk27
-rw-r--r--mk/cwrappers.mk71
-rw-r--r--mk/defaults/mk.conf8
-rw-r--r--mk/wrapper/bsd.wrapper.mk4
5 files changed, 112 insertions, 4 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index e760d4d7574..98a98b48b40 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.2004 2014/10/12 23:39:17 joerg Exp $
+# $NetBSD: bsd.pkg.mk,v 1.2005 2014/11/24 00:32:31 joerg Exp $
#
# This file is in the public domain.
#
@@ -430,6 +430,10 @@ fake-home: ${FAKEHOMEDIR}
${FAKEHOMEDIR}:
${RUN} ${MKDIR} ${.TARGET}
+.if ${USE_CWRAPPERS:tl} != "no"
+.include "cwrappers.mk"
+.endif
+
.include "wrapper/bsd.wrapper.mk"
.if defined(ABI_DEPENDS) || defined(BUILD_ABI_DEPENDS)
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk
index 9aae54f3405..74c23a8342e 100644
--- a/mk/buildlink3/bsd.buildlink3.mk
+++ b/mk/buildlink3/bsd.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.228 2014/10/31 16:14:07 wiz Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.229 2014/11/24 00:32:31 joerg Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -979,6 +979,7 @@ MAKEVARS+= _BLNK_PHYSICAL_PATH.${_var_}
# Add any package specified transformations (l:, etc.)
#
_BLNK_TRANSFORM+= ${BUILDLINK_TRANSFORM}
+_CWRAPPERS_TRANFORM+= ${BUILDLINK_TRANSFORM}
# Transform all references to the physical paths to some important
# directories into their given names.
#
@@ -998,6 +999,9 @@ _BLNK_TRANSFORM+= strip-slashdot:
#
.for _dir_ in ${_BLNK_PROTECT_DIRS}
_BLNK_TRANSFORM+= mangle:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
+_CWRAPPERS_TRANSFORM+= I:${_dir_}:${_dir_}
+_CWRAPPERS_TRANSFORM+= L:${_dir_}:${_dir_}
+_CWRAPPERS_TRANSFORM+= P:${_dir_}:${_dir_}
.endfor
#
# Transform /usr/lib/../lib* to /usr/lib* so the following transformation
@@ -1008,6 +1012,9 @@ _BLNK_TRANSFORM+= mangle:/usr/lib/../lib64:/usr/lib64
_BLNK_TRANSFORM+= mangle:/usr/lib/../lib:/usr/lib
_BLNK_TRANSFORM+= mangle:/usr/lib/../lib32:/usr/lib32
_BLNK_TRANSFORM+= mangle:/usr/lib/../libx32:/usr/libx32
+_CWRAPPERS_TRANSFORM+= L:/usr/lib/../lib:/usr/lib
+_CWRAPPERS_TRANSFORM+= L:/usr/lib/../lib32:/usr/lib32
+_CWRAPPERS_TRANSFORM+= L:/usr/lib/../libx32:/usr/libx32
.endif
#
# Protect -I/usr/include/* and -L/usr/lib/* from transformations (these
@@ -1015,17 +1022,21 @@ _BLNK_TRANSFORM+= mangle:/usr/lib/../libx32:/usr/libx32
#
.for _dir_ in ${COMPILER_INCLUDE_DIRS}
_BLNK_TRANSFORM+= opt-sub:-I${_dir_}:-I${_BLNK_MANGLE_DIR.${_dir_}}
+_CWRAPPERS_TRANSFORM+= I:${_dir_}:${_dir_}
.endfor
.for _dir_ in ${COMPILER_LIB_DIRS}
_BLNK_TRANSFORM+= opt-sub:-L${_dir_}:-L${_BLNK_MANGLE_DIR.${_dir_}}
++_CWRAPPERS_TRANSFORM+= L:${_dir_}:${_dir_}
.endfor
#
# Change any buildlink directories in runtime library search paths into
# the canonical actual installed paths.
#
_BLNK_TRANSFORM+= rpath:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}:${LOCALBASE}
+_CWRAPPERS_TRANSFORM+= R:${BUILDLINK_DIR}:${LOCALBASE}
.if defined(USE_X11) && ${X11_TYPE} != "modular"
_BLNK_TRANSFORM+= rpath:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}:${X11BASE}
+_CWRAPPERS_TRANSFORM+= R:${BUILDLINK_X11_DIR}:${X11BASE}
.endif
#
# Protect some directories that we allow to be specified for the runtime
@@ -1033,6 +1044,7 @@ _BLNK_TRANSFORM+= rpath:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}:${X11BASE}
#
.for _dir_ in ${_BLNK_PASSTHRU_DIRS} ${_BLNK_PASSTHRU_RPATHDIRS}
_BLNK_TRANSFORM+= rpath:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
+_CWRAPPERS_TRANSFORM+= R:${_dir_}:${_dir_}
.endfor
#
# Protect /usr/lib/* as they're all allowed to be specified for the
@@ -1040,6 +1052,7 @@ _BLNK_TRANSFORM+= rpath:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
#
.for _dir_ in ${SYSTEM_DEFAULT_RPATH:S/:/ /g}
_BLNK_TRANSFORM+= sub-rpath:${_dir_}:${_BLNK_MANGLE_DIR.${_dir}}
+_CWRAPPERS_TRANSFORM+= R:/usr/lib:/usr/lib
.endfor
#
# Change references to ${DEPOTBASE}/<pkg> into ${LOCALBASE} so that
@@ -1055,8 +1068,10 @@ _BLNK_TRANSFORM+= depot:${DEPOTBASE}:${LOCALBASE}
#
.if ${PKG_INSTALLATION_TYPE} == "overwrite"
_BLNK_TRANSFORM+= P:${LOCALBASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}
+_CWRAPPERS_TRANSFORM+= P:${X11BASE}:${BUILDLINK_X11_DIR}
. if defined(USE_X11) && ${X11_TYPE} != "modular"
_BLNK_TRANSFORM+= P:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
+_CWRAPPERS_TRANSFORM+= P:${LOCALBASE}:${BUILDLINK_DIR}
. endif
.endif
#
@@ -1067,6 +1082,8 @@ _BLNK_TRANSFORM+= P:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
.if defined(USE_X11) && empty(LOCALBASE:M${X11BASE}*) && ${X11_TYPE} != "modular"
_BLNK_TRANSFORM+= I:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
_BLNK_TRANSFORM+= L:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
+_CWRAPPERS_TRANSFORM+= I:${X11BASE}:${BUILDLINK_X11_DIR}
+_CWRAPPERS_TRANSFORM+= L:${X11BASE}:${BUILDLINK_X11_DIR}
.endif
#
# Transform references to ${LOCALBASE} into ${BUILDLINK_DIR}.
@@ -1074,6 +1091,8 @@ _BLNK_TRANSFORM+= L:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
.if ${PKG_INSTALLATION_TYPE} == "overwrite"
_BLNK_TRANSFORM+= I:${LOCALBASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}
_BLNK_TRANSFORM+= L:${LOCALBASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}
+_CWRAPPERS_TRANSFORM+= I:${LOCALBASE}:${BUILDLINK_DIR}
+_CWRAPPERS_TRANSFORM+= L:${LOCALBASE}:${BUILDLINK_DIR}
.endif
#
# Transform references to ${X11BASE} into ${BUILDLINK_X11_DIR}.
@@ -1083,6 +1102,8 @@ _BLNK_TRANSFORM+= L:${LOCALBASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}
.if defined(USE_X11) && !empty(LOCALBASE:M${X11BASE}*) && ${X11_TYPE} != "modular"
_BLNK_TRANSFORM+= I:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
_BLNK_TRANSFORM+= L:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
+_CWRAPPERS_TRANSFORM+= I:${X11BASE}:${BUILDLINK_X11_DIR}
+_CWRAPPERS_TRANSFORM+= L:${X11BASE}:${BUILDLINK_X11_DIR}
.endif
#
# Protect any remaining references to ${PREFIX}, ${LOCALBASE}, or ${X11BASE}.
@@ -1136,6 +1157,10 @@ _BLNK_LIBTOOL_FIX_LA= ${WRAPPER_TMPDIR}/libtool-fix-la
# We need to "unbuildlinkify" any libtool archives.
_BLNK_WRAP_LT_UNTRANSFORM_SED= ${SUBST_SED.unwrap}
+.if defined(USE_X11) && ${X11_TYPE} != "modular"
+_CWRAPPERS_UNWRAP+= ${BUILDLINK_X11_DIR}:${X11BASE}
+.endif
+_CWRAPPERS_UNWRAP+= ${BUILDLINK_DIR}:${LOCALBASE}
# The libtool wrapper should do all of the same transformations as the
# compiler wrapper since the primary mode of operation of the wrapper
diff --git a/mk/cwrappers.mk b/mk/cwrappers.mk
new file mode 100644
index 00000000000..36bafbe31f1
--- /dev/null
+++ b/mk/cwrappers.mk
@@ -0,0 +1,71 @@
+# $NetBSD: cwrappers.mk,v 1.1 2014/11/24 00:32:31 joerg Exp $
+#
+# This Makefile fragment implements integration of pkgtools/cwrappers.
+
+BUILD_DEPENDS+= cwrappers>=20100308:../../pkgtools/cwrappers
+
+CWRAPPERS_SRC_DIR= ${PREFIX}/libexec/cwrappers
+CWRAPPERS_BIN_DIR= ${WRKDIR}/.cwrapper/bin
+CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config
+CONFIGURE_ENV+= WRAPPER_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
+MAKE_ENV+= WRAPPER_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
+ALL_ENV+= WRAPPER_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
+
+CWRAPPERS_CONFIG.as= as
+CWRAPPERS_CONFIG.cc= cc
+CWRAPPERS_CONFIG.cxx= c++
+CWRAPPERS_CONFIG.cpp= cpp
+CWRAPPERS_CONFIG.f77= f77
+CWRAPPERS_CONFIG.imake= imake
+CWRAPPERS_CONFIG.ld= ld
+CWRAPPERS_CONFIG.libtool= libtool
+CWRAPPERS_CONFIG.shlibtool= shlibtool
+
+CWRAPPERS_ALIASES.as= as
+CWRAPPERS_ALIASES.cc= cc gcc
+CWRAPPERS_ALIASES.cxx= c++ g++ CC cxx
+CWRAPPERS_ALIASES.cpp= cpp
+CWRAPPERS_ALIASES.f77= f77 g77
+CWRAPPERS_ALIASES.imake= imake
+CWRAPPERS_ALIASES.ld= ld
+CWRAPPERS_ALIASES.libtool= libtool
+CWRAPPERS_ALIASES.shlibtool= shlibtool
+
+CWRAPPERS_WRAPPEE.as= ${AS:Ufalse}
+CWRAPPERS_WRAPPEE.cxx= ${CXX:Ufalse}
+CWRAPPERS_WRAPPEE.cc= ${CC:Ufalse}
+CWRAPPERS_WRAPPEE.cpp= ${CPP:Ufalse}
+CWRAPPERS_WRAPPEE.f77= ${F77:Ufalse}
+CWRAPPERS_WRAPPEE.imake= ${IMAKE:Ufalse}
+CWRAPPERS_WRAPPEE.ld= ${LD:Ufalse}
+CWRAPPERS_WRAPPEE.libtool= ${PREFIX}/bin/libtool
+CWRAPPERS_WRAPPEE.shlibtool= ${PREFIX}/bin/shlibtool
+
+.PHONY: generate-cwrapper
+
+do-wrapper: generate-cwrapper
+
+generate-cwrapper:
+ ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${CWRAPPERS_BIN_DIR}
+.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=${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}}
+. endfor
+. for cmd in ${_CWRAPPERS_TRANSFORM}
+ ${RUN}echo transform=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
+. endfor
+. for cmd in ${_CWRAPPERS_UNWRAP}
+ ${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}
+. endfor
+.endfor
+
+_LIBTOOL= ${CWRAPPERS_BIN_DIR}/libtool
+_SHLIBTOOL= ${CWRAPPERS_BIN_DIR}/shlibtool
+PREPEND_PATH+= ${CWRAPPERS_BIN_DIR}
diff --git a/mk/defaults/mk.conf b/mk/defaults/mk.conf
index dfe3720d361..b5e4b61afd8 100644
--- a/mk/defaults/mk.conf
+++ b/mk/defaults/mk.conf
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.248 2014/11/21 10:46:36 obache Exp $
+# $NetBSD: mk.conf,v 1.249 2014/11/24 00:32:31 joerg Exp $
#
# This file provides default values for variables that may be overridden
@@ -12,6 +12,12 @@
# NOTE TO PEOPLE EDITING THIS FILE - USE LEADING SPACES, NOT LEADING TABS.
# ************************************************************************
+USE_CWRAPPERS?= no
+# build packages using the newer rpkgtools/cwrapper infrastructure.
+# WARNING: Experimental!
+# Possible: yes, no
+# Default: no
+
#ALLOW_VULNERABLE_PACKAGES=
# allow the user to build packages which are known to be vulnerable to
# security exploits
diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk
index 30eb1623c79..417b6e9845f 100644
--- a/mk/wrapper/bsd.wrapper.mk
+++ b/mk/wrapper/bsd.wrapper.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.89 2014/03/06 10:15:54 uebayasi Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.90 2014/11/24 00:32:31 joerg Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -65,7 +65,9 @@ ECHO_WRAPPER_MSG?= ${TRUE}
# 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