diff --git a/README.md b/README.md index 4aa4f80..baee504 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # glibc +The glibc package contains standard libraries which are used by multiple programs on the system. +In order to save disk space and memory, as well as to make upgrading easier, common system code is kept in one place and shared between programs. +This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system will not function. +The glibc package also contains national language (locale) support. + + diff --git a/glibc-2.10.1-binutils-2.20.patch b/glibc-2.10.1-binutils-2.20.patch new file mode 100644 index 0000000..7574147 --- /dev/null +++ b/glibc-2.10.1-binutils-2.20.patch @@ -0,0 +1,37 @@ +diff -Nru glibc-2.10.1.orig/configure glibc-2.10.1/configure +--- glibc-2.10.1.orig/configure 2009-05-17 14:19:31.000000000 +0200 ++++ glibc-2.10.1/configure 2009-11-03 19:44:54.000000000 +0100 +@@ -4839,7 +4839,7 @@ + ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; +- 2.1[3-9]*) ++ 2.2[0-9]*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + +@@ -4902,7 +4902,7 @@ + ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; +- 2.1[3-9]*) ++ 2.2[0-9]*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + +diff -Nru glibc-2.10.1.orig/configure.in glibc-2.10.1/configure.in +--- glibc-2.10.1.orig/configure.in 2009-04-04 01:51:47.000000000 +0200 ++++ glibc-2.10.1/configure.in 2009-11-03 19:44:33.000000000 +0100 +@@ -897,10 +897,10 @@ + # Accept binutils 2.13 or newer. + AC_CHECK_PROG_VER(AS, $AS, --version, + [GNU assembler.* \([0-9]*\.[0-9.]*\)], +- [2.1[3-9]*], AS=: critic_missing="$critic_missing as") ++ [2.2[0-9]*], AS=: critic_missing="$critic_missing as") + AC_CHECK_PROG_VER(LD, $LD, --version, + [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)], +- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld") ++ [2.2[0-9]*], LD=: critic_missing="$critic_missing ld") + + # We need the physical current working directory. We cannot use the + # "pwd -P" shell builtin since that's not portable. Instead we try to diff --git a/glibc-2.11.2-gcc-4.5.0.patch b/glibc-2.11.2-gcc-4.5.0.patch new file mode 100644 index 0000000..f7cddad --- /dev/null +++ b/glibc-2.11.2-gcc-4.5.0.patch @@ -0,0 +1,31 @@ +diff -Naur glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c +glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c +--- glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c 2009-12-08 20:10:20.000000000 +0000 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c 2010-04-17 02:24:02.000000000 +0100 +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*...@header_ends*/"); + +diff -Naur glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h +glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h +--- glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-12-08 20:10:20.000000000 +0000 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-04-17 02:24:02.000000000 +0100 +@@ -29,6 +29,10 @@ +#include +#include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h diff --git a/glibc-2.13-fix_prelink_ld_so.patch b/glibc-2.13-fix_prelink_ld_so.patch new file mode 100644 index 0000000..e28345a --- /dev/null +++ b/glibc-2.13-fix_prelink_ld_so.patch @@ -0,0 +1,39 @@ +From 25b3aadaf646bff18d6527e03717c87bf50b3a50 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Tue, 28 Sep 2010 15:11:48 +0200 +Subject: [PATCH] Don't try to write to _rtld_global_ro after performing relro protection + +--- + ChangeLog | 5 +++++ + elf/rtld.c | 8 ++++---- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/elf/rtld.c b/elf/rtld.c +index 9a560b3..201c9cf 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -2168,6 +2168,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + we need it in the memory handling later. */ + GLRO(dl_initial_searchlist) = *GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist; + ++ /* Remember the last search directory added at startup, now that ++ malloc will no longer be the one from dl-minimal.c. */ ++ GLRO(dl_init_all_dirs) = GL(dl_all_dirs); ++ + if (prelinked) + { + if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL) +@@ -2288,10 +2292,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + lossage); + } + +- /* Remember the last search directory added at startup, now that +- malloc will no longer be the one from dl-minimal.c. */ +- GLRO(dl_init_all_dirs) = GL(dl_all_dirs); +- + if (! prelinked && rtld_multiple_ref) + { + /* There was an explicit ref to the dynamic linker as a shared lib. +-- +1.7.3.4 + diff --git a/glibc-2.14-fix-resolver-crash-typo.patch b/glibc-2.14-fix-resolver-crash-typo.patch new file mode 100644 index 0000000..b5d86c7 --- /dev/null +++ b/glibc-2.14-fix-resolver-crash-typo.patch @@ -0,0 +1,22 @@ +diff --git a/resolv/res_send.c b/resolv/res_send.c +index 97142b7..a001c1e 100644 +--- a/resolv/res_send.c ++++ b/resolv/res_send.c +@@ -549,7 +549,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen, + ns, ansp, ansp2, nansp2, resplen2); + if (n < 0) + return (-1); +- if (n == 0 && (buf2 == NULL || resplen2 == 0)) ++ if (n == 0 && (buf2 == NULL || *resplen2 == 0)) + goto next_ns; + } else { + /* Use datagrams. */ +@@ -559,7 +559,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen, + ansp2, nansp2, resplen2); + if (n < 0) + return (-1); +- if (n == 0 && (buf2 == NULL || resplen2 == 0)) ++ if (n == 0 && (buf2 == NULL || *resplen2 == 0)) + goto next_ns; + if (v_circuit) + // XXX Check whether both requests failed or diff --git a/glibc-2.14-rpc_nis_headers_restore.patch b/glibc-2.14-rpc_nis_headers_restore.patch new file mode 100644 index 0000000..c3b5671 --- /dev/null +++ b/glibc-2.14-rpc_nis_headers_restore.patch @@ -0,0 +1,56 @@ +--- glibc-2.14/nis/Makefile ++++ glibc-2.14-2/nis/Makefile +@@ -23,9 +23,9 @@ subdir := nis + + aux := nis_hash + ++headers := $(wildcard rpcsvc/*.[hx]) + distribute := nss-nis.h nss-nisplus.h nis_intern.h Banner \ +- nisplus-parser.h nis_xdr.h nss \ +- $(wildcard rpcsvc/*.[hx]) ++ nisplus-parser.h nis_xdr.h nss + + # These are the databases available for the nis (and perhaps later nisplus) + # service. This must be a superset of the services in nss. +@@ -69,6 +69,8 @@ libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes)) + + include ../Rules + ++CFLAGS-nis_findserv.c += -fno-strict-aliasing ++CFLAGS-ypclnt.c += -fno-strict-aliasing + + $(objpfx)libnss_compat.so: $(objpfx)libnsl.so$(libnsl.so-version) + $(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \ +--- glibc-2.14/sunrpc/Makefile ++++ glibc-2.14-2/sunrpc/Makefile +@@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \ + des_crypt.h) + headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \ + $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h +-headers = rpc/netdb.h ++headers = rpc/netdb.h $(headers-in-tirpc) $(headers-not-in-tirpc) + install-others = $(inst_sysconfdir)/rpc + generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \ + $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen +@@ -152,6 +152,10 @@ CFLAGS-openchild.c = -fexceptions + + CPPFLAGS += -D_RPC_THREAD_SAFE_ + ++CFLAGS-clnt_tcp.c += -fno-strict-aliasing ++CFLAGS-clnt_udp.c += -fno-strict-aliasing ++CFLAGS-clnt_unix.c += -fno-strict-aliasing ++ + $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so + $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so + $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so +--- a/include/libc-symbols.h ++++ b/include/libc-symbols.h +@@ -635,7 +635,7 @@ for linking") + # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) + # define libc_hidden_def(name) hidden_def (name) + # define libc_hidden_weak(name) hidden_weak (name) +-# define libc_hidden_nolink(name, version) hidden_nolink (name, libc, version) ++# define libc_hidden_nolink(name, version) hidden_def (name) + # define libc_hidden_ver(local, name) hidden_ver (local, name) + # define libc_hidden_data_def(name) hidden_data_def (name) + # define libc_hidden_data_weak(name) hidden_data_weak (name) diff --git a/glibc-2.14.1-fix-segfault-at-dl-lookup.patch b/glibc-2.14.1-fix-segfault-at-dl-lookup.patch new file mode 100644 index 0000000..357721f --- /dev/null +++ b/glibc-2.14.1-fix-segfault-at-dl-lookup.patch @@ -0,0 +1,118 @@ +On Monday, June 06, 2011 13:00:50 Mike Frysinger wrote: +> On Monday, June 06, 2011 04:51:29 Andreas Schwab wrote: +> > Paweł Sikora writes: +> > > git bisect shows first bad commit: +> > > +> > > 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3 is the first bad commit +> > > commit 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3 +> > > Author: Andreas Schwab +> > > Date: Fri Feb 25 20:49:48 2011 -0500 +> > > +> > > Fix memory leak in dlopen with RTLD_NOLOAD. +> > +> > See and +> > for the +> > original, working patches. +> +> thanks, i'm seeing basically the same crash with the mpd server (music +> daemon) + +in case it's helpful to someone else, this is the patch i'm using +-mike + +partially revert 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3 + +http://sourceware.org/ml/libc-alpha/2011-06/msg00006.html + +--- a/elf/dl-libc.c ++++ b/elf/dl-libc.c +@@ -279,6 +279,10 @@ libc_freeres_fn (free_mem) + if (! old->dont_free) + free (old); + } ++ ++ /* Free the initfini dependency list. */ ++ if (l->l_free_initfini) ++ free (l->l_initfini); + } + + if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -2240,6 +2240,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + lnp->dont_free = 1; + lnp = lnp->next; + } ++ l->l_free_initfini = 0; + + if (l != &GL(dl_rtld_map)) + _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0, +--- a/elf/dl-close.c ++++ b/elf/dl-close.c +@@ -119,17 +119,8 @@ _dl_close_worker (struct link_map *map) + if (map->l_direct_opencount > 0 || map->l_type != lt_loaded + || dl_close_state != not_pending) + { +- if (map->l_direct_opencount == 0) +- { +- if (map->l_type == lt_loaded) +- dl_close_state = rerun; +- else if (map->l_type == lt_library) +- { +- struct link_map **oldp = map->l_initfini; +- map->l_initfini = map->l_orig_initfini; +- _dl_scope_free (oldp); +- } +- } ++ if (map->l_direct_opencount == 0 && map->l_type == lt_loaded) ++ dl_close_state = rerun; + + /* There are still references to this object. Do nothing more. */ + if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)) +--- a/elf/dl-deps.c ++++ b/elf/dl-deps.c +@@ -478,6 +478,7 @@ _dl_map_object_deps (struct link_map *map, + nneeded * sizeof needed[0]); + atomic_write_barrier (); + l->l_initfini = l_initfini; ++ l->l_free_initfini = 1; + } + + /* If we have no auxiliary objects just go on to the next map. */ +@@ -662,6 +663,7 @@ Filters not supported with LD_TRACE_PRELINKING")); + l_initfini[nlist] = NULL; + atomic_write_barrier (); + map->l_initfini = l_initfini; ++ map->l_free_initfini = 1; + if (l_reldeps != NULL) + { + atomic_write_barrier ();diff --git a/include/link.h b/include/link.h +@@ -686,5 +686,5 @@ Filters not supported with LD_TRACE_PRELINKING")); + _dl_scope_free (old_l_reldeps); + } + if (old_l_initfini != NULL) +- map->l_orig_initfini = old_l_initfini; ++ _dl_scope_free (old_l_initfini); + +--- a/include/link.h ++++ b/include/link.h +@@ -192,6 +192,9 @@ struct link_map + during LD_TRACE_PRELINKING=1 + contains any DT_SYMBOLIC + libraries. */ ++ unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be ++ freed, ie. not allocated with ++ the dummy malloc in ld.so. */ + + /* Collected information about own RPATH directories. */ + struct r_search_path_struct l_rpath_dirs; +@@ -240,9 +240,6 @@ struct link_map + + /* List of object in order of the init and fini calls. */ + struct link_map **l_initfini; +- /* The init and fini list generated at startup, saved when the +- object is also loaded dynamically. */ +- struct link_map **l_orig_initfini; + + /* List of the dependencies introduced through symbol binding. */ + struct link_map_reldeps diff --git a/glibc-2.16.0-localedata_openmamba.patch b/glibc-2.16.0-localedata_openmamba.patch new file mode 100644 index 0000000..43774e9 --- /dev/null +++ b/glibc-2.16.0-localedata_openmamba.patch @@ -0,0 +1,40 @@ +diff -Nru glibc-2.16.0.orig/localedata/SUPPORTED.openmamba glibc-2.16.0/localedata/SUPPORTED.openmamba +--- glibc-2.16.0.orig/localedata/SUPPORTED.openmamba 1970-01-01 01:00:00.000000000 +0100 ++++ glibc-2.16.0/localedata/SUPPORTED.openmamba 2012-11-18 13:28:51.661087792 +0100 +@@ -0,0 +1,36 @@ ++# This file names the currently supported and somewhat tested locales. ++# If you have any additions please file a glibc bug report. ++SUPPORTED-LOCALES=\ ++de_AT.UTF-8/UTF-8 \ ++de_AT/ISO-8859-1 \ ++de_AT@euro/ISO-8859-15 \ ++de_DE.UTF-8/UTF-8 \ ++de_DE/ISO-8859-1 \ ++de_DE@euro/ISO-8859-15 \ ++en_GB.UTF-8/UTF-8 \ ++en_GB/ISO-8859-1 \ ++en_HK.UTF-8/UTF-8 \ ++en_HK/ISO-8859-1 \ ++en_IE.UTF-8/UTF-8 \ ++en_IE/ISO-8859-1 \ ++en_IE@euro/ISO-8859-15 \ ++en_IN/UTF-8 \ ++en_PH.UTF-8/UTF-8 \ ++en_PH/ISO-8859-1 \ ++en_US.UTF-8/UTF-8 \ ++en_US/ISO-8859-1 \ ++es_ES.UTF-8/UTF-8 \ ++es_ES/ISO-8859-1 \ ++es_ES@euro/ISO-8859-15 \ ++es_MX.UTF-8/UTF-8 \ ++es_MX/ISO-8859-1 \ ++fa_IR/UTF-8 \ ++fr_FR.UTF-8/UTF-8 \ ++fr_FR/ISO-8859-1 \ ++fr_FR@euro/ISO-8859-15 \ ++it_CH.UTF-8/UTF-8 \ ++it_CH/ISO-8859-1 \ ++it_IT.UTF-8/UTF-8 \ ++it_IT/ISO-8859-1 \ ++it_IT@euro/ISO-8859-15 \ ++ja_JP.EUC-JP/EUC-JP \ diff --git a/glibc-2.16.0-tetex-3.0.patch b/glibc-2.16.0-tetex-3.0.patch new file mode 100644 index 0000000..7badd41 --- /dev/null +++ b/glibc-2.16.0-tetex-3.0.patch @@ -0,0 +1,11 @@ +--- glibc-2.16.0.orig/manual/texinfo.tex 2012-06-30 21:12:34.000000000 +0200 ++++ glibc-2.16.0/manual/texinfo.tex 2012-07-02 01:11:41.500955548 +0200 +@@ -1107,7 +1107,7 @@ + % #1 is a control sequence in which to do the replacements, + % which we \xdef. + \def\txiescapepdf#1{% +- \ifx\pdfescapestring\relax ++ \ifx\pdfescapestring\thisisundefined + % No primitive available; should we give a warning or log? + % Many times it won't matter. + \else diff --git a/glibc-2.4-manual-syntax-fix.patch b/glibc-2.4-manual-syntax-fix.patch new file mode 100644 index 0000000..bfa3c37 --- /dev/null +++ b/glibc-2.4-manual-syntax-fix.patch @@ -0,0 +1,38 @@ +diff -Nru glibc-2.4.orig/manual/arith.texi glibc-2.4/manual/arith.texi +--- glibc-2.4.orig/manual/arith.texi 2004-10-06 05:02:14.000000000 +0200 ++++ glibc-2.4/manual/arith.texi 2006-06-09 13:14:46.000000000 +0200 +@@ -778,8 +778,7 @@ + + @comment fenv.h + @comment ISO +-@deftypefun int fesetexceptflag (const fexcept_t *@var{flagp}, int +-@var{excepts}) ++@deftypefun int fesetexceptflag (const fexcept_t *@var{flagp}, int@var{excepts}) + This function restores the flags for the exceptions indicated by + @var{excepts} to the values stored in the variable pointed to by + @var{flagp}. +diff -Nru glibc-2.4.orig/manual/errno.texi glibc-2.4/manual/errno.texi +--- glibc-2.4.orig/manual/errno.texi 2005-12-24 21:21:03.000000000 +0100 ++++ glibc-2.4/manual/errno.texi 2006-06-09 13:14:46.000000000 +0200 +@@ -1494,7 +1494,7 @@ + + @comment error.h + @comment GNU +-@deftypevar {void (*} error_print_progname ) (void) ++@deftypevar {void *} error_print_progname (void) + If the @code{error_print_progname} variable is defined to a non-zero + value the function pointed to is called by @code{error} or + @code{error_at_line}. It is expected to print the program name or do +diff -Nru glibc-2.4.orig/manual/sysinfo.texi glibc-2.4/manual/sysinfo.texi +--- glibc-2.4.orig/manual/sysinfo.texi 2003-11-29 07:38:43.000000000 +0100 ++++ glibc-2.4/manual/sysinfo.texi 2006-06-09 13:14:46.000000000 +0200 +@@ -1066,8 +1066,7 @@ + + @comment sysctl.h + @comment BSD +-@deftypefun int sysctl (int *@var{names}, int @var{nlen}, void *@var{oldval}, +- size_t *@var{oldlenp}, void *@var{newval}, size_t @var{newlen}) ++@deftypefun int sysctl (int *@var{names}, int @var{nlen}, void *@var{oldval},size_t *@var{oldlenp}, void *@var{newval}, size_t @var{newlen}) + + @code{sysctl} gets or sets a specified system parameter. There are so + many of these parameters that it is not practical to list them all here, diff --git a/glibc-2.6.1-strlcpy_strlcat-1.patch b/glibc-2.6.1-strlcpy_strlcat-1.patch new file mode 100644 index 0000000..377e9a7 --- /dev/null +++ b/glibc-2.6.1-strlcpy_strlcat-1.patch @@ -0,0 +1,361 @@ +Submitted By: Robert Connolly (ashes) +Date: 2007-10-07 +Initial Package Version: 2.6.1 +Upstream Status: Rejected Upstream +http://sources.redhat.com/ml/libc-alpha/2000-08/msg00052.html +Origin: OpenBSD, then see the url above, the ported to Owl/Openwall. +http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/glibc/\ + glibc-2.3.5-openbsd-strlcpy-strlcat.diff +Then I retrieved the latest copies of strlcat.c and strlcpy.c from OpenBSD-cvs, +which had trivial changes. +Description: http://www.courtesan.com/todd/papers/strlcpy.html + +diff -Naur glibc-2.6.1.orig/manual/strlcpy.3 glibc-2.6.1/manual/strlcpy.3 +--- glibc-2.6.1.orig/manual/strlcpy.3 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.6.1/manual/strlcpy.3 2007-08-04 06:48:03.000000000 +0000 +@@ -0,0 +1,186 @@ ++.\" $OpenBSD: strlcpy.3,v 1.18 2005/08/06 03:24:19 jaredy Exp $ ++.\" ++.\" Copyright (c) 1998, 2000 Todd C. Miller ++.\" ++.\" Permission to use, copy, modify, and distribute this software for any ++.\" purpose with or without fee is hereby granted, provided that the above ++.\" copyright notice and this permission notice appear in all copies. ++.\" ++.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++.\" ++.Dd June 22, 1998 ++.Dt STRLCPY 3 ++.Os ++.Sh NAME ++.Nm strlcpy , ++.Nm strlcat ++.Nd size-bounded string copying and concatenation ++.Sh SYNOPSIS ++.Fd #include ++.Ft size_t ++.Fn strlcpy "char *dst" "const char *src" "size_t size" ++.Ft size_t ++.Fn strlcat "char *dst" "const char *src" "size_t size" ++.Sh DESCRIPTION ++The ++.Fn strlcpy ++and ++.Fn strlcat ++functions copy and concatenate strings respectively. ++They are designed ++to be safer, more consistent, and less error prone replacements for ++.Xr strncpy 3 ++and ++.Xr strncat 3 . ++Unlike those functions, ++.Fn strlcpy ++and ++.Fn strlcat ++take the full size of the buffer (not just the length) and guarantee to ++NUL-terminate the result (as long as ++.Fa size ++is larger than 0 or, in the case of ++.Fn strlcat , ++as long as there is at least one byte free in ++.Fa dst ) . ++Note that a byte for the NUL should be included in ++.Fa size . ++Also note that ++.Fn strlcpy ++and ++.Fn strlcat ++only operate on true ++.Dq C ++strings. ++This means that for ++.Fn strlcpy ++.Fa src ++must be NUL-terminated and for ++.Fn strlcat ++both ++.Fa src ++and ++.Fa dst ++must be NUL-terminated. ++.Pp ++The ++.Fn strlcpy ++function copies up to ++.Fa size ++- 1 characters from the NUL-terminated string ++.Fa src ++to ++.Fa dst , ++NUL-terminating the result. ++.Pp ++The ++.Fn strlcat ++function appends the NUL-terminated string ++.Fa src ++to the end of ++.Fa dst . ++It will append at most ++.Fa size ++- strlen(dst) - 1 bytes, NUL-terminating the result. ++.Sh RETURN VALUES ++The ++.Fn strlcpy ++and ++.Fn strlcat ++functions return the total length of the string they tried to create. ++For ++.Fn strlcpy ++that means the length of ++.Fa src . ++For ++.Fn strlcat ++that means the initial length of ++.Fa dst ++plus ++the length of ++.Fa src . ++While this may seem somewhat confusing, it was done to make ++truncation detection simple. ++.Pp ++Note, however, that if ++.Fn strlcat ++traverses ++.Fa size ++characters without finding a NUL, the length of the string is considered ++to be ++.Fa size ++and the destination string will not be NUL-terminated (since there was ++no space for the NUL). ++This keeps ++.Fn strlcat ++from running off the end of a string. ++In practice this should not happen (as it means that either ++.Fa size ++is incorrect or that ++.Fa dst ++is not a proper ++.Dq C ++string). ++The check exists to prevent potential security problems in incorrect code. ++.Sh EXAMPLES ++The following code fragment illustrates the simple case: ++.Bd -literal -offset indent ++char *s, *p, buf[BUFSIZ]; ++ ++\&... ++ ++(void)strlcpy(buf, s, sizeof(buf)); ++(void)strlcat(buf, p, sizeof(buf)); ++.Ed ++.Pp ++To detect truncation, perhaps while building a pathname, something ++like the following might be used: ++.Bd -literal -offset indent ++char *dir, *file, pname[MAXPATHLEN]; ++ ++\&... ++ ++if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname)) ++ goto toolong; ++if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname)) ++ goto toolong; ++.Ed ++.Pp ++Since it is known how many characters were copied the first time, things ++can be sped up a bit by using a copy instead of an append: ++.Bd -literal -offset indent ++char *dir, *file, pname[MAXPATHLEN]; ++size_t n; ++ ++\&... ++ ++n = strlcpy(pname, dir, sizeof(pname)); ++if (n >= sizeof(pname)) ++ goto toolong; ++if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n) ++ goto toolong; ++.Ed ++.Pp ++However, one may question the validity of such optimizations, as they ++defeat the whole purpose of ++.Fn strlcpy ++and ++.Fn strlcat . ++As a matter of fact, the first version of this manual page got it wrong. ++.Sh SEE ALSO ++.Xr snprintf 3 , ++.Xr strncat 3 , ++.Xr strncpy 3 ++.Sh HISTORY ++The ++.Fn strlcpy ++and ++.Fn strlcat ++functions first appeared in ++.Ox 2.4 . +diff -Naur glibc-2.6.1.orig/string/Makefile glibc-2.6.1/string/Makefile +--- glibc-2.6.1.orig/string/Makefile 2007-02-01 16:10:11.000000000 +0000 ++++ glibc-2.6.1/string/Makefile 2007-08-04 06:48:35.000000000 +0000 +@@ -40,7 +40,12 @@ + addsep replace) \ + envz basename \ + strcoll_l strxfrm_l string-inlines memrchr \ +- xpg-strerror strerror_l ++ xpg-strerror strerror_l strlcat strlcpy ++ ++# These routines will be omitted from the libc shared object. ++# Instead the static object files will be included in a special archive ++# linked against when the shared library will be used. ++static-only-routines = strlcat strlcpy + + # Gcc internally generates calls to unbounded memcpy and memset + # for -fbounded-pointer compiles. Glibc uses memchr for explicit checks. +diff -Naur glibc-2.6.1.orig/string/string.h glibc-2.6.1/string/string.h +--- glibc-2.6.1.orig/string/string.h 2007-02-01 16:08:52.000000000 +0000 ++++ glibc-2.6.1/string/string.h 2007-08-04 06:48:03.000000000 +0000 +@@ -354,6 +354,24 @@ + extern char *strsep (char **__restrict __stringp, + __const char *__restrict __delim) + __THROW __nonnull ((1, 2)); ++ ++/* ++ * Appends __src to string __dst of size __n (unlike strncat, __n is the ++ * full size of __dst, not space left). At most __n-1 characters ++ * will be copied. Always NUL terminates (unless __n <= strlen(__dst)). ++ * Returns strlen(__src) + MIN(__n, strlen(initial __dst)). ++ * If retval >= __n, truncation occurred. ++ */ ++extern size_t strlcat (char *__dst, __const char *__src, size_t __n) ++ __THROW __nonnull ((1, 2)); ++ ++/* ++ * Copy __src to string __dst of size __n. At most __n-1 characters ++ * will be copied. Always NUL terminates (unless __n == 0). ++ * Returns strlen(__src); if retval >= __n, truncation occurred. ++ */ ++extern size_t strlcpy (char *__dst, __const char *__src, size_t __n) ++ __THROW __nonnull ((1, 2)); + #endif + + #ifdef __USE_GNU +diff -Naur glibc-2.6.1.orig/string/strlcat.c glibc-2.6.1/string/strlcat.c +--- glibc-2.6.1.orig/string/strlcat.c 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.6.1/string/strlcat.c 2007-08-04 06:48:03.000000000 +0000 +@@ -0,0 +1,55 @@ ++/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ ++ ++/* ++ * Copyright (c) 1998 Todd C. Miller ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include ++#include ++ ++/* ++ * Appends src to string dst of size siz (unlike strncat, siz is the ++ * full size of dst, not space left). At most siz-1 characters ++ * will be copied. Always NUL terminates (unless siz <= strlen(dst)). ++ * Returns strlen(src) + MIN(siz, strlen(initial dst)). ++ * If retval >= siz, truncation occurred. ++ */ ++size_t ++strlcat(char *dst, const char *src, size_t siz) ++{ ++ char *d = dst; ++ const char *s = src; ++ size_t n = siz; ++ size_t dlen; ++ ++ /* Find the end of dst and adjust bytes left but don't go past end */ ++ while (n-- != 0 && *d != '\0') ++ d++; ++ dlen = d - dst; ++ n = siz - dlen; ++ ++ if (n == 0) ++ return(dlen + strlen(s)); ++ while (*s != '\0') { ++ if (n != 1) { ++ *d++ = *s; ++ n--; ++ } ++ s++; ++ } ++ *d = '\0'; ++ ++ return(dlen + (s - src)); /* count does not include NUL */ ++} +diff -Naur glibc-2.6.1.orig/string/strlcpy.c glibc-2.6.1/string/strlcpy.c +--- glibc-2.6.1.orig/string/strlcpy.c 1970-01-01 00:00:00.000000000 +0000 ++++ glibc-2.6.1/string/strlcpy.c 2007-08-04 06:48:03.000000000 +0000 +@@ -0,0 +1,51 @@ ++/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ ++ ++/* ++ * Copyright (c) 1998 Todd C. Miller ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include ++#include ++ ++/* ++ * Copy src to string dst of size siz. At most siz-1 characters ++ * will be copied. Always NUL terminates (unless siz == 0). ++ * Returns strlen(src); if retval >= siz, truncation occurred. ++ */ ++size_t ++strlcpy(char *dst, const char *src, size_t siz) ++{ ++ char *d = dst; ++ const char *s = src; ++ size_t n = siz; ++ ++ /* Copy as many bytes as will fit */ ++ if (n != 0) { ++ while (--n != 0) { ++ if ((*d++ = *s++) == '\0') ++ break; ++ } ++ } ++ ++ /* Not enough room in dst, add NUL and traverse rest of src */ ++ if (n == 0) { ++ if (siz != 0) ++ *d = '\0'; /* NUL-terminate dst */ ++ while (*s++) ++ ; ++ } ++ ++ return(s - src - 1); /* count does not include NUL */ ++} diff --git a/glibc-2.7-gcc-4.3.patch b/glibc-2.7-gcc-4.3.patch new file mode 100644 index 0000000..76125a5 --- /dev/null +++ b/glibc-2.7-gcc-4.3.patch @@ -0,0 +1,29 @@ +Submitted By: Tushar Teredesai +Date: 2008-04-18 +Initial Package Version: 2.7 +Upstream Status: Fixed +Origin: glibc cvs +Description: Fix compilation with gcc-4.3 + +=================================================================== +RCS file: /cvs/glibc/libc/configure,v +retrieving revision 1.462 +retrieving revision 1.463 +diff -u -r1.462 -r1.463 +--- libc/configure 2008/01/24 20:21:23 1.462 ++++ libc/configure 2008/02/01 00:20:07 1.463 +@@ -5065,8 +5065,12 @@ + # header directory and add that to the list. NOTE: Only does the right + # thing on a system that doesn't need fixincludes. (Not presently a problem.) + if test -n "$sysheaders"; then +- ccheaders=`$CC -print-file-name=include` +- SYSINCLUDES="-nostdinc -isystem $ccheaders \ ++ SYSINCLUDES=-nostdinc ++ for d in include include-fixed; do ++ i=`$CC -print-file-name="$d"` && test "x$i" != "x$d" && ++ SYSINCLUDES="$SYSINCLUDES -isystem $i" ++ done ++ SYSINCLUDES="$SYSINCLUDES \ + -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" + if test -n "$CXX"; then + cxxversion=`$CXX -dumpversion 2>&5` && diff --git a/glibc-2.7-lowlevellock.patch b/glibc-2.7-lowlevellock.patch new file mode 100644 index 0000000..f91823b --- /dev/null +++ b/glibc-2.7-lowlevellock.patch @@ -0,0 +1,26 @@ +2007-11-01 Ryan S. Arnold + + * nptl/sysdeps/unix/sysv/linux/lowlevellock.c + (__lll_timedlock_wait) Wake before returning timeout. + +--- glibc-2.7/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-08-14 14:59:34.000000000 -0500 ++++ glibc-2.7.new/nptl/sysdeps/unix/sysv/linux/lowlevellock.c 2007-11-01 12:25:49.000000000 -0500 +@@ -76,12 +76,16 @@ + --rt.tv_sec; + } + ++ int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1); + /* Already timed out? */ + if (rt.tv_sec < 0) +- return ETIMEDOUT; ++ { ++ if (oldval == 0) ++ lll_futex_wake (futex, 1, private); ++ return ETIMEDOUT; ++ } + + /* Wait. */ +- int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1); + if (oldval != 0) + lll_futex_timed_wait (futex, 2, &rt, private); + } diff --git a/glibc-2.7-memcpy_chk_S.patch b/glibc-2.7-memcpy_chk_S.patch new file mode 100644 index 0000000..153e701 --- /dev/null +++ b/glibc-2.7-memcpy_chk_S.patch @@ -0,0 +1,12 @@ +--- sysdeps/i386/i586/memcpy_chk.S.i586 2007-10-02 07:00:06.000000000 -0700 ++++ sysdeps/i386/i586/memcpy_chk.S 2007-10-02 06:58:51.000000000 -0700 +@@ -0,0 +1 @@ ++#include +--- sysdeps/i386/i586/mempcpy_chk.S.i586 2007-10-02 07:00:06.000000000 -0700 ++++ sysdeps/i386/i586/mempcpy_chk.S 2007-10-02 06:58:51.000000000 -0700 +@@ -0,0 +1 @@ ++#include +--- sysdeps/i386/i586/memset_chk.S.i586 2007-10-02 07:00:06.000000000 -0700 ++++ sysdeps/i386/i586/memset_chk.S 2007-10-02 06:58:51.000000000 -0700 +@@ -0,0 +1 @@ ++#include diff --git a/glibc-2.7-only-lookup-ipv6-if-it-makes-sense.patch b/glibc-2.7-only-lookup-ipv6-if-it-makes-sense.patch new file mode 100644 index 0000000..282b602 --- /dev/null +++ b/glibc-2.7-only-lookup-ipv6-if-it-makes-sense.patch @@ -0,0 +1,45 @@ +diff -Nru glibc-2.7.orig/sysdeps/posix/getaddrinfo.c glibc-2.7/sysdeps/posix/getaddrinfo.c +--- glibc-2.7.orig/sysdeps/posix/getaddrinfo.c 2007-10-17 18:05:12.000000000 +0200 ++++ glibc-2.7/sysdeps/posix/getaddrinfo.c 2008-02-05 19:53:08.000000000 +0100 +@@ -263,7 +263,7 @@ + static int + gaih_inet (const char *name, const struct gaih_service *service, + const struct addrinfo *req, struct addrinfo **pai, +- unsigned int *naddrs) ++ unsigned int *naddrs, bool usable_ipv6) + { + const struct gaih_typeproto *tp = gaih_inet_typeproto; + struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; +@@ -706,7 +706,7 @@ + if (fct != NULL) + { + if (req->ai_family == AF_INET6 +- || req->ai_family == AF_UNSPEC) ++ || (req->ai_family == AF_UNSPEC && usable_ipv6)) + { + gethosts (AF_INET6, struct in6_addr); + no_inet6_data = no_data; +@@ -1914,7 +1914,7 @@ + if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET + || hints->ai_family == AF_INET6) + { +- last_i = gaih_inet (name, pservice, hints, end, &naddrs); ++ last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6); + if (last_i != 0) + { + freeaddrinfo (p); +diff -Nru glibc-2.7.orig/sysdeps/unix/sysv/linux/check_pf.c glibc-2.7/sysdeps/unix/sysv/linux/check_pf.c +--- glibc-2.7.orig/sysdeps/unix/sysv/linux/check_pf.c 2007-08-29 18:49:45.000000000 +0200 ++++ glibc-2.7/sysdeps/unix/sysv/linux/check_pf.c 2008-02-05 19:50:30.000000000 +0100 +@@ -201,7 +201,10 @@ + { + out_v6: + if (!IN6_IS_ADDR_LOOPBACK (address ?: local)) +- *seen_ipv6 = true; ++ if (ifam->ifa_scope < RT_SCOPE_LINK) ++ { ++ *seen_ipv6 = true; ++ } + } + + if (ifam->ifa_flags & (IFA_F_DEPRECATED diff --git a/glibc-2.7-x86-fnstsw.patch b/glibc-2.7-x86-fnstsw.patch new file mode 100644 index 0000000..cb593fd --- /dev/null +++ b/glibc-2.7-x86-fnstsw.patch @@ -0,0 +1,11 @@ +--- glibc-2.7/sysdeps/i386/fpu/ftestexcept.c.vaniglia 2009-01-28 22:38:10.000000000 +0100 ++++ glibc-2.7/sysdeps/i386/fpu/ftestexcept.c 2009-01-28 22:39:05.000000000 +0100 +@@ -26,7 +26,7 @@ + int + fetestexcept (int excepts) + { +- int temp; ++ short temp; + int xtemp = 0; + + /* Get current exceptions. */ diff --git a/glibc-2.9-arm_local_args6.patch b/glibc-2.9-arm_local_args6.patch new file mode 100644 index 0000000..f9e0915 --- /dev/null +++ b/glibc-2.9-arm_local_args6.patch @@ -0,0 +1,12 @@ +--- ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h.orig ++++ ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h +@@ -73,6 +73,9 @@ + # define DOCARGS_5 DOCARGS_4 + # define UNDOCARGS_5 UNDOCARGS_4 + ++# define DOCARGS_6 DOCARGS_5 ++# define UNDOCARGS_6 UNDOCARGS_5 ++ + # ifdef IS_IN_libpthread + # define CENABLE bl PLTJMP(__pthread_enable_asynccancel) + # define CDISABLE bl PLTJMP(__pthread_disable_asynccancel) diff --git a/glibc-ports-2.15-arm-libmemusage-libc_nonshared.patch b/glibc-ports-2.15-arm-libmemusage-libc_nonshared.patch new file mode 100644 index 0000000..f1dc9c5 --- /dev/null +++ b/glibc-ports-2.15-arm-libmemusage-libc_nonshared.patch @@ -0,0 +1,19 @@ +commit 2d80bda39073a35af4b904d27fa1511cd309b26f +Author: Nathan Sidwell +Date: Fri Jan 6 20:14:44 2012 +0000 + + Add ARM dependency of libmemusage.so on libc_nonshared.a. + +diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile +index 5651161..1a88430 100644 +--- a/ports/sysdeps/arm/Makefile ++++ b/ports/sysdeps/arm/Makefile +@@ -7,3 +7,8 @@ endif + ifeq ($(subdir),csu) + gen-as-const-headers += tlsdesc.sym + endif ++ ++# to pull in __aeabi_read_tp, needed for tls ++ifeq ($(subdir),malloc) ++$(objpfx)libmemusage.so: $(common-objpfx)libc_nonshared.a ++endif diff --git a/glibc.spec b/glibc.spec new file mode 100644 index 0000000..afb8ae2 --- /dev/null +++ b/glibc.spec @@ -0,0 +1,1134 @@ +# if you want to build glibc on this build platform for target ppc, building +# for ppc: +#rpmbuild -ba -target ppc-openmamba-linux-gnu glibc.spec + +# example: build a ppc cross-platform glibc package: +#rpmbuild -ba --define='cross_target_cpu ppc' glibc.spec + +# example: build a arm cross-platform glibc package with soft floating point support: +#rpmbuild -ba --define='cross_target_cpu arm' --define='softfloat 1' glibc.spec + +%define kheaders_ver %{?KERNEL_VER}%{?KERNEL_TARGET} +##% define kheaders_append +%define kheaders_dir %{_prefix}/src/linux-%{kheaders_ver}/usr/include +%define glibc_headers_dir %{_builddir}/%{name}-%{version}/linux-headers/include +%define majver %(echo %version | cut -d. -f1-2) +%define minver %(echo %version | cut -d. -f3) +%define enablekernel 2.6.16 + +%if "%{?build_doc}" == "" +%define build_doc 1 +%endif + +%if "%{?build_profile}" == "" +%define build_profile 1 +%endif + +%if "%{?build_selinux}" == "" +%define build_selinux 1 +%endif + +# build a soft floating point targeted library (currently only for ARM) +%if "%{?bigendian}" +%define bigendian_append -bigendian +%endif + +# build a soft floating point targeted library (currently only for ARM) +%if "%{?softfloat}" +%define softfloat_append -softfloat +%endif + +# stage1: build only headers package +%if "%{stage1}" == "1" +%define bootstrap_append -stage1 +%define build_doc 0 +%define build_profile 0 +%define build_selinux 0 +%endif + +# stage2: build what you can without requirements may not be present yet (doc,profile,selinux) +%if "%{stage2}" == "1" +%define bootstrap_append -stage2 +%define build_doc 0 +%define build_profile 0 +%define build_selinux 0 +%endif + +%define target_cpu %(echo %{_target_platform} | cut -d- -f1) + +%if "%{multilib}" == "1" + %define _host %{_build} + %define _target_platform %{_build} +%endif + +%if "%{_target_platform}" != "%{_host}" + %define _as %{_target_platform}-as + %define _ld %{_target_platform}-ld + %define glibc_prefix %{_prefix}/%{_target_platform} + %define glibc_libdir %{_prefix}/%{_target_platform}/lib + %define glibc_datadir %{_prefix}/%{_target_platform}/share + %define glibc_libexecdir %{_prefix}/%{_target_platform}/libexec + %define glibc_includedir %{_prefix}/%{_target_platform}/include + %define glibc_target_cpu %{_target_cpu} + %define slibdir %{_prefix}/%{_target_platform}/%{_lib} +%else + %define _as as + %define _ld ld +%if "%{multilib}" != "1" + %define glibc_prefix %{_prefix} + %define glibc_libdir %{_libdir} + %define glibc_datadir %{_datadir} + %define glibc_libexecdir %{_libexecdir} + %define glibc_includedir %{_includedir} + %define glibc_target_cpu %{_target_cpu} + %define slibdir /%{_lib} +%else + %define glibc_prefix /usr + %define glibc_libdir /usr/lib + %define glibc_datadir %{_datadir} + %define glibc_libexecdir /usr/libexec + %define glibc_includedir /usr/include + %define slibdir /lib + %define glibc_target_cpu %{_build_cpu} +%endif +%endif +%define buildcc %{_target_platform}-gcc +%define buildcxx %{_target_platform}-g++ + +%if "%{_target_platform}" != "%{_build}" +%define build_doc 0 +%define build_profile 0 +%define build_selinux 0 +%endif + + +%if "%{?KERNEL_VER}" == "" + %define KERNEL_VER %(uname -r | sed "s|\\([0-9.]*\\).*|\\1|" ) +%endif + +%if "%{?KERNEL_TARGET}" == "" + # build a mamba kernel by default + %define KERNEL_TARGET mamba +%else + %define KERNEL_TARGET_APPEND -%{KERNEL_TARGET} +%endif + +Name: glibc +Version: 2.19 +Release: 2mamba +Summary: The GNU libc libraries +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.gnu.org/software/libc/ +Source0: http://ftp.gnu.org/gnu/glibc/glibc-%{version}.tar.xz +## glibc-ports got from head (release/2.12/master) here: +## http://sourceware.org/git/?p=glibc-ports.git +#Source1: http://ftp.gnu.org/gnu/glibc/glibc-ports-%{version}.tar.xz +#Source0: ftp://sources.redhat.com/pub/glibc/snapshots/glibc-%{majver}-%{minver}.tar.bz2 +#Source1: ftp://sources.redhat.com/pub/glibc/snapshots/glibc-%{majver}-ports-latest.tar.bz2 +#Source1: ftp://sources.redhat.com/pub/glibc/snapshots/glibc-%{majver}-ports-%{minver}.tar.bz2 +#Source3: http://ftp.gnu.org/gnu/glibc/glibc-libidn-%{version}.tar.bz2 +#Source3: ftp://sources.redhat.com/pub/glibc/snapshots/glibc-%{majver}-libidn-%{minver}.tar.bz2 +Source4: nscd-logrotate +Source5: nscd-conf +Source6: nscd-initscript +Patch0: %{name}-2.4-manual-syntax-fix.patch +Patch1: %{name}-2.6.1-strlcpy_strlcat-1.patch +Patch2: %{name}-2.7-memcpy_chk_S.patch +Patch3: %{name}-2.9-arm_local_args6.patch +Patch4: %{name}-2.7-lowlevellock.patch +Patch5: %{name}-2.16.0-localedata_openmamba.patch +Patch6: %{name}-2.7-only-lookup-ipv6-if-it-makes-sense.patch +Patch7: %{name}-2.7-gcc-4.3.patch +Patch8: %{name}-2.7-x86-fnstsw.patch +Patch9: %{name}-2.10.1-binutils-2.20.patch +Patch10: %{name}-2.11.2-gcc-4.5.0.patch +Patch11: %{name}-2.13-fix_prelink_ld_so.patch +Patch12: %{name}-2.14.1-fix-segfault-at-dl-lookup.patch +Patch13: %{name}-2.14-fix-resolver-crash-typo.patch +Patch14: %{name}-2.14-rpc_nis_headers_restore.patch +Patch15: glibc-ports-2.15-arm-libmemusage-libc_nonshared.patch +Patch16: glibc-2.16.0-tetex-3.0.patch +License: LGPL +## AUTOBUILDREQ-BEGIN +BuildRequires: libcap-devel +BuildRequires: libgd-devel +BuildRequires: libpng-devel +BuildRequires: libselinux-devel +BuildRequires: libz-devel +## AUTOBUILDREQ-END +BuildRequires: libidn-devel +BuildRequires: binutils >= 2.13 +%if "%{_host}" == "%{_build}" +BuildRequires: coreutils >= 5.2.1 +BuildRequires: perl >= 5.8.0 +%endif +BuildRequires: gettext-devel >= 0.14.0 +BuildRequires: gawk +BuildRequires: bison +BuildRequires: texinfo >= 4.8 +%if "%{?build_doc}" != "0" +BuildRequires: tetex +BuildRequires: tetex-latex +Requires(post):%{__install_info} +%endif +%if "%{?build_selinux}" != "0" +BuildRequires: libselinux-devel >= 1.22 +BuildRequires: libcap-devel +%endif +BuildRequires: kernelsanitisedheaders +Requires: ldconfig = %{?epoch:%epoch:}%{version}-%{release} +Prefix: %{_prefix} +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +# FIXME : +# $> localedef -v -c -i da_DK -f UTF-8 /tmp/da_DK.UTF-8 +# character map file `UTF-8' not found: No such file or directory +# cannot read character map directory `/usr/share/i18n/charmaps': No such file or directory + +%description +The glibc package contains standard libraries which are used by multiple programs on the system. +In order to save disk space and memory, as well as to make upgrading easier, common system code is kept in one place and shared between programs. +This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system will not function. +The glibc package also contains national language (locale) support. + + +%if "%{multilib}" +%package multilib +Summary: The GNU libc libraries (multilib) +Group: System/Libraries +Requires(post):%{__install_info} + +%description multilib +The glibc package contains standard libraries which are used by multiple programs on the system. +In order to save disk space and memory, as well as to make upgrading easier, common system code is kept in one place and shared between programs. +This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system will not function. +The glibc package also contains national language (locale) support. +%endif + +%package %{?multilib:multilib-}devel +Summary: Header and object files for development using standard C libraries. +Group: Development/Libraries +Requires: %{name}%{?multilib:-multilib} = %{?epoch:%epoch:}%{version}-%{release} +Prereq: %{__install_info} +%if "%{multilib}" == "1" +# non-multilib glibc-devel required for /usr/include headers +Requires: glibc-devel +%endif + +%description %{?multilib:multilib-}devel +The glibc-devel package contains the header and object files necessary for developing programs which use the standard C libraries (which are used by nearly all programs). +If you are developing programs which will use the standard C libraries, your system needs to have these standard header and object files available in order to create the executables. + +This package also includes the C header files for the Linux kernel. +The header files define structures and constants that are needed for building most standard programs. +The header files are also needed for rebuilding the kernel. + +Install glibc-devel if you are going to develop programs which will use the standard C libraries. + +%if "%{build_profile}" == "1" +%package %{?multilib:multilib-}profile +Summary: The GNU libc libraries, including support for gprof profiling +Group: Development/Libraries +Requires: %{name}%{?multilib:-multilib} = %{?epoch:%epoch:}%{version}-%{release} + +%description %{?multilib:multilib-}profile +The glibc package contains standard libraries which are used by multiple programs on the system. +In order to save disk space and memory, as well as to make upgrading easier, common system code is kept in one place and shared between programs. +This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. +Without these two libraries, a Linux system will not function. +The glibc package also contains national language (locale) support. + +If you are going to use the gprof program to profile a program, you'll need to install the glibc-profile program. +%endif + +%if %{build_doc} +%package %{?multilib:multilib-}apidocs +Summary: GNU libc libraries API documentation +Group: Documentation +Requires: glibc-%{?multilib:multilib-}devel = %{?epoch:%epoch:}%{version}-%{release} + +%description %{?multilib:multilib-}apidocs +GNU libc libraries API documentation. +%endif + +%package %{?multilib:multilib-}i18ndata +Summary: Database sources for 'locale' +Group: System/Libraries +Requires(pre): %{name}%{?multilib:-multilib} = %{?epoch:%epoch:}%{version}-%{release} + +%description %{?multilib:multilib-}i18ndata +This package contains the data needed to build the locale data files to use the internationalization features of the GNU libc. + +%package %{?multilib:multilib-}utils +Summary: Development utilities from GNU C library +Group: Development/Tools +Requires: %{name}%{?multilib:-multilib} = %{?epoch:%epoch:}%{version}-%{release} + +%description %{?multilib:multilib-}utils +The glibc-utils package contains memusage, a memory usage profiler, mtrace, a memory leak tracer and, a function call tracer which can be helpful during program debugging. + +%package -n ldconfig%{?multilib:-multilib} +Summary: Configure dynamic linker run time bindings +Group: System/Tools +# The dynamic linker supports DT_GNU_HASH +Provides: rtld(GNU_HASH) +Provides: rtld(GNU_UNIQUE) + +%description -n ldconfig%{?multilib:-multilib} +ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib). +The cache is used by the run-time linker, ld.so or ld-linux.so. +ldconfig checks the header and file names of the libraries it encounters when determining which versions should have their links updated. + +%package -n timezone%{?multilib:-multilib} +Summary: Time zone descriptions +Group: System/Internationalization +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires(post):tzdata + +%description -n timezone%{?multilib:-multilib} +These are configuration files that describe possible time zones. + +%package -n locales%{?multilib:-multilib} +Summary: Base files for localization +Group: System/Internationalization +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description -n locales%{?multilib:-multilib} +These are the base files for language localization. +You also need to install the specific locales-?? for the language(s) you want. +Then the user need to set the LANG variable to their preferred language in their ~/.profile configuration file. + +%package -n nscd%{?multilib:-multilib} +Summary: Name service cache daemon +Group: System/Servers +Requires: logrotate >= 3.6.8 + +%description -n nscd%{?multilib:-multilib} +Nscd is a daemon that provides a cache for the most common name service requests. + +%package -n cross-%{_target_platform}-%{name}%{?bootstrap_append}%{?bigendian_append}%{?softfloat_append} +Summary: Cross Platform glibc for %{_target_platform} +Group: System/Libraries +AutoReqProv: no +%if "%{?stage2}" +Obsoletes: cross-%{_target_platform}-%{name}-stage1%{?bigendian_append}%{?softfloat_append} +%else +%if "%{?stage1}" == "" +Provides: cross-%{_target_platform}-%{name}-stage2%{?bigendian_append}%{?softfloat_append} +Obsoletes: cross-%{_target_platform}-%{name}-stage2%{?bigendian_append}%{?softfloat_append} +Obsoletes: cross-%{_target_platform}-%{name}-stage1%{?bigendian_append}%{?softfloat_append} +%endif +%endif + +%description -n cross-%{_target_platform}-%{name}%{?bootstrap_append}%{?bigendian_append}%{?softfloat_append} +Cross Platform glibc for %{_target_platform}. + +%if "%{_target_platform}" == "%{_host}" +%if "%{multilib}" != "1" +%debug_package +%endif +%endif + +%prep +%setup -q -n %{name}-%{version} +# -D -T +#:<< ___EOF +%patch5 -p1 +#%patch10 -p1 +#% patch11 -p +#%patch12 -p1 +#%patch13 -p1 +#%patch14 -p1 + +#cd glibc-ports-%{version} +#%patch15 -p2 +#cd .. +#%patch16 -p1 + +## FIX build with make 3.82 (see http://comments.gmane.org/gmane.linux.lfs.support/31227) +#sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile + +%if "%{?stage2}" + # link glibc without libgcc_eh, not available in stage1 cross compiler + # this is the reason why also a glibc rebuild is needed later + sed -i "s|-lgcc_eh||" Makeconfig +%endif + +%if %{build_selinux} +ln -sf %{_includedir}/selinux selinux +ln -sf %{_includedir}/sys/capability.h include/sys/capability.h +%endif + +# do not try to explicitly provide GLIBC_PRIVATE versioned libraries +%define _use_internal_dependency_generator 0 +%define __find_provides %{_builddir}/glibc-%{version}/find_provides.sh +%define __find_requires %{_builddir}/glibc-%{version}/find_requires.sh + +# create find-provides and find-requires script in order to ignore GLIBC_PRIVATE errors +cat > find_provides.sh << _EOF +#! /bin/sh +%{_prefix}/lib/rpm/find-provides | grep -v GLIBC_PRIVATE +exit 0 +_EOF +chmod +x find_provides.sh + +cat > find_requires.sh << _EOF +#! /bin/sh +%{_prefix}/lib/rpm/find-requires %{buildroot} %{glibc_target_cpu} | grep -v GLIBC_PRIVATE +_EOF +chmod +x find_requires.sh +#___EOF + +%build +#:<< ___EOF +case %{target_cpu} in + i*86|athlon*) + platform_includes=asm-x86 + buildflags="-mtune=pentiumpro -g -O3" + ;; + ppc|powerpc) + platform_includes=asm-powerpc + buildflags="-g -O3" + ;; + arm) + platform_includes=asm-arm + buildflags="-g -O3 -fgnu89-inline" + ;; + x86_64) + platform_includes=asm-x86_64 + buildflags="-g -O3" + ;; + *) + echo "Target CPU %{target_cpu} not supported. Aborting." + exit 1 + ;; +esac + +# prepare kernel headers for platform +mkdir -p %{glibc_headers_dir} +cp -af %{kheaders_dir}/* %{glibc_headers_dir} +#cp -af %{kheaders_dir}/$platform_includes %{glibc_headers_dir}/$platform_includes +#ln -sf $platform_includes %{glibc_headers_dir}/asm + +function build_glibc() { + local builddir="$1"; shift + + case %{target_cpu} in + i*86|athlon*) + %if "%{?bigendian}" == "1" + echo "Error: bigendian build is not supported on i*86 architecture" + exit 1 + %endif + %if "%{?softfloat}" == "1" + echo "Error: softfloat build is not supported for i*86 architecture" + exit 1 + %endif + CONFIG_OPTS="--enable-targets=x86_64-%{_target_vendor}-linux" + ;; + ppc|powerpc) + %if "%{?bigendian}" == "1" + echo "Error: bigendian build is not supported on ppc architecture" + exit 1 + %endif + %if "%{?softfloat}" == "1" + echo "Error: softfloat build is not supported on ppc architecture" + exit 1 + %endif + CONFIG_OPTS="--enable-targets=powerpc64-%{_target_vendor}-linux" + ;; + arm) + %if "%{?softfloat}" == "1" + CONFIG_LIBDIR_ADD="/soft-float" + CONFIG_ADD="--without-fp" + CC_ADD="-msoft-float" + %else + CONFIG_OPTS="" + %endif + %if "%{?bigendian}" == "1" + CONFIG_LIBDIR_ADD="/be${CONFIG_LIBDIR_ADD}" + CC_ADD="-mbig-endian" + AS_ADD="-mbig-endian" + %endif +# PRECONFIG_OPTS="CC=\"arm-%{_target_vendor}-linux-gnu-gcc $CC_ADD -finline-limit=10000\" +# AS=\"arm-%{_target_vendor}-linux-gnu-as $AS_ADD\" +# LD=\"arm-%{_target_vendor}-linux-gnu-ld -EB\"" +# SLIBDIR=/usr/arm-%{_target_vendor}-linux-gnu/lib${CONFIG_LIBDIR_ADD} +# CONFIG_OPTS="$CONFIG_ADD --libdir=$SLIBDIR" + CONFIG_OPTS="" + ;; + x86_64) + %if "%{?bigendian}" == "1" + echo "Error: bigendian build is not supported on i*86 architecture" + exit 1 + %endif + %if "%{?softfloat}" == "1" + echo "Error: softfloat build is not supported for i*86 architecture" + exit 1 + %endif + CONFIG_OPTS="--enable-targets=i586-%{_target_vendor}-linux" + ;; + *) + echo "Target CPU %{target_cpu} not supported.Aborting." + exit 1 + ;; + esac + + rm -rf ../$builddir + mkdir ../$builddir + + ( cd ../$builddir + +# %if "%{?_target_platform}" != "%{_host}" +# echo "libc_cv_forced_unwind=yes" > config.cache +# echo "libc_cv_c_cleanup=yes" >> config.cache +# %endif + + eval $PRECONFIG_OPTS ../%{name}-%{version}/configure \ + --prefix=%{glibc_prefix} \ + --infodir=%{_infodir} \ + --libexecdir=%{glibc_libexecdir} \ + --with-headers=%{glibc_headers_dir} $@\ + --enable-kernel=%{enablekernel} \ + --without-cvs \ + --enable-bind-now \ + --build=%{_build} \ + %if "%{?stage1}" != "1" + --host=%{_target_platform} \ + %endif + --with-binutils=%{_prefix}/bin \ + $CONFIG_OPTS \ + CFLAGS=\"$buildflags\ -Wl,--build-id\" + +# CC=%{buildcc} \ +# CXX=%{buildcxx} \ +# %if "%{_target_platform}" != "%{_host}" +# --cache-file=config.cache \ +# %endif + + %if "%{?stage1}" != "1" + make %{_smp_mflags} -r %PARALLELMFLAGS=-s slibdir=%{slibdir} \ + %if "%{_target_platform}" != "%{_host}" + LDLIBS-resolv.so+="-lssp" LDFLAGS-nscd+="-lssp" + %endif + + #CFLAGS="$buildflags" + %endif + ) +} + +%if "%{?stage2}" + # hack, diable nptl for bootstrap gcc + opt_tls="--enable-addons --with-tls --disable-sanity-checks" +%else + opt_tls="--enable-addons --with-tls --enable-obsolete-rpc" +%endif + +%if %{build_selinux} + opt_selinux="--with-selinux" +%else + opt_selinux="--without-selinux" +%endif + +%if "%{build_profile}" == "1" + build_glibc glibc-build-profile --enable-profile $opt_tls $opt_selinux +%endif + +build_glibc glibc-build $opt_tls $opt_selinux + +# build documentation (pdf and html formats) +%if %{build_doc} + make pdf html -C ../glibc-build +%endif +#___EOF + +%install +[ "%{buildroot}" != / ] && rm -rf %{buildroot} + +%if "%{?stage1}" != "1" +# crelate ld.so.conf +install -d %{buildroot}%{_sysconfdir}/ld.so.conf.d +cat > %{buildroot}%{_sysconfdir}/ld.so.conf << _EOF +include %{_sysconfdir}/ld.so.conf.d/*.conf +_EOF + +%if "%{build_profile}" == "1" + make install -C ../glibc-build-profile install_root=%{buildroot} +%endif + make install -C ../glibc-build install_root=%{buildroot} + +# install openmamba default supported locales + mv localedata/SUPPORTED localedata/SUPPORTED.orig + mv localedata/SUPPORTED.openmamba localedata/SUPPORTED + echo "%{_target_platform} == %{_host}" +%if "%{_target_platform}" == "%{_build}" + make localedata/install-locales -C ../glibc-build install_root=%{buildroot} +%else + make LOCALEDEF="I18NPATH=. LC_ALL=C localedef" localedata/install-locales -C ../glibc-build install_root=%{buildroot} +%endif + mv localedata/SUPPORTED localedata/SUPPORTED.openmamba + mv localedata/SUPPORTED.orig localedata/SUPPORTED + install -m0644 localedata/SUPPORTED %{buildroot}%{glibc_datadir}/i18n/locales/ + [-e %{buildroot}%{glibc_libdir}/libbsd-compat.a ] && ln -sf libbsd-compat.a %{buildroot}%{glibc_libdir}/libbsd.a +%else + # stage 1 + make -C ../glibc-build install-headers install_root=%{buildroot} cross-compiling=yes + # the following files are generated during the glibc build. + # Fortunately, it is sufficient to substitute empty files for a first stage gcc build + touch %{buildroot}%{glibc_includedir}/gnu/stubs.h + touch %{buildroot}%{glibc_includedir}/bits/stdio_lim.h +%endif + +rm -f %{buildroot}%{_sysconfdir}/localtime + +# install kernel headers +install -d %{buildroot}%{glibc_includedir} +cp -avrf %{glibc_headers_dir}/* %{buildroot}%{glibc_includedir} + +%if "%{_target_platform}" == "%{_host}" +# install/create nscd service dirs and configuration files +install -d %{buildroot}/var/log/nscd +install -D -m644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/nscd +install -D -m644 %{SOURCE5} %{buildroot}%{_sysconfdir}/nscd.conf +install -D -m755 %{SOURCE6} %{buildroot}%{_initrddir}/nscd +# work around to avoid stripping libthread_db-1.0.so for debugging +chmod -x %{buildroot}/%{slibdir}/libthread_db-1.0.so +%else +rm -rf %{buildroot}%{_sysconfdir} +rm -rf %{buildroot}%{_infodir} +rm -rf %{buildroot}%{_mandir} +rm -f %{buildroot}%{_prefix}/%{_target_platform}/%{_sysconfdir}/localtime +rm -f %{buildroot}%{_localstatedir}/db/Makefile +rm -f %{buildroot}%{_prefix}/%{_target_platform}/%{_sysconfdir}/ld.so.cache +# work around to avoid stripping libthread_db-1.0.so for debugging +chmod -x %{buildroot}/%{glibc_libdir}/libthread_db-1.0.so +%endif + +%if "%{multilib}" == "1" +cp %{buildroot}%{glibc_includedir}/gnu/stubs-32.h %{buildroot}/ +rm -rf %{buildroot}%{glibc_includedir} +install -d -m0755 %{buildroot}%{glibc_includedir}/gnu/ +mv %{buildroot}/stubs-32.h %{buildroot}%{glibc_includedir}/gnu/stubs-32.h +%endif + +# install rpc headers removed since glibc 2.14 but required by e.g. samba and libtirpc +install -d -m0755 %{buildroot}%{glibc_includedir}/rpc +cp -v ../glibc-%{version}/sunrpc/rpc/*.h %{buildroot}%{glibc_includedir}/rpc/ +install -d -m0755 %{buildroot}%{glibc_includedir}/rpcsvc +cp -v ../glibc-%{version}/sunrpc/rpcsvc/*.h %{buildroot}%{glibc_includedir}/rpcsvc/ +cp -v ../glibc-%{version}/nis/rpcsvc/*.h %{buildroot}%{glibc_includedir}/rpcsvc/ + +%if "%{?stage1}" != "1" +## strip debug symbols +#find %{buildroot}%{glibc_libdir} -maxdepth 1 -type f \ +# -exec strip -g -R .comment {} 2>/dev/null \; +##strip -g -R .comment %{buildroot}%{_libexecdir}/pt_chown + +%find_lang libc + +#install api documentation +%if "%{_target_platform}" == "%{_host}" +%if %{build_doc} +install -d %{buildroot}%{_docdir}/libc/html +cp -a ../glibc-build/manual/libc/* %{buildroot}%{_docdir}/libc/html/ +cp -a ../glibc-build/manual/libc.pdf %{buildroot}%{_docdir}/libc/ +%endif +%endif + +%endif + +rm -f %{buildroot}%{_sysconfdir}/ld.so.cache + +# updated zoneinfo provided by tzdata +rm -rf %{buildroot}%{glibc_datadir}/zoneinfo + +%clean +[ "%{buildroot}" != / ] && rm -rf %{buildroot} + +# this script does not permit the clean installation of glibc packages +# during the setup: i.e. do NOT use pre script here! +#%pre +#if [ -d %{_bindir}/getconf ]; then +# rm -fr %{_bindir}/getconf +#fi +#exit 0 + +%post %{?multilib:multilib} -p /sbin/ldconfig +%postun %{?multilib:multilib} -p /sbin/ldconfig + +%post -n timezone%{?multilib:-multilib} +if [ -e %{_sysconfdir}/timezone ]; then + timezone=`cat %{_sysconfdir}/timezone` +else + case ${LANG:0:2} in + it) timezone=Europe/Rome ;; + *) timezone=UTC ;; + esac + echo $timezone > %{_sysconfdir}/timezone +fi +[ -L /etc/localtime ] && rm -f /etc/localtime +[ /usr/share/zoneinfo/$timezone -nt /etc/localtime ] && \ + cp /usr/share/zoneinfo/$timezone /etc/localtime +exit 0 + +%pre %{?multilib:multilib-}devel +[ -L %{_includedir}/asm ] && exit 0 + +# FIX an upgrade problem with /usr/include/asm becoming symlink +case %{target_cpu} in + i*86 | athlon*) + platform_includes=asm-i386 + ;; + ppc | powerpc) + platform_includes=asm-ppc + ;; + arm) + platform_includes=asm-arm + ;; + *) + platform_includes=asm-orphan + ;; +esac + +[ -L %{_includedir}/asm ] || { + mkdir -p %{_includedir}/$platform_includes + mv %{_includedir}/asm/* %{_includedir}/$platform_includes + rm -rf %{_includedir}/asm +} + +exit 0 + +%post %{?multilib:multilib-}devel +%install_info libc.info + +%postun %{?multilib:multilib-}devel +%uninstall_info libc.info + +%posttrans %{?multilib:multilib-}i18ndata +# update locale-archive for current language settings +LOCALES=(`grep ${LANG:0:5} %{glibc_datadir}/i18n/locales/SUPPORTED | awk '{ print $1 }'`); +for l in ${LOCALES[*]}; do + charset=`echo $l | sed -e 's,.*/,,'` + locale=`echo $l | sed -e 's,/[^/]*,,'` + input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'` + localedef -i $input -c -f $charset $locale +done +exit 0 + +%pre -n nscd%{?multilib:-multilib} +if [ $1 -eq 1 ]; then + /usr/sbin/groupadd -g 65001 nscd + /usr/sbin/useradd -u 65001 -g nscd -d /dev/null nscd -s /bin/false +fi +exit 0 + +%post -n nscd%{?multilib:-multilib} +if [ $1 -eq 1 ]; then + /sbin/chkconfig --add nscd + service nscd start +fi +exit 0 + +%preun -n nscd%{?multilib:-multilib} +if [ $1 -eq 0 ]; then + service nscd stop + /sbin/chkconfig --del nscd + /usr/sbin/userdel nscd +fi +exit 0 + +%postun -n nscd%{?multilib:-multilib} +if [ $1 -eq 1 ]; then + service nscd restart +fi +exit 0 + +%if "%{_target_platform}" == "%{_host}" +%files %{?multilib:multilib} +%defattr(-,root,root) +%if "%{multilib}" != "1" +%{_sbindir}/iconvconfig +%{_bindir}/catchsegv +%{_bindir}/gencat +%{_bindir}/getconf +%{_bindir}/getent +%{_bindir}/iconv +%{_bindir}/ldd +%ifarch %{ix86} +%{_bindir}/lddlibc4 +%endif +%{_bindir}/locale +%{_bindir}/localedef +%{_bindir}/makedb +%{_bindir}/pldd +%{_bindir}/rpcgen +%{_bindir}/sprof +%{_bindir}/tzselect +/sbin/sln +%endif +%config(noreplace) %{_sysconfdir}/rpc +/%{slibdir}/* +%exclude %{slibdir}/libmemusage.so +%exclude %{slibdir}/libpcprofile.so +%dir %{glibc_libdir}/gconv +%{glibc_libdir}/gconv/* +%dir %{glibc_libexecdir}/getconf +%ifnarch x86_64 +%{glibc_libexecdir}/getconf/POSIX_V6_ILP32_OFF32 +%{glibc_libexecdir}/getconf/POSIX_V6_ILP32_OFFBIG +%{glibc_libexecdir}/getconf/POSIX_V7_ILP32_OFF32 +%{glibc_libexecdir}/getconf/POSIX_V7_ILP32_OFFBIG +%{glibc_libexecdir}/getconf/XBS5_ILP32_OFF32 +%{glibc_libexecdir}/getconf/XBS5_ILP32_OFFBIG +%endif +%ifarch x86_64 +%if "%{multilib}" != "1" +%{glibc_libexecdir}/getconf/POSIX_V6_LP64_OFF64 +%{glibc_libexecdir}/getconf/POSIX_V7_LP64_OFF64 +%{glibc_libexecdir}/getconf/XBS5_LP64_OFF64 +%else +%{glibc_libexecdir}/getconf/POSIX_V6_ILP32_OFF32 +%{glibc_libexecdir}/getconf/POSIX_V6_ILP32_OFFBIG* +%{glibc_libexecdir}/getconf/POSIX_V7_ILP32_OFF32 +%{glibc_libexecdir}/getconf/POSIX_V7_ILP32_OFFBIG* +%{glibc_libexecdir}/getconf/XBS5_ILP32_OFF32 +%{glibc_libexecdir}/getconf/XBS5_ILP32_OFFBIG* +%endif +%endif +%ifnarch x86_64 +%dir %{glibc_libdir}/locale +%{glibc_libdir}/locale/locale-archive +%else +%{_prefix}/lib/locale/locale-archive +%endif +%{_localstatedir}/db/Makefile +%doc COPYING* LICENSES + +%if "%{build_profile}" == "1" +%files %{?multilib:multilib-}profile +%defattr(-,root,root) +%{glibc_libdir}/lib*_p.a +%endif + +%files %{?multilib:multilib-}devel +%defattr(-,root,root) +%{glibc_includedir}/* +%{glibc_libdir}/*.o +%{glibc_libdir}/*.so +%{glibc_libdir}/*.a +%if "%{build_profile}" == "1" +%exclude %{glibc_libdir}/lib*_p.a +%endif +%{_infodir}/* +%doc BUGS ChangeLog CONFORMANCE NAMESPACE +%doc NEWS PROJECTS README* + +%if %{build_doc} +%files %{?multilib:multilib-}apidocs +%defattr(-,root,root) +%dir %{_docdir}/libc/ +%{_docdir}/libc/* +%endif + +%files %{?multilib:multilib-}i18ndata +%defattr(-,root,root) +%dir %{glibc_datadir}/i18n +%{glibc_datadir}/i18n/* + +%files %{?multilib:multilib-}utils +%defattr(-,root,root) +%if "%{multilib}" == "1" +%{_sbindir}/iconvconfig +%{_bindir}/catchsegv +%{_bindir}/gencat +%{_bindir}/getconf +%{_bindir}/getent +%{_bindir}/iconv +%{_bindir}/ldd +%{_bindir}/lddlibc4 +%{_bindir}/locale +%{_bindir}/localedef +%{_bindir}/makedb +%{_bindir}/pldd +%{_bindir}/rpcgen +%{_bindir}/sprof +%{_bindir}/tzselect +/sbin/sln +%endif +%{_bindir}/mtrace +%{_bindir}/pcprofiledump +%{_bindir}/sotruss +%{_bindir}/xtrace +%if "%{glibc_target_cpu}" == "%{_build_cpu}" +%{_bindir}/memusage +%{_bindir}/memusagestat +%endif +%{glibc_libdir}/audit/sotruss-lib.so +#%{glibc_libexecdir}/pt_chown +%{slibdir}/libmemusage.so +%{slibdir}/libpcprofile.so + +%files -n ldconfig%{?multilib:-multilib} +%defattr(-,root,root) +/sbin/ldconfig +%config(noreplace) %{_sysconfdir}/ld.so.conf +%dir %{_sysconfdir}/ld.so.conf.d +#%if "%{_target_cpu}" == "%{_build_cpu}" +#%config(noreplace) %{_sysconfdir}/ld.so.cache +#%endif + +%files -n locales%{?multilib:-multilib} -f libc.lang +%defattr(-,root,root) +%{glibc_datadir}/locale/locale.alias + +%files -n nscd%{?multilib:-multilib} +%defattr(-,root,root) +%{_sbindir}/nscd +%attr(0755,nscd,nscd) /var/log/nscd +%config(noreplace) %{_sysconfdir}/logrotate.d/nscd +%config(noreplace) %{_sysconfdir}/nscd.conf +%attr(0755,root,root) %{_initrddir}/nscd + +%files -n timezone%{?multilib:-multilib} +%defattr(-,root,root) +%{_sbindir}/zdump +%{_sbindir}/zic + +%else +%files -n cross-%{_target_platform}-%{name}%{?bootstrap_append}%{?bigendian_append}%{?softfloat_append} +%defattr(-,root,root) +%if "%{?stage1}" != "1" +%{glibc_prefix}/etc/rpc +%{glibc_libexecdir}/* +%{glibc_prefix}/bin/* +%{glibc_prefix}/sbin/* +%{glibc_libdir}/* +%{glibc_prefix}/share/* +%endif +%{glibc_includedir}/* +%{glibc_prefix}/%{_localstatedir}/db/Makefile +%endif + +%changelog +* Sun Apr 20 2014 Silvan Calarco 2.19-2mamba +- rebuilt with enable-obsolete-rpc required by pwdutils + +* Sun Feb 09 2014 Automatic Build System 2.19-1mamba +- automatic version update by autodist + +* Sat Aug 17 2013 Automatic Build System 2.18-1mamba +- automatic version update by autodist + +* Tue Jan 15 2013 Automatic Build System 2.17-1mamba +- update to 2.17 + +* Mon Oct 01 2012 Silvan Calarco 2.16.0-2mamba +- restore installing rpcnis headers needed by samba +- source edit: install de_AT locale because required by perl-libintl + +* Fri Sep 28 2012 Automatic Build System 2.16.0-1mamba +- automatic version update by autodist + +* Thu Jun 14 2012 Automatic Build System 2.15-1mamba +- automatic version update by autodist + +* Mon Oct 10 2011 Automatic Build System 2.14.1-1mamba +- automatic version update by autodist + +* Wed Aug 24 2011 Silvan Calarco 2.14-5mamba +- complete rpc/nis patch by reexporting symbols + +* Tue Aug 23 2011 Silvan Calarco 2.14-4mamba +- rebuilt with 2.6.38 kernel headers for x86 and x86_64 targets (for arm still use 2.6.35) +- added a patch to restore rpc/nis headers (http://permalink.gmane.org/gmane.linux.pld.devel.english/7397) + +* Sat Aug 13 2011 Silvan Calarco 2.14-3mamba +- added patch to fix resolver crash in __libc_res_query + +* Thu Aug 11 2011 Silvan Calarco 2.14-2mamba +- added patch to fix several crashes in dl_lookup (eg. libSDL). See http://sourceware.org/bugzilla/show_bug.cgi?id=12871 + +* Thu Jul 07 2011 Automatic Build System 2.14-1mamba +- automatic update by autodist + +* Tue Apr 19 2011 Silvan Calarco 2.13-4mamba +- don't build debug package for cross-platform targets to avoid overwriting native glibc-debug package + +* Fri Apr 01 2011 Silvan Calarco 2.13-3mamba +- timezone: modify to use zoneinfo from tzdata + +* Sat Feb 19 2011 Silvan Calarco 2.13-2mamba +- add patch to fix a prelink segmentation fault in ld.so causing whole system crash + +* Sat Feb 12 2011 Automatic Build System 2.13-1mamba +- update to 2.13 + +* Tue Dec 14 2010 Automatic Build System 2.12.2-1mamba +- automatic update to 2.12.2 by autodist + +* Mon Dec 13 2010 Davide Madrisan 2.12.1-3mamba +- provides rtld(GNU_HASH) for google-talkplugin and other closed-source packages + +* Wed Nov 24 2010 Silvan Calarco 2.12.1-2mamba +- rebuilt with debug package +- don't strip libthread_db.so.1 to allow multithreaded debugging + +* Tue Aug 17 2010 Automatic Build System 2.12.1-1mamba +- update to 2.12.1 + +* Fri May 28 2010 Automatic Build System 2.11.2-1mamba +- automatic update to 2.11.2 by autodist + +* Sat Mar 13 2010 Silvan Calarco 2.11.1-2mamba +- rebuilt with kernel 2.6.31 headers + +* Fri Nov 13 2009 Automatic Build System 2.11-1mamba +- update to 2.11 + +* Tue Nov 03 2009 Silvan Calarco 2.10.1-5mamba +- added es_ES* locale support + +* Thu Sep 24 2009 Silvan Calarco 2.10.1-4mamba +- revert back previous patch because kde and maybe other software need to be rebuilt without internal str* functions + +* Fri Sep 11 2009 Automatic Build System 2.10.1-3mamba +- automatic rebuild by autodist +- readded BSD-like strlcpy strlcat patch + +* Wed Aug 12 2009 Automatic Build System 2.10.1-2mamba +- automatic rebuild by autodist + +* Thu May 28 2009 Automatic Build System 2.10.1-1mamba +- update to 2.10.1 + +* Wed Apr 29 2009 Automatic Build System 2.9-3mamba +- build with ports and libidn + +* Wed Apr 29 2009 Automatic Build System 2.9-2mamba +- automatic rebuild by autodist + +* Wed Apr 15 2009 Silvan Calarco 2.9-1mamba +- update to 2.9 + +* Wed Jan 28 2009 Davide Madrisan 2.7-6mamba +- patch: x86-fnstsw.patch (fixes "suffix or operands invalid for `fnstsw'" in ftestexcept.c) + +* Tue Sep 16 2008 Silvan Calarco 2.7-5mamba +- rebuilt with gcc 4.3.2 and 2.6.26.5 kernel headers + +* Tue Feb 05 2008 Silvan Calarco 2.7-4mamba +- patch: only-lookup-ipv6-if-it-makes-sense (should fix ipv6 dns requests resolved to 1.0.0.0) +- patch: arm_lowlevellock fixed and renamed to lowlevellock + +* Tue Dec 18 2007 Silvan Calarco 2.7-3mamba +- post script: update /etc/localtime file + +* Fri Dec 14 2007 Silvan Calarco 2.7-2mamba +- move i18ndata script to posttrans to avoid missing prereqs errors +- added stricter version requirements for glibc-profile and others +- fixed a couple of errors in i18ndata postrans script + +* Wed Nov 28 2007 Silvan Calarco 2.7-1mamba +- update to 2.7 +- added html documentation +- added cross--glibc-stage2 provide to cross--glibc +- added support for a limited set of default locales +- i18ndata: update locale-archive according to current LANG setting + +* Fri Mar 30 2007 Silvan Calarco 2.5-4mamba +- rebuilt with sanitized headers from clfs +- added patch that adds strlcpy and strlcat functions + +* Sat Mar 24 2007 Silvan Calarco 2.5-3qilnx +- rebuild for the openmamba platform +- cross packages obsoletion of both stage1 and stage2 transient packages + +* Fri Mar 09 2007 Silvan Calarco 2.5-2qilnx +- kernel headers update to 2.6.20 +- sln moved from tools to main package for LSB compliance +- ld.so.conf: add support for includes directory ld.so.conf.d + +* Fri Nov 24 2006 Silvan Calarco 2.5-1qilnx +- new version build + +* Sat Jun 24 2006 Silvan Calarco 2.4-2qilnx +- rebuilt with cleaned headers from kernel 2.6.17 + +* Fri Jun 09 2006 Silvan Calarco 2.4-1qilnx +- new version build +- added arm support +- added stage1 (only headers) and stage2 (only c cross compiler) build support + +* Wed Jan 25 2006 Davide Madrisan 2.3.6-3qilnx +- patched sys/kd.h header to make linux/agpgart.h usable from userspace + +* Fri Nov 04 2005 Silvan Calarco 2.3.6-2qilnx +- added /usr/include/sound headers from kernel sources +- removed the now obsolete linuxthreads stuff + +* Fri Nov 04 2005 Silvan Calarco 2.3.6-1qilnx +- update to version 2.3.6 by autospec + +* Wed Sep 07 2005 Silvan Calarco 2.3.5-5qilnx +- add qilinux headers installation (currently for sisfb.h) +- add cross-platform (cross-glibc) build target + +* Thu Aug 25 2005 Silvan Calarco 2.3.5-4qilnx +- add specfile code for cross-platform builds +- add maintained sanitized kernel headers +- /sbin/sln moved to glibc-utils package + +* Mon Jun 06 2005 Davide Madrisan 2.3.5-3qilnx +- run make check +- install man pages for linuxthread (devel package) + +* Mon Jun 06 2005 Davide Madrisan 2.3.5-2qilnx +- updated kernel headers to release 2.6.11 +- added package 'glibc-profile' (support for gprof profiling) +- enabled selinux support + +* Thu Apr 07 2005 Davide Madrisan 2.3.5-1qilnx +- update to version 2.3.5 by autospec +- updated kernel headers to release 2.4.30 + +* Fri Feb 11 2005 Davide Madrisan 2.3.4-3qilnx +- removed pre scriptlet + +* Wed Feb 02 2005 Davide Madrisan 2.3.4-2qilnx +- moved `ld.so.conf' and `ld.so.cache' to package ldconfig +- removed configure option `--libexecdir=${_bindir}' + +* Fri Jan 28 2005 Davide Madrisan 2.3.4-1qilnx +- update to 2.3.4 + +* Mon Jan 12 2004 Davide Madrisan 2.3.2-9qilnx +- fixed specfile summary + +* Mon Dec 15 2003 Davide Madrisan 2.3.2-8qilnx +- disabled nscd hosts caching, specfile updates +- kernel headers updated to version 2.4.22 + +* Tue Sep 30 2003 Silvan Calarco 2.3.2-7qilnx +- added nscd package and automatic service configuration + +* Mon Jun 16 2003 Silvan Calarco 2.3.2-6qilnx +- rebuilt against gcc 3.2.3 + +* Mon May 05 2003 Silvan Calarco 2.3.2-5qilnx +- removed /etc/localtime link (will be in setup package) + +* Tue Apr 24 2003 Silvan Calarco 2.3.2-4qilnx +- added linux kernel includes: /usr/include/linux, /usr/include/asm +- addded _libdir files in devel package + +* Tue Apr 16 2003 Silvan Calarco 2.3.2-3qilnx +- removed _libdir and _bindir * references not to include util package files + +* Tue Apr 16 2003 Silvan Calarco 2.3.2-2qilnx +- fixed find_requires and find_provides scripts: ignore GLIBC_PRIVATE references +- added util package, so glibc doesn't need perl as a dependancy + +* Tue Apr 08 2003 Silvan Calarco 2.3.2-1qilnx +- first build for 2.3.2 diff --git a/nscd-conf b/nscd-conf new file mode 100644 index 0000000..5e88b23 --- /dev/null +++ b/nscd-conf @@ -0,0 +1,25 @@ +# +# Name Service Cache Daemon configuration file +# +logfile /var/log/nscd/nscd.log +threads 6 +server-user nscd +debug-level 0 + +enable-cache passwd yes +positive-time-to-live passwd 600 +negative-time-to-live passwd 20 +suggested-size passwd 211 +check-files passwd yes + +enable-cache group yes +positive-time-to-live group 3600 +negative-time-to-live group 60 +suggested-size group 211 +check-files group yes + +enable-cache hosts no +positive-time-to-live hosts 3600 +negative-time-to-live hosts 6 +suggested-size hosts 211 +check-files hosts yes diff --git a/nscd-initscript b/nscd-initscript new file mode 100644 index 0000000..af769c7 --- /dev/null +++ b/nscd-initscript @@ -0,0 +1,48 @@ +#!/bin/bash +# Begin $rc_base/init.d/nscd - Name Service Cache Daemon loader +# +# Created by Silvan Calarco - silvan.calarco@qilinux.it +# +# nscd This starts and stops nscd daemon. +# +# chkconfig: 2345 17 93 +# +# description: Syslogd and Klogd loaders +# + +source /etc/sysconfig/rc +source $rc_functions + +case "$1" in + start) + echo -n "Starting name service cache daemon..." + nscd + evaluate_retval + echo + ;; + + stop) + echo -n "Stopping name service cache daemon..." + killproc nscd + evaluate_retval + echo + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + status) + statusproc nscd + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/sysklogd + diff --git a/nscd-logrotate b/nscd-logrotate new file mode 100644 index 0000000..a74f4a4 --- /dev/null +++ b/nscd-logrotate @@ -0,0 +1,8 @@ +/var/log/nscd/nscd.log { + weekly + rotate 5 + copytruncate + compress + notifempty + missingok +}