###############################################################################
name = glibc
-version = 2.14.1
+version = 2.38
release = 1
maintainer = Michael Tremer <michael.tremer@ipfire.org>
groups = System/Base
-url = http://sources.redhat.com/glibc/
+url = https://www.gnu.org/software/libc/libc.html
license = GPLv2+ LGPLv2+
summary = The GNU libc libraries.
Linux system will not function.
end
-# The version of the ports addon.
-ports_version = %{version}
-
-source_dl = http://ftp.gnu.org/gnu/glibc/
-sources = %{thisapp}.tar.xz glibc-ports-%{ports_version}.tar.xz
+source_dl = https://ftp.gnu.org/gnu/glibc/
+sources = %{thisapp}.tar.xz
build
+ # Build in a separate directory
+ DIR_BUILD = %{DIR_SRC}/glibc-build
+
# Optimize glibc for kernel
- OPTIMIZED_KERNEL = 2.6.32
+ OPTIMIZED_KERNEL = 5.10
requires
- audit-devel
autoconf
automake
+ binutils >= 2.35
+ bison
+ gcc >= 11
gettext
- kernel-headers>=%{OPTIMIZED_KERNEL}
+ kernel-headers >= %{OPTIMIZED_KERNEL}
libcap-devel
- libselinux-devel
- nss-devel
+ libstdc++-static
+ make >= 4.0
+ patchelf
+ python3 >= 3.4
texinfo
end
- # Build glibc with custom cflags
- GLIBC_FLAGS = -O3 -g -fasynchronous-unwind-tables -DNDEBUG -fPIC -DPIC
-
- if "%{DISTRO_ARCH}" == "i686"
- GLIBC_FLAGS += -march=i686 -mtune=generic
- end
-
- if "%{DISTRO_ARCH}" == "x86_64"
- GLIBC_FLAGS += -mtune=generic
- end
+ # Disable LTO
+ LTO_CFLAGS =
- export CFLAGS = %{GLIBC_FLAGS}
- export CXXFLAGS = %{GLIBC_FLAGS}
-
- export QUALITY_AGENT_RPATH_ALLOW_ORIGIN=yes
-
- prepare
- # Extract source tarballs.
- %{MACRO_EXTRACT_TARBALL}
-
- # Create link for ports addon.
- ln -svf ../glibc-ports-%{ports_version} ports
-
- # Apply the patches.
- %{MACRO_PATCHES}
-
- # In the vi_VN.TCVN locale, bash enters an infinite loop at startup. It is
- # unknown whether this is a bash bug or a Glibc problem. Disable
- # installation of this locale in order to avoid the problem.
- sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED
-
- # The ldd shell script contains Bash-specific syntax. Change its default
- # program interpreter to /bin/bash in case another /bin/sh is installed.
- sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
-
- # We don't install pt_chown(1) on the final system, so why install it to
- # $(TOOLS_DIR):
- sed -e "/^install.*pt_chown/d" -i login/Makefile
-
- # Build nscd with -fstack-protector-all, instead of -fstack-protector:
- sed -e "s/fstack-protector/&-all/" -i nscd/Makefile
-
- cat %{DIR_SOURCE}/glibc-stack_chk_fail.c > debug/stack_chk_fail.c
-
- # Use gnu hash style
- sed -i Makeconfig \
- -e "s/-Wl,--hash-style=both/-Wl,--hash-style=gnu -Wl,-O1/"
-
- # stdlib/tst-putenvmod is not linked against libc.
- sed -i stdlib/Makefile \
- -e "s/^CFLAGS-tst-putenvmod.c.*/& -fno-stack-protector/g"
-
- # stdio-common/bug22 hits timeout.
- sed -i stdio-common/bug22.c \
- -e "s/#define TIMEOUT.*/#define TIMEOUT 300/"
-
- # These tests don't work or need more investigation:
- sed -i dlfcn/Makefile -e "s/default //g"
-
- sed -i nptl/Makefile \
- -e "s/tst-mutex5 //g" \
- -e "s/tst-mutex5a //g" \
- -e "s/tst-cond11 //g" \
- -e "s/tst-rwlock6 //g" \
- -e "s/tst-rwlock7 //g" \
- -e "s/tst-sem5 //g" \
- -e "s/tst-cancelx4 //g" \
- -e "s/tst-cancelx5 //g" \
- -e "s/tst-cancelx10 //g" \
- -e "s/tst-cancelx18 //g" \
- -e "s/tst-signal1 //g"
-
- # These are known to fail on x86:
- sed -i rt/Makefile \
- -e "s/tst-cpuclock1 //g" \
- -e "s/tst-cpuclock2 //g"
-
- sed -i elf/Makefile \
- -e "s/tst-tls1 //g" \
- -e "s/tst-tls1-static //g" \
- -e "s/tst-tls2 //g" \
- -e "s/tst-tls2-static //g" \
- -e "s/tst-tls3 //g" \
- -e "s/resolvfail //g" \
- -e "s/constload1 //g" \
- -e "s/order //g" \
- -e "s/lateglobal //g" \
- -e "s/dblload //g" \
- -e "s/dblunload //g" \
- -e "s/reldep6 //g" \
- -e "s/circleload1 //g" \
- -e "s/tst-global1 //g" \
- -e "s/tst-audit2 //g" \
- -e "s/check-localplt //g" \
- -e "s/check-localplt.out$$//g"
-
- sed -i signal/Makefile \
- -e "s/tst-sigset2//g"
- end
+ # Path to put the runtime linker
+ rtlddir = %{libdir}
configure_options = \
--build=%{DISTRO_BUILDTARGET} \
--prefix=/usr \
+ --libdir=%{libdir} \
--libexecdir=%{libdir}/glibc \
- --disable-profile \
- --enable-add-ons \
+ --sbindir=%{sbindir} \
+ --enable-multi-arch \
--enable-kernel=%{OPTIMIZED_KERNEL} \
- --with-selinux \
+ --enable-add-ons \
--disable-werror \
- --enable-experimental-malloc \
+ --disable-profile \
+ --disable-crypt \
+ --enable-fortify-source \
+ --enable-stack-protector=all \
--enable-bind-now \
- --enable-nss-crypt
+ --with-bugurl=https://bugtracker.ipfire.org \
+ --disable-build-nscd \
+ --disable-nscd
- if "%{DISTRO_ARCH}" == "armv5tel"
- # Disable hardware FP for ARM.
+ if "%{DISTRO_ARCH}" == "aarch64"
configure_options += \
- --without-fp
- end
-
- build
- mkdir -p %{DIR_SRC}/glibc-build
- cd %{DIR_SRC}/glibc-build
-
- CFLAGS="${CFLAGS} -fno-asynchronous-unwind-tables" \
- ../%{thisapp}/configure \
- %{configure_options}
+ --enable-memory-tagging
- sed -i config.make \
- -e "s/^build-pic-default=.*/build-pic-default=yes/"
+ # The runtime linker on aarch64 for whatever braindead reason is in /usr/lib
+ rtlddir = %{prefix}/lib
- # Our GCC is already passing -fPIC, and that's all we want for the libraries.
- # LDFLAGS.so is appended to so we don't build shared libraries with
- # DT_TEXTREL (and to tell us if something goes wrong). For now we only build
- # the libraries, not the programs:
- echo "build-programs=no" >> configparms
+ # Runtime Linker
+ rtld = /lib/ld-linux-aarch64.so.1
+ end
- make PARALLELMFLAGS=%{PARALLELISMFLAGS} \
- CFLAGS="%{CFLAGS} -fno-stack-protector -U_FORTIFY_SOURCE" \
- CXXFLAGS="%{CXXFLAGS} -fno-stack-protector -U_FORTIFY_SOURCE"
+ if "%{DISTRO_ARCH}" == "x86_64"
+ configure_options += \
+ --enable-cet
- # Then build the programs with hardening, so everything possible in
- # is hardened:
- echo "# Nothing in here :D" > configparms
- make PARALLELMFLAGS=%{PARALLELISMFLAGS} \
- CFLAGS="%{CFLAGS}" CXXFLAGS="%{CXXFLAGS}"
+ # Runtime Linker
+ rtld = /lib64/ld-linux-x86-64.so.2
end
- #test
- # cd $(DIR_SRC)/glibc-build
- # make check TIMEOUTFACTOR=16 \
- # CFLAGS="%{CFLAGS} -fno-stack-protector -U_FORTIFY_SOURCE" \
- # CXXFLAGS="%{CXXFLAGS} -fno-stack-protector -U_FORTIFY_SOURCE"
- #end
-
install
- cd %{DIR_SRC}/glibc-build
- make install install_root=%{BUILDROOT}
+ # Install everything
+ make install install_root=%{BUILDROOT} \
+ rtlddir=%{rtlddir} rootsbindir=%{sbindir} slibdir=%{libdir}
# Locales
mkdir -pv %{BUILDROOT}/usr/lib/locale
# This would install all locales that are supported
make localedata/install-locales install_root=%{BUILDROOT}
- # Timezone
- cp -v --remove-destination %{BUILDROOT}/usr/share/zoneinfo/GMT \
- %{BUILDROOT}/etc/localtime
- rm -rf %{BUILDROOT}/usr/share/zoneinfo
+ # Install runtime linker configuration
+ install -v -m 644 %{DIR_SOURCE}/ld.so.conf %{BUILDROOT}%{sysconfdir}
+ mkdir -pv %{BUILDROOT}%{sysconfdir}/ld.so.conf.d
- # Configuration
- cp -vf %{DIR_SOURCE}/{ld.so.conf,nsswitch.conf} %{BUILDROOT}/etc
- mkdir -pv %{BUILDROOT}/etc/{default,ld.so.conf.d}
- install -p -m644 %{DIR_APP}/nis/nss %{BUILDROOT}/etc/default/nss
+ # Don't distribute linker cache
+ rm -vf %{BUILDROOT}%{sysconfdir}/ld.so.cache
- # Remove unused binaries
- rm -vf %{BUILDROOT}/sbin/sln \
- %{BUILDROOT}/usr/bin/rpcinfo
+ # Install nsswitch.conf
+ install -v -m 644 %{DIR_SOURCE}/nsswitch.conf %{BUILDROOT}%{sysconfdir}
- # Don't distribute linker cache
- rm -vf %{BUILDROOT}/etc/ld.so.cache
+ # Remove unused statically linked binaries
+ rm -vf %{BUILDROOT}%{sbindir}/sln
# Include /usr/lib/gconv/gconv-modules.cache
> %{BUILDROOT}%{libdir}/gconv/gconv-modules.cache
chmod 644 %{BUILDROOT}%{libdir}/gconv/gconv-modules.cache
- strip -g %{BUILDROOT}%{libdir}/*.o
-
- # Move some libs to correct place
- mv -v %{BUILDROOT}/%{lib}/lib{memusage,pcprofile}.so %{BUILDROOT}%{libdir}
- end
-
- keep_libraries
- %{libdir}/libc_nonshared.a
- %{libdir}/libpthread_nonshared.a
+ # Strip any object files
+ strip --strip-debug %{BUILDROOT}%{libdir}/*.o
+
+ # Some gconv libraries requires other libraries and contain $ORIGIN
+ # as RUNPATH because they are all located in the same directory.
+ # We do not support $ORIGIN as RUNPATH so change this to the directory
+ # where the modules are located.
+ find %{BUILDROOT}%{libdir}/gconv -type f -name "*.so" -exec sh -c '
+ for file do
+ # Obtain the RUNPATH of the module in case it has one set.
+ runpath=$(patchelf --print-rpath ${file} | tr -d '\n')
+
+ # Check if the RUNPATH is $ORIGIN
+ if [ "${runpath}" == "\$ORIGIN" ]; then
+ # Use patchelf to change the RUNPATH
+ patchelf --set-rpath %{libdir}/gconv ${file}
+ fi
+ done ' sh {} +
end
end
packages
package glibc
- requires = glibc-common=%{thisver}
- end
+ # Export the path to the runtime linker which is actually
+ # installed into /usr, but is being searched for elsewhere
+ provides += %{rtld}
- package glibc-common
- # XXX description and summary are missing
+ requires
+ tzdata
+ end
- requires = tzdata
+ conflicts
+ kernel < %{OPTIMIZED_KERNEL}
+ end
- files
- /usr/bin
- /usr/sbin
- /usr/share
- !/usr/share/zoneinfo
+ obsoletes
+ glibc-common < %{thisver}
end
end
package glibc-devel
- summary = Object files for development using standard C libraries.
- description
- The glibc-devel package contains the 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 object files available in order to create the
- executables.
-
- Install glibc-devel if you are going to develop programs which will
- use the standard C libraries.
- end
- group = Development/Libraries
+ template DEVEL
- requires = glibc-headers=%{thisver}
-
- files = %{libdir}/*.a %{libdir}/*.o
- end
-
- package glibc-headers
- description
- The glibc-headers package contains the header 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 files available in order to create the
- executables.
-
- Install glibc-headers if you are going to develop programs which will
- use the standard C libraries.
+ requires
+ glibc = %{thisver}
+ glibc-headers = %{thisver}
+ kernel-headers >= %{OPTIMIZED_KERNEL}
end
- requires = kernel-headers
-
- files
- /usr/include
- !/usr/include/linuxthreads
- !/usr/include/gnu/stubs-[32164]*.h
+ provides
+ glibc-headers = %{thisver}
end
- end
- package nscd
- summary = A Name Service Caching Daemon (nscd).
- description
- Nscd caches name service lookups and can dramatically improve
- performance with NIS+, and may help with DNS as well.
+ obsoletes
+ glibc-headers < %{thisver}
end
- group = System/Daemons
- files
- /usr/sbin/nscd
- end
+ files += %{libdir}/*.[ao]
end
package %{name}-utils
- summary = Development utilities from GNU C library.
+ summary = Development utilities from GNU C library
description
The glibc-utils package contains memusage, a memory usage profiler,
mtrace, a memory leak tracer and xtrace, a function call tracer
which can be helpful during program debugging.
end
- group = Development/Tools
files
- /usr/bin/memusage
- /usr/bin/memusagestat
- /usr/bin/mtrace
- /usr/bin/pcprofiledump
- /usr/bin/xtrace
+ %{bindir}/memusage
+ %{bindir}/memusagestat
+ %{bindir}/mtrace
+ %{bindir}/pcprofiledump
+ %{bindir}/xtrace
%{libdir}/libmemusage.so
%{libdir}/libpcprofile.so
end