+# Copyright © 2021 Nick Bowler
+# License GPLv3+: GNU General Public License version 3 or any later version.
+# This is free software: you are free to change and redistribute it.
+# There is NO WARRANTY, to the extent permitted by law.
+
+EAPI=7
+
+DESCRIPTION="Explain and construct C declarations"
+HOMEPAGE="http://draconx.ca/projects/cdecl99/"
+SRC_URI="http://draconx.ca/archive/$PN/$P.tar.xz"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="static-libs test nls readline"
+
+BDEPEND="test? ( virtual/pkgconfig )"
+RDEPEND="nls? ( virtual/libintl )
+ readline? ( sys-libs/readline:= )"
+DEPEND="$RDEPEND
+ test? ( sci-libs/gsl )"
+
+src_configure () {
+ econf \
+ --enable-shared $(use_enable static-libs static) \
+ $(usex !readline gl_cv_lib_readline=no '') \
+ $(use_enable nls)
+}
+
+src_test () {
+ # testcase compilation currently busted with -Wl,--as-needed
+ emake LDFLAGS='-Wl,--no-as-needed' check
+}
+
+src_install () {
+ default
+
+ use static-libs || find "$ED" -name '*.la' -delete
+}