1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit toolchain-funcs
9 DESCRIPTION="the bind library for interix"
10 HOMEPAGE="https://dev.gentoo.org/~mduft"
15 KEYWORDS="-* ~x86-interix"
22 # scratch together the pieces of the bind installation from all over the
23 # place on different interix systems, and copy the files to the local
24 # prefix installation.
26 if [[ -d /usr/local/bind ]]; then
27 # layout as of vista onwards.
28 local incdir="/usr/local/bind/include"
29 local libdir="/usr/local/lib/bind"
31 # layout of xp and server 2003
32 local incdir="/usr/local/include/bind"
33 local libdir="/usr/local/lib/bind"
35 # windows xp has a silly bug in the installer it seems:
36 [[ -x "${incdir}/sys" ]] || chmod a+x "${incdir}/sys"
39 insinto /usr/include/bind
41 for obj in "${incdir}"/*; do
42 [[ -f "${obj}" ]] && doins "${obj}"
43 [[ -d "${obj}" ]] && doins -r "${obj}"
47 # wrap some symbols for the sake of configure link test. the libbind names
48 # symbols differently than required (some extra underscores), and renames
49 # them through the headers. however this is not enough, if configure checks
50 # don't include header files ... :(
51 $(tc-getCC) -c "${FILESDIR}"/weak.s
53 mkdir "${T}"/link || die "cannot mkdir"
56 # now for the _magic_ part...
57 ar -x "${libdir}/libbind.a"
58 # permissions are _totally_ broken here...
61 # remove the gethostent.o file, since the contained gethostbyname* functions
62 # seem to not work on older interixen, whereas the libc contained versions
63 # do work well enough.
66 # find libdb.a from the system - need the _oold_ one...
70 "/usr/lib/x86/libdb.a" \
71 "/usr/lib/libdb.a"; do
72 if test -f "${mydb}"; then
77 # this needs a _stoneage_ berkeley db, so we really need to take the
78 # systems instead if installing db ourselves. newer db's don't have the
79 # requested symbols (they do support it, but with a different name). Another
80 # option would be to generate wrapper symbols for the things needed, but i'd
81 # rather avoid doing so, since i don't know them all.
82 $(tc-getCC) -shared -Wl,-h,libbind.so.${PV} -o libbind.so.${PV} *.o \
83 ../weak.o "${mydb}" || die "cannot link shared libbind"
85 dolib.so libbind.so.${PV}
87 # to prevent accidental linking during configure tests of packages which are
88 # not prepared for itx-bind, install things in a separate directory.
89 # packages need to explicitly add this and the include directory for this to
91 dosym ../libbind.so.${PV} /usr/lib/bind/libbind.so
92 dosym ../libbind.so.${PV} /usr/lib/bind/libresolv.so # mean, huh? :)