From 88845b72ee29e231d9713367cbeebe42ff636af2 Mon Sep 17 00:00:00 2001 From: "Dongkyun, Son" Date: Thu, 25 Aug 2016 19:48:25 +0900 Subject: [PATCH] packaging: add packaging Signed-off-by: Dongkyun, Son --- packaging/baselibs.conf | 23 ++ packaging/bindresvport.blacklist | 14 + packaging/glibc.changes | 24 ++ packaging/glibc.manifest | 8 + packaging/glibc.rpmlintrc | 25 ++ packaging/glibc_post_upgrade.c | 348 +++++++++++++++++++ packaging/linaro-glibc.spec | 717 +++++++++++++++++++++++++++++++++++++++ packaging/nsswitch.conf | 47 +++ 8 files changed, 1206 insertions(+) create mode 100644 packaging/baselibs.conf create mode 100644 packaging/bindresvport.blacklist create mode 100644 packaging/glibc.changes create mode 100644 packaging/glibc.manifest create mode 100644 packaging/glibc.rpmlintrc create mode 100644 packaging/glibc_post_upgrade.c create mode 100755 packaging/linaro-glibc.spec create mode 100644 packaging/nsswitch.conf diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..dbf1ea9 --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,23 @@ +glibc + arch i586 block! + targettype x86 +/etc/ld.so.conf + targettype x86 "/lib/ld-linux.so.2 -> /lib/ld-linux.so.2" + targettype x86 obsoletes "baselibs-x86" + targettype ia32 +/etc/ld.so.conf + targettype ia32 "/lib/ld-linux.so.2 -> /lib/ld-linux.so.2" + prereq -glibc-x86 + +/usr/lib/getconf/[^g] +glibc-locale + arch i586 block! + +/usr/lib(64)?/gconv/gconv-modules + targettype x86 -/usr/lib(64)?/gconv/gconv-modules +glibc-devel + requires "glibc- = %version" + arch i586 block! + +^/usr/include/gnu/stubs-.*\.h$ +glibc-devel-static + arch i586 block! +glibc-profile + arch i586 block! +glibc-utils + arch i586 block! diff --git a/packaging/bindresvport.blacklist b/packaging/bindresvport.blacklist new file mode 100644 index 0000000..6fc9730 --- /dev/null +++ b/packaging/bindresvport.blacklist @@ -0,0 +1,14 @@ +# +# This file contains a list of port numbers between 600 and 1024, +# which should not be used by bindresvport. bindresvport is mostly +# called by RPC services. This mostly solves the problem, that a +# RPC service uses a well known port of another service. +# +623 # ASF, used by IPMI on some cards +631 # cups +636 # ldaps +664 # Secure ASF, used by IPMI on some cards +774 # rpasswd +921 # lwresd +993 # imaps +995 # pops diff --git a/packaging/glibc.changes b/packaging/glibc.changes new file mode 100644 index 0000000..daa2c29 --- /dev/null +++ b/packaging/glibc.changes @@ -0,0 +1,24 @@ +* Tue Sep 09 2014 Chanho Park upstream/2.20-26-g1a827dc +- Update to 2.20 + +* Tue Oct 15 2013 Jacek Bukarewicz accepted/tizen/20130912.200215@1ee152e +- Subpackage reorganization - devel-utils package + +* Mon Aug 26 2013 Anas Nashif glibc-2.18@e8510fa +- Update to 2.18 + +* Thu Aug 01 2013 Anas Nashif submit/tizen/20130711.122834@23f8266 +- Update package groups + +* Mon Jul 08 2013 Junfeng Dong accepted/tizen/20130520.095530@99d0fc1 +- No ld-linux-armhf.so.3 on armv7l architecture. + +* Fri Mar 22 2013 Anas Nashif submit/trunk/20130115.205551@642c22b +- Fixed package groups + +* Tue Jan 15 2013 Anas Nashif submit/trunk/20130114.165606@6013fa6 +- do not provide /usr/lib/locale + +* Mon Jan 14 2013 Anas Nashif glibc-2.17@fe086f2 +- Update to 2.17 + diff --git a/packaging/glibc.manifest b/packaging/glibc.manifest new file mode 100644 index 0000000..14b2780 --- /dev/null +++ b/packaging/glibc.manifest @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packaging/glibc.rpmlintrc b/packaging/glibc.rpmlintrc new file mode 100644 index 0000000..93f2c63 --- /dev/null +++ b/packaging/glibc.rpmlintrc @@ -0,0 +1,25 @@ +addFilter(".*glibc-profile.* devel-file-in-non-devel-package.*/usr/lib.*/lib.*_p.a") +addFilter(".*glibc.* incorrect-fsf-address") +# False positive - glibc implements gethostbyname +addFilter(".*binary-or-shlib-calls-gethostbyname") +# We do need to keep the symtab (see comments in glibc.spec), so this is intented: +addFilter(".*unstripped-binary-or-object.*") +# The duplication is intented: +addFilter(".*files-duplicate /usr/lib64/libbsd-compat.a /usr/lib.*/libg.a") +# ld.so is special: +addFilter(".*shared-lib-without-dependency-information /lib.*/ld-2.*.so") +# Handled via glibc_post_upgrade: +addFilter(".*permissions-missing-postin missing %set_permissions /usr/.*pt_chown in %post") +# Do not require permissions, this will lead to a cycle (bnc#700925): +addFilter("glibc\..*: permissions-missing-requires") +# We will not rename glibc to follow the shlib policy +addFilter("shlib-policy-missing-suffix") +# The dynamic linker and libnsl call exit - this is fine +addFilter(".*shared-lib-calls-exit.*") +# The man-pages package contains a number of man pages for programs that come +# with glibc, therefore do not warn about them +addFilter(".*glibc.*no-manual-page-for-binary getent") +addFilter(".*glibc.*no-manual-page-for-binary iconv") +addFilter(".*glibc.*no-manual-page-for-binary ldd") +addFilter(".*glibc.*no-manual-page-for-binary ldconfig") +addFilter(".*nscd.*no-manual-page-for-binary nscd") diff --git a/packaging/glibc_post_upgrade.c b/packaging/glibc_post_upgrade.c new file mode 100644 index 0000000..3f3ed82 --- /dev/null +++ b/packaging/glibc_post_upgrade.c @@ -0,0 +1,348 @@ +/* skeleton based on version from Fedora Core 3 */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define verbose_exec(failcode, fail_ok, path...) \ + do \ + { \ + char *const arr[] = { path, NULL }; \ + vexec (failcode, fail_ok, arr); \ + } while (0) + +__attribute__((noinline)) void vexec (int failcode, int fail_ok, char *const path[]); +__attribute__((noinline)) void says (const char *str); +__attribute__((noinline)) void sayn (long num); +__attribute__((noinline)) void message (char *const path[]); +__attribute__((noinline)) int check_elf (const char *name); + +int +main (void) +{ + char initpath[256]; + struct stat root, init_root; + + /* First, get rid of platform-optimized libraries. We remove any we have + ever built, since otherwise we might end up using some old leftover + libraries when new ones aren't installed in their place anymore. */ +#ifdef REMOVE_TLS_DIRS + const char *library[] = {"libc.so.6", "libc.so.6.1", "libm.so.6", + "libm.so.6.1", "librt.so.1", "librtkaio.so.1", + "libpthread.so.0", "libthread_db.so.1"}; + const char *remove_dir[] = { +#ifdef __i386__ + "/lib/i686/", +#endif +#ifdef __powerpc64__ +#ifdef REMOVE_PPC_OPTIMIZE_POWER4 + "/lib64/power4/", + "/lib64/ppc970/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER5 + "/lib64/power5/", + "/lib64/power5+/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER6 + "/lib64/power6/", + "/lib64/power6x/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER7 + "/lib64/power7/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_CELL + "/lib64/ppc-cell-be/", +#endif +#endif /* __powerpc64__ */ +#ifdef __powerpc__ +#ifdef REMOVE_PPC_OPTIMIZE_POWER4 + "/lib/power4/", + "/lib/ppc970/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER5 + "/lib/power5/", + "/lib/power5+/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER6 + "/lib/power6/", + "/lib/power6x/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER7 + "/lib/power7/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_CELL + "/lib/ppc-cell-be/", +#endif +#endif /* __powerpc__ */ + LIBDIR"/tls/" }; + int i, j; + + for (i = 0; i < sizeof (remove_dir) / sizeof (remove_dir[0]); ++i) + for (j = 0; j < sizeof (library) / sizeof (library[0]); j++) + { + char buf[strlen (remove_dir[i]) + strlen (library[j]) + 1]; + char readlink_buf[(strlen (remove_dir[i]) + strlen (library[j])) * 2 + 30]; + ssize_t len; + char *cp; + + cp = stpcpy (buf, remove_dir[i]); + strcpy (cp, library[j]); + /* This file could be a symlink to library-%{version}.so, so check + this and don't remove only the link, but also the library itself. */ + cp = stpcpy (readlink_buf, remove_dir[i]); + if ((len = readlink (buf, cp, (sizeof (readlink_buf) + - (cp - readlink_buf) - 1))) > 0) + { + cp[len] = '\0'; + if (cp[0] != '/') cp = readlink_buf; + unlink (cp); + } + unlink (buf); + } +#endif + + /* If installing bi-arch glibc, rpm sometimes doesn't unpack all files + before running one of the lib's %post scriptlet. /sbin/ldconfig will + then be run by the other arch's %post. */ + if (access ("/sbin/ldconfig", X_OK) == 0) + verbose_exec (110, 0, "/sbin/ldconfig", "/sbin/ldconfig", "-X"); + + if (utimes (GCONV_MODULES_DIR "/gconv-modules.cache", NULL) == 0) + { +#ifndef ICONVCONFIG +#define ICONVCONFIG "/usr/sbin/iconvconfig" +#endif + verbose_exec (113, 0, ICONVCONFIG, "/usr/sbin/iconvconfig", + "-o", GCONV_MODULES_DIR"/gconv-modules.cache", + "--nostdlib", GCONV_MODULES_DIR); + } + + /* Implement %set_permissions %{_libexecdir}/pt_chown. */ + if (access ("/usr/bin/chkstat", X_OK) == 0) + verbose_exec (114, 1, "/usr/bin/chkstat", "/usr/bin/chkstat", + "-n", "--set", "--system", "/usr/lib/pt_chown"); + + /* Check if telinit is available and the init fifo as well. */ + if (access ("/sbin/telinit", X_OK) || access ("/dev/initctl", F_OK)) + _exit (0); + /* Check if we are not inside of some chroot, because we'd just + timeout and leave /etc/initrunlvl. */ + if (readlink ("/proc/1/exe", initpath, 256) <= 0 || + readlink ("/proc/1/root", initpath, 256) <= 0 || + stat ("/proc/1/root", &init_root) < 0 || + stat ("/.buildenv", &init_root) < 0 || /* XEN build */ + stat ("/", &root) < 0 || + init_root.st_dev != root.st_dev || init_root.st_ino != root.st_ino) + _exit (0); + + if (check_elf ("/proc/1/exe")) + verbose_exec (116, 0, "/sbin/telinit", "/sbin/telinit", "u"); + +#if 0 + /* Check if we can safely condrestart sshd. */ + if (access ("/sbin/service", X_OK) == 0 + && access ("/usr/sbin/sshd", X_OK) == 0 + && access ("/bin/bash", X_OK) == 0) + { + if (check_elf ("/usr/sbin/sshd")) + verbose_exec (121, 0, "/sbin/service", "/sbin/service", "sshd", "condrestart"); + } +#endif + + _exit(0); +} + +void +vexec (int failcode, int fail_ok, char *const path[]) +{ + pid_t pid; + int status, save_errno; + + pid = vfork (); + if (pid == 0) + { + execv (path[0], path + 1); + save_errno = errno; + message (path); + says (" exec failed with errno "); + sayn (save_errno); + says ("\n"); + _exit (failcode); + } + else if (pid < 0) + { + save_errno = errno; + message (path); + says (" fork failed with errno "); + sayn (save_errno); + says ("\n"); + _exit (failcode + 1); + } + if (waitpid (0, &status, 0) != pid || !WIFEXITED (status)) + { + message (path); + says (" child terminated abnormally\n"); + _exit (failcode + 2); + } + if (WEXITSTATUS (status)) + { + message (path); + says (" child exited with exit code "); + sayn (WEXITSTATUS (status)); + if (fail_ok) + { + says (" (ignored) \n"); + } + else + { + says ("\n"); + _exit (WEXITSTATUS (status)); + } + } +} + +void +says (const char *str) +{ + write (1, str, strlen (str)); +} + +void +sayn (long num) +{ + char string[sizeof (long) * 3 + 1]; + char *p = string + sizeof (string) - 1; + + *p = '\0'; + if (num == 0) + *--p = '0'; + else + while (num) + { + *--p = '0' + num % 10; + num = num / 10; + } + + says (p); +} + +void +message (char *const path[]) +{ + says ("/usr/sbin/glibc_post_upgrade: While trying to execute "); + says (path[0]); +} + +int +check_elf (const char *name) +{ + /* Play safe, if we can't open or read, assume it might be + ELF for the current arch. */ + int ret = 1; + int fd = open (name, O_RDONLY); + if (fd >= 0) + { + Elf32_Ehdr ehdr; + if (read (fd, &ehdr, offsetof (Elf32_Ehdr, e_version)) + == offsetof (Elf32_Ehdr, e_version)) + { + ret = 0; + if (ehdr.e_ident[EI_CLASS] + == (sizeof (long) == 8 ? ELFCLASS64 : ELFCLASS32)) + { +#if defined __i386__ + ret = ehdr.e_machine == EM_386; +#elif defined __x86_64__ + ret = ehdr.e_machine == EM_X86_64; +#elif defined __ia64__ + ret = ehdr.e_machine == EM_IA_64; +#elif defined __powerpc64__ + ret = ehdr.e_machine == EM_PPC64; +#elif defined __powerpc__ + ret = ehdr.e_machine == EM_PPC; +#elif defined __s390__ || defined __s390x__ + ret = ehdr.e_machine == EM_S390; +#elif defined __x86_64__ + ret = ehdr.e_machine == EM_X86_64; +#elif defined __sparc__ + if (sizeof (long) == 8) + ret = ehdr.e_machine == EM_SPARCV9; + else + ret = (ehdr.e_machine == EM_SPARC + || ehdr.e_machine == EM_SPARC32PLUS); +#else + ret = 1; +#endif + } + } + close (fd); + } + return ret; +} + +#ifdef SMALL_BINARY + +int __libc_multiple_threads __attribute__((nocommon)); +int __libc_enable_asynccancel (void) { return 0; } +void __libc_disable_asynccancel (int x) { } +void __libc_csu_init (void) { } +void __libc_csu_fini (void) { } +pid_t __fork (void) { return -1; } +char thr_buf[65536]; + +#ifndef __powerpc__ +int +__libc_start_main (int (*main) (void), int argc, char **argv, + void (*init) (void), void (*fini) (void), + void (*rtld_fini) (void), void * stack_end) +#else +struct startup_info +{ + void *sda_base; + int (*main) (int, char **, char **, void *); + int (*init) (int, char **, char **, void *); + void (*fini) (void); +}; + +int +__libc_start_main (int argc, char **ubp_av, char **ubp_ev, + void *auxvec, void (*rtld_fini) (void), + struct startup_info *stinfo, + char **stack_on_entry) +#endif +{ +#if defined __ia64__ || defined __powerpc64__ + register void *r13 __asm ("r13") = thr_buf + 32768; + __asm ("" : : "r" (r13)); +#elif defined __sparc__ + register void *g6 __asm ("g6") = thr_buf + 32768; +# ifdef __arch64__ + __thread_self = thr_buf + 32768; +# else + register void *__thread_self __asm ("g7") = thr_buf + 32768; +# endif + __asm ("" : : "r" (g6), "r" (__thread_self)); +#elif defined __s390__ && !defined __s390x__ + __asm ("sar %%a0,%0" : : "d" (thr_buf + 32768)); +#elif defined __s390x__ + __asm ("sar %%a1,%0; srlg 0,%0,32; sar %%a0,0" : : "d" (thr_buf + 32768) : "0"); +#elif defined __powerpc__ && !defined __powerpc64__ + register void *r2 __asm ("r2") = thr_buf + 32768; + __asm ("" : : "r" (r2)); +#endif + main(); + return 0; +} + +#endif diff --git a/packaging/linaro-glibc.spec b/packaging/linaro-glibc.spec new file mode 100755 index 0000000..db3f5c7 --- /dev/null +++ b/packaging/linaro-glibc.spec @@ -0,0 +1,717 @@ +# +# spec file for package glibc +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# This will avoid building some parts of glibc +%bcond_with fast_build + +Name: glibc +Summary: Standard Shared Libraries (from the GNU C Library) +License: LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Base/Libraries +BuildRequires: fdupes +BuildRequires: makeinfo +BuildRequires: xz +BuildRequires: gcc-c++ +BuildRequires: gettext-tools +BuildRequires: libstdc++-devel +#BuildRequires: pkgconfig(systemd) + +%define _filter_GLIBC_PRIVATE 1 +%if %_target_cpu == "i686" +# For i686 let's only build what's different from i586, so +# no need to build documentation +%define build_profile 1 +%define build_locales 0 +%define build_html 0 +%else +%if %{with fast_build} +%define build_profile 0 +%define build_locales 0 +%define build_html 0 +%else +# Default: +%define build_profile 1 +%define build_locales 0 +%define build_html 1 +%endif +%endif + +%define disable_assert 0 +%define enable_stackguard_randomization 1 + + +%ifarch x86_64 +%define enablekernel 2.6.16 +%else +%define enablekernel 2.6.16 +%endif +Conflicts: kernel < %{enablekernel} +%ifarch armv7l armv7hl +# The old runtime linker link gets not provided by rpm find.provides, but it exists +Provides: ld-linux.so.3 +Provides: ld-linux.so.3(GLIBC_2.4) +%endif +Version: 2.24 +Release: 0 +%define glibc_major_version 2.24 +%define git_id 4e42b5b8f89f + +Url: http://www.gnu.org/software/libc/libc.html +Source: glibc-%{version}.tar.xz +Source5: nsswitch.conf +Source7: bindresvport.blacklist +Source8: glibc_post_upgrade.c +Source9: glibc.rpmlintrc +Source10: baselibs.conf +# For systemd +Source1001: glibc.manifest + +Requires(pre): filesystem +Provides: rtld(GNU_HASH) + +%description +The GNU C Library provides the most important standard libraries used +by nearly all programs: the standard C library, the standard math +library, and the POSIX thread library. A system is not functional +without these libraries. + +%package info +Summary: Info Files for the GNU C Library +License: GFDL-1.1 +Group: Documentation +BuildArch: noarch + +%description info +This package contains the documentation for the GNU C library stored as +info files. Due to a lack of resources, this documentation is not +complete and is partially out of date. + +%package html +Summary: HTML Documentation for the GNU C Library +License: GFDL-1.1 +Group: Documentation +BuildArch: noarch + +%description html +This package contains the HTML documentation for the GNU C library. Due +to a lack of resources, this documentation is not complete and is +partially out of date. + +%package i18ndata +Summary: Database Sources for 'locale' +License: GPL-2.0+ and MIT +Group: Base/Libraries +BuildArch: noarch + +%description i18ndata +This package contains the data needed to build the locale data files to +use the internationalization features of the GNU libc. It is normally +not necessary to install this packages, the data files are already +created. + +%package locale +Summary: Locale Data for Localized Programs +License: GPL-2.0+ and MIT and LGPL-2.1+ +Requires(post): /usr/bin/cat +Requires: glibc = %{version} + +%description locale +Locale data for the internationalisation features of the GNU C library. + +%package profile +Summary: Libc Profiling and Debugging Versions +License: LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Base/Utilities +Requires: glibc = %{version} + +%description profile +This package contains special versions of the GNU C library which are +necessary for profiling and debugging. + +%package devel +Summary: Include Files and Libraries Mandatory for Development +License: BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Requires: glibc = %{version} +Requires: linux-kernel-headers + +%description devel +These libraries are needed to develop programs which use the standard C +library. + +%package devel-static +Summary: C library static libraries for -static linking +License: BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Requires: %{name}-devel = %{version} +# Provide Fedora name for package to make packaging easier +Provides: %{name}-static = %version + +%description devel-static +The glibc-devel-static package contains the C library static libraries +for -static linking. You don't need these, unless you link statically, +which is highly discouraged. + +%package devel-utils +Summary: Development utilities from GNU C library +License: LGPL-2.1+ +Requires: glibc = %{version} + +%description devel-utils +The glibc-devel-utils package contains various binaries which can be helpful during program +debugging. + +If you are unsure if you need this, don't install this package. + +%package extra +Summary: Extra binaries from GNU C Library +License: LGPL-2.1+ +Requires: glibc = %{version} + +%description extra +The glibc-extra package contains some extra binaries for glibc that +are not essential but recommend to use. + +makedb: A program to create a database for nss + +%package obsolete +Summary: Obsolete Shared Libraries from the GNU C Library +License: LGPL-2.0+ +Requires: glibc = %{version} + +%description obsolete +This package provides some old libraries from the GNU C Library which +are no longer supported. Additional it provides a compatibility library +for old binaries linked against glibc 2.0. + +Install this package if you need one of this libraries to get old +binaries working, but since this libraries are not supported and there +is no gurantee that they work for you, you should try to get newer +versions of your software. + +%prep +%setup -n glibc-%{version} -q +cp %{SOURCE1001} . + +%build +if [ -x /bin/uname.bin ]; then + /bin/uname.bin -a +else + uname -a +fi +uptime || : +ulimit -a +nice +# We do not want configure to figure out the system its building one +# to support a common ground and thus set build and host to the +# target_cpu. +%ifarch %arm +%define target %{_target_cpu}-tizen-linux-gnueabi +%else +%define target %{_target_cpu}-tizen-linux +%endif +# Don't use as-needed, it breaks glibc assumptions +# Before enabling it, run the testsuite and verify that it +# passes completely +export LD_AS_NEEDED=0 +# Adjust glibc version.h +echo "#define CONFHOST \"%{target}\"" >> version.h +echo "#define GITID \"%{git_id}\"" >> version.h +# +# Default CFLAGS and Compiler +# +BuildFlags=$(echo %{optflags} | sed -e "s/-Wp,-D_FORTIFY_SOURCE=2//g" | sed -e "s/-ffast-math//" | sed -e "s/atom/i686/g" | sed -e "s/-fexceptions//" ) +BuildFlags="$BuildFlags -O2 -g -U_FORTIFY_SOURCE" +BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')" +BuildFlags="$(echo $BuildFlags | sed -e 's/-Wa,-mimplicit-it=thumb//g' | sed -e 's/-mthumb//g')" +BuildCC="%__cc" +BuildCCplus="%__cxx" +add_ons=",libidn" + + +BuildFlags="$BuildFlags -g" +%if %{disable_assert} + BuildFlags="$BuildFlags -DNDEBUG=1" +%endif +%ifarch %ix86 + add_ons=$add_ons +%endif +%ifarch %arm aarch64 + add_ons=$add_ons +%endif +%ifarch mipsel + # fails to build otherwise - need to recheck and fix + %define enable_stackguard_randomization 0 +%endif + +configure_and_build_glibc() { + local dirname="$1"; shift + local cflags="$1"; shift + local addons="$1"; shift + mkdir "cc-$dirname" + cd "cc-$dirname" + conf_cflags="$cflags -funwind-tables" + + profile="--disable-profile" +%if %{build_profile} + if [ "$dirname" = "base" ] ; then + profile="--enable-profile" + fi +%endif + CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ + CC="$BuildCC" CXX="$BuildCCplus" ../configure \ + --prefix=%{_prefix} \ + --libexecdir=%{_libexecdir} --infodir=%{_infodir} \ + --enable-add-ons=$addons \ + $profile \ + "$@" \ +%if %{enable_stackguard_randomization} + --enable-stackguard-randomization \ +%endif + --build=%{target} --host=%{target} \ +%ifarch %{ix86} x86_64 + --enable-multi-arch \ +%endif + --enable-kernel=%{enablekernel} \ + --enable-bind-now --enable-obsolete-rpc \ + --disable-nscd + # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) + make %{?_smp_mflags} #CFLAGS="$cflags" BUILD_CFLAGS="$cflags" + cd .. +} + + # + # Build base glibc + # + configure_and_build_glibc base "$BuildFlags" "$add_ons" + +# +# Build html documentation +# +%if %{build_html} +make -C cc-base html +%endif + +# +# Build glibc_post_upgrade binary +# +$BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \ + -Lcc-base -Bcc-base/csu \ + '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \ + '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"' + + +####################################################################### +### +### CHECK +### +####################################################################### + +%check +# The testsuite will fail if asneeded is used +export LD_AS_NEEDED=0 +# This has to pass on all platforms! +# Exceptions: +# None! +make %{?_smp_mflags} -C cc-base check-abi + +####################################################################### +### +### INSTALL +### +####################################################################### + +%install +# We don't want to strip the .symtab from our libraries in find-debuginfo.sh, +# certainly not from libpthread.so.* because it is used by libthread_db to find +# some non-exported symbols in order to detect if threading support +# should be enabled. These symbols are _not_ exported, and we can't easily +# export them retroactively without changing the ABI. So we have to +# continue to "export" them via .symtab, instead of .dynsym :-( +# But we also want to keep .symtab and .strtab of other libraries since some +# debugging tools currently require these sections directly inside the main +# files - specifically valgrind and PurifyPlus. +export STRIP_KEEP_SYMTAB=*.so* + +# Make sure we will create the gconv-modules.cache +mkdir -p %{buildroot}%{_libdir}/gconv +touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache + +# Install base glibc +make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base + +install_optimized_variant() { + local dirname="$1"; shift + local subdir="$1"; shift + local subdir_up="$1"; shift + +cd "cc-$dirname" +destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir +mkdir -p $destdir +# Don't run a complete make install, we know which libraries +# we want +for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db +do + libbase=${lib#*/} + libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so) + # Only install if different from base lib + if cmp -s ${lib}.so ../cc-base/${lib}.so; then + ln -sf $subdir_up/$libbaseso $destdir/$libbaseso + else + cp -a ${lib}.so $destdir/$libbaseso + fi + # Emulate ldconfig + ln -sf $libbaseso $destdir/$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}.so.*) +done +cd .. +} + + +# Install locales +%if %{build_locales} + # XXX Do not install locales in parallel! + cd cc-base + # localedef creates hardlinks to other locales if possible + # this will not work if we generate them in parallel. + # thus we need to run fdupes on /usr/lib/locale/ + # Still, on my system this is a speed advantage: + # non-parallel build for install-locales: 9:34mins + # parallel build with fdupes: 7:08mins + make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales + %fdupes %{buildroot}/usr/lib/locale + cd .. +%endif +# Create file list for glibc-locale package +%{find_lang} libc + +# Prepare obsolete/, used only on some architectures: +export RPM_BUILD_ROOT +%ifarch %ix86 +mkdir -p %{buildroot}/%{_lib}/obsolete +%endif + +# NPTL is not usable outside of glibc, so include +# the generic one (RH#162634) +cp -av bits/stdio-lock.h %{buildroot}%{_includedir}/bits/stdio-lock.h + + +# Miscelanna: + +install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} + +install -m 644 %{SOURCE7} %{buildroot}/etc +install -m 644 %{SOURCE5} %{buildroot}/etc +install -m 644 posix/gai.conf %{buildroot}/etc + +mkdir -p %{buildroot}/etc/default +install -m 644 nis/nss %{buildroot}/etc/default/ + +mkdir -p %{buildroot}%{_includedir}/resolv +install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/ +install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/ + +%if %{build_html} +mkdir -p %{buildroot}%{_datadir}/doc/glibc +cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc +%endif + + +# +# Create ld.so.conf +# +cat > %{buildroot}/etc/ld.so.conf <>"$l" + cat "$l.d"/* >>"$l" +done +/usr/sbin/iconvconfig + +%post info +%install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%postun info +%install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%files +%manifest %{name}.manifest +# glibc +%defattr(-,root,root) +%license LICENSES +%config(noreplace) /etc/bindresvport.blacklist +%config /etc/ld.so.conf +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache +%config(noreplace) /etc/rpc +%verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf +%verify(not md5 size mtime) %config(noreplace) /etc/gai.conf +%config(noreplace) /etc/default/nss +/%{_lib}/ld-%{glibc_major_version}.so + +# Each architecture has a different name for the dynamic linker: +%ifarch %arm +%ifarch armv7hl +/%{_lib}/ld-linux-armhf.so.3 +# Keep compatibility link +/%{_lib}/ld-linux.so.3 +%else +/%{_lib}/ld-linux.so.3 +%endif +%endif +%ifarch x86_64 +/%{_lib}/ld-linux-x86-64.so.2 +%endif +%ifarch %ix86 %sparc +/%{_lib}/ld-linux.so.2 +%endif +%ifarch aarch64 +/lib/ld-linux-aarch64.so.1 +/%{_lib}/ld-linux-aarch64.so.1 +%endif + +/%{_lib}/libanl-%{glibc_major_version}.so +/%{_lib}/libanl.so.1 +/%{_lib}/libc-%{glibc_major_version}.so +/%{_lib}/libc.so.6* +/%{_lib}/libcidn-%{glibc_major_version}.so +/%{_lib}/libcidn.so.1 +/%{_lib}/libcrypt-%{glibc_major_version}.so +/%{_lib}/libcrypt.so.1 +/%{_lib}/libdl-%{glibc_major_version}.so +/%{_lib}/libdl.so.2* +/%{_lib}/libm-%{glibc_major_version}.so +/%{_lib}/libm.so.6* +/%{_lib}/libnsl-%{glibc_major_version}.so +/%{_lib}/libnsl.so.1 +/%{_lib}/libnss_compat-%{glibc_major_version}.so +/%{_lib}/libnss_compat.so.2 +/%{_lib}/libnss_db-%{glibc_major_version}.so +/%{_lib}/libnss_db.so.2 +/%{_lib}/libnss_dns-%{glibc_major_version}.so +/%{_lib}/libnss_dns.so.2 +/%{_lib}/libnss_files-%{glibc_major_version}.so +/%{_lib}/libnss_files.so.2 +/%{_lib}/libnss_hesiod-%{glibc_major_version}.so +/%{_lib}/libnss_hesiod.so.2 +/%{_lib}/libnss_nis-%{glibc_major_version}.so +/%{_lib}/libnss_nis.so.2 +/%{_lib}/libnss_nisplus-%{glibc_major_version}.so +/%{_lib}/libnss_nisplus.so.2 +/%{_lib}/libpthread-%{glibc_major_version}.so +/%{_lib}/libpthread.so.0 +/%{_lib}/libthread_db-1.0.so +/%{_lib}/libthread_db.so.1 +/%{_lib}/libresolv-%{glibc_major_version}.so +/%{_lib}/libresolv.so.2 +/%{_lib}/librt-%{glibc_major_version}.so +/%{_lib}/librt.so.1 +/%{_lib}/libutil-%{glibc_major_version}.so +/%{_lib}/libutil.so.1 +%define optimized_libs() \ + %dir %attr(0755,root,root) /%{_lib}/%1\ + /%{_lib}/%1/libc-%{glibc_major_version}.so\ + /%{_lib}/%1/libc.so.6*\ + /%{_lib}/%1/libm-%{glibc_major_version}.so\ + /%{_lib}/%1/libm.so.6*\ + /%{_lib}/%1/libpthread-%{glibc_major_version}.so\ + /%{_lib}/%1/libpthread.so.0\ + /%{_lib}/%1/librt-%{glibc_major_version}.so\ + /%{_lib}/%1/librt.so.1\ + /%{_lib}/%1/libthread_db-1.0.so\ + /%{_lib}/%1/libthread_db.so.1 + +%dir %attr(0700,root,root) /var/cache/ldconfig +/sbin/ldconfig +%{_bindir}/gencat +%{_bindir}/getconf +%{_bindir}/getent +%{_bindir}/iconv +%attr(755,root,root) %{_bindir}/ldd +%ifarch %ix86 sparc sparcv9 + %{_bindir}/lddlibc4 +%endif +%{_bindir}/locale +%{_bindir}/localedef +%dir %attr(0755,root,root) %{_libexecdir}/getconf +%{_libexecdir}/getconf/* +%{_sbindir}/glibc_post_upgrade +%{_sbindir}/iconvconfig +/%{_lib}/libBrokenLocale-%{glibc_major_version}.so +/%{_lib}/libBrokenLocale.so.1 + +%ifarch %ix86 + +%files obsolete +%manifest %{name}.manifest +%defattr (755,root,root,755) +%dir /%{_lib}/obsolete/ + #%dir /%{_lib}/obsolete/noversion + #/%{_lib}/obsolete/noversion/libNoVersion-%{glibc_major_version}.so + #/%{_lib}/obsolete/noversion/libNoVersion.so.1 +%endif + +%files locale -f libc.lang +%manifest %{name}.manifest +%defattr(-,root,root) +%{_datadir}/locale/locale.alias +%if %{build_locales} +/usr/lib/locale/* +%endif +%{_libdir}/gconv + +%files devel +%manifest %{name}.manifest +%defattr(-,root,root) +%license COPYING COPYING.LIB +%doc NEWS README BUGS CONFORMANCE +%{_bindir}/rpcgen +%{_includedir}/* +%{_libdir}/*.o +%{_libdir}/*.so +# These static libraries are needed even for shared builds +%{_libdir}/libc_nonshared.a +%{_libdir}/libg.a +%{_libdir}/libieee.a +%ifarch ppc ppc64 s390 s390x sparc sparcv8 sparcv9 sparcv9v +# This is not built on sparc64. + %{_libdir}/libnldbl_nonshared.a +%endif +%{_libdir}/libmcheck.a +%{_libdir}/libpthread_nonshared.a +%{_libdir}/librpcsvc.a + +%files devel-static +%manifest %{name}.manifest +%defattr(-,root,root) +%{_libdir}/libBrokenLocale.a +%{_libdir}/libanl.a +%{_libdir}/libc.a +%{_libdir}/libcrypt.a +%{_libdir}/libdl.a +%{_libdir}/libm.a +%{_libdir}/libnsl.a +%{_libdir}/libpthread.a +%{_libdir}/libresolv.a +%{_libdir}/librt.a +%{_libdir}/libutil.a + +%files info +%manifest %{name}.manifest +%defattr(-,root,root) +%doc %{_infodir}/libc.info.gz +%doc %{_infodir}/libc.info-?.gz +%doc %{_infodir}/libc.info-??.gz + +%if %{build_html} +%files html +%manifest %{name}.manifest +%defattr(-,root,root) +%doc %{_prefix}/share/doc/glibc +%endif + +%files i18ndata +%manifest %{name}.manifest +%defattr(-,root,root) +%{_prefix}/share/i18n + +%if %{build_profile} +%files profile +%manifest %{name}.manifest +%defattr(-,root,root) +%{_libdir}/libc_p.a +%{_libdir}/libBrokenLocale_p.a +%{_libdir}/libanl_p.a +%{_libdir}/libm_p.a +%{_libdir}/libcrypt_p.a +%{_libdir}/libpthread_p.a +%{_libdir}/libresolv_p.a +%{_libdir}/libnsl_p.a +%{_libdir}/librt_p.a +%{_libdir}/librpcsvc_p.a +%{_libdir}/libutil_p.a +%{_libdir}/libdl_p.a +%endif + +%files devel-utils +%manifest %{name}.manifest +%defattr(-,root,root) +/%{_lib}/libmemusage.so +/%{_lib}/libpcprofile.so +/%{_libdir}/libBrokenLocale.so +/%{_lib}/libSegFault.so +/%{_lib}/libthread_db-1.0.so +/%{_lib}/libthread_db.so.1 +/%{_libdir}/libthread_db.so +%dir /%{_libdir}/audit +/%{_libdir}/audit/sotruss-lib.so +# These need gd-devel for building +# %%{_bindir}/memusage +# %%{_bindir}/memusagestat +%{_bindir}/mtrace +%{_bindir}/pcprofiledump +%{_bindir}/sotruss +%{_bindir}/xtrace +%{_bindir}/pldd +%{_bindir}/catchsegv +%{_bindir}/sprof + +%files extra +%manifest %{name}.manifest +%defattr(-,root,root) +%{_bindir}/makedb +/var/db/Makefile + + +%docs_package diff --git a/packaging/nsswitch.conf b/packaging/nsswitch.conf new file mode 100644 index 0000000..0062365 --- /dev/null +++ b/packaging/nsswitch.conf @@ -0,0 +1,47 @@ +# +# /etc/nsswitch.conf +# +# An example Name Service Switch config file. This file should be +# sorted with the most-used services at the beginning. +# +# The entry '[NOTFOUND=return]' means that the search for an +# entry should stop if the search in the previous entry turned +# up nothing. Note that if the search failed due to some other reason +# (like no NIS server responding) then the search continues with the +# next entry. +# +# Legal entries are: +# +# compat Use compatibility setup +# nisplus Use NIS+ (NIS version 3) +# nis Use NIS (NIS version 2), also called YP +# dns Use DNS (Domain Name Service) +# files Use the local files +# [NOTFOUND=return] Stop searching if not found so far +# +# For more information, please read the nsswitch.conf.5 manual page. +# + +# passwd: files nis +# shadow: files nis +# group: files nis + +passwd: compat +group: compat + +hosts: files dns +networks: files dns + +services: files +protocols: files +rpc: files +ethers: files +netmasks: files +netgroup: files nis +publickey: files + +bootparams: files +automount: files nis +aliases: files + + -- 2.7.4