958c4474fffa1b1daa94ff52f1a72fc63ee07c97
[gentoo.git] / dev-libs / kpathsea / kpathsea-6.2.3_p20170524.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit texlive-common eutils libtool prefix
7
8 TEXMFD_VERSION="8"
9
10 DESCRIPTION="Path searching library for TeX-related files"
11 HOMEPAGE="http://tug.org/texlive/"
12 SRC_URI="mirror://gentoo/texlive-${PV#*_p}-source.tar.xz
13         mirror://gentoo/${PN}-texmf.d-${TEXMFD_VERSION}.tar.xz"
14
15 LICENSE="GPL-2"
16 SLOT="0/${PV%_p*}"
17 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 ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
18 IUSE="doc source static-libs"
19
20 DEPEND="!<app-text/texlive-core-2013
21         !app-text/ptex"
22 RDEPEND="${DEPEND}"
23
24 S=${WORKDIR}/texlive-${PV#*_p}-source/texk/${PN}
25
26 TL_VERSION=2017
27 EXTRA_TL_MODULES="kpathsea"
28 EXTRA_TL_DOC_MODULES="kpathsea.doc"
29
30 for i in ${EXTRA_TL_MODULES} ; do
31         SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${TL_VERSION}.tar.xz"
32 done
33
34 SRC_URI="${SRC_URI} doc? ( "
35 for i in ${EXTRA_TL_DOC_MODULES} ; do
36         SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${TL_VERSION}.tar.xz"
37 done
38 SRC_URI="${SRC_URI} ) "
39
40 TEXMF_PATH=/usr/share/texmf-dist
41
42 src_prepare() {
43         epatch "${FILESDIR}/insecure_tmp_mktexlsr.patch"
44         cd "${WORKDIR}/texlive-${PV#*_p}-source"
45         S="${WORKDIR}/texlive-${PV#*_p}-source" elibtoolize #sane .so versionning on gfbsd
46         cp "${FILESDIR}/texmf-update-r2" "${S}"/texmf-update
47         eprefixify "${S}"/texmf-update
48 }
49
50 src_configure() {
51         # Too many regexps use A-Z a-z constructs, what causes problems with locales
52         # that don't have the same alphabetical order than ascii. Bug #347798
53         # So we set LC_ALL to C in order to avoid problems.
54         export LC_ALL=C
55
56         # Disable largefile because it seems to cause problems on big endian 32 bits
57         # systems...
58         econf \
59                 --disable-largefile \
60                 $(use_enable static-libs static)
61 }
62
63 src_install() {
64         emake DESTDIR="${D}" web2cdir="${EPREFIX}/usr/share/texmf-dist/web2c" install
65         find "${D}" -name '*.la' -delete
66
67         dodir /usr/share # just in case
68         cp -pR "${WORKDIR}"/texmf-dist "${ED}/usr/share/" || die "failed to install texmf trees"
69         if use source ; then
70                 cp -pR "${WORKDIR}"/tlpkg "${ED}/usr/share/" || die "failed to install tlpkg files"
71         fi
72
73         # The default configuration expects it to be world writable, bug #266680
74         # People can still change it with texconfig though.
75         dodir /var/cache/fonts
76         fperms 1777 /var/cache/fonts
77
78         # Take care of fmtutil.cnf and texmf.cnf
79         dodir /etc/texmf/{fmtutil.d,texmf.d}
80
81         # Remove default texmf.cnf to ship our own, greatly based on texlive dvd's
82         # texmf.cnf
83         # It will also be generated from /etc/texmf/texmf.d files by texmf-update
84         rm -f "${ED}${TEXMF_PATH}/web2c/texmf.cnf"
85
86         insinto /etc/texmf/texmf.d
87         doins "${WORKDIR}/texmf.d/"*.cnf
88
89         # Remove fmtutil.cnf, it will be regenerated from /etc/texmf/fmtutil.d files
90         # by texmf-update
91         rm -f "${ED}${TEXMF_PATH}/web2c/fmtutil.cnf"
92
93         dosym /etc/texmf/web2c/fmtutil.cnf ${TEXMF_PATH}/web2c/fmtutil.cnf
94         dosym /etc/texmf/web2c/texmf.cnf ${TEXMF_PATH}/web2c/texmf.cnf
95
96         newsbin "${S}/texmf-update" texmf-update
97
98         # Keep it as that's where the formats will go
99         keepdir /var/lib/texmf
100
101         dodoc ChangeLog NEWS PROJECTS README
102 }
103
104 pkg_postinst() {
105         etexmf-update
106 }
107
108 pkg_postrm() {
109         etexmf-update
110 }