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

EAPI=6

VCS="git"
IS_MULTILIB=true
GITHUB_A="diegonehab"
inherit lua

DESCRIPTION="Networking support library for the Lua language."
HOMEPAGE="http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/"

LICENSE="MIT"
SLOT="0"
KEYWORDS=""
IUSE="doc examples debug"

DOCS=(NEW README)
HTML_DOCS=(doc/.)
EXAMPLES=(samples/.)

all_lua_prepare() {
	lua_default

	# dirty hack for crazy buildsystem
	sed -r \
		-e '1iinclude ../.lua_eclass_config' \
		-e '/^MYCFLAGS=/d' \
		-e '/^MYLDFLAGS=/d' \
		-e '/^CC=/d' \
		-e '/^LD=/d' \
		-e '/^INSTALL_TOP=/d' \
		-i src/makefile
}

each_lua_configure() {
	local luav="${lua_impl}"
	luav="${luav##lua}"

	myeconfargs=(
		"LUAV=${luav}"
		"CDIR=$(lua_get_pkgvar INSTALL_CMOD)"
		"LDIR=$(lua_get_pkgvar INSTALL_LMOD)"
		'INSTALL_TOP=$(DESTDIR)'
		"COMPAT=COMPAT"
		LD='$(CC)'
	)

	use debug && \
		myeconfargs+=("DEBUG=DEBUG")

	use elibc_Winnt && \
		myeconfargs+=("PLAT=win32")

	use elibc_Cygwin && \
		myeconfargs+=("PLAT=mingw")

	use elibc_Darwin && (
		myeconfargs+=(
			"PLAT=macosx"
			LDFLAGS="-bundle -undefined dynamic_lookup"
		)
		sed \
			-e 's#-[fD]PIC#-fno-common#g' \
			-i .lua_eclass_config
	)

	lua_default

	# dirty hack for crazy buildsystem
	sed -r \
		-e 's#(^CFLAGS=)#MY\1#' \
		-e 's#(^LDFLAGS=)#MY\1#' \
		-i .lua_eclass_config
}