diff --git a/glibc.spec b/glibc.spec index b503ffa..565c71b 100644 --- a/glibc.spec +++ b/glibc.spec @@ -54,7 +54,7 @@ %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} + %define slibdir %{_prefix}/%{_target_platform}/lib %else %define _as as %define _ld ld @@ -64,7 +64,7 @@ %define glibc_libexecdir %{_libexecdir} %define glibc_includedir %{_includedir} %define glibc_target_cpu %{_target_cpu} - %define slibdir /%{_lib} + %define slibdir %{_libdir} %endif %define buildcc %{_target_platform}-gcc %define buildcxx %{_target_platform}-g++ @@ -84,7 +84,7 @@ Name: glibc Version: 2.34 -Release: 1mamba +Release: 4mamba Summary: The GNU libc libraries Group: System/Libraries Vendor: openmamba @@ -116,6 +116,12 @@ Patch17: glibc-2.21-prevent-ehaustion-of-tls-slots.patch Patch18: glibc-2.25-resolv-no-compat.patch License: LGPL ## AUTOBUILDREQ-BEGIN +BuildRequires: libaudit-devel +BuildRequires: libcap-devel +BuildRequires: libgd-devel +BuildRequires: libpng-devel +BuildRequires: libselinux-devel +BuildRequires: libz-devel ## AUTOBUILDREQ-END BuildRequires: libidn-devel BuildRequires: binutils >= 2.13 @@ -177,9 +183,9 @@ Install glibc-devel if you are going to develop programs which will use the stan Summary: GNU libc multilib (lib32) libraries Group: System/Libraries Provides: glibc-multilib-i18ndata -Obsoletes: glibc-multilib-i18ndata +Obsoletes: glibc-multilib-i18ndata < 2.34 Provides: glibc-multilib-utils -Obsoletes: glibc-multilib-utils +Obsoletes: glibc-multilib-utils < 2.34 %description multilib The glibc package contains standard libraries which are used by multiple programs on the system. @@ -192,7 +198,7 @@ Summary: GNU libc multilib (lib32) libraries and files for development Group: Development/Libraries Requires: glibc-multilib = %{?epoch:%epoch:}%{version}-%{release} Provides: glibc-multilib-apidocs -Obsoletes: glibc-multilib-apidocs +Obsoletes: glibc-multilib-apidocs < 2.34 %description multilib-devel The glibc package contains standard libraries which are used by multiple programs on the system. @@ -232,6 +238,7 @@ Group: System/Tools # The dynamic linker supports DT_GNU_HASH Provides: rtld(GNU_HASH) Provides: rtld(GNU_UNIQUE) +Provides: /sbin/ldconfig %description -n ldconfig 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). @@ -270,12 +277,12 @@ Summary: Cross Platform glibc for %{_target_platform} Group: System/Libraries AutoReqProv: no %if "%{?stage2}" -Obsoletes: cross-%{_target_platform}-%{name}-stage1%{?bigendian_append}%{?softfloat_append} +Obsoletes: cross-%{_target_platform}-%{name}-stage1%{?bigendian_append}%{?softfloat_append} <= %{version}-%{release} %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} +Obsoletes: cross-%{_target_platform}-%{name}-stage2%{?bigendian_append}%{?softfloat_append} <= %{version}-%{release} +Obsoletes: cross-%{_target_platform}-%{name}-stage1%{?bigendian_append}%{?softfloat_append} <= %{version}-%{release} %endif %endif @@ -294,7 +301,6 @@ Cross Platform glibc for %{_target_platform}. %setup -q #-D -T #:<< ___EOF - %patch5 -p1 %patch17 -p1 #%patch18 -p1 @@ -425,6 +431,13 @@ export CXXFLAGS="$buildflags" ../%{name}-%{version}/configure \ ${_configure_flags[@]} +echo "slibdir=%{slibdir}" >> configparms +%if "%{_target_platform}" == "%{_host}" +echo "rtlddir=%{_libdir}" >> configparms +echo "sbindir=%{_bindir}" >> configparms +echo "rootsbindir=%{_sbindir}" >> configparms +%endif + %if "%{?stage1}" != "1" # build libraries with fortify disabled echo "build-programs=no" >> configparms @@ -479,7 +492,7 @@ CFLAGS="-mtune=pentiumpro -g -O3 -Wl,--build-id" echo "build-programs=no" >> configparms echo "slibdir=/usr/lib32" >> configparms echo "rtlddir=/usr/lib32" >> configparms - + make %{_smp_mflags} -r %PARALLELMFLAGS=-s %endif @@ -500,7 +513,7 @@ _EOF %if "%{_target_platform}" == "%{_host}" # Multilib %ifarch x86_64 -make install -C ../glibc-multilib-build install_root=%{buildroot} +%makeinstall -C ../glibc-multilib-build cat > %{buildroot}%{_sysconfdir}/ld.so.conf.d/lib32-glibc.conf << _EOF /usr/lib32 _EOF @@ -516,6 +529,10 @@ ln -s ../lib/locale %{buildroot}/usr/lib32/locale mv localedata/SUPPORTED.openmamba localedata/SUPPORTED echo "%{_target_platform} == %{_host}" %if "%{_target_platform}" == "%{_build}" +%ifarch aarch64 + install -d -m0755 %{buildroot}%{_prefix}/lib + ln -s ../lib64/ld-linux-aarch64.so.1 %{buildroot}%{_prefix}/lib/ld-linux-aarch64.so.1 +%endif make localedata/install-locales -C ../glibc-build install_root=%{buildroot} %else # WORKAROUND: worked up to 2.21 @@ -578,8 +595,6 @@ chmod -w %{buildroot}/%{slibdir}/libthread_db*.so.* %endif %endif -rm -f %{buildroot}%{_libdir}/libnsl.* - %if "%{_target_platform}" == "%{_host}" # 2.26: workaround for header required by external libnss_nis install -D -m0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/mapv4v6addr.h @@ -595,13 +610,25 @@ ln -s locale.h %{buildroot}%{_includedir}/xlocale.h %find_lang libc -#install api documentation %if "%{_target_platform}" == "%{_host}" +#install api documentation %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 + +# provide legacy /lib[64] after glibc migration to /usr/lib[64] +install -d -m0755 %{buildroot}%{_sysconfdir}/ld.so.conf.d +%ifarch x86_64 aarch64 +cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/glibc64.conf << __EOF +/%{_lib} +__EOF +%else +cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/glibc.conf << __EOF +/%{_lib} +__EOF +%endif %endif %endif @@ -622,8 +649,125 @@ rm -rf %{buildroot}%{glibc_datadir}/zoneinfo #fi #exit 0 -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig +%post +if [ $1 -ge 1 ]; then + cat > /tmp/migrate-libdirs.sh << _EOF +#!/bin/bash +d=\$1 +echo "Migrating /\$d.notmigrated/* to /usr/\$d..." +for f in \${d}.notmigrated/*; do + dest=/usr\${f/.notmigrated} + if [ -e \$dest ]; then + #echo "\$f exists as \$dest" + if [ -L \$f ]; then + linkdest=\`readlink \$f\` + #echo "\$f is a symlink to \$linkdest" + /usr/bin/rm -f \$f + elif [ -L \$dest ]; then + linkdest=\`readlink \$dest\` + #echo "\$dest is a symlink to \$linkdest" + /usr/bin/rm -f \$dest && mv \$f \$dest + else + #echo "\$f exists as a file also as \$linkdest" + if [ -d \${f} ]; then + # second level + for f1 in \${f}/*; do + dest=/usr\${f1/.notmigrated} + if [ -e \$dest ]; then + #echo "$f1 exists as $dest" + if [ -L \$f1 ]; then + linkdest=\`readlink \$f1\` + #echo "$f1 is a symlink to $linkdest" + /usr/bin/rm -f \$f1 + elif [ -L \$dest ]; then + linkdest=\`readlink \$dest\` + #echo "$dest is a symlink to $linkdest" + /usr/bin/rm -f \$dest && mv \$f1 \$dest + else + /usr/bin/rm -f \$f1 + fi + else + if [ -L \$f1 ]; then + linkdest=\`readlink \$f1\` + if [ "\${linkdest:0:3}" = "../" ]; then + fulllinkdest=\`readlink -f \$f1\` + #echo "$f1 is a symlink pointing to ../ -> fixing" + /usr/bin/ln -s \$fulllinkdest \$dest + /usr/bin/rm -f \$f1 + else + /usr/bin/mv \$f1 \$dest + fi + else + /usr/bin/mv \$f1 \$dest + fi + fi + [ -d \${f1} ] && /usr/bin/rmdir \${f1} + done + /usr/bin/rmdir \${f} + else + /usr/bin/rm -f \$f + fi + fi + else + if [ -L \$f ]; then + linkdest=\`readlink \$f\` + if [ "\${linkdest:0:3}" = "../" ]; then + fulllinkdest=\`readlink -f \$f\` + #echo "\$f is a symlink pointing to ../ -> fixing" + /usr/bin/ln -s \$fulllinkdest \$dest + /usr/bin/rm -f \$f + else + /usr/bin/mv \$f \$dest + fi + else + /usr/bin/mv \$f \$dest + fi + fi +done +/usr/bin/rmdir \${d}.notmigrated +_EOF +chmod +x /tmp/migrate-libdirs.sh +fi +: + +%postun -p /usr/sbin/ldconfig + +# Restore ld-linux loader after removing from /lib[64] to fix /usr/lib[64] migration +%triggerpostun -p -- glibc < 2.34-4mamba +local libdirs = { + [1] = "/lib64", + [2] = "/lib", +} +for i, l in ipairs(libdirs) do + stat_libdir = posix.stat(l) + if stat_libdir ~= nil then + if stat_libdir.mode ~= "rwxrwxrwx" then + -- lib dir exists and is not already a symlink + -- Check that old glibc has been cleaned in this dir (or fails on multilib glibc on x86_64) + stat_check_cleaned = posix.stat(l .. "/libc.so.6") + if stat_check_cleaned == nil then + -- All seems ok to migrate + print("Migrating " .. l .. " to /usr" .. l .. "..") + os.rename(l, l .. ".notmigrated") + posix.symlink("usr" .. l,l) + local pid = posix.fork() + if pid == 0 then + posix.exec("/tmp/migrate-libdirs.sh", l) + elseif pid > 0 then + posix.wait(pid) + end + end + end + end +end + +%transfiletriggerin -n ldconfig -P 2000000 -- /%{_lib} %{_libdir} +/usr/sbin/ldconfig +: + +%transfiletriggerpostun -n ldconfig -P 2000000 -- /%{_lib} %{_libdir} +/usr/sbin/ldconfig +: %pre devel [ -L %{_includedir}/asm ] && rm -f %{_includedir}/asm @@ -699,11 +843,13 @@ fi %if "%{_target_platform}" == "%{_host}" %files %defattr(-,root,root) +%{_sysconfdir}/ld.so.conf.d/glibc*.conf %config(noreplace) %{_sysconfdir}/rpc -%attr(0755,-,-) /%{slibdir}/* +%attr(0755,-,-) /%{slibdir}/lib*.so.* %ifarch aarch64 -/lib/ld-linux-aarch64.so.1 +%{_prefix}/lib/ld-linux-aarch64.so.1 %endif +%{_libdir}/ld-linux*.so.* %exclude %{slibdir}/libmemusage.so %exclude %{slibdir}/libpcprofile.so %dir %{glibc_libdir}/gconv @@ -754,6 +900,7 @@ fi %{_prefix}/lib32/*.o %{_prefix}/lib32/lib*.a %{_prefix}/lib32/lib*.so +#%exclude %{_prefix}/lib32/lib*-%{version}.so %endif %if %{build_doc} @@ -770,12 +917,13 @@ fi %files utils %defattr(-,root,root) -%{_sbindir}/iconvconfig +%{_sbindir}/sln %{_bindir}/catchsegv %{_bindir}/gencat %{_bindir}/getconf %{_bindir}/getent %{_bindir}/iconv +%{_bindir}/iconvconfig %{_bindir}/ldd %ifarch %{ix86} %{_bindir}/lddlibc4 @@ -786,7 +934,6 @@ fi #%{_bindir}/rpcgen %{_bindir}/sprof %{_bindir}/tzselect -/sbin/sln %{_bindir}/mtrace %{_bindir}/pcprofiledump %{_bindir}/sotruss @@ -803,12 +950,9 @@ fi %files -n ldconfig %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 +%{_sbindir}/ldconfig %files -n locales -f libc.lang %defattr(-,root,root) @@ -822,13 +966,13 @@ fi %config(noreplace) %{_sysconfdir}/nscd.conf %{_unitdir}/nscd.service %{_tmpfilesdir}/nscd.conf -%{_sbindir}/nscd +%{_bindir}/nscd %attr(0755,nscd,nscd) /var/log/nscd %files -n timezone %defattr(-,root,root) %{_bindir}/zdump -%{_sbindir}/zic +%{_bindir}/zic %else %files -n cross-%{_target_platform}-%{name}%{?bootstrap_append}%{?bigendian_append}%{?softfloat_append} @@ -846,8 +990,17 @@ fi %endif %changelog -* Sat Aug 14 2021 Silvan Calarco 2.34-1mamba -- update to 2.34 +* Sun Aug 15 2021 Silvan Calarco 2.34-4mamba +- triggerpostun glibc < 2.34-4mamba: lua script to finally migrate /lib[64] to /usr/lib[64] and symlink to them + +* Mon Aug 09 2021 Silvan Calarco 2.34-3mamba +- triggerpostun from glibc 2.33: this time use lua to really fix the lib -> /usr/lib migration + +* Sat Aug 07 2021 Silvan Calarco 2.34-2mamba +- fixes for migration of ld-linux.so.2 from /lib[64] to /usr/lib[64] + +* Fri Aug 06 2021 Automatic Build System 2.34-1mamba +- automatic version update by autodist * Fri Feb 05 2021 Automatic Build System 2.33-1mamba - automatic version update by autodist