diff options
author | tnn <tnn> | 2015-04-19 13:30:35 +0000 |
---|---|---|
committer | tnn <tnn> | 2015-04-19 13:30:35 +0000 |
commit | 3aff006d6356ab6d68e742506894920bdeebcc4a (patch) | |
tree | b586fca129820b6e4c3dd4b1f60ee7e7e3f03d85 /pkgtools | |
parent | 773bca7d39421835fbad824c46e478f82c63e217 (diff) | |
download | pkgsrc-3aff006d6356ab6d68e742506894920bdeebcc4a.tar.gz |
Trust libnbcompat to know if we need a getline(3) replacement or not.
Avoids us having to encode a list of all such platforms here.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/cwrappers/Makefile | 5 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/Makefile | 6 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/common.c | 3 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/common.h | 5 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/fixup-libtool.c | 5 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/getline.c | 52 |
6 files changed, 8 insertions, 68 deletions
diff --git a/pkgtools/cwrappers/Makefile b/pkgtools/cwrappers/Makefile index b59f29d3343..af1aa18eeb8 100644 --- a/pkgtools/cwrappers/Makefile +++ b/pkgtools/cwrappers/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2015/03/18 15:05:35 jperkin Exp $ +# $NetBSD: Makefile,v 1.10 2015/04/19 13:30:35 tnn Exp $ PKGNAME= cwrappers-20150318 CATEGORIES= pkgtools sysutils @@ -21,9 +21,6 @@ CHECK_PERMS= no .if ${OPSYS} != "NetBSD" || !empty(MACHINE_PLATFORM:MNetBSD-[0-5].*) MAKE_ENV+= NEED_MI_VECTOR_HASH=1 .endif -.if !empty(MACHINE_PLATFORM:MDarwin-9.*) || !empty(MACHINE_PLATFORM:MDarwin-10.*) -MAKE_ENV+= NEED_GETLINE=1 -.endif CFLAGS.FreeBSD+= -D_WITH_GETLINE CFLAGS.Linux+= -D_GNU_SOURCE=1 diff --git a/pkgtools/cwrappers/files/bin/Makefile b/pkgtools/cwrappers/files/bin/Makefile index b4cdfc60942..5d92841dc0a 100644 --- a/pkgtools/cwrappers/files/bin/Makefile +++ b/pkgtools/cwrappers/files/bin/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2014/09/18 19:31:47 joerg Exp $ +# $NetBSD: Makefile,v 1.3 2015/04/19 13:30:35 tnn Exp $ # PROGS= as-wrapper cc-wrapper c++-wrapper cpp-wrapper f77-wrapper \ imake-wrapper ld-wrapper libtool-wrapper shlibtool-wrapper @@ -11,10 +11,6 @@ LIB_SRCS= alloc.c cleanup-cc.c common.c reorder-cc.c LIB_SRCS+= mi_vector_hash.c CPPFLAGS+= -DNEED_MI_VECTOR_HASH .endif -.ifdef NEED_GETLINE -LIB_SRCS+= getline.c -CPPFLAGS+= -DNEED_GETLINE -.endif LDADD+= -lnbcompat diff --git a/pkgtools/cwrappers/files/bin/common.c b/pkgtools/cwrappers/files/bin/common.c index 279e562cadc..5d44db1ce91 100644 --- a/pkgtools/cwrappers/files/bin/common.c +++ b/pkgtools/cwrappers/files/bin/common.c @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.3 2014/11/29 22:19:55 joerg Exp $ */ +/* $NetBSD: common.c,v 1.4 2015/04/19 13:30:35 tnn Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -32,6 +32,7 @@ #include <nbcompat.h> #include <sys/wait.h> #include <nbcompat/err.h> +#include <nbcompat/stdio.h> #include <nbcompat/stdlib.h> #include <string.h> #include <unistd.h> diff --git a/pkgtools/cwrappers/files/bin/common.h b/pkgtools/cwrappers/files/bin/common.h index c0d79d0896d..5aea466c178 100644 --- a/pkgtools/cwrappers/files/bin/common.h +++ b/pkgtools/cwrappers/files/bin/common.h @@ -1,4 +1,4 @@ -/* $NetBSD: common.h,v 1.3 2015/02/13 22:18:38 jperkin Exp $ */ +/* $NetBSD: common.h,v 1.4 2015/04/19 13:30:35 tnn Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -104,8 +104,5 @@ void fixup_libtool(struct arglist *); #ifdef NEED_MI_VECTOR_HASH void mi_vector_hash(const void *, size_t, uint32_t, uint32_t[3]); #endif -#ifdef NEED_GETLINE -ssize_t getline(char **, size_t *, FILE *); -#endif #endif diff --git a/pkgtools/cwrappers/files/bin/fixup-libtool.c b/pkgtools/cwrappers/files/bin/fixup-libtool.c index 652ac4e0feb..2cd61b6944c 100644 --- a/pkgtools/cwrappers/files/bin/fixup-libtool.c +++ b/pkgtools/cwrappers/files/bin/fixup-libtool.c @@ -1,4 +1,4 @@ -/* $NetBSD: fixup-libtool.c,v 1.5 2015/03/18 15:05:36 jperkin Exp $ */ +/* $NetBSD: fixup-libtool.c,v 1.6 2015/04/19 13:30:35 tnn Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -29,10 +29,11 @@ * SUCH DAMAGE. */ +#include <nbcompat.h> +#include <nbcompat/stdio.h> #include <sys/stat.h> #include <err.h> #include <stdint.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/pkgtools/cwrappers/files/bin/getline.c b/pkgtools/cwrappers/files/bin/getline.c deleted file mode 100644 index 7bace4143d8..00000000000 --- a/pkgtools/cwrappers/files/bin/getline.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "common.h" - -ssize_t -getline(char **lineptr, size_t *len, FILE *fp) -{ - char *iter, *eos; - int ch; - - if (*len == 1) { - free(*lineptr); - *len = 0; - } - if (*len == 0) { - *lineptr = malloc(128); - if (*lineptr == NULL) - return -1; - *len = 128; - } - - iter = *lineptr; - for (;;) { - eos = *lineptr + *len - 1; - - while (iter < eos) { - ch = getc_unlocked(fp); - if (ch == -1) - break; - *iter++ = ch; - if (ch == '\n') { - *iter = '\0'; - return iter - *lineptr; - } - } - if (iter == *lineptr) - return -1; - if (iter < eos) { - *iter = '\0'; - return iter - *lineptr; - } - - iter = realloc(*lineptr, *len * 2); - if (iter == NULL) - return -1; - *lineptr = iter; - iter += *len - 1; - *len *= 2; - } -} |