From: Ben Gras Date: Fri, 1 Jul 2011 13:57:43 +0000 (+0200) Subject: Reduce compiler/libraries/headers cases to only two X-Git-Tag: v3.2.0~496 X-Git-Url: http://zhaoyanbai.com/repos/doc/roff.7.html?a=commitdiff_plain;h=f3d5a9dc616da7f2a0e330388955115b60050031;p=minix.git Reduce compiler/libraries/headers cases to only two 1. ack, a.out, minix headers (moved to /usr/include.ack), minix libc 2. gcc/clang, elf, netbsd headers (moved to /usr/include), netbsd libc (moved to /usr/lib) So this obsoletes the /usr/netbsd hierarchy. No special invocation for netbsd libc necessary - it's always used for gcc/clang. --- diff --git a/Makefile b/Makefile index 74c8edc65..e788d2e77 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,7 @@ clean: $(MAKE) -C test clean cleandepend: + $(MAKE) -C lib cleandepend_all $(MAKE) -C boot cleandepend $(MAKE) -C commands cleandepend $(MAKE) -C bin cleandepend diff --git a/commands/acd/Makefile b/commands/acd/Makefile index ee0ddf681..559070b0d 100644 --- a/commands/acd/Makefile +++ b/commands/acd/Makefile @@ -5,9 +5,6 @@ PROG= acd CPPFLAGS+= -DARCH=\"`arch`\" -DDESCR=\"/usr/lib/descr\" LINKS+= ${BINDIR}/acd ${BINDIR}/cc -FILESDIR= /usr/lib -FILES= acd.descr -FILESNAME= descr MAN= .include diff --git a/common/include/arch/i386/Makefile.inc b/common/include/arch/i386/Makefile.inc index 0f20ddb2d..bc6e15d55 100644 --- a/common/include/arch/i386/Makefile.inc +++ b/common/include/arch/i386/Makefile.inc @@ -2,7 +2,7 @@ .PATH: ${MINIXSRCDIR}/common/include/arch/i386 INCS+= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \ - interrupt.h memory.h partition.h \ + interrupt.h memory.h multiboot.h partition.h \ pci.h pci_amd.h pci_intel.h pci_sis.h pci_via.h \ ports.h stackframe.h vm.h elf.h diff --git a/include/arch/i386/multiboot.h b/common/include/arch/i386/multiboot.h similarity index 100% rename from include/arch/i386/multiboot.h rename to common/include/arch/i386/multiboot.h diff --git a/docs/UPDATING b/docs/UPDATING index ff539f21f..e8b185873 100644 --- a/docs/UPDATING +++ b/docs/UPDATING @@ -1,3 +1,34 @@ +20110701: + # rm -rf /usr/include /usr/netbsd + # make etcfiles includes cleandepend depend gnu-includes + + DOWNGRADING: + Important: this automatically updates your /usr/lib/descr, + something you will have to revert manually if you + want to go back a revision! Previous to this + revision, you do this by: + # cp commands/acd/acd.descr /usr/lib/descr + Repeating the above commands to make sure your /usr/include + is re-acked is probably a good idea too for going back revisions. + + This change moves + 1. /usr/include to /usr/include.ack + 2. /usr/netbsd/include to /usr/include + + Reduce compiler cases to only two: + 1. ack, a.out, minix headers (moved to /usr/include.ack), + minix libc + 2. gcc/clang, elf, netbsd headers (moved to /usr/include), + netbsd libc (moved to /usr/lib) + + So this obsoletes the /usr/netbsd hierarchy. + + There are no specific UPDATING instructions, but you should know + that starting with this version, gcc/clang use the netbsd libc and + headers system exclusively, and those files are in the standard + locations now. It's the first step to switching completely and + simplifying building. + 20110629: Rebuild m4: make -C usr.bin/m4 install diff --git a/etc/Makefile b/etc/Makefile index f709d1023..4404daaec 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -13,8 +13,8 @@ USRFILES=Makefile clean:: install:: - @echo "Installing /etc and /usr/etc.." - mkdir -p $(ETC) + @echo "Installing /etc, /usr/etc and /usr/lib.." + mkdir -p $(ETC) $(USRLIB) @for f in $(FILES1); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 755 $(ETC)/$$f; fi; done @for f in $(FILES2); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 600 $(ETC)/$$f; fi; done @for f in $(USRFILES); do cp usr/$$f $(USR)/$$f; chmod 644 $(USR)/$$f; done @@ -29,6 +29,8 @@ install:: for u in /usr/ast ~root; do cp ast/.[aepv]* $$u ; done @echo "Installing fonts.." install -m 644 -o root -g operator fonts/*.fnt /usr/lib/fonts/ + @echo "Installing /usr/lib/descr.." + install -m 644 -o root -g operator descr /usr/lib/ installforce:: $(ETC)/rc $(ETC)/rs.inet $(ETC)/rs.single $(ETC)/system.conf $(USRETC)/rc $(USR)/Makefile diff --git a/commands/acd/acd.descr b/etc/descr similarity index 98% rename from commands/acd/acd.descr rename to etc/descr index 2d5ead0ec..77f226355 100644 --- a/commands/acd/acd.descr +++ b/etc/descr @@ -18,8 +18,8 @@ ifndef ARCH import ARCH # Compiler passes. -ACK_CPP = $A/cpp.ansi $CPP_F $PREDEF $NOLINENO -ACK_CEM = $A/em_cemcom.ansi -L $CPP_F $PREDEF \ +ACK_CPP = $A/cpp.ansi $CPP_F $PREDEF $NOLINENO -I/usr/include.ack +ACK_CEM = $A/em_cemcom.ansi -L $CPP_F $PREDEF \ -Vw${W}.${W}i${W}.${W}p${P}.${W}f4.${W}s2.2l4.${W}d8.${W} ACK_M2 = $A/em_m2 -I$MOD_INCL -WR \ -Vw${W}.${W}i${W}.${W}p${P}.${W}l4.${W}f4.${W}d8.${W} @@ -298,7 +298,7 @@ transform "" .E # Compile C source to EM-code. transform .c .k transform .i .k - $ACK_CEM $* $> + $ACK_CEM -I/usr/include.ack $* $> ifndef RTSO RTSO = -.c LIBS = $LIBS + -.c diff --git a/etc/mtree/minix.tree b/etc/mtree/minix.tree index a28b455d9..81b180b9f 100644 --- a/etc/mtree/minix.tree +++ b/etc/mtree/minix.tree @@ -21,16 +21,16 @@ 755 root operator /usr/pkg/etc 755 root operator /usr/pkg/etc/rc.d 755 root operator /home -755 root operator /usr/include -755 root operator /usr/include/i386 -755 root operator /usr/include/arpa -755 root operator /usr/include/minix -755 root operator /usr/include/net -755 root operator /usr/include/net/gen -755 root operator /usr/include/netinet -755 root operator /usr/include/sys -755 root operator /usr/include/ddekit -755 root operator /usr/include/ddekit/minix +755 root operator /usr/include.ack +755 root operator /usr/include.ack/i386 +755 root operator /usr/include.ack/arpa +755 root operator /usr/include.ack/minix +755 root operator /usr/include.ack/net +755 root operator /usr/include.ack/net/gen +755 root operator /usr/include.ack/netinet +755 root operator /usr/include.ack/sys +755 root operator /usr/include.ack/ddekit +755 root operator /usr/include.ack/ddekit/minix 755 root operator /usr/lib 755 root operator /usr/lib/advent 755 root operator /usr/lib/cawf @@ -55,22 +55,20 @@ 755 root operator /usr/man/man8 755 root operator /usr/man/man9 755 root operator /usr/mdec -755 root operator /usr/netbsd -755 root operator /usr/netbsd/include -755 root operator /usr/netbsd/include/i386 -755 root operator /usr/netbsd/include/arpa -755 root operator /usr/netbsd/include/compat -755 root operator /usr/netbsd/include/compat/machine -755 root operator /usr/netbsd/include/ddekit -755 root operator /usr/netbsd/include/ddekit/minix -755 root operator /usr/netbsd/include/minix -755 root operator /usr/netbsd/include/net -755 root operator /usr/netbsd/include/net/gen -755 root operator /usr/netbsd/include/protocols -755 root operator /usr/netbsd/include/rpcsvc -755 root operator /usr/netbsd/include/ssp -755 root operator /usr/netbsd/include/sys -755 root operator /usr/netbsd/lib +755 root operator /usr/include +755 root operator /usr/include/i386 +755 root operator /usr/include/arpa +755 root operator /usr/include/compat +755 root operator /usr/include/compat/machine +755 root operator /usr/include/ddekit +755 root operator /usr/include/ddekit/minix +755 root operator /usr/include/minix +755 root operator /usr/include/net +755 root operator /usr/include/net/gen +755 root operator /usr/include/protocols +755 root operator /usr/include/rpcsvc +755 root operator /usr/include/ssp +755 root operator /usr/include/sys 700 root operator /usr/preserve 755 root operator /usr/run 755 root operator /usr/share diff --git a/include/Makefile b/include/Makefile index 8ded2bece..4ed6f85fa 100644 --- a/include/Makefile +++ b/include/Makefile @@ -21,7 +21,7 @@ INCS+= netinet/if_ether.h netinet/in.h netinet/tcp.h .include -INCSDIR= /usr/include +INCSDIR= /usr/include.ack .include "${MINIXSRCDIR}/common/include/Makefile.inc" .include "${MINIXSRCDIR}/common/include/Makefile.termios.inc" diff --git a/include/arch/Makefile b/include/arch/Makefile index 9668ddb76..9d108587f 100644 --- a/include/arch/Makefile +++ b/include/arch/Makefile @@ -2,6 +2,6 @@ SUBDIR= ${ARCH} -INCSYMLINKS= ${MACHINE} /usr/include/machine +INCSYMLINKS= ${MACHINE} /usr/include.ack/machine .include diff --git a/include/arch/i386/Makefile b/include/arch/i386/Makefile index 5637c78b0..14128f73d 100644 --- a/include/arch/i386/Makefile +++ b/include/arch/i386/Makefile @@ -1,4 +1,4 @@ -INCSDIR= /usr/include/i386 +INCSDIR= /usr/include.ack/i386 INCS+= _align.h asm.h mcontext.h multiboot.h param.h diff --git a/include/sys/Makefile b/include/sys/Makefile index 0cdfa7ec5..ab0feb33b 100644 --- a/include/sys/Makefile +++ b/include/sys/Makefile @@ -1,6 +1,6 @@ .include -INCSDIR= /usr/include/sys +INCSDIR= /usr/include.ack/sys INCS= asynchio.h dir.h file.h \ ioctl.h ipc.h jmp_buf.h kbdio.h mman.h \ diff --git a/lib/Makefile b/lib/Makefile index 4b083d1fc..876928b5a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -44,3 +44,6 @@ clean_all: sh ack_build.sh clean sh elf_build.sh clean +cleandepend_all: + sh ack_build.sh cleandepend + sh elf_build.sh cleandepend diff --git a/lib/elf_build.sh b/lib/elf_build.sh index 6b03019af..2c0c18ecf 100755 --- a/lib/elf_build.sh +++ b/lib/elf_build.sh @@ -6,7 +6,5 @@ export CC=${CC:-clang} export COMPILER_TYPE=gnu export PATH=$PATH:/usr/pkg/bin -export MAKEOBJDIR=obj-elfbase-nbsd -make $@ NBSD_LIBC=yes -export MAKEOBJDIR=obj-elfbase -make $@ NBSD_LIBC=no +export MAKEOBJDIR=obj-elfbase-nbsd NBSD_LIBC=yes +make $@ diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index 52de5badb..cdd3fea67 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -65,10 +65,10 @@ SRCS+= minix_utils.c .endif CPPFLAGS+= -DHAVE_CONFIG_H -.if (${NBSD_LIBC} != "no") -INCSDIR= /usr/netbsd/include -.else +.if ${NBSD_LIBC} == "yes" INCSDIR= /usr/include +.else +INCSDIR= /usr/include.ack .endif INCS= archive.h \ archive_entry.h diff --git a/lib/libbz2/Makefile b/lib/libbz2/Makefile index aee7c69d7..fc7295541 100644 --- a/lib/libbz2/Makefile +++ b/lib/libbz2/Makefile @@ -8,10 +8,11 @@ SRCS= bzlib.c blocksort.c compress.c crctable.c decompress.c \ huffman.c randtable.c CPPFLAGS+= -I ${BZ2DIR} INCS= bzlib.h + .if (${NBSD_LIBC} != "no") -INCSDIR= /usr/netbsd/include +INCSDIR= /usr/include .else -INCSDIR= /usr/include +INCSDIR= /usr/include.ack .endif .include diff --git a/lib/libelf/Makefile b/lib/libelf/Makefile index 8534a8881..c0d5a8c3a 100644 --- a/lib/libelf/Makefile +++ b/lib/libelf/Makefile @@ -1,10 +1,5 @@ # $Id$ -# Requires NBSD_LIBC and clang/gcc (we default to using clang) -NBSD_LIBC:= yes -CC:=${CC:C/^cc/clang/} -COMPILER_TYPE:= gnu - LIB= elf SRCS= elf.c \ @@ -163,11 +158,7 @@ libelf_convert.c: elf_types.m4 libelf_convert.m4 libelf_fsize.c: elf_types.m4 libelf_fsize.m4 libelf_msize.c: elf_types.m4 libelf_msize.m4 -.if (${NBSD_LIBC} != "no") -INCSDIR= /usr/netbsd/include -.else INCSDIR= /usr/include -.endif .include diff --git a/lib/libexec/Makefile b/lib/libexec/Makefile index 098db0019..d1f7b1d34 100644 --- a/lib/libexec/Makefile +++ b/lib/libexec/Makefile @@ -5,8 +5,9 @@ INCS= libexec.h SRCS= exec_aout.c exec_elf.c .if (${NBSD_LIBC} != "no") -INCSDIR= /usr/netbsd/include -.else INCSDIR= /usr/include +.else +INCSDIR= /usr/include.ack .endif + .include diff --git a/lib/libz/Makefile b/lib/libz/Makefile index f87038a06..b23fa456b 100644 --- a/lib/libz/Makefile +++ b/lib/libz/Makefile @@ -6,9 +6,9 @@ SRCS= adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c gzread.c \ gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c .if (${NBSD_LIBC} != "no") -INCSDIR= /usr/netbsd/include -.else INCSDIR= /usr/include +.else +INCSDIR= /usr/include.ack .endif INCS= zconf.h zlib.h diff --git a/lib/nbsd_libasyn/Makefile b/lib/nbsd_libasyn/Makefile index 6d3593d82..55567e7a7 100644 --- a/lib/nbsd_libasyn/Makefile +++ b/lib/nbsd_libasyn/Makefile @@ -2,8 +2,7 @@ .PATH: ${MINIXSRCDIR}/lib/libc/asyn LIB= asyn INCS= asynchio.h -INCSDIR= /usr/netbsd/include/sys - +INCSDIR= /usr/include/sys SRCS+= asyn_cancel.c asyn_close.c asyn_init.c asyn_pending.c asyn_read.c \ asyn_special.c asyn_synch.c asyn_wait.c asyn_write.c diff --git a/lib/nbsd_libc/minix-config.inc b/lib/nbsd_libc/minix-config.inc index 4dde4e263..61bb99238 100644 --- a/lib/nbsd_libc/minix-config.inc +++ b/lib/nbsd_libc/minix-config.inc @@ -1,5 +1,5 @@ NETBSDSRCDIR= ${MINIXSRCDIR} -NETBSDINCLUDES= /usr/netbsd/include/ +NETBSDINCLUDES= /usr/include/ MACHINE_ARCH?= i386 CITRUS=yes diff --git a/lib/nbsd_libc/minix-port.patch b/lib/nbsd_libc/minix-port.patch index 4ccc28c9e..b5786ff31 100644 --- a/lib/nbsd_libc/minix-port.patch +++ b/lib/nbsd_libc/minix-port.patch @@ -365,6 +365,24 @@ diff -ru nbsdsrc/src/lib/libc/gdtoa/gdtoa_locks.c lib/nbsd_libc/gdtoa/gdtoa_lock +#ifdef _REENTRANT /* !__minix */ mutex_t __gdtoa_locks[2] = { MUTEX_INITIALIZER, MUTEX_INITIALIZER }; +#endif /* _REENTRANT */ +diff -ru nbsdsrc/src/lib/libc/gdtoa/gdtoaimp.h lib/nbsd_libc/gdtoa/gdtoaimp.h +--- nbsdsrc/src/lib/libc/gdtoa/gdtoaimp.h ++++ lib/nbsd_libc/gdtoa/gdtoaimp.h +@@ -1,4 +1,4 @@ +-/* $NetBSD: gdtoaimp.h,v 1.7 2009/05/07 20:31:44 christos Exp $ */ ++/* $NetBSD: gdtoaimp.h,v 1.8 2011/01/21 23:36:49 christos Exp $ */ + + /**************************************************************** + +@@ -276,7 +276,7 @@ + Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined. + #endif + +-typedef union { double d; ULong L[2]; } U; ++typedef union { double d; ULong L[2]; } __attribute__((__may_alias__)) U; + + #ifdef YES_ALIAS + #define dval(x) x diff -ru nbsdsrc/src/lib/libc/gen/Makefile.inc lib/nbsd_libc/gen/Makefile.inc --- nbsdsrc/src/lib/libc/gen/Makefile.inc +++ lib/nbsd_libc/gen/Makefile.inc @@ -953,6 +971,231 @@ diff -ru nbsdsrc/src/lib/libc/gen/getpwent.c lib/nbsd_libc/gen/getpwent.c mutex_unlock(&_pwmutex); switch (r) { case NS_SUCCESS: +diff -ru nbsdsrc/src/lib/libc/gen/glob.c lib/nbsd_libc/gen/glob.c +--- nbsdsrc/src/lib/libc/gen/glob.c ++++ lib/nbsd_libc/gen/glob.c +@@ -1,4 +1,4 @@ +-/* $NetBSD: glob.c,v 1.27 2010/09/06 14:40:25 christos Exp $ */ ++/* $NetBSD: glob.c,v 1.28 2011/01/21 23:30:31 christos Exp $ */ + + /* + * Copyright (c) 1989, 1993 +@@ -37,7 +37,7 @@ + #if 0 + static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; + #else +-__RCSID("$NetBSD: glob.c,v 1.27 2010/09/06 14:40:25 christos Exp $"); ++__RCSID("$NetBSD: glob.c,v 1.28 2011/01/21 23:30:31 christos Exp $"); + #endif + #endif /* LIBC_SCCS and not lint */ + +@@ -87,13 +87,18 @@ + #define NO_GETPW_R + #endif + +-#define GLOB_LIMIT_MALLOC 65536 +-#define GLOB_LIMIT_STAT 128 +-#define GLOB_LIMIT_READDIR 16384 ++#define GLOB_LIMIT_STRING 65536 /* number of readdirs */ ++#define GLOB_LIMIT_STAT 128 /* number of stat system calls */ ++#define GLOB_LIMIT_READDIR 16384 /* total buffer size of path strings */ ++#define GLOB_LIMIT_PATH 1024 /* number of path elements */ ++#define GLOB_LIMIT_BRACE 128 /* Number of brace calls */ + +-#define GLOB_INDEX_MALLOC 0 +-#define GLOB_INDEX_STAT 1 +-#define GLOB_INDEX_READDIR 2 ++struct glob_limit { ++ size_t l_string; ++ size_t l_stat; ++ size_t l_readdir; ++ size_t l_brace; ++}; + + /* + * XXX: For NetBSD 1.4.x compatibility. (kill me l8r) +@@ -158,17 +163,17 @@ + static DIR *g_opendir(Char *, glob_t *); + static Char *g_strchr(const Char *, int); + static int g_stat(Char *, __gl_stat_t *, glob_t *); +-static int glob0(const Char *, glob_t *, size_t *); +-static int glob1(Char *, glob_t *, size_t *); ++static int glob0(const Char *, glob_t *, struct glob_limit *); ++static int glob1(Char *, glob_t *, struct glob_limit *); + static int glob2(Char *, Char *, Char *, const Char *, glob_t *, +- size_t *); ++ struct glob_limit *); + static int glob3(Char *, Char *, Char *, const Char *, const Char *, +- const Char *, glob_t *, size_t *); +-static int globextend(const Char *, glob_t *, size_t *); ++ const Char *, glob_t *, struct glob_limit *); ++static int globextend(const Char *, glob_t *, struct glob_limit *); + static const Char *globtilde(const Char *, Char *, size_t, glob_t *); +-static int globexp1(const Char *, glob_t *, size_t *); ++static int globexp1(const Char *, glob_t *, struct glob_limit *); + static int globexp2(const Char *, const Char *, glob_t *, int *, +- size_t *); ++ struct glob_limit *); + static int match(const Char *, const Char *, const Char *); + #ifdef DEBUG + static void qprintf(const char *, Char *); +@@ -181,8 +186,7 @@ + const u_char *patnext; + int c; + Char *bufnext, *bufend, patbuf[MAXPATHLEN+1]; +- /* 0 = malloc(), 1 = stat(), 2 = readdir() */ +- size_t limit[] = { 0, 0, 0 }; ++ struct glob_limit limit = { 0, 0, 0, 0 }; + + _DIAGASSERT(pattern != NULL); + +@@ -218,9 +222,9 @@ + *bufnext = EOS; + + if (flags & GLOB_BRACE) +- return globexp1(patbuf, pglob, limit); ++ return globexp1(patbuf, pglob, &limit); + else +- return glob0(patbuf, pglob, limit); ++ return glob0(patbuf, pglob, &limit); + } + + /* +@@ -229,7 +233,7 @@ + * characters + */ + static int +-globexp1(const Char *pattern, glob_t *pglob, size_t *limit) ++globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit) + { + const Char* ptr = pattern; + int rv; +@@ -237,6 +241,12 @@ + _DIAGASSERT(pattern != NULL); + _DIAGASSERT(pglob != NULL); + ++ if ((pglob->gl_flags & GLOB_LIMIT) && ++ limit->l_brace++ >= GLOB_LIMIT_BRACE) { ++ errno = 0; ++ return GLOB_NOSPACE; ++ } ++ + /* Protect a single {}, for find(1), like csh */ + if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) + return glob0(pattern, pglob, limit); +@@ -256,7 +266,7 @@ + */ + static int + globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, +- size_t *limit) ++ struct glob_limit *limit) + { + int i; + Char *lm, *ls; +@@ -461,7 +471,7 @@ + * to find no matches. + */ + static int +-glob0(const Char *pattern, glob_t *pglob, size_t *limit) ++glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit) + { + const Char *qpatnext; + int c, error; +@@ -570,7 +580,7 @@ + } + + static int +-glob1(Char *pattern, glob_t *pglob, size_t *limit) ++glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit) + { + Char pathbuf[MAXPATHLEN+1]; + +@@ -596,7 +606,7 @@ + */ + static int + glob2(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern, +- glob_t *pglob, size_t *limit) ++ glob_t *pglob, struct glob_limit *limit) + { + __gl_stat_t sb; + const Char *p; +@@ -624,10 +634,11 @@ + return 0; + + if ((pglob->gl_flags & GLOB_LIMIT) && +- limit[GLOB_INDEX_STAT]++ >= GLOB_LIMIT_STAT) { ++ limit->l_stat++ >= GLOB_LIMIT_STAT) { + errno = 0; + *pathend++ = SEP; + *pathend = EOS; ++printf("stat limit\n"); + return GLOB_NOSPACE; + } + if (((pglob->gl_flags & GLOB_MARK) && +@@ -692,7 +703,7 @@ + static int + glob3(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern, + const Char *restpattern, const Char *pglobstar, glob_t *pglob, +- size_t *limit) ++ struct glob_limit *limit) + { + struct dirent *dp; + DIR *dirp; +@@ -785,7 +796,7 @@ + Char *dc; + + if ((pglob->gl_flags & GLOB_LIMIT) && +- limit[GLOB_INDEX_READDIR]++ >= GLOB_LIMIT_READDIR) { ++ limit->l_readdir++ >= GLOB_LIMIT_READDIR) { + errno = 0; + *pathend++ = SEP; + *pathend = EOS; +@@ -894,7 +905,7 @@ + * gl_pathv points to (gl_offs + gl_pathc + 1) items. + */ + static int +-globextend(const Char *path, glob_t *pglob, size_t *limit) ++globextend(const Char *path, glob_t *pglob, struct glob_limit *limit) + { + char **pathv; + size_t i, newsize, len; +@@ -905,6 +916,9 @@ + _DIAGASSERT(pglob != NULL); + + newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); ++ if ((pglob->gl_flags & GLOB_LIMIT) && ++ newsize > GLOB_LIMIT_PATH * sizeof(*pathv)) ++ goto nospace; + pathv = pglob->gl_pathv ? realloc(pglob->gl_pathv, newsize) : + malloc(newsize); + if (pathv == NULL) +@@ -921,7 +935,7 @@ + for (p = path; *p++;) + continue; + len = (size_t)(p - path); +- limit[GLOB_INDEX_MALLOC] += len; ++ limit->l_string += len; + if ((copy = malloc(len)) != NULL) { + if (g_Ctoc(path, copy, len)) { + free(copy); +@@ -932,12 +946,13 @@ + pathv[pglob->gl_offs + pglob->gl_pathc] = NULL; + + if ((pglob->gl_flags & GLOB_LIMIT) && +- (newsize + limit[GLOB_INDEX_MALLOC]) >= GLOB_LIMIT_MALLOC) { +- errno = 0; +- return GLOB_NOSPACE; +- } ++ (newsize + limit->l_string) >= GLOB_LIMIT_STRING) ++ goto nospace; + + return copy == NULL ? GLOB_NOSPACE : 0; ++nospace: ++ errno = 0; ++ return GLOB_NOSPACE; + } + + diff -ru nbsdsrc/src/lib/libc/gen/gr_private.h lib/nbsd_libc/gen/gr_private.h --- nbsdsrc/src/lib/libc/gen/gr_private.h +++ lib/nbsd_libc/gen/gr_private.h diff --git a/lib/nbsd_libc/pkgconfig/Makefile b/lib/nbsd_libc/pkgconfig/Makefile index 4c2c4c916..e34cc5b45 100644 --- a/lib/nbsd_libc/pkgconfig/Makefile +++ b/lib/nbsd_libc/pkgconfig/Makefile @@ -3,7 +3,7 @@ NOOBJ= # defined .include FILES=libc.pc -FILESDIR=/usr/netbsd/lib +FILESDIR=/usr/lib FILESMODE=444 .include diff --git a/lib/nbsd_libc/pkgconfig/libc.pc b/lib/nbsd_libc/pkgconfig/libc.pc index 828a9df8c..e997aa887 100644 --- a/lib/nbsd_libc/pkgconfig/libc.pc +++ b/lib/nbsd_libc/pkgconfig/libc.pc @@ -1,5 +1,4 @@ Name: c Description: NetBSD C Library Version: 1.0 -Libs: -nostdlib /usr/netbsd/lib/crt1.o /usr/netbsd/lib/crti.o /usr/netbsd/lib/crtn.o -L/usr/netbsd/lib -lc -L/usr/pkg/lib -lgcc -L/usr/netbsd/lib -lminlib -lcompat_minix -Cflags: -nostdinc -D__NBSD_LIBC -isystem /usr/netbsd/include +Libs: -lc -lminlib -lcompat_minix diff --git a/lib/nbsd_libcompat_minix/include/Makefile.inc b/lib/nbsd_libcompat_minix/include/Makefile.inc index a6f0f1a1c..c07ff6715 100644 --- a/lib/nbsd_libcompat_minix/include/Makefile.inc +++ b/lib/nbsd_libcompat_minix/include/Makefile.inc @@ -1,6 +1,6 @@ .PATH: ${MINIXSRCDIR}/lib/nbsd_libcompat_minix/include -INCSDIR= /usr/netbsd/include +INCSDIR= /usr/include INCS+= configfile.h termcap.h INCS+= compat/a.out.h compat/regexp.h compat/syslog.h \ diff --git a/lib/nbsd_libcompat_minix/pkgconfig/Makefile b/lib/nbsd_libcompat_minix/pkgconfig/Makefile index 73a654d12..6fa213cf5 100644 --- a/lib/nbsd_libcompat_minix/pkgconfig/Makefile +++ b/lib/nbsd_libcompat_minix/pkgconfig/Makefile @@ -3,7 +3,7 @@ NOOBJ= # defined .include FILES=compat_minix.pc -FILESDIR=/usr/netbsd/lib +FILESDIR=/usr/lib FILESMODE=444 .include diff --git a/lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc b/lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc index f763fd81e..5e7eec352 100644 --- a/lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc +++ b/lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc @@ -1,5 +1,4 @@ Name: compat_minix Description: Minix Compatibility Library Version: 1.0 -Libs: -L/usr/netbsd/lib -lcompat_minix -Cflags: -I/usr/netbsd/include +Libs: -lcompat_minix diff --git a/lib/nbsd_libminlib/Makefile b/lib/nbsd_libminlib/Makefile index 76062b65e..12bbfc39c 100644 --- a/lib/nbsd_libminlib/Makefile +++ b/lib/nbsd_libminlib/Makefile @@ -1,6 +1,6 @@ .include .PATH: ${.CURDIR} ${.CURDIR}/${MACHINE} -INCSDIR= /usr/netbsd/include +INCSDIR= /usr/include LIB= minlib CPPFLAGS.fslib.c+= -I${MINIXSRCDIR}/servers diff --git a/lib/nbsd_libminlib/pkgconfig/Makefile b/lib/nbsd_libminlib/pkgconfig/Makefile index b70ad99ab..426ad5ba4 100644 --- a/lib/nbsd_libminlib/pkgconfig/Makefile +++ b/lib/nbsd_libminlib/pkgconfig/Makefile @@ -3,7 +3,7 @@ NOOBJ= # defined .include FILES=minlib.pc -FILESDIR=/usr/netbsd/lib +FILESDIR=/usr/lib FILESMODE=444 .include diff --git a/lib/nbsd_libminlib/pkgconfig/minlib.pc b/lib/nbsd_libminlib/pkgconfig/minlib.pc index 9fb06b6ea..de98a5370 100644 --- a/lib/nbsd_libminlib/pkgconfig/minlib.pc +++ b/lib/nbsd_libminlib/pkgconfig/minlib.pc @@ -1,6 +1,6 @@ Name: minlib Description: Minix Compatibility Library Version: 1.0 -Libs: -L/usr/netbsd/lib -lminlib -Cflags: -I/usr/netbsd/include +Libs: -lminlib +Cflags: diff --git a/nbsd_include/Makefile b/nbsd_include/Makefile index 8c4a912a5..085a6d0ad 100644 --- a/nbsd_include/Makefile +++ b/nbsd_include/Makefile @@ -59,11 +59,7 @@ INCS+= ieeefp.h .include -.if defined(__MINIX) -INCSDIR= /usr/netbsd/include -.else INCSDIR= /usr/include -.endif .if defined(__MINIX) # RPC is not compiled in the libc. This include also needs diff --git a/nbsd_include/arch/Makefile b/nbsd_include/arch/Makefile index 058d2b9b4..d9989a0b8 100644 --- a/nbsd_include/arch/Makefile +++ b/nbsd_include/arch/Makefile @@ -53,10 +53,10 @@ SUBDIR+= xen # x68k x86_64 xen \ # zaurus -INCSYMLINKS= ${MACHINE} /usr/netbsd/include/machine +INCSYMLINKS= ${MACHINE} /usr/include/machine -INCSYMLINKS+= machine/float.h /usr/netbsd/include/float.h \ - machine/stdarg.h /usr/netbsd/include/stdarg.h +INCSYMLINKS+= machine/float.h /usr/include/float.h \ + machine/stdarg.h /usr/include/stdarg.h .include diff --git a/nbsd_include/arch/i386/include/Makefile b/nbsd_include/arch/i386/include/Makefile index c01b94fb4..93281aee8 100644 --- a/nbsd_include/arch/i386/include/Makefile +++ b/nbsd_include/arch/i386/include/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.36 2007/12/20 23:46:12 ad Exp $ .include -INCSDIR= /usr/netbsd/include/i386 +INCSDIR= /usr/include/i386 INCS= ansi.h asm.h bswap.h byte_swap.h cdefs.h \ endian.h endian_machdep.h fenv.h float.h ieee.h \ diff --git a/nbsd_include/arch/x86/include/Makefile b/nbsd_include/arch/x86/include/Makefile index 86b9686a3..c568c8e9b 100644 --- a/nbsd_include/arch/x86/include/Makefile +++ b/nbsd_include/arch/x86/include/Makefile @@ -1,6 +1,6 @@ # $NetBSD: Makefile,v 1.13 2008/05/11 15:32:20 ad Exp $ -INCSDIR=/usr/netbsd/include/x86 +INCSDIR=/usr/include/x86 INCS= float.h \ ieee.h \ diff --git a/nbsd_include/minix-port.patch b/nbsd_include/minix-port.patch index a40d5494a..b3b07a6f5 100644 --- a/nbsd_include/minix-port.patch +++ b/nbsd_include/minix-port.patch @@ -38,15 +38,9 @@ diff -ru nbsdsrc/src/include/Makefile nbsd_include/Makefile INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \ arpa/telnet.h arpa/tftp.h INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \ -@@ -40,10 +59,28 @@ - .include +@@ -42,8 +61,22 @@ - -+.if defined(__MINIX) -+INCSDIR= /usr/netbsd/include -+.else INCSDIR= /usr/include -+.endif +.if defined(__MINIX) +# RPC is not compiled in the libc. This include also needs @@ -197,21 +191,6 @@ diff -ru nbsdsrc/src/include/pwd.h nbsd_include/pwd.h #ifndef _PWD_H_ #define _PWD_H_ -diff -ru nbsdsrc/src/include/rpc/Makefile nbsd_include/rpc/Makefile ---- nbsdsrc/src/include/rpc/Makefile -+++ nbsd_include/rpc/Makefile -@@ -7,7 +7,11 @@ - svc.h svc_auth.h svc_soc.h types.h xdr.h - RPC_INCS= rpcb_prot.h - -+.if defined(__MINIX) -+INCSDIR= /usr/netbsd/include/rpc -+.else - INCSDIR= /usr/include/rpc -+.endif - - .include - .include diff -ru nbsdsrc/src/include/sched.h nbsd_include/sched.h --- nbsdsrc/src/include/sched.h +++ nbsd_include/sched.h diff --git a/nbsd_include/minix/Makefile b/nbsd_include/minix/Makefile index f59fa6ae6..92b56b8c8 100644 --- a/nbsd_include/minix/Makefile +++ b/nbsd_include/minix/Makefile @@ -2,7 +2,7 @@ NOOBJ= # defined .include -INCSDIR= /usr/netbsd/include/minix +INCSDIR= /usr/include/minix INCS+= dirent.h paths.h types.h diff --git a/nbsd_include/net/Makefile b/nbsd_include/net/Makefile index 1a5a4e9b0..3b46d5e1f 100644 --- a/nbsd_include/net/Makefile +++ b/nbsd_include/net/Makefile @@ -1,4 +1,4 @@ -INCSDIR= /usr/netbsd/include/net +INCSDIR= /usr/include/net INCS+= hton.h ethertypes.h if.h if_ether.h netlib.h diff --git a/nbsd_include/netinet/Makefile b/nbsd_include/netinet/Makefile index c83b50dc5..805741080 100644 --- a/nbsd_include/netinet/Makefile +++ b/nbsd_include/netinet/Makefile @@ -1,4 +1,4 @@ -INCSDIR= /usr/netbsd/include/netinet +INCSDIR= /usr/include/netinet INCS+= in.h tcp.h diff --git a/nbsd_include/netinet6/Makefile b/nbsd_include/netinet6/Makefile index 32c07e9f4..4d5a883d8 100644 --- a/nbsd_include/netinet6/Makefile +++ b/nbsd_include/netinet6/Makefile @@ -1,4 +1,4 @@ -INCSDIR= /usr/netbsd/include/netinet6 +INCSDIR= /usr/include/netinet6 INCS+= in6.h diff --git a/nbsd_include/rpc/Makefile b/nbsd_include/rpc/Makefile index 8c93b4ffc..b37d99d96 100644 --- a/nbsd_include/rpc/Makefile +++ b/nbsd_include/rpc/Makefile @@ -7,11 +7,7 @@ INCS= auth.h auth_unix.h clnt.h clnt_soc.h nettype.h \ svc.h svc_auth.h svc_soc.h types.h xdr.h RPC_INCS= rpcb_prot.h -.if defined(__MINIX) -INCSDIR= /usr/netbsd/include/rpc -.else INCSDIR= /usr/include/rpc -.endif .include .include diff --git a/nbsd_include/sys/Makefile b/nbsd_include/sys/Makefile index 278e843ac..1763baa54 100644 --- a/nbsd_include/sys/Makefile +++ b/nbsd_include/sys/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.126 2010/03/01 21:10:13 darran Exp $ -NETBSDINCSDIR= /usr/netbsd/include -INCSDIR= /usr/netbsd/include/sys +NETBSDINCSDIR= /usr/include +INCSDIR= /usr/include/sys .include diff --git a/share/Makefile b/share/Makefile index edb1205a6..8ae65e740 100644 --- a/share/Makefile +++ b/share/Makefile @@ -1,8 +1,5 @@ .include -SUBDIR= mk -.if (${NBSD_LIBC} == "no") -SUBDIR+= zoneinfo -.endif +SUBDIR= mk zoneinfo .include diff --git a/share/mk/Makefile b/share/mk/Makefile index 4eff2fc36..5bb2943db 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -8,7 +8,7 @@ FILES= bsd.ack.mk bsd.dep.mk bsd.files.mk \ bsd.init.mk bsd.kinc.mk bsd.klinks.mk bsd.lib.mk \ bsd.links.mk bsd.man.mk bsd.obj.mk bsd.own.mk \ bsd.prog.mk bsd.subdir.mk bsd.sys.mk bsd.gcov.mk \ - minix.libc.mk pkgsrchooks.mk sys.mk + pkgsrchooks.mk sys.mk # MINIX-specific files FILES+= minix.bootprog.mk diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index f90077df1..47753cd83 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -541,12 +541,6 @@ OBJECT_FMT= ELF OBJECT_FMT= a.out .endif -.if ${COMPILER_TYPE} == "gnu" -.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no") -LIBDIR= /usr/netbsd/lib -.endif -.endif - # # If this platform's toolchain is missing, we obviously cannot build it. # diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index cccc74201..3e0de997a 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -28,12 +28,8 @@ cleanprog: .PHONY cleanobjs cleanextra ##### Default values .if empty(CPPFLAGS:M-nostdinc) -.if (${NBSD_LIBC} == "yes") -CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/netbsd/include} -.else CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include} .endif -.endif .if empty(CXXFLAGS:M-nostdinc++) CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++} .endif @@ -69,12 +65,8 @@ LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a .if ${COMPILER_TYPE} == "ack" LIB${_lib:tu}= ${DESTDIR}/usr/lib/i386/lib${_lib}.a .elif ${COMPILER_TYPE} == "gnu" -.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no") -LIB${_lib:tu}= ${DESTDIR}/usr/netbsd/lib/lib${_lib}.a -.else LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a .endif -.endif .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded .endif .endfor diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index d6c27a74c..b32b043e2 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -66,8 +66,7 @@ HAS_SSP= yes .endif .if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no") -CPPFLAGS+= -nostdinc -D__NBSD_LIBC -isystem /usr/netbsd/include -LDFLAGS+= -L /usr/netbsd/lib +CPPFLAGS+= -D__NBSD_LIBC .endif .if defined(USE_FORT) && (${USE_FORT} != "no") diff --git a/share/mk/minix.libc.mk b/share/mk/minix.libc.mk deleted file mode 100644 index 9ed8619f3..000000000 --- a/share/mk/minix.libc.mk +++ /dev/null @@ -1,6 +0,0 @@ -# NetBSD libc flags go here -NETBSD_LIBC_CPPFLAGS=-B/usr/netbsd -D__NBSD_LIBC -NETBSD_LIBC_LDFLAGS=-B/usr/netbsd:/usr/netbsd/lib -lminlib -lcompat_minix -# Minix libc flags go here -MINIX_LIBC_CPPFLAGS= -MINIX_LIBC_LDFLAGS= diff --git a/share/mk/pkgsrchooks.mk b/share/mk/pkgsrchooks.mk index ad4a6a36a..f9b8d54c9 100644 --- a/share/mk/pkgsrchooks.mk +++ b/share/mk/pkgsrchooks.mk @@ -2,35 +2,4 @@ .if !defined(_MINIX_PKGSRC_HOOKS_) _MINIX_PKGSRC_HOOKS_=1 - -# Get PKGS_REQUIRING_MINIX_LIBC -.include "/usr/pkgsrc/minix/pkgs_requiring_minix_libc.mk" - -# Get MINIX_LIBC_* and NETBSD_LIBC_* -.include "/usr/share/mk/minix.libc.mk" - -# Build everything not in PKGS_REQUIRING_MINIX_LIBC with NetBSD libc -PKG_REQUIRES_MINIX_LIBC=no - -# Search PKGS_REQUIRING_MINIX_LIBC to see if it needs Minix libc -.for PKG_REQUIRING_MINIX_LIBC in ${PKGS_REQUIRING_MINIX_LIBC} -.if "${PKG_REQUIRING_MINIX_LIBC}" == "${PKGPATH}" -PKG_REQUIRES_MINIX_LIBC=yes -.endif -.endfor - -# Set the proper compilation flags -.if ${PKG_REQUIRES_MINIX_LIBC} == yes -CPPFLAGS+= ${MINIX_LIBC_CPPFLAGS} -LDFLAGS+= ${MINIX_LIBC_LDFLAGS} -.else -SED=/bin/sed -.include "/usr/pkgsrc/mk/nbsd_libc.buildlink3.mk" -PREFER_NATIVE+=minlib -PREFER_NATIVE+=compat_minix -PREFER_NATIVE+=nbsd_libc -CPPFLAGS+= ${NETBSD_LIBC_CPPFLAGS} -LDFLAGS+= ${NETBSD_LIBC_LDFLAGS} -.endif - .endif # !defined(_MINIX_PKGSRC_HOOKS_) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index e935aca12..5466a7920 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -239,8 +239,7 @@ AR?= ar .endif # Set NBSD_LIBC to either "yes" or "no". -.if !defined(NBSD) || (${NBSD} == "no") \ - || !defined(COMPILER_TYPE) || (${COMPILER_TYPE} == "ack") +.if ${COMPILER_TYPE} == "ack" NBSD_LIBC= no .else NBSD_LIBC= yes diff --git a/usr.bin/Makefile.inc b/usr.bin/Makefile.inc index 9b4467498..fb17b6ac9 100644 --- a/usr.bin/Makefile.inc +++ b/usr.bin/Makefile.inc @@ -1,5 +1,4 @@ -# Requires NBSD_LIBC and clang/gcc (we default to using clang) -NBSD_LIBC:= yes +# Requires clang/gcc for NetBSD libc CC:=${CC:C/^cc/clang/} COMPILER_TYPE:= gnu