summaryrefslogtreecommitdiff
path: root/mk/djbware.mk
diff options
context:
space:
mode:
authorschmonz <schmonz>2005-03-23 01:45:34 +0000
committerschmonz <schmonz>2005-03-23 01:45:34 +0000
commitedc84915cfd78f34191b3034c68370dfb17fbd43 (patch)
tree983e403e66c8b2ea6810d8b579d35e98e9170ab6 /mk/djbware.mk
parent5b4152b298f02f5cd1881ee1c8620323b06c50ae (diff)
downloadpkgsrc-edc84915cfd78f34191b3034c68370dfb17fbd43.tar.gz
Replace inline definitions of errno with "#include <errno.h>" to
fix compilation on systems with glibc 2.3.1 or newer.
Diffstat (limited to 'mk/djbware.mk')
-rw-r--r--mk/djbware.mk16
1 files changed, 14 insertions, 2 deletions
diff --git a/mk/djbware.mk b/mk/djbware.mk
index d2f723fb518..888b0be8a3c 100644
--- a/mk/djbware.mk
+++ b/mk/djbware.mk
@@ -1,4 +1,4 @@
-# $NetBSD: djbware.mk,v 1.1 2005/03/23 00:50:06 schmonz Exp $
+# $NetBSD: djbware.mk,v 1.2 2005/03/23 01:45:34 schmonz Exp $
#
# Makefile fragment for packages with djb-style build machinery
#
@@ -6,16 +6,18 @@
# * a boilerplate RESTRICTED clause
# * typical defaults for BUILD_TARGET and INSTALL_TARGET
# * typical values for conf-* files
+# * replace inline definitions of errno with "#include <errno.h>"
#
# TODO:
# * set RESTRICTED automatically iff patches or other mods are applied
-# * on recent glibc, subst.mk inline errno defn into #include <errno.h>
+# * do the <errno.h> dance only where needed (glibc>=2.3)
#
.if !defined(DJBWARE_MK)
DJBWARE_MK= # defined
DJB_RESTRICTED?= YES
+DJB_ERRNO_HACK?= YES
DJB_BUILD_TARGETS?= # empty
DJB_INSTALL_TARGETS?= # empty
DJB_CONFIG_DIR?= ${WRKSRC}
@@ -24,6 +26,8 @@ DJB_CONFIG_HOME?= conf-home
DJB_CONFIG_CMDS?= ${DO_NADA}
BGWARE_INSTALLER?= NO
+BUILD_DEFS+= DJB_ERRNO_HACK
+
.if !empty(DJB_RESTRICTED:M[yY][eE][sS])
RESTRICTED= "modified source and binaries may not be distributed"
NO_BIN_ON_CDROM= ${RESTRICTED}
@@ -33,6 +37,14 @@ NO_BIN_ON_FTP= ${RESTRICTED}
BUILD_TARGET?= it ${DJB_BUILD_TARGETS}
INSTALL_TARGET?= setup check ${DJB_INSTALL_TARGETS}
+.if !empty(DJB_ERRNO_HACK:M[yY][eE][sS])
+SUBST_CLASSES+= djbware
+SUBST_STAGE.djbware= do-configure
+SUBST_FILES.djbware= error.h
+SUBST_SED.djbware= -e 's|^extern\ int\ errno\;|\#include \<errno.h\>|'
+SUBST_MESSAGE.djbware= "Correcting definition of errno."
+.endif
+
.if !target(do-configure)
do-configure:
${_PKG_SILENT}${_PKG_DEBUG}cd ${DJB_CONFIG_DIR}; \