Commit | Line | Data |
---|---|---|
d6ce1786 C |
1 | # Copyright 1999-2008 Gentoo Foundation |
2 | # Distributed under the terms of the GNU General Public License v2 | |
3 | # $Header$ | |
4 | ||
5 | EAPI="2" | |
6 | SUPPORT_PYTHON_ABIS="1" | |
7 | ||
8 | inherit findlib python eutils git | |
9 | ||
10 | IUSE="" | |
11 | ||
12 | DESCRIPTION="Bindings for Python and OCaml" | |
13 | HOMEPAGE="http://github.com/chemoelectric/pycaml" | |
14 | SRC_URI="" | |
15 | EGIT_REPO_URI="git://github.com/chemoelectric/pycaml.git" | |
16 | ||
17 | LICENSE="LGPL-2.1" | |
18 | SLOT="0" | |
19 | KEYWORDS="~amd64 ppc x86" | |
20 | ||
21 | RDEPEND=">=dev-ml/ocaml-make-6.29.3" | |
22 | DEPEND=">=dev-lang/ocaml-3.11.1 | |
23 | >=dev-lang/python-2.6.4 | |
24 | ${RDEPEND}" | |
25 | ||
26 | S="${WORKDIR}/${PN}" | |
27 | ||
28 | ||
29 | pkg_setup() { | |
30 | if ! built_with_use --missing true dev-lang/ocaml ocamlopt; then | |
31 | eerror "${PN} needs to be built with native code support from ocaml" | |
32 | eerror "You first need to have a native code ocaml compiler." | |
33 | eerror "You need to install dev-lang/ocaml with ocamlopt useflag on." | |
34 | die "Please install ocaml with ocamlopt useflag" | |
35 | fi | |
36 | } | |
37 | ||
38 | src_compile() { | |
39 | compile_abi_pycaml() { | |
40 | abi=`echo "${PYTHON_ABI}" | sed -e 's/\./_/g'` | |
41 | name="${PN}${abi}" | |
42 | cd "${WORKDIR}" | |
43 | cp -r "${PN}" "${name}" | |
44 | cd "${name}" | |
45 | emake -j1 PYVER="${PYTHON_ABI}" PYVER_PACK="${abi}" \ | |
46 | get_libdir="$(get_libdir)" || die "emake failed" | |
47 | } | |
48 | python_execute_function compile_abi_pycaml | |
49 | ||
50 | compile_pycaml() { | |
51 | cd "${S}" | |
52 | emake -j1 PYVER="${PYVER}" PYVER_PACK="" \ | |
53 | get_libdir="$(get_libdir)" || die "emake failed" | |
54 | } | |
55 | python_version | |
56 | compile_pycaml | |
57 | } | |
58 | ||
59 | src_install() { | |
60 | python_need_rebuild | |
61 | ||
62 | # Use findlib to install properly, especially to avoid | |
63 | # the shared library mess | |
64 | findlib_src_preinst | |
65 | ||
66 | install_abi_pycaml() { | |
67 | abi=`echo "${PYTHON_ABI}" | sed -e 's/\./_/g'` | |
68 | name="${PN}${abi}" | |
69 | cd "${WORKDIR}/${name}" | |
70 | ocamlfind install "${name}" \ | |
71 | dllpycaml"${abi}"_stubs.so* libpycaml"${abi}"_stubs.a \ | |
72 | pycaml"${abi}".a pycaml"${abi}".cma pycaml"${abi}".cmxa \ | |
73 | pycaml.cmi pycaml.cmo pycaml.cmx pycaml.ml pycaml.mli \ | |
74 | pycaml.o pycaml_stubs.c pycaml_stubs.h pycaml_stubs.o META | |
75 | } | |
76 | python_execute_function install_abi_pycaml | |
77 | ||
78 | install_pycaml() { | |
79 | cd "${S}" | |
80 | ocamlfind install "${PN}" \ | |
81 | dllpycaml_stubs.so* libpycaml_stubs.a pycaml.a pycaml.cma \ | |
82 | pycaml.cmi pycaml.cmo pycaml.cmx pycaml.cmxa pycaml.ml pycaml.mli \ | |
83 | pycaml.o pycaml_stubs.c pycaml_stubs.h pycaml_stubs.o META | |
84 | } | |
85 | python_version | |
86 | install_pycaml | |
87 | } |