+# Copyright © 2020-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
+
+inherit autotools xdg-utils
+
+MY_P=$PN-${PV%_p*}
+
+DESCRIPTION="Schematic capture and netlist utilities (fork of gEDA:gaf)"
+HOMEPAGE="https://github.com/lepton-eda/lepton-eda"
+SRC_URI="$HOMEPAGE/releases/download/${PV/_p/-}/$MY_P.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc nls stroke"
+
+RDEPEND=">=dev-scheme/guile-2.0
+ >=x11-libs/gtk+-2.24:2
+ x11-libs/gtkextra
+ nls? ( virtual/libintl )
+ stroke? ( dev-libs/libstroke )"
+DEPEND="$RDEPEND
+ doc? ( app-doc/doxygen )
+ nls? ( >=sys-devel/gettext-0.18 )
+ dev-util/desktop-file-utils
+ x11-misc/shared-mime-info
+ sys-apps/groff
+ virtual/pkgconfig"
+
+S=$WORKDIR/$MY_P
+
+PATCHES=("$FILESDIR/$PN-precompile.patch")
+
+src_prepare () {
+ default
+ eautoreconf
+}
+
+src_configure () {
+ econf \
+ $(use_enable doc doxygen) \
+ $(use_enable nls) \
+ $(use_with stroke libstroke) \
+ --disable-update-xdg-database \
+ --disable-rpath
+}
+
+src_install () {
+ default
+
+ GUILE_AUTO_COMPILE=0 LEPTON_INHIBIT_RC_FILES=1 \
+ GUILE_LOAD_PATH=${ED%/}/usr/share/lepton-eda/scheme \
+ LIBLEPTONGUI=${ED%/}/usr/$(get_libdir)/libleptongui \
+ LIBLEPTON=${ED%/}/usr/$(get_libdir)/liblepton \
+ emake bindir="${ED%/}/usr/bin" datadir="${ED%/}/usr/share" precompile
+}
+
+pkg_postinst () {
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ xdg_icon_cache_update
+}
+
+pkg_postrm () {
+ pkg_postinst
+}