summaryrefslogtreecommitdiff
blob: 0e5bae5e8d593bd3dda2070bf1467b249d245a57 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/metakit/metakit-2.4.9.7-r1.ebuild,v 1.1 2012/06/21 09:07:52 jlec Exp $

EAPI=4

PYTHON_DEPEND="python? 2"
SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="3.* *-jython 2.7-pypy-*"

inherit eutils flag-o-matic multilib python toolchain-funcs

DESCRIPTION="Embedded database library"
HOMEPAGE="http://www.equi4.com/metakit/"
SRC_URI="http://www.equi4.com/pub/mk/${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~ia64 ~ppc ~s390 ~sparc ~x86"
IUSE="python static tcl"

DEPEND="tcl? ( dev-lang/tcl )"
RDEPEND="${DEPEND}"

RESTRICT="test"

pkg_setup() {
	use python && python_pkg_setup
}

src_prepare() {
	epatch "${FILESDIR}/${P}-linking.patch"
}

src_configure() {
	local myconf mycxxflags
	use tcl && myconf+=" --with-tcl=${EPREFIX}/usr/include,${EPREFIX}/usr/$(get_libdir)"
	use static && myconf+=" --disable-shared"
	use static || append-cxxflags -fPIC

	CXXFLAGS="${CXXFLAGS} ${mycxxflags}" unix/configure \
		${myconf} \
		--host=${CHOST} \
		--prefix="${EPREFIX}/usr" \
		--libdir="${EPREFIX}/usr/$(get_libdir)" \
		--infodir="${EPREFIX}/usr/share/info" \
		--mandir="${EPREFIX}/usr/share/man"
}

src_compile() {
	emake SHLIB_LD="$(tc-getCXX) -shared -Wl,-soname,libmk4.so.2.4"

	if use python; then
		python_copy_sources

		building() {
			emake \
				SHLIB_LD="$(tc-getCXX) -shared" \
				pyincludedir="$(python_get_includedir)" \
				PYTHON_LIB="$(python_get_library)" \
				python
		}
		python_execute_function -s building
	fi
}

src_install () {
	default

	mv "${ED}"//usr/$(get_libdir)/libmk4.so{,.2.4}
	dosym libmk4.so.2.4 /usr/$(get_libdir)/libmk4.so.2
	dosym libmk4.so.2.4 /usr/$(get_libdir)/libmk4.so

	if use python; then
		installation() {
			dodir "$(python_get_sitedir)" || return 1
			emake \
				DESTDIR="${D}" \
				pylibdir="$(python_get_sitedir)" \
				install-python
		}
		python_execute_function -s installation
	fi

	dohtml Metakit.html
	dohtml -a html,gif,png,jpg -r doc/*
}

pkg_postinst() {
	if use python; then
		python_mod_optimize metakit.py
	fi
}

pkg_postrm() {
	if use python; then
		python_mod_cleanup metakit.py
	fi
}