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

EAPI=7

PYTHON_COMPAT=( python3_{7..9} )
DOCS_BUILDER="doxygen"
# File is hardcoded to be run from ../ so we use this instead of DOCS_DIR
DOCS_CONFIG_NAME="doc/Doxyfile"

inherit docs python-single-r1 perl-functions

DESCRIPTION="C library to handle DWG files"
HOMEPAGE="https://www.gnu.org/software/libredwg/"
SRC_URI="https://github.com/LibreDWG/${PN}/releases/download/${PV}/${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"

IUSE="debug python perl static-libs"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

RDEPEND="
	python? ( ${PYTHON_DEPS} )
	perl? ( dev-lang/perl )
	dev-libs/libpcre2
	dev-libs/pslib
"
DEPEND="${RDEPEND}
	python? ( dev-lang/swig )
	perl? ( dev-lang/swig )
"

src_configure() {
	perl_set_version
	local myconf=(
		--enable-write
		--enable-dxf
		--enable-json
		--disable-gcov
		$(usex debug "--disable-release" "--enable-release")
		$(use_enable debug trace)
		$(use_enable debug)
		$(use_enable static-libs static)
		$(use_enable python python "${EPYTHON}")
		$(usex perl "--with-perl-install=vendor" "--with-perl-install=no")
	)

	if use python || use perl; then
		myconf+=( --enable-bindings )
	else
		myconf+=( --disable-bindings )
	fi

	econf ${myconf[@]}

	# Fix variable references itself error, fails in src_install otherwise.
	# Can't put this in src_prepare and use eautoreconf because eautoreconf
	# only works inside a git repository for this package.
	sed -i -e 's/TEXINPUTS = "$(TEXINPUTS)$(PATH_SEPARATOR)$(TEXINFO_TEX_DIR)"/TEXINPUTS = "$(PATH_SEPARATOR)$(TEXINFO_TEX_DIR)"/g' doc/Makefile || die
}

src_compile() {
	perl_set_version
	emake
	docs_compile
}

src_install() {
	perl_set_version
	default
	use python && python_optimize
	use perl && perl_domodule bindings/perl/LibreDWG.pm
}