pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/posix_headers Near full rewrite of posix_head...
details: https://anonhg.NetBSD.org/pkgsrc/rev/418f28d0f06a
branches: trunk
changeset: 531550:418f28d0f06a
user: tnn <tnn%pkgsrc.org@localhost>
date: Wed Aug 01 21:33:40 2007 +0000
description:
Near full rewrite of posix_headers:
- Implement a simple framework for automated header testing and generation
using the c preprocessor.
- Make it installable on all platforms. On most platforms it will not install
any files however.
- Bump revision to 0.5.
The changes should make it easier to add Interix support to this package.
Note that the package is still far from complete; for example the replacement
stdint.h does not yet provide fallback definitions for int_*t and friends
but relies on inttypes.h to provide them, which turns out to work for HPUX.
diffstat:
pkgtools/posix_headers/Makefile | 35 +-----
pkgtools/posix_headers/buildlink3.mk | 6 +-
pkgtools/posix_headers/files/make.sh | 17 +++
pkgtools/posix_headers/files/math.h | 18 ---
pkgtools/posix_headers/files/math.h.in | 30 ++++++
pkgtools/posix_headers/files/math.h.tests | 10 ++
pkgtools/posix_headers/files/resolv.h | 16 ---
pkgtools/posix_headers/files/resolv.h.in | 10 ++
pkgtools/posix_headers/files/resolv.h.tests | 1 +
pkgtools/posix_headers/files/stdint.h | 12 --
pkgtools/posix_headers/files/stdint.h.in | 8 +
pkgtools/posix_headers/files/stdint.h.tests | 2 +
pkgtools/posix_headers/files/stdlib.h | 32 ------
pkgtools/posix_headers/files/stdlib.h.in | 5 +
pkgtools/posix_headers/files/stdlib.h.tests | 1 +
pkgtools/posix_headers/files/subr.sh | 111 ++++++++++++++++++++++++
pkgtools/posix_headers/files/sys/select.h | 9 -
pkgtools/posix_headers/files/sys/select.h.in | 3 +
pkgtools/posix_headers/files/sys/select.h.tests | 1 +
19 files changed, 211 insertions(+), 116 deletions(-)
diffs (truncated from 432 to 300 lines):
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/Makefile
--- a/pkgtools/posix_headers/Makefile Wed Aug 01 21:24:57 2007 +0000
+++ b/pkgtools/posix_headers/Makefile Wed Aug 01 21:33:40 2007 +0000
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.5 2007/04/28 21:03:56 tnn Exp $
+# $NetBSD: Makefile,v 1.6 2007/08/01 21:33:40 tnn Exp $
-DISTNAME= posix_headers-0.4
-PKGREVISION= 5
+DISTNAME= posix_headers-0.5
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
@@ -14,37 +13,21 @@
NO_CHECKSUM= yes
NO_MTREE= yes
NO_CONFIGURE= yes
-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 resolv.h stdlib.h
-SUBST_HEADERS.HPUX= math.h resolv.h stdlib.h
-
+REPLACE_SH+= make.sh
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}
+ cp -R ${FILESDIR} ${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
+ cd ${WRKSRC} && ./make.sh
+ find ${WRKSRC} -name "*.h" | sed s,${WRKSRC}/,, > ${WRKSRC}/hfiles
+ cat ${WRKSRC}/hfiles | sed s,^,include/, > ${PLIST_SRC}
do-install:
-.for header in ${POSIX_HEADERS.${OPSYS}}
- ${INSTALL_DATA} ${WRKSRC}/${header} ${PREFIX}/include/${header}
- ${ECHO} include/${header} >> ${PLIST_SRC}
-.endfor
+ for f in `cat ${WRKSRC}/hfiles`; do \
+ ${INSTALL_DATA} ${WRKSRC}/$$f ${DESTDIR}${PREFIX}/include/$$f; done
.include "../../mk/bsd.pkg.mk"
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/buildlink3.mk
--- a/pkgtools/posix_headers/buildlink3.mk Wed Aug 01 21:24:57 2007 +0000
+++ b/pkgtools/posix_headers/buildlink3.mk Wed Aug 01 21:33:40 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.4 2007/04/29 19:52:44 tnn Exp $
+# $NetBSD: buildlink3.mk,v 1.5 2007/08/01 21:33:40 tnn Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
POSIX_HEADERS_BUILDLINK3_MK:= ${POSIX_HEADERS_BUILDLINK3_MK}+
@@ -12,8 +12,8 @@
BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}posix_headers
.if !empty(POSIX_HEADERS_BUILDLINK3_MK:M+)
-BUILDLINK_API_DEPENDS.posix_headers+= posix_headers>=0.4nb5
-BUILDLINK_ABI_DEPENDS.posix_headers+= posix_headers>=0.4nb5
+BUILDLINK_API_DEPENDS.posix_headers+= posix_headers>=0.5
+BUILDLINK_ABI_DEPENDS.posix_headers+= posix_headers>=0.5
BUILDLINK_PKGSRCDIR.posix_headers?= ../../pkgtools/posix_headers
BUILDLINK_DEPMETHOD.posix_headers?= build
.endif # POSIX_HEADERS_BUILDLINK3_MK
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/make.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/make.sh Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,17 @@
+#! /bin/sh
+#
+# $NetBSD: make.sh,v 1.1 2007/08/01 21:33:40 tnn Exp $
+#
+# Please read subr.sh for a brief explanation of how this works.
+
+[ -z "$CC" ] && CC=gcc
+[ -z "$CPP" ] && CPP="$CC -E"
+
+HEADERS="math.h resolv.h stdlib.h stdint.h sys/select.h"
+
+. ./subr.sh
+
+for hdr in $HEADERS
+do
+ make_header $hdr
+done
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/math.h
--- a/pkgtools/posix_headers/files/math.h Wed Aug 01 21:24:57 2007 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-/* $NetBSD: math.h,v 1.2 2007/04/24 23:12:44 tnn Exp $ */
-#ifndef _PKGSRC_MATH_H_
-#define _PKGSRC_MATH_H_
-#include "@REAL_HEADER@"
-#ifdef __hpux
-/* Floatified math functions are not available. */
-#define floorf(x) ((float)floor (x))
-#define ceilf(x) ((float)ceil (x))
-#define sinf(x) ((float)sin (x))
-#define cosf(x) ((float)cos (x))
-#define tanf(x) ((float)tan (x))
-#define asinf(x) ((float)asin (x))
-#define acosf(x) ((float)acos (x))
-#define atanf(x) ((float)atan (x))
-#define atan2f(x,y) ((float)atan2 (x, y))
-#define sqrtf(x) ((float)sqrt (y))
-#endif /* __hpux */
-#endif /* _PKGSRC_MATH_H_ */
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/math.h.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/math.h.in Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,30 @@
+#ifndef @floorf@
+@define floorf(x) ((float)floor (x))
+#endif
+#ifndef @ceilf@
+@define ceilf(x) ((float)ceil (x))
+#endif
+#ifndef @sinf@
+@define sinf(x) ((float)sin (x))
+#endif
+#ifndef @cosf@
+@define cosf(x) ((float)cos (x))
+#endif
+#ifndef @tanf@
+@define tanf(x) ((float)tan (x))
+#endif
+#ifndef @asinf@
+@define asinf(x) ((float)asin (x))
+#endif
+#ifndef @acosf@
+@define acosf(x) ((float)acos (x))
+#endif
+#ifndef @atanf@
+@define atanf(x) ((float)atan (x))
+#endif
+#ifndef @atan2f@
+@define atan2f(x,y) ((float)atan2 (x, y))
+#endif
+#ifndef @sqrtf@
+@define sqrtf(x) ((float)sqrt (y))
+#endif
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/math.h.tests
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/math.h.tests Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,10 @@
+scan_preproc|floorf| floorf(
+scan_preproc|ceilf| ceilf(
+scan_preproc|sinf| sinf(
+scan_preproc|cosf| cosf(
+scan_preproc|tanf| tanf(
+scan_preproc|asinf| asinf(
+scan_preproc|acosf| acosf(
+scan_preproc|atanf| atanf(
+scan_preproc|atan2f| atan2f(
+scan_preproc|sqrtf| sqrtf(
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/resolv.h
--- a/pkgtools/posix_headers/files/resolv.h Wed Aug 01 21:24:57 2007 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-/* $NetBSD: resolv.h,v 1.2 2007/04/28 21:03:56 tnn Exp $ */
-#ifndef _PKGSRC_RESOLV_H_
-#define _PKGSRC_RESOLV_H_
-#include "@REAL_HEADER@"
-#ifdef __hpux
-/* Missing prototypes. We have them in libc though. */
-ssize_t res_query(char*, int, int, u_char*, int);
-ssize_t res_search(char*, int, int, u_char*, int);
-ssize_t res_mkquery(int, const char*, int, int, const char*, int,\
- const char*, char*, int);
-ssize_t res_send(const char*, ssize_t, char*, int);
-int res_init();
-ssize_t dn_comp(const char*, u_char*, ssize_t, u_char**, u_char**);
-ssize_t dn_expand(const u_char*, const u_char*, const u_char*, u_char*, int);
-#endif /* __hpux */
-#endif /* _PKGSRC_RESOLV_H_ */
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/resolv.h.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/resolv.h.in Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,10 @@
+#if !defined(@have_res_proto@) && defined(__hpux)
+ssize_t res_query(char*, int, int, u_char*, int);
+ssize_t res_search(char*, int, int, u_char*, int);
+ssize_t res_mkquery(int, const char*, int, int, const char*, int,\
+ const char*, char*, int);
+ssize_t res_send(const char*, ssize_t, char*, int);
+int res_init();
+ssize_t dn_comp(const char*, u_char*, ssize_t, u_char**, u_char**);
+ssize_t dn_expand(const u_char*, const u_char*, const u_char*, u_char*, int);
+#endif
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/resolv.h.tests
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/resolv.h.tests Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,1 @@
+scan_preproc|have_res_proto|dn_expand
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/stdint.h
--- a/pkgtools/posix_headers/files/stdint.h Wed Aug 01 21:24:57 2007 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-/* $NetBSD: stdint.h,v 1.1.1.1 2007/04/24 19:35:46 tnn Exp $ */
-#ifndef _PKGSRC_STDINT_H_
-#define _PKGSRC_STDINT_H_
-#ifdef __hpux
-#include <inttypes.h>
-#ifndef UINT_FAST32_MAX
-#define UINT_FAST32_MAX 0xffffffffU
-#endif /* UINT_FAST32_MAX */
-#else
-#error No support for this platform.
-#endif /* __hpux */
-#endif /* _PKGSRC_STDINT_H_ */
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/stdint.h.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/stdint.h.in Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,8 @@
+#ifndef @have_stdint@
+#ifdef @have_inttypes@
+@include <inttypes.h>
+#endif
+@ifndef UINT_FAST32_MAX
+@define UINT_FAST32_MAX 0xffffffffU
+@endif
+#endif
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/stdint.h.tests
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/stdint.h.tests Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,2 @@
+have_header|have_stdint|stdint.h
+have_header|have_inttypes|inttypes.h
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/stdlib.h
--- a/pkgtools/posix_headers/files/stdlib.h Wed Aug 01 21:24:57 2007 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/* $NetBSD: stdlib.h,v 1.3 2007/04/28 23:33:36 tnn Exp $ */
-#ifndef _PKGSRC_STDLIB_H_
-#define _PKGSRC_STDLIB_H_
-#include "@REAL_HEADER@"
-#ifdef __hpux
-/* What were they thinking? */
-#include <inttypes.h>
-#define strtoll __strtoll
-#define strtoull __strtoull
-/* provide a setenv(3) implementation */
-#if 0
-/*
- * XXX: disabled because some GNU configure scripts don't pick this up,
- * they look for the symbol in the c library. A better solution is needed.
- */
-#include <string.h>
-#include <stdio.h>
-static __inline int setenv(const char *name, const char *value, int overwrite);
-static __inline int setenv(const char *name, const char *value, int overwrite) {
- char *c;
- int ret;
- if (!overwrite && getenv(name)) return(-1);
- c = (char*)malloc(strlen(name)+strlen(value)+2);
- if(!c) return(-1);
- sprintf(c, "%s=%s", name, value);
- ret = putenv(c);
- free(c);
- return(ret);
-}
-#endif /* 0 */
-#endif /* __hpux */
-#endif /* _PKGSRC_STDLIB_H_ */
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/stdlib.h.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/stdlib.h.in Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,5 @@
+#if !defined(@strtoll@) || defined(__hpux)
+@include <inttypes.h>
+@define strtoll __strtoll
+@define strtoull __strtoull
+#endif
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/stdlib.h.tests
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/stdlib.h.tests Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,1 @@
+scan_preproc|strtoll| strtoll
diff -r 2f9b0cb17459 -r 418f28d0f06a pkgtools/posix_headers/files/subr.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/posix_headers/files/subr.sh Wed Aug 01 21:33:40 2007 +0000
@@ -0,0 +1,111 @@
+#
+# $NetBSD: subr.sh,v 1.1 2007/08/01 21:33:46 tnn Exp $
+#
+
Home |
Main Index |
Thread Index |
Old Index