ladybird/Ports/libpng/package.sh
Gunnar Beutner 5b69e8d2c6 Ports: Build shared libraries with -Wl,-soname
Without a SONAME gcc will put the whole library path into executables
which link against these libraries:

$ readelf -d Root/usr/local/games/openttd

Dynamic section at offset 0xf0747c contains 32 entries:
 Tag        Type     Name/Value
0x00000001 (NEEDED) [libgcc_s.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/libpng.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/libz.so]
0x00000001 (NEEDED) [/serenity/Build/i686/Root/usr/local/lib/liblzma.so]
0x00000001 (NEEDED) [libSDL2-2.0.so.1]
0x00000001 (NEEDED) [libicui18n.so.69]
0x00000001 (NEEDED) [libicuuc.so.69]
0x00000001 (NEEDED) [libicudata.so.69]
0x00000001 (NEEDED) [libpthread.so]
0x00000001 (NEEDED) [libm.so]
0x00000001 (NEEDED) [libc.so]

This causes the executable to fail because the dynamic linker
tries to find the library in the incorrect path.
2021-04-25 10:14:50 +02:00

15 lines
705 B
Bash
Executable File

#!/usr/bin/env -S bash ../.port_include.sh
port=libpng
version=1.6.37
useconfigure=true
files="https://download.sourceforge.net/libpng/libpng-${version}.tar.gz libpng-${version}.tar.gz 6c7519f6c75939efa0ed3053197abd54"
auth_type=md5
depends="zlib"
install() {
run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install
${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.so -Wl,-soname,libpng16.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.a -Wl,--no-whole-archive -lz
ln -sf libpng16.so ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng.so
rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng16.la ${SERENITY_INSTALL_ROOT}/usr/local/lib/libpng.la
}