[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Adding runtime dependencies that aren't caught by shlibs:Depends

* Jens Reyer <jre.winesim@gmail.com>, 2016-05-27, 20:17:
I think I have it working now in wine to automatically generate a list of runtime dependencies. I based it on Jakub's suggestions, however I didn't go for creating a "dependency binary".

For one I did get results this way, but unfortunately I neither really know python nor perl which is usually used in wine packaging, in order to cleanly implement it there.

I've attached shell implementation of SONAMEs-to-ELF converter.

sonames=$(shell grep  "^\#define SONAME_" include/config.h | cut -d\" -f2)
paths=/usr /usr/lib /lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH) /usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
dlopenRecommends=$(shell \
   for soname in $(sonames); do \
   for path in $(paths); do \
       file=$$(echo $$path/$$soname | sed "s|//|/|g"); \
       [ -f $$file ] && dpkg -S $$file | cut -d: -f1 | sed "s/\\(.*\\) */\\1,/" && break || true; \
       done; \

The problem with $(shell) constructs is that they ignore errors. Please avoid putting complicated code in them.

Jakub Wilk
set -e -u
if [ $# = 0 ] || tty <&1 >/dev/null
    printf 'Usage: %s SONAME... > ELF\n' "$0"
    exit 1
tmpdir=$(mktemp -d -t sonames2elf.XXXXXX)
cd "$tmpdir"
printf 'INPUT(%s)\n' "$@" > libeverything.so
gcc -shared -nostdlib -Wl,--no-as-needed -L. -leverything -o elf
cat elf
rm -rf "$tmpdir"

Reply to: