On Thu, 27 Nov 2014, Michael Tokarev wrote:

> (The Built-Using field generation is a bit fun here: I asked on IRC
> how people identify which libc is in use, and got various somewhat-
> incpmplete replies (the prob is that on different arches, libc package
> is named differently).  So I invented my own way for busybox, because

You didn’t ask in the #!/bin/mksh channel on IRC (= Freenode) ;-)

So let me add mine:

‣ intimate knowledge of the build system required, so you know
  what precidely is pulled in (reading shlibs:Depends from the
  build of the shared version is almost certainly wrong)

In the mksh case, I have a switch between different libcs to use.
For dietlibc and klibc, the cases are clear:

• libc_pkgname='libklibc-dev linux-libc-dev'

• libc_pkgname=dietlibc-dev

For (e)glibc, or rather, “the default libc”, a little trick:

• x=$(dpkg -S "$(readlink -f "$($CC -print-file-name=libc.a)")")
  libc_pkgname=${x%%: *}

In *all* cases, you also need

• x=$(dpkg -S "$(readlink -f "$($CC -print-file-name=libgcc.a)")")
  libgcc_pkgname=${x%%: *}

Now you need to get from that to the corresponding source packages:

for x in $libc_pkgname $libgcc_pkgname; do
        dpkg-query -Wf '${source:Package} (= ${source:Version})\n' "$x"
done | sort -u | {
        srcpkgnames=
        while IFS= read -r x; do
                test -n "$x" || continue
                test x"$x" = x" (= )" && continue
                echo "Built Using: $x"
                test -z "$srcpkgnames" || srcpkgnames="$srcpkgnames, "
                srcpkgnames=$srcpkgnames$x
        done
        echo "mksh:B-U=$srcpkgnames" >builddir/substvars
}

bye,
//mirabilos
-- 
«MyISAM tables -will- get corrupted eventually. This is a fact of life. »
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database”  ‣‣‣ Please, http://deb.li/mysql and MariaDB, finally die!


--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/alpine.deb.2.11.1411281305150.10...@tglase.lan.tarent.de

Reply via email to