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