summaryrefslogtreecommitdiff
blob: 8bb3a1d99a93f2e3b07891ccd1836ff25bf8e963 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit elisp-common flag-o-matic toolchain-funcs

DESCRIPTION="Extensible editor for structured binary data"
HOMEPAGE="https://www.jemarch.net/poke"

if [[ ${PV} == 9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://git.savannah.gnu.org/git/poke.git"
	REGEN_BDEPEND="
		>=sys-devel/autoconf-2.62
		>=sys-devel/automake-2.16
		sys-apps/gawk
		sys-apps/help2man
		sys-apps/texinfo
		app-alternatives/yacc
		app-alternatives/lex
	"
else
	SRC_URI="mirror://gnu/poke/${P}.tar.gz"
	KEYWORDS="amd64 ~x86"
	REGEN_BDEPEND=""
fi

LICENSE="GPL-3+"
SLOT="0"
IUSE="emacs pvm-profiling nbd nls test"

RESTRICT="!test? ( test )"

RDEPEND="
	dev-libs/boehm-gc:=
	dev-libs/libatomic_ops
	sys-devel/gettext
	sys-libs/readline:=
	emacs? ( >=app-editors/emacs-23.1:* )
	nbd? ( sys-libs/libnbd )
"
DEPEND="
	${RDEPEND}
	test? ( nbd? ( sys-libs/libnbd[uri-support(+)] ) )
"
BDEPEND="
	${REGEN_BDEPEND}
	virtual/pkgconfig
	pvm-profiling? ( sys-devel/gcc )
	emacs? ( >=app-editors/emacs-23.1:* )
	test? (
		dev-util/dejagnu
		nbd? ( sys-block/nbdkit )
	)
"

SITEFILE="50${PN}-gentoo.el"

pkg_pretend() {
	if use pvm-profiling && ! tc-is-gcc; then
		die "USE=pvm-profiling requires GCC"
	fi
}

pkg_setup() {
	use emacs && elisp-check-emacs-version
}

src_prepare() {
	default

	if [[ ${PV} == 9999 ]]; then
		./bootstrap || die
	fi
}

src_configure() {
	# See bug 858461.
	# Upstream support might happen one day.  For context, only one file needs
	# LTO to be disabled (since it's an autogenerated bytecode interpreter),
	# others do not.  The build system will handle this at some point in the
	# future.  Until then, just filter out LTO.
	filter-lto

	# NB --disable-{gui,mi}:
	# These (AFAICT) have no consumers in Gentoo, and should not get any,
	# preferably. They are slated for removal with Poke 3 (should happen
	# towards the end of the year, possibly), so they should not be relied
	# upon.
	local myconf=(
		--with-lispdir="${EPREFIX}/${SITELISP}/${PN}"
		--enable-hserver
		--disable-gui
		--disable-mi
		$(use_enable nbd libnbd)
		$(use_enable pvm-profiling)
		$(use_enable nls)
	)

	econf "${myconf[@]}"
}

src_compile() {
	default

	if use emacs; then
		cd etc || die
		elisp-compile *.el
	fi
}

src_install() {
	default

	if use emacs; then
		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
		cd etc || die
		elisp-install "${PN}" *.el *.elc
	fi
	find "${ED}" -name '*.la' -delete || die
}

pkg_postinst() {
	use emacs && elisp-site-regen
}

pkg_postrm() {
	use emacs && elisp-site-regen
}