]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/commitdiff
glibc: Fix RUNPATH in gconv libraries
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 21 Mar 2023 18:49:23 +0000 (19:49 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Mar 2023 10:07:42 +0000 (10:07 +0000)
Those libraries uses a special RUNPATH called $ORIGIN which we
do not support in IPFire. So changing this to the directory where
the are installed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
glibc/glibc.nm

index a58a826c8bf4d03a1890ed4bd01202839be58a7b..3b1362d4dadc5425f32e29c0854a0d7f59c79178 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = glibc
 version    = 2.37
-release    = 4
+release    = 5
 
 maintainer = Michael Tremer <michael.tremer@ipfire.org>
 groups     = System/Base
@@ -44,6 +44,7 @@ build
                libcap-devel
                libstdc++-static
                make >= 4.0
+               patchelf
                python3 >= 3.4
                texinfo
        end
@@ -119,6 +120,22 @@ build
 
                # 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