diff options
author | tnn <tnn@pkgsrc.org> | 2007-04-24 23:12:44 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2007-04-24 23:12:44 +0000 |
commit | 5f2360b6dcd4f4fc45b839c5e928fbb91c5cb860 (patch) | |
tree | 079084c08f9dfbc6a73604b6de849d42e34b9afb /pkgtools | |
parent | 53110f964711a033cfad16f8a8fe3cbff556791b (diff) | |
download | pkgsrc-5f2360b6dcd4f4fc45b839c5e928fbb91c5cb860.tar.gz |
When we're substituting a system-provided header file, use the C
preprocessor to find out the absolute path of the system header, so that
we may include it before we add our customizations.
This is especially important when using gcc, due to it's "fixincludes".
For example, <math.h> might not be /usr/include/math.h, but instead
something like /path/to/gcc/lib/gcc/${MACHINE_GNU_PLATFORM}/include/math.h.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/posix_headers/Makefile | 26 | ||||
-rw-r--r-- | pkgtools/posix_headers/files/math.h | 4 |
2 files changed, 24 insertions, 6 deletions
diff --git a/pkgtools/posix_headers/Makefile b/pkgtools/posix_headers/Makefile index 551721f7038..a88633422aa 100644 --- a/pkgtools/posix_headers/Makefile +++ b/pkgtools/posix_headers/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.1.1.1 2007/04/24 19:35:46 tnn Exp $ +# $NetBSD: Makefile,v 1.2 2007/04/24 23:12:44 tnn Exp $ DISTNAME= posix_headers-0.4 +PKGREVISION= 1 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty @@ -13,19 +14,36 @@ NO_PKGTOOLS_REQD_CHECK= yes NO_CHECKSUM= yes NO_MTREE= yes NO_CONFIGURE= yes -NO_BUILD= yes -USE_LANGUAGES= ONLY_FOR_PLATFORM= HPUX-11.11-* # add more as needed PLIST_SRC= ${WRKDIR}/PLIST_SRC POSIX_HEADERS.HPUX= sys/select.h stdint.h math.h +SUBST_HEADERS.HPUX= math.h BUILDING_POSIX_HEADERS= yes +# Command that uses the C preprocessing feature to find out the real absolute +# path of a header included using #include <someheader.h> +REAL_HEADER_CMD= ${ECHO} "\#include <@REAL_HEADER@>" | ${CC} -E - | \ + ${AWK} -F'"' '/\# 1 .*@REAL_HEADER@"/ {print $$2}' + +do-extract: + ${MKDIR} ${WRKSRC} + cd ${FILESDIR} && ${PAX} -rw * ${WRKSRC} + +do-build: +.for header in ${SUBST_HEADERS.${OPSYS}} + realheader=`${REAL_HEADER_CMD:S/@REAL_HEADER@/${header}/}` ;\ + ${ECHO} "header: ${header} -> $$realheader" ;\ + ${SED} "s|@REAL_HEADER@|$$realheader|" \ + < ${WRKSRC}/${header} > ${WRKSRC}/${header}.tmp + ${MV} ${WRKSRC}/${header}.tmp ${WRKSRC}/${header} +.endfor + do-install: for h in ${POSIX_HEADERS.${OPSYS}}; do \ - ${INSTALL_DATA} ${FILESDIR}/"$$h" ${PREFIX}/include/"$$h"; \ + ${INSTALL_DATA} ${WRKSRC}/"$$h" ${PREFIX}/include/"$$h"; \ ${ECHO} include/"$$h" >> ${PLIST_SRC}; \ done diff --git a/pkgtools/posix_headers/files/math.h b/pkgtools/posix_headers/files/math.h index eaf0195d08c..d1967d51903 100644 --- a/pkgtools/posix_headers/files/math.h +++ b/pkgtools/posix_headers/files/math.h @@ -1,7 +1,7 @@ -/* $NetBSD: math.h,v 1.1.1.1 2007/04/24 19:35:46 tnn Exp $ */ +/* $NetBSD: math.h,v 1.2 2007/04/24 23:12:44 tnn Exp $ */ #ifndef _PKGSRC_MATH_H_ #define _PKGSRC_MATH_H_ -#include "/usr/include/math.h" +#include "@REAL_HEADER@" #ifdef __hpux /* Floatified math functions are not available. */ #define floorf(x) ((float)floor (x)) |