summaryrefslogtreecommitdiff
blob: dc22875577ccdca88d9fcc1018698a0d5fe3f5ac (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=5

inherit epatch toolchain-funcs multilib versionator

MY_PV=$(replace_version_separator 5 '.' "$(replace_version_separator 4 '-' )")
DESCRIPTION="Make replacement"
HOMEPAGE="http://omake.metaprl.org/"
SRC_URI="http://omake.metaprl.org/downloads/${PN}-${MY_PV}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ppc x86"
IUSE="doc fam ncurses +ocamlopt readline"
RESTRICT="installsources !ocamlopt? ( strip )"

DEPEND=">=dev-lang/ocaml-3.10.2:=[ocamlopt?]
	ncurses? ( >=sys-libs/ncurses-5.3:0= )
	fam? ( virtual/fam )
	readline? ( >=sys-libs/readline-4.3:0= )"
RDEPEND="${DEPEND}"

S=${WORKDIR}/${PN}-${MY_PV%-*}

use_boolean() {
	if use ${1}; then
		echo "true"
	else
		echo "false"
	fi
}

src_prepare() {
	epatch \
		"${FILESDIR}/${P}-cflags.patch" \
		"${FILESDIR}/${P}-warnerror.patch"
}

src_configure() {
	# Configuration steps...
	echo "PREFIX = \$(dir \$\"/usr\")" > .config
	echo "BINDIR = \$(dir \$\"\$(PREFIX)/bin\")" >> .config
	echo "LIBDIR = \$(dir \$\"\$(PREFIX)/$(get_libdir)\")" >> .config
	echo "MANDIR = \$(dir \$\"\$(PREFIX)/man\")" >> .config

	echo "CC = $(tc-getCC)" >> .config
	echo "CFLAGS = ${CFLAGS}" >> .config

	if use ocamlopt; then
		echo "NATIVE_ENABLED = true" >> .config
		echo "BYTE_ENABLED = false" >> .config
	else
		echo "NATIVE_ENABLED = false" >> .config
		echo "BYTE_ENABLED = true" >> .config
	fi

	echo "NATIVE_PROFILE = false" >> .config

	echo "READLINE_ENABLED = $(use_boolean readline)" >> .config
	echo "FAM_ENABLED = $(use_boolean fam)" >> .config
	echo "NCURSES_ENABLED = $(use_boolean ncurses)" >> .config

	echo "DEFAULT_SAVE_INTERVAL = 60" >> .config

	echo "OCAMLDEP_MODULES_ENABLED = false" >> .config
}

src_compile() {
	emake all
}

src_install() {
	emake INSTALL_ROOT="${D}" install
	dodoc CHANGELOG.txt
	if use doc; then
		dodoc doc/ps/omake-doc.{pdf,ps} doc/txt/omake-doc.txt
		dohtml -r doc/html/*
	fi
}