Use https by default
[gentoo.git] / sys-libs / itx-bind / itx-bind-0.1-r2.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=2
6
7 inherit toolchain-funcs
8
9 DESCRIPTION="the bind library for interix"
10 HOMEPAGE="https://dev.gentoo.org/~mduft"
11 SRC_URI=""
12
13 LICENSE="ISC BSD-4"
14 SLOT="0"
15 KEYWORDS="-* ~x86-interix"
16 IUSE=""
17
18 DEPEND=""
19 RDEPEND=""
20
21 src_install() {
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.
25
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"
30         else
31                 # layout of xp and server 2003
32                 local incdir="/usr/local/include/bind"
33                 local libdir="/usr/local/lib/bind"
34
35                 # windows xp has a silly bug in the installer it seems:
36                 [[ -x "${incdir}/sys" ]] || chmod a+x "${incdir}/sys"
37         fi
38
39         insinto /usr/include/bind
40
41         for obj in "${incdir}"/*; do
42                 [[ -f "${obj}" ]] && doins    "${obj}"
43                 [[ -d "${obj}" ]] && doins -r "${obj}"
44         done
45
46         cd "${T}"
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
52
53         mkdir "${T}"/link || die "cannot mkdir"
54         cd "${T}"/link
55
56         # now for the _magic_ part...
57         ar -x "${libdir}/libbind.a"
58         # permissions are _totally_ broken here...
59         chmod 666 *.o
60
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.
64         rm gethostent.o
65
66         # find libdb.a from the system - need the _oold_ one...
67         local mydb=
68
69         for mydb in \
70                         "/usr/lib/x86/libdb.a" \
71                         "/usr/lib/libdb.a"; do
72                 if test -f "${mydb}"; then
73                         break
74                 fi
75         done
76
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"
84
85         dolib.so libbind.so.${PV}
86
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
90         # work!
91         dosym ../libbind.so.${PV} /usr/lib/bind/libbind.so
92         dosym ../libbind.so.${PV} /usr/lib/bind/libresolv.so # mean, huh? :)
93 }