mirror of https://github.com/YosysHQ/yosys.git
feat: bundle shared library deps and set RPATH in release tarball
Copies all non-system shared library dependencies into lib/, then uses patchelf to set RPATH to $ORIGIN/../lib for bin/ executables and $ORIGIN for lib/ libraries. Made-with: Cursor
This commit is contained in:
parent
944d0b370a
commit
df261f46e3
|
|
@ -34,7 +34,7 @@ jobs:
|
|||
tcl-dev readline-dev zlib-dev libffi-dev \
|
||||
libdwarf-dev elfutils-dev \
|
||||
python3 python3-dev py3-pip py3-setuptools py3-wheel \
|
||||
git pkgconf ccache
|
||||
git pkgconf ccache patchelf
|
||||
|
||||
git config --global --add safe.directory /src
|
||||
git submodule foreach --recursive git config --global --add safe.directory \$toplevel/\$sm_path
|
||||
|
|
@ -58,6 +58,33 @@ jobs:
|
|||
make clean
|
||||
make -j$(nproc) SMALL=1 ENABLE_PLUGINS=0 ENABLE_TCL=1 ENABLE_READLINE=1 PREFIX=/usr/local
|
||||
make DESTDIR=/tmp/install PREFIX=/usr/local install
|
||||
|
||||
# Bundle shared library dependencies and set RPATHs
|
||||
STAGE=/tmp/install/usr/local
|
||||
mkdir -p "$STAGE/lib"
|
||||
|
||||
copy_deps() {
|
||||
for f in "$@"; do
|
||||
[ -f "$f" ] || continue
|
||||
ldd "$f" 2>/dev/null | awk "/=>/ {print \$3}" | while read -r lib; do
|
||||
[ -f "$lib" ] || continue
|
||||
base=$(basename "$lib")
|
||||
case "$base" in ld-musl-*|libc.musl-*) continue ;; esac
|
||||
[ -f "$STAGE/lib/$base" ] || cp "$lib" "$STAGE/lib/$base"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
copy_deps "$STAGE"/bin/*
|
||||
copy_deps "$STAGE"/lib/*.so*
|
||||
|
||||
for f in "$STAGE"/bin/*; do
|
||||
[ -f "$f" ] && patchelf --set-rpath "\$ORIGIN/../lib" "$f" 2>/dev/null || true
|
||||
done
|
||||
for f in "$STAGE"/lib/*.so*; do
|
||||
[ -f "$f" ] && patchelf --set-rpath "\$ORIGIN" "$f" 2>/dev/null || true
|
||||
done
|
||||
|
||||
cd /tmp/install
|
||||
tar czf /src/yosys-anylinux-amd64.tar.gz .
|
||||
'
|
||||
|
|
|
|||
Loading…
Reference in New Issue