pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/posix_headers When we're substituting a syste...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d5ad102c77e1
branches:  trunk
changeset: 528218:d5ad102c77e1
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Tue Apr 24 23:12:44 2007 +0000

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

 pkgtools/posix_headers/Makefile     |  26 ++++++++++++++++++++++----
 pkgtools/posix_headers/files/math.h |   4 ++--
 2 files changed, 24 insertions(+), 6 deletions(-)

diffs (65 lines):

diff -r e3ef9290addc -r d5ad102c77e1 pkgtools/posix_headers/Makefile
--- a/pkgtools/posix_headers/Makefile   Tue Apr 24 22:45:03 2007 +0000
+++ b/pkgtools/posix_headers/Makefile   Tue Apr 24 23:12:44 2007 +0000
@@ -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_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 -r e3ef9290addc -r d5ad102c77e1 pkgtools/posix_headers/files/math.h
--- a/pkgtools/posix_headers/files/math.h       Tue Apr 24 22:45:03 2007 +0000
+++ b/pkgtools/posix_headers/files/math.h       Tue Apr 24 23:12:44 2007 +0000
@@ -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))



Home | Main Index | Thread Index | Old Index