app-text/xdvik: use pkg-config instead of freetype-config
authorNaohiro Aota <naota@gentoo.org>
Mon, 8 Oct 2018 21:43:02 +0000 (06:43 +0900)
committerNaohiro Aota <naota@gentoo.org>
Mon, 8 Oct 2018 21:51:19 +0000 (06:51 +0900)
Also, bump to EAPI=6 and introduced CDEPEND variable.

Thanks to Aidan Thornton for the patch.

Closes: https://bugs.gentoo.org/655358
Signed-off-by: Naohiro Aota <naota@gentoo.org>
Package-Manager: Portage-2.3.50, Repoman-2.3.11

app-text/xdvik/files/xdvik-22.87.03-freetype2-config.patch [new file with mode: 0644]
app-text/xdvik/xdvik-22.87.03-r2.ebuild [new file with mode: 0644]

diff --git a/app-text/xdvik/files/xdvik-22.87.03-freetype2-config.patch b/app-text/xdvik/files/xdvik-22.87.03-freetype2-config.patch
new file mode 100644 (file)
index 0000000..6387b28
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/m4/kpse-freetype2-flags.m4       2018-09-19 10:19:06.437789178 +0100
++++ b/m4/kpse-freetype2-flags.m4       2018-09-19 10:23:48.556050046 +0100
+@@ -21,17 +21,10 @@
+ # KPSE_FREETYPE2_OPTIONS([WITH-SYSTEM])
+ # -------------------------------------
+-AC_DEFUN([KPSE_FREETYPE2_OPTIONS], [_KPSE_LIB_OPTIONS([freetype2], [$1], [freetype-config])])
++AC_DEFUN([KPSE_FREETYPE2_OPTIONS], [_KPSE_LIB_OPTIONS([freetype2], [$1], [pkg-config])])
+ # KPSE_FREETYPE2_SYSTEM_FLAGS
+ # ---------------------------
+ AC_DEFUN([KPSE_FREETYPE2_SYSTEM_FLAGS], [dnl
+-AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
+-AC_CHECK_TOOL([FT2_CONFIG], [freetype-config], [false])[]dnl
+-if $FT2_CONFIG --ftversion >/dev/null 2>&1; then
+-  FREETYPE2_INCLUDES=`$FT2_CONFIG --cflags`
+-  FREETYPE2_LIBS=`$FT2_CONFIG --libs`
+-elif test "x$need_freetype2:$with_system_freetype2" = xyes:yes; then
+-  AC_MSG_ERROR([did not find freetype-config required for system freetype2 library])
+-fi
+-]) # KPSE_FREETYPE2_SYSTEM_FLAGS
++_KPSE_PKG_CONFIG_FLAGS([freetype2], [freetype2])])
++
diff --git a/app-text/xdvik/xdvik-22.87.03-r2.ebuild b/app-text/xdvik/xdvik-22.87.03-r2.ebuild
new file mode 100644 (file)
index 0000000..30720be
--- /dev/null
@@ -0,0 +1,115 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools elisp-common eutils flag-o-matic multilib toolchain-funcs xdg-utils
+
+DESCRIPTION="DVI previewer for X Window System"
+HOMEPAGE="http://xdvi.sourceforge.net/"
+SRC_URI="mirror://sourceforge/xdvi/${P}.tar.gz"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+SLOT="0"
+LICENSE="GPL-2"
+IUSE="motif neXt Xaw3d emacs"
+
+CDEPEND=">=media-libs/freetype-2.9.1-r2:2
+       x11-libs/libX11
+       x11-libs/libXi
+       x11-libs/libXmu
+       x11-libs/libXpm
+       x11-libs/libXt
+       motif? ( >=x11-libs/motif-2.3:0 )
+       !motif? (
+               neXt? ( x11-libs/neXtaw )
+               !neXt? (
+                       Xaw3d? ( x11-libs/libXaw3d )
+                       !Xaw3d? ( x11-libs/libXaw )
+               )
+       )
+       dev-libs/kpathsea"
+DEPEND="sys-devel/flex
+       virtual/yacc
+       virtual/pkgconfig
+       ${CDEPEND}"
+RDEPEND="${CDEPEND}
+       virtual/latex-base
+       !<app-text/texlive-2007"
+S=${WORKDIR}/${P}/texk/xdvik
+
+src_prepare() {
+       local i
+       # Make sure system kpathsea headers are used
+       cd "${WORKDIR}/${P}/texk/kpathsea"
+       for i in *.h ; do echo "#include_next \"$i\"" > $i; done
+
+       cd "${WORKDIR}/${P}"
+       eapply "${FILESDIR}"/${P}-freetype2-config.patch
+       cd "${S}"
+       eautoreconf
+
+       eapply_user
+}
+
+src_configure() {
+       has_version '>=dev-libs/kpathsea-6.2.1' && append-cppflags "$($(tc-getPKG_CONFIG) --cflags kpathsea)"
+
+       local toolkit
+
+       if use motif ; then
+               toolkit="motif"
+               use neXt && ewarn "neXt USE flag ignored (superseded by motif)"
+               use Xaw3d && ewarn "Xaw3d USE flag ignored (superseded by motif)"
+       elif use neXt ; then
+               toolkit="neXtaw"
+               use Xaw3d && ewarn "Xaw3d USE flag ignored (superseded by neXt)"
+       elif use Xaw3d ; then
+               toolkit="xaw3d"
+       else
+               toolkit="xaw"
+       fi
+
+       econf \
+               --with-system-freetype2 \
+               --with-system-kpathsea \
+               --with-kpathsea-include="${EPREFIX}"/usr/include/kpathsea \
+               --with-xdvi-x-toolkit="${toolkit}" \
+               --x-includes="${SYSROOT}${EPREFIX}"/usr/include \
+               --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
+}
+
+src_compile() {
+       emake kpathsea_dir="${EPREFIX}/usr/include/kpathsea"
+       use emacs && elisp-compile xdvi-search.el
+}
+
+src_install() {
+       dodir /usr/share/texmf-dist/dvips/config
+
+       emake DESTDIR="${D}" install
+
+       dosym ../../texmf-dist/xdvi/XDvi /usr/share/X11/app-defaults/XDvi
+
+       dodoc BUGS FAQ README.*
+
+       use emacs && elisp-install tex-utils *.el *.elc
+
+       doicon "${FILESDIR}"/${PN}.xpm
+       make_desktop_entry xdvi "XDVI" xdvik "Graphics;Viewer"
+       echo "MimeType=application/x-dvi;" >> "${ED}"usr/share/applications/xdvi-"${PN}".desktop
+}
+
+pkg_postinst() {
+       xdg_desktop_database_update
+
+       if use emacs; then
+               elog "Add"
+               elog "  (add-to-list 'load-path \"${EPREFIX}${SITELISP}/tex-utils\")"
+               elog "  (require 'xdvi-search)"
+               elog "to your ~/.emacs file"
+       fi
+}
+
+pkg_postrm() {
+       xdg_desktop_database_update
+}