summaryrefslogtreecommitdiff
blob: 8dad745b310cfad29cdf03442b3ba730f900982a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

inherit toolchain-funcs

DESCRIPTION="a small hash library written in C"
HOMEPAGE="ftp://ftp.ugh.net.au/pub/unix/libhash/"
SRC_URI="ftp://ftp.ugh.net.au/pub/unix/libhash/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm hppa ppc x86"
IUSE="doc"

DEPEND=""

S=${WORKDIR}/${PN}

src_compile() {
	rm -f Makefile
	$(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} \
		-Wl,-soname,libhash.so -fPIC -shared \
		-o libhash.so hash.c || die ".so failed"
	$(tc-getCC) ${CPPFLAGS} ${CFLAGS} \
		-c -o libhash.a hash.c || die ".a failed"
}

src_test() {
	cd tests
	sed -i '/wrappers.h/d' *.c
	for n in 2 3 ; do
		$(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -I.. -L.. ${n}.c -o ${n} -lhash || die "compile ${n} failed"
		LD_LIBRARY_PATH=.. ./${n} || die "test ${n} failed"
	done
}

src_install() {
	insinto /usr/include
	doins hash.h || die "hash.h"
	dolib.so libhash.so || die "dolib.so"
	dolib.a libhash.a || die "dolib.a"
	doman *.3 || die "doman"
	use doc && dodoc tests/*.c
}