1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit toolchain-funcs multilib-minimal
8 DESCRIPTION="Low-overhead managed string library for C"
9 HOMEPAGE="http://www.and.org/ustr/"
10 SRC_URI="ftp://ftp.and.org/pub/james/ustr/${PV}/${P}.tar.bz2"
12 LICENSE="|| ( BSD-2 MIT LGPL-2 )"
14 KEYWORDS="amd64 ~arm ~arm64 ~mips x86"
15 IUSE="static-libs ustr-import"
17 DOCS=(ChangeLog README README-DEVELOPERS AUTHORS NEWS TODO)
19 MULTILIB_WRAPPED_HEADERS=(
20 /usr/include/ustr-conf.h
21 /usr/include/ustr-conf-debug.h
25 epatch "${FILESDIR}/${P}-gcc_5-check.patch"
26 epatch "${FILESDIR}/${PN}-1.0.4-build-libs.patch"
32 USE_STATIC=$(usex static-libs) \
35 CFLAGS="${CFLAGS} ${CPPFLAGS}" \
36 LDFLAGS="${LDFLAGS}" \
37 prefix="${EPREFIX}/usr" \
38 libdir="${EPREFIX}/usr/$(get_libdir)" \
39 mandir="${EPREFIX}/usr/share/man" \
40 SHRDIR="${EPREFIX}/usr/share/${P}" \
41 DOCSHRDIR="${EPREFIX}/usr/share/doc/${PF}" \
46 multilib_src_configure() {
47 # The included configure tests require execution.
49 # We require vsnprintf everywhere as it's in POSIX.
50 printf '#!/bin/sh\necho 0\n' > autoconf_vsnprintf
51 chmod a+rx autoconf_vsnprintf
53 # Always use stdint.h as it's in POSIX.
54 sed -i '/have_stdint_h=0/s:=0:=1:' Makefile || die
56 # Figure out the size of size_t.
57 printf '#include <sys/types.h>\nint main() { char buf[sizeof(size_t) - 8]; }\n' > sizet_test.c
58 $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -c sizet_test.c 2>/dev/null
59 printf '#!/bin/sh\necho %s\n' $(( $? == 0 )) > autoconf_64b
60 chmod a+rx autoconf_64b
62 # Generate the config file now to avoid bad makefile deps.
66 multilib_src_compile() {
70 multilib_src_install() {
71 _emake DESTDIR="${D}" install
73 if ! use ustr-import ; then
75 "${ED}/usr/bin/ustr-import" \
76 "${ED}/usr/share/man/man1/ustr-import.1" \
77 "${ED}/usr/share/${P}" || die