summaryrefslogtreecommitdiff
blob: 88dcc07ba1c20e9417f0207acc8549b421dac319 (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

LUA_COMPAT="lua51 luajit2"
IS_MULTILIB=true
VCS="mercurial"
inherit lua

DESCRIPTION="DBI module for Lua"
HOMEPAGE="https://code.google.com/p/luadbi"
#EHG_REPO_URI="https://code.google.com/p/luadbi"
EHG_REPO_URI="https://bitbucket.org/mva/luadbi-temp"

LICENSE="MIT"
SLOT="0"
KEYWORDS=""
IUSE="mysql postgres sqlite oracle"

RDEPEND="
	mysql? ( || ( dev-db/mysql dev-db/mariadb ) )
	postgres? ( dev-db/postgresql )
	sqlite? ( >=dev-db/sqlite-3 )
	oracle? ( dev-db/oracle-instantclient-basic )
"
DEPEND="${RDEPEND}"

#S="${WORKDIR}"

each_lua_compile() {
	local drivers=()
	use mysql && drivers+=( "mysql" )
	use postgres && drivers+=( "psql" )
	use sqlite && drivers+=( "sqlite3" )
	use oracle && drivers+=( "oracle" )

	if [[ -z "${drivers[@]}" ]] ; then
		eerror
		eerror "No driver was selected, cannot build."
		eerror "Please set USE flags to build any driver."
		eerror "Possible USE flags: mysql postgres sqlite"
		eerror
		die "No driver selected"
	fi

	for driver in "${drivers[@]}"; do
		local buildme;
		if [[ ${driver} = "psql" && ${ABI} = "x86" ]]; then
			# FIXME: when postgres and perl (as postgres dep) will have multilib support
			buildme=no
		fi

#			LUA_INC="$($(tc-getPKG_CONFIG) --cflags ${lua_impl})" \

		[[ ${buildme} = "no" ]] || lua_default \
			PSQL_INC="-I/usr/include/postgresql/server" \
			MYSQL_INC="-I/usr/include/mysql -L/usr/$(get_libdir)/mysql" \
			${driver}

		unset buildme
	done
}

each_lua_install() {
	dolua *.so DBI.lua
}