You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

358 lines
12 KiB

  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. TL_SOURCE_VERSION=20210325
  5. inherit flag-o-matic toolchain-funcs libtool texlive-common
  6. MY_P=${PN%-core}-${TL_SOURCE_VERSION}-source
  7. PATCHLEVEL=1
  8. DESCRIPTION="A complete TeX distribution"
  9. HOMEPAGE="https://tug.org/texlive/"
  10. SLOT="0"
  11. LICENSE="GPL-2 LPPL-1.3c TeX"
  12. SRC_URI="https://dev.gentoo.org/~zlogene/distfiles/texlive/${MY_P}.tar.xz
  13. https://dev.gentoo.org/~zlogene/distfiles/texlive/texlive-tlpdb-${PV}.tar.xz
  14. https://dev.gentoo.org/~zlogene/distfiles/texlive/${PN}-patches-${PV}-${PATCHLEVEL}.tar.xz"
  15. # We ship binextra collection alongside
  16. TL_CORE_BINEXTRA_MODULES="
  17. a2ping adhocfilelist arara asymptote bundledoc checklistings chklref ctan_chk
  18. clojure-pamphlet cluttex ctanify ctan-o-mat ctanbib ctanupload ctie cweb de-macro
  19. dtl dtxgen dvi2tty dviasm dvicopy dvidvi dviinfox dviout-util dviljk dvipos findhyph
  20. fragmaster hook-pre-commit-pkg installfont ketcindy lacheck latex-git-log latex-papersize
  21. latex2man latex2nemeth latexfileversion latexpand latexindent ltxfileinfo ltximg
  22. listings-ext make4ht match_parens mflua mkjobtexmf patgen pdfbook2 pdfcrop pdfjam
  23. pdflatexpicscale pdftex-quiet pdfxup pdftosrc pfarrei pkfix pkfix-helper purifyeps
  24. seetexk spix srcredact sty2dtx synctex tex4ebook texcount texdef texdiff texdirflatten
  25. texdoc texfot texliveonfly texlive-scripts-extra texloganalyser texosquery texplate
  26. texware tie tlcockpit tpic2pdftex typeoutfileinfo web xindy xindex xpdfopen collection-binextra
  27. "
  28. TL_CORE_BINEXTRA_DOC_MODULES="
  29. a2ping.doc adhocfilelist.doc arara.doc asymptote.doc bundledoc.doc
  30. checklistings.doc chklref.doc ctan_chk.doc clojure-pamphlet.doc cluttex.doc
  31. ctanify.doc ctan-o-mat.doc ctanbib.doc ctanupload.doc ctie.doc cweb.doc de-macro.doc
  32. dtl.doc dtxgen.doc dvi2tty.doc dviasm.doc dvicopy.doc dvidvi.doc dviinfox.doc dviljk.doc
  33. dvipos.doc dviout-util.doc findhyph.doc fragmaster.doc hook-pre-commit-pkg.doc installfont.doc
  34. ketcindy.doc lacheck.doc latex-git-log.doc latex-papersize.doc latex2man.doc latex2nemeth.doc
  35. latexfileversion.doc latexpand.doc latexindent.doc ltxfileinfo.doc ltximg.doc listings-ext.doc
  36. make4ht.doc match_parens.doc mkjobtexmf.doc patgen.doc pdfbook2.doc pdfcrop.doc pdfjam.doc
  37. pdflatexpicscale.doc pdftex-quiet.doc pdfxup.doc pdftosrc.doc pfarrei.doc pkfix.doc
  38. pkfix-helper.doc purifyeps.doc pythontex.doc seetexk.doc spix.doc srcredact.doc
  39. sty2dtx.doc synctex.doc tex4ebook.doc texcount.doc texdef.doc texdiff.doc
  40. texdirflatten.doc texdoc.doc texfot.doc texliveonfly.doc texlive-scripts-extra.doc
  41. texloganalyser.doc texosquery.doc texware.doc tie.doc tlcockpit.doc tpic2pdftex.doc
  42. typeoutfileinfo.doc texplate.doc web.doc xindy.doc xindex.doc xpdfopen.doc
  43. "
  44. TL_CORE_BINEXTRA_SRC_MODULES="
  45. adhocfilelist.source arara.source checklistings.source clojure-pamphlet.source
  46. listings-ext.source mkjobtexmf.source pfarrei.source pythontex.source
  47. texdef.source texosquery.source texplate.source tlcockpit.source
  48. "
  49. # Macros that are not a part of texlive-sources or collection-binextra but still needed
  50. # for other packages during installation
  51. TL_CORE_EXTRA_MODULES="hyphen-base gsftopk texlive.infra texlive-scripts ${TL_CORE_BINEXTRA_MODULES}"
  52. TL_CORE_EXTRA_DOC_MODULES="gsftopk.doc texlive.infra.doc texlive-scripts.doc ${TL_CORE_BINEXTRA_DOC_MODULES}"
  53. TL_CORE_EXTRA_SRC_MODULES="${TL_CORE_BINEXTRA_SRC_MODULES}"
  54. for i in ${TL_CORE_EXTRA_MODULES}; do
  55. SRC_URI="${SRC_URI} https://dev.gentoo.org/~zlogene/distfiles/texlive/tl-${i}-${PV}.tar.xz"
  56. done
  57. SRC_URI="${SRC_URI} doc? ( "
  58. for i in ${TL_CORE_EXTRA_DOC_MODULES}; do
  59. SRC_URI="${SRC_URI} https://dev.gentoo.org/~zlogene/distfiles/texlive/tl-${i}-${PV}.tar.xz"
  60. done
  61. SRC_URI="${SRC_URI} )"
  62. SRC_URI="${SRC_URI} source? ( "
  63. for i in ${TL_CORE_EXTRA_SRC_MODULES}; do
  64. SRC_URI="${SRC_URI} https://dev.gentoo.org/~zlogene/distfiles/texlive/tl-${i}-${PV}.tar.xz"
  65. done
  66. SRC_URI="${SRC_URI} )"
  67. KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris"
  68. IUSE="cjk X doc source tk +luajittex xetex xindy"
  69. TEXMF_PATH=/usr/share/texmf-dist
  70. MODULAR_X_DEPEND="X? (
  71. x11-libs/libX11
  72. x11-libs/libXmu
  73. )"
  74. COMMON_DEPEND="${MODULAR_X_DEPEND}
  75. !app-text/epspdf
  76. !app-text/pdfjam
  77. sys-libs/zlib
  78. >=media-libs/harfbuzz-1.4.5:=[icu,graphite]
  79. >=media-libs/libpng-1.2.43-r2:0=
  80. media-libs/gd[png]
  81. media-gfx/graphite2
  82. >=x11-libs/cairo-1.12
  83. >=x11-libs/pixman-0.18
  84. dev-libs/zziplib:=
  85. app-text/libpaper
  86. dev-libs/gmp:0
  87. dev-libs/mpfr:0=
  88. >=dev-libs/ptexenc-1.3.8
  89. xetex? (
  90. >=app-text/teckit-2.5.3
  91. media-libs/fontconfig
  92. )
  93. xindy? ( dev-lisp/clisp:= )
  94. media-libs/freetype:2
  95. >=dev-libs/icu-50:=
  96. >=dev-libs/kpathsea-6.3.2:="
  97. BDEPEND="sys-apps/ed
  98. sys-devel/flex
  99. virtual/pkgconfig"
  100. DEPEND="${COMMON_DEPEND}"
  101. RDEPEND="${COMMON_DEPEND}
  102. >=app-text/ps2pkm-1.8_p20170524
  103. >=app-text/dvipsk-5.997
  104. >=dev-tex/bibtexu-3.71_p20170524
  105. virtual/perl-Getopt-Long
  106. dev-perl/File-HomeDir
  107. dev-perl/Log-Dispatch
  108. dev-perl/Unicode-LineBreak
  109. dev-perl/YAML-Tiny
  110. tk? (
  111. dev-lang/tk
  112. dev-perl/Tk
  113. )"
  114. S="${WORKDIR}/${P}_build"
  115. B="${WORKDIR}/${MY_P}"
  116. src_unpack() {
  117. unpack ${A}
  118. mkdir -p "${S}" || die "failed to create build dir"
  119. }
  120. RELOC_TARGET=texmf-dist
  121. src_prepare() {
  122. cd "${WORKDIR}" || die
  123. mv texlive.tlpdb tlpkg/ || die "failed to move texlive.tlpdb"
  124. # From texlive-module.eclass.
  125. sed -n -e 's:\s*RELOC/::p' tlpkg/tlpobj/* > "${T}/reloclist" || die
  126. sed -e 's/\/[^/]*$//' -e "s:^:${RELOC_TARGET}/:" "${T}/reloclist" |
  127. sort -u |
  128. xargs mkdir -p || die
  129. local i
  130. while read i; do
  131. mv "${i}" "${RELOC_TARGET}/${i%/*}" || die
  132. done < "${T}/reloclist"
  133. mv "${WORKDIR}"/texmf* "${B}" || die "failed to move texmf files"
  134. cd "${B}" || die
  135. sed -i \
  136. -e "s,/usr/include /usr/local/include.*echo \$KPATHSEA_INCLUDES.*,${EPREFIX}/usr/include\"," \
  137. texk/web2c/configure || die
  138. eapply "${WORKDIR}"/patches
  139. default
  140. elibtoolize
  141. }
  142. src_configure() {
  143. # It fails on alpha without this
  144. use alpha && append-ldflags "-Wl,--no-relax"
  145. # Too many regexps use A-Z a-z constructs, what causes problems with locales
  146. # that don't have the same alphabetical order than ascii. Bug #242430
  147. # So we set LC_ALL to C in order to avoid problems.
  148. export LC_ALL=C
  149. # Disable freetype-config as this is considered obsolete.
  150. # Also only pkg-config works for prefix as described in bug #690094
  151. export ac_cv_prog_ac_ct_FT2_CONFIG=no
  152. tc-export CC CXX AR RANLIB
  153. ECONF_SOURCE="${B}" \
  154. econf -C \
  155. --bindir="${EPREFIX}"/usr/bin \
  156. --datadir="${S}" \
  157. --with-system-freetype2 \
  158. --with-system-zlib \
  159. --with-system-libpng \
  160. --with-system-teckit \
  161. --with-teckit-includes="${EPREFIX}"/usr/include/teckit \
  162. --with-system-kpathsea \
  163. --with-kpathsea-includes="${EPREFIX}"/usr/include \
  164. --with-system-icu \
  165. --with-system-ptexenc \
  166. --with-system-harfbuzz \
  167. --with-system-icu \
  168. --with-system-graphite2 \
  169. --with-system-cairo \
  170. --with-system-pixman \
  171. --with-system-zziplib \
  172. --with-system-libpaper \
  173. --with-system-gmp \
  174. --with-system-gd \
  175. --with-system-mpfr \
  176. --without-texinfo \
  177. --disable-dialog \
  178. --disable-multiplatform \
  179. --enable-chktex \
  180. --enable-epsfwin \
  181. --enable-detex \
  182. --enable-dvi2tty \
  183. --enable-mftalkwin \
  184. --enable-regiswin \
  185. --enable-shared \
  186. --enable-tektronixwin \
  187. --enable-unitermwin \
  188. --enable-vlna \
  189. --with-ps=gs \
  190. --disable-psutils \
  191. --disable-t1utils \
  192. --enable-ipc \
  193. --disable-biber \
  194. --disable-bibtex-x \
  195. --disable-dvipng \
  196. --disable-dvipsk \
  197. --disable-lcdf-typetools \
  198. --disable-ps2pk \
  199. --disable-ttf2pk2 \
  200. --disable-tex4htk \
  201. --disable-cjkutils \
  202. --disable-xdvik \
  203. --enable-luatex \
  204. --disable-dvisvgm \
  205. --disable-ps2eps \
  206. --disable-static \
  207. --disable-native-texlive-build \
  208. --disable-largefile \
  209. --disable-build-in-source-tree \
  210. --disable-xindy-docs \
  211. --disable-xindy-rules \
  212. --with-banner-add=" Gentoo Linux" \
  213. $(use_enable luajittex) \
  214. $(use_enable luajittex luajithbtex) \
  215. $(use_enable luajittex mfluajit) \
  216. $(use_enable xetex) \
  217. $(use_enable cjk dviout-util) \
  218. $(use_enable cjk ptex) \
  219. $(use_enable cjk eptex) \
  220. $(use_enable cjk uptex) \
  221. $(use_enable cjk euptex) \
  222. $(use_enable cjk mendexk) \
  223. $(use_enable cjk makejvf) \
  224. $(use_enable cjk pmp) \
  225. $(use_enable cjk upmp) \
  226. $(use_enable tk texdoctk) \
  227. $(use_with X x) \
  228. $(use_enable xindy)
  229. }
  230. src_compile() {
  231. tc-export CC CXX AR RANLIB
  232. emake AR="$(tc-getAR)" SHELL="${EPREFIX}"/bin/sh texmf="${EPREFIX}"${TEXMF_PATH:-/usr/share/texmf-dist}
  233. cd "${B}" || die
  234. # Mimic updmap --syncwithtrees to enable only fonts installed
  235. # Code copied from updmap script
  236. for i in `egrep '^(Mixed|Kanji)?Map' "texmf-dist/web2c/updmap.cfg" | sed 's@.* @@'`; do
  237. texlive-common_is_file_present_in_texmf "${i}" || echo "${i}"
  238. done > "${T}/updmap_update"
  239. {
  240. sed 's@/@\\/@g; s@^@/^MixedMap[ ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
  241. sed 's@/@\\/@g; s@^@/^Map[ ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
  242. sed 's@/@\\/@g; s@^@/^KanjiMap[ ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
  243. } > "${T}/updmap_update2"
  244. sed -f "${T}/updmap_update2" "texmf-dist/web2c/updmap.cfg" > "${T}/updmap_update3"\
  245. && cat "${T}/updmap_update3" > "texmf-dist/web2c/updmap.cfg"
  246. }
  247. src_install() {
  248. dodir ${TEXMF_PATH:-/usr/share/texmf-dist}/web2c
  249. emake DESTDIR="${D}" texmf="${ED}${TEXMF_PATH:-/usr/share/texmf-dist}" run_texlinks="true" run_mktexlsr="true" install
  250. cd "${B}" || die
  251. dodir /usr/share # just in case
  252. cp -pR texmf-dist "${ED}/usr/share/" || die "failed to install texmf trees"
  253. cp -pR "${WORKDIR}"/tlpkg "${ED}/usr/share/" || die "failed to install tlpkg files"
  254. # When X is disabled mf-nowin doesn't exist but some scripts expect it to
  255. # exist. Instead, it is called mf, so we symlink it to please everything.
  256. use X || dosym mf /usr/bin/mf-nowin
  257. docinto texk
  258. cd "${B}/texk" || die
  259. dodoc ChangeLog README
  260. docinto dviljk
  261. cd "${B}/texk/dviljk" || die
  262. dodoc ChangeLog README NEWS
  263. docinto makeindexk
  264. cd "${B}/texk/makeindexk" || die
  265. dodoc ChangeLog NOTES README
  266. docinto web2c
  267. cd "${B}/texk/web2c" || die
  268. dodoc ChangeLog NEWS PROJECTS README
  269. use doc || rm -rf "${ED}/usr/share/texmf-dist/doc"
  270. dodir /etc/env.d
  271. echo 'CONFIG_PROTECT_MASK="/etc/texmf/web2c /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d"' > "${ED}/etc/env.d/98texlive"
  272. # populate /etc/texmf
  273. keepdir /etc/texmf/web2c
  274. # take care of updmap.cfg and language.d files
  275. keepdir /etc/texmf/{updmap.d,language.dat.d,language.def.d,language.dat.lua.d}
  276. mv "${ED}${TEXMF_PATH}/web2c/updmap.cfg" "${ED}/etc/texmf/updmap.d/00updmap.cfg" || die "moving updmap.cfg failed"
  277. # Remove fmtutil.cnf, it will be regenerated from /etc/texmf/fmtutil.d files
  278. # by texmf-update
  279. rm -f "${ED}${TEXMF_PATH}/web2c/fmtutil.cnf" || die
  280. # Remove bundled and invalid updmap.cfg
  281. rm -f "${ED}/usr/share/texmf-dist/web2c/updmap.cfg" || die
  282. texlive-common_handle_config_files
  283. keepdir /usr/share/texmf-site
  284. # the virtex symlink is not installed
  285. # The links has to be relative, since the targets
  286. # is not present at this stage and MacOS doesn't
  287. # like non-existing targets
  288. dosym tex /usr/bin/virtex
  289. dosym pdftex /usr/bin/pdfvirtex
  290. find "${ED}" -name '*.la' -delete || die
  291. }
  292. pkg_postinst() {
  293. etexmf-update
  294. einfo "Regenerating TeX formats"
  295. fmtutil-sys --all &> /dev/null
  296. elog
  297. elog "If you have configuration files in ${EPREFIX}/etc/texmf to merge,"
  298. elog "please update them and run ${EPREFIX}/usr/sbin/texmf-update."
  299. elog
  300. ewarn "If you are migrating from an older TeX distribution"
  301. ewarn "Please make sure you have read:"
  302. ewarn "https://wiki.gentoo.org/wiki/Project:TeX/Tex_Live_Migration_Guide"
  303. ewarn "in order to avoid possible problems"
  304. }