--- /dev/null
+1. avoid rebuilding documentation
+2. avoid non-portable syntax
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -7,6 +7,9 @@
+ AC_GNU_SOURCE
+ AC_CONFIG_HEADERS([config.h])
+
++# avoid rebuilding documentation
++AM_MAINTAINER_MODE
++
+ ##########################################################################
+ #
+ # Try to figure out if we are building from git sources.
+@@ -1285,11 +1288,6 @@
+ if test -d $srcdir/doc; then
+ AC_CONFIG_FILES(doc/Makefile)
+ fi
+-if test -d $srcdir/doc/gs; then
+- AC_CONFIG_FILES(doc/gs/Makefile)
+- AC_CONFIG_FILES(doc/gs/gafrc)
+- AC_CONFIG_FILES(doc/gs/gschemrc)
+-fi
+ if test -d $srcdir/example; then
+ AC_CONFIG_FILES(example/Makefile)
+ AC_CONFIG_FILES(example/libraries/Makefile)
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -15,5 +15,5 @@
+ MAINTAINERCLEANFILES= $(INTLTOOL_FILES)
+
+ ACLOCAL_AMFLAGS = -I m4
+-DISTCHECK_CONFIGURE_FLAGS := ${DISTCHECK_CONFIGURE_FLAGS} --disable-update-mime-database --disable-update-desktop-database GTK_UPDATE_ICON_THEME_BIN=true --with-gui=batch
++DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_CONFIGURE_FLAGS} --disable-update-mime-database --disable-update-desktop-database GTK_UPDATE_ICON_THEME_BIN=true --with-gui=batch
+
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools toolchain-funcs xdg
+
+DESCRIPTION="GPL Electronic Design Automation: Printed Circuit Board editor"
+HOMEPAGE="http://pcb.geda-project.org/"
+SRC_URI="mirror://sourceforge/pcb/pcb/${P}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~x86-macos"
+IUSE="dbus doc gcode gif gsvit gui jpeg m4lib-png nelma png test tk toporouter"
+# toporouter-output USE flag removed, there seems to be no result
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ dev-libs/glib:2
+ sci-electronics/electronics-menu
+ gif? ( media-libs/gd )
+ gsvit? ( media-libs/gd[png] )
+ gui? (
+ x11-libs/gtk+:2
+ x11-libs/pango
+ dbus? ( sys-apps/dbus )
+ )
+ jpeg? ( media-libs/gd[jpeg] )
+ nelma? ( media-libs/gd[png] )
+ gcode? ( media-libs/gd[png] )
+ virtual/libintl
+ png? ( media-libs/gd[png] )
+ m4lib-png? ( media-libs/gd[png] )
+ tk? ( >=dev-lang/tk-8:0 )"
+#toporouter-output? ( x11-libs/cairo )
+
+DEPEND="${RDEPEND}"
+BDEPEND="
+ >=dev-util/intltool-0.35
+ virtual/pkgconfig
+ sys-devel/gettext
+ test? (
+ sci-electronics/gerbv
+ virtual/imagemagick-tools
+ )"
+
+PATCHES=( "${FILESDIR}"/${PN}-4.2.2-fix-autotools.patch )
+
+src_prepare() {
+ default
+ eautoreconf
+
+ # tests are unconditional, even in the known presence of missing/disabled
+ # features, so we have to remove feature tests ourselves.
+ if ! use gcode; then
+ sed -i '/^hid_gcode/d' tests/tests.list || die
+ fi
+ if ! use gsvit; then
+ sed -i '/^hid_gsvit/d' tests/tests.list || die
+ fi
+ if ! use nelma; then
+ sed -i '/^hid_nelma/d' tests/tests.list || die
+ fi
+ if ! use png; then
+ sed -i '/^hid_png/d' tests/tests.list || die
+ fi
+ if ! use gif; then
+ sed -i '/^hid_png10[[:digit:]]/d' tests/tests.list || die
+ fi
+ if ! use jpeg; then
+ sed -i '/^hid_png20[[:digit:]]/d' tests/tests.list || die
+ fi
+}
+
+src_configure() {
+ local exporters=( bom gerber ps ipcd356 )
+ if use png || use jpeg || use gif; then
+ exporters+=( png )
+ fi
+ use gcode && exporters+=( gcode )
+ use gsvit && exporters+=( gsvit )
+ use nelma && exporters+=( nelma )
+ use tk || export WISH="${EPREFIX}/bin/true"
+
+ # toporouter-output USE flag removed, seems to do nothing
+ # opengl disabled unconditionally, due to requiring EOL gtkglext
+ econf \
+ --disable-gl \
+ --disable-rpath \
+ --disable-toporouter-output \
+ --disable-update-mime-database \
+ --disable-update-desktop-database \
+ --disable-xrender \
+ --enable-nls \
+ $(use_enable doc) \
+ $(use_enable gif) \
+ $(use_enable jpeg) \
+ $(use_enable png) \
+ $(use_enable m4lib-png) \
+ $(use_enable toporouter) \
+ $(use_enable gui dbus $(usex dbus yes no)) \
+ --with-gui=$(usex gui gtk batch) \
+ --with-exporters="${exporters[*]}"
+}
+
+src_compile() {
+ emake AR="$(tc-getAR)"
+}