/[gentoo-x86]/eclass/texlive-module.eclass
Gentoo

Diff of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.63 Revision 1.71
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2014 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.63 2012/07/26 16:40:47 aballier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.71 2015/07/30 12:59:09 aballier Exp $
4 4
5# @ECLASS: texlive-module.eclass 5# @ECLASS: texlive-module.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# tex@gentoo.org 7# tex@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
18# texmf and texmf-dist directories to ${WORKDIR} (which is what the default 18# texmf and texmf-dist directories to ${WORKDIR} (which is what the default
19# src_unpack does). 19# src_unpack does).
20# Starting from TeX Live 2009, the eclass provides a src_unpack function taking 20# Starting from TeX Live 2009, the eclass provides a src_unpack function taking
21# care of unpacking and relocating the files that need it. 21# care of unpacking and relocating the files that need it.
22# 22#
23# It inherits texlive-common and base for supporting patching via the PATCHES 23# It inherits texlive-common. Patching is supported via the PATCHES
24# bash array with EAPI>=2. 24# bash array.
25 25
26# @ECLASS-VARIABLE: TEXLIVE_MODULE_CONTENTS 26# @ECLASS-VARIABLE: TEXLIVE_MODULE_CONTENTS
27# @DESCRIPTION: 27# @DESCRIPTION:
28# The list of packages that will be installed. This variable will be expanded to 28# The list of packages that will be installed. This variable will be expanded to
29# SRC_URI: 29# SRC_URI:
43# @DESCRIPTION: 43# @DESCRIPTION:
44# A space separated list of files that are in fact scripts installed in the 44# A space separated list of files that are in fact scripts installed in the
45# texmf tree and that we want to be available directly. They will be installed in 45# texmf tree and that we want to be available directly. They will be installed in
46# /usr/bin. 46# /usr/bin.
47 47
48# @ECLASS-VARIABLE: TEXLIVE_MODULE_BINLINKS
49# @DESCRIPTION:
50# A space separated list of links to add for BINSCRIPTS.
51# The systax is: foo:bar to create a symlink bar -> foo.
52
48# @ECLASS-VARIABLE: TL_PV 53# @ECLASS-VARIABLE: TL_PV
49# @DESCRIPTION: 54# @DESCRIPTION:
50# Normally the module's PV reflects the TeXLive release it belongs to. 55# Normally the module's PV reflects the TeXLive release it belongs to.
51# If this is not the case, TL_PV takes the version number for the 56# If this is not the case, TL_PV takes the version number for the
52# needed app-text/texlive-core. 57# needed app-text/texlive-core.
54# @ECLASS-VARIABLE: TL_MODULE_INFORMATION 59# @ECLASS-VARIABLE: TL_MODULE_INFORMATION
55# @DESCRIPTION: 60# @DESCRIPTION:
56# Information to display about the package. 61# Information to display about the package.
57# e.g. for enabling/disabling a feature 62# e.g. for enabling/disabling a feature
58 63
64# @ECLASS-VARIABLE: PATCHES
65# @DESCRIPTION:
66# Array variable specifying any patches to be applied.
67
59inherit texlive-common base 68inherit texlive-common eutils
69
70case "${EAPI:-0}" in
71 0|1|2)
72 die "EAPI='${EAPI}' is not supported anymore"
73 ;;
74 *)
75 ;;
76esac
60 77
61HOMEPAGE="http://www.tug.org/texlive/" 78HOMEPAGE="http://www.tug.org/texlive/"
62 79
63COMMON_DEPEND=">=app-text/texlive-core-${TL_PV:-${PV}}" 80COMMON_DEPEND=">=app-text/texlive-core-${TL_PV:-${PV}}"
64 81
91 108
92RDEPEND="${COMMON_DEPEND}" 109RDEPEND="${COMMON_DEPEND}"
93 110
94[ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc" 111[ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc"
95 112
113# @ECLASS-VARIABLE: TEXLIVE_MODULE_OPTIONAL_ENGINE
114# @DESCRIPTION:
115# A space separated list of Tex engines that can be made optional.
116# e.g. "luatex luajittex"
117
118if [ -n "${TEXLIVE_MODULE_OPTIONAL_ENGINE}" ] ; then
119 for engine in ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ; do
120 IUSE="${IUSE} +${engine}"
121 done
122fi
123
96S="${WORKDIR}" 124S="${WORKDIR}"
97 125
98# @FUNCTION: texlive-module_src_unpack 126# @FUNCTION: texlive-module_src_unpack
99# @DESCRIPTION: 127# @DESCRIPTION:
100# Only for TeX Live 2009 and later. 128# Only for TeX Live 2009 and later.
101# Gives tar.xz unpack support until we can use an EAPI with that support.
102# If EAPI supports tar.xz then it calls unpack instead of its own unpacker.
103# After unpacking, the files that need to be relocated are moved accordingly. 129# After unpacking, the files that need to be relocated are moved accordingly.
104 130
105RELOC_TARGET=texmf-dist 131RELOC_TARGET=texmf-dist
106 132
107texlive-module_src_unpack() { 133texlive-module_src_unpack() {
108 if has "${EAPI:-0}" 0 1 2 ; then
109 local i s
110 # Avoid installing world writable files
111 # Bugs #309997, #310039, #338881
112 umask 022
113 for i in ${A}
114 do
115 s="${DISTDIR%/}/${i}"
116 einfo "Unpacking ${s} to ${PWD}"
117 test -s "${s}" || die "${s} does not exist"
118 xz -dc -- "${s}" | tar xof - || die "Unpacking ${s} failed"
119 done
120 else
121 unpack ${A} 134 unpack ${A}
122 fi
123 135
124 grep RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist" 136 grep RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist"
125 { for i in $(<"${T}/reloclist"); do dirname $i; done; } | uniq > "${T}/dirlist" 137 { for i in $(<"${T}/reloclist"); do dirname $i; done; } | uniq > "${T}/dirlist"
126 for i in $(<"${T}/dirlist"); do 138 for i in $(<"${T}/dirlist"); do
127 [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}" 139 [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}"
129 for i in $(<"${T}/reloclist"); do 141 for i in $(<"${T}/reloclist"); do
130 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})" 142 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})"
131 done 143 done
132} 144}
133 145
146# @FUNCTION: texlive-module_src_prepare
147# @DESCRIPTION:
148# Apply patches from the PATCHES array and user patches, if any.
149
150texlive-module_src_prepare() {
151 [[ ${#PATCHES[@]} -gt 0 ]] && epatch "${PATCHES[@]}"
152 epatch_user
153}
154
134# @FUNCTION: texlive-module_add_format 155# @FUNCTION: texlive-module_add_format
135# @DESCRIPTION: 156# @DESCRIPTION:
136# Creates/appends to a format.${PN}.cnf file for fmtutil. 157# Creates/appends to a format.${PN}.cnf file for fmtutil.
137# It parses the AddFormat directive of tlpobj files to create it. 158# It parses the AddFormat directive of tlpobj files to create it.
138# This will make fmtutil generate the formats when asked and allow the remaining 159# This will make fmtutil generate the formats when asked and allow the remaining
140 161
141texlive-module_add_format() { 162texlive-module_add_format() {
142 local name engine mode patterns options 163 local name engine mode patterns options
143 eval $@ 164 eval $@
144 einfo "Appending to format.${PN}.cnf for $@" 165 einfo "Appending to format.${PN}.cnf for $@"
145 [ -d texmf/fmtutil ] || mkdir -p texmf/fmtutil 166 [ -d texmf-dist/fmtutil ] || mkdir -p texmf-dist/fmtutil
146 [ -f texmf/fmtutil/format.${PN}.cnf ] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf/fmtutil/format.${PN}.cnf; } 167 [ -f texmf-dist/fmtutil/format.${PN}.cnf ] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf-dist/fmtutil/format.${PN}.cnf; }
168 [ -n "${TEXLIVE_MODULE_OPTIONAL_ENGINE}" ] && has ${engine} ${TEXLIVE_MODULE_OPTIONAL_ENGINE} && use !${engine} && mode="disabled"
147 if [ "${mode}" = "disabled" ]; then 169 if [ "${mode}" = "disabled" ]; then
148 printf "#! " >> texmf/fmtutil/format.${PN}.cnf 170 printf "#! " >> texmf-dist/fmtutil/format.${PN}.cnf
149 fi 171 fi
150 [ -z "${patterns}" ] && patterns="-" 172 [ -z "${patterns}" ] && patterns="-"
151 printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf/fmtutil/format.${PN}.cnf 173 printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf-dist/fmtutil/format.${PN}.cnf
152} 174}
153 175
154# @FUNCTION: texlive-module_make_language_def_lines 176# @FUNCTION: texlive-module_make_language_def_lines
155# @DESCRIPTION: 177# @DESCRIPTION:
156# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d. 178# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d.
202 done 224 done
203} 225}
204 226
205# @FUNCTION: texlive-module_make_language_lua_lines 227# @FUNCTION: texlive-module_make_language_lua_lines
206# @DESCRIPTION: 228# @DESCRIPTION:
207# Only valid for TeXLive 2010. 229# Only valid for TeXLive 2010 and later.
208# Creates a language.${PN}.dat.lua entry to put in 230# Creates a language.${PN}.dat.lua entry to put in
209# /etc/texmf/language.dat.lua.d. 231# /etc/texmf/language.dat.lua.d.
210# It parses the AddHyphen directive of tlpobj files to create it. 232# It parses the AddHyphen directive of tlpobj files to create it.
211 233
212texlive-module_make_language_lua_lines() { 234texlive-module_make_language_lua_lines() {
277 die "No rule to proccess ${command}. Please file a bug." 299 die "No rule to proccess ${command}. Please file a bug."
278 esac 300 esac
279 done 301 done
280 302
281 # Build format files 303 # Build format files
282 for i in texmf/fmtutil/format*.cnf; do 304 for i in texmf-dist/fmtutil/format*.cnf; do
283 if [ -f "${i}" ]; then 305 if [ -f "${i}" ]; then
284 einfo "Building format ${i}" 306 einfo "Building format ${i}"
307 [ -d texmf-var ] || mkdir texmf-var
308 [ -d texmf-var/web2c ] || mkdir texmf-var/web2c
285 VARTEXFONTS="${T}/fonts" TEXMFHOME="${S}/texmf:${S}/texmf-dist:${S}/texmf-var"\ 309 VARTEXFONTS="${T}/fonts" TEXMFHOME="${S}/texmf:${S}/texmf-dist:${S}/texmf-var"\
286 env -u TEXINPUTS fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\ 310 env -u TEXINPUTS fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
287 || die "failed to build format ${i}" 311 || die "failed to build format ${i}"
288 fi 312 fi
289 done 313 done
297# @DESCRIPTION: 321# @DESCRIPTION:
298# exported function: 322# exported function:
299# Installs texmf and config files to the system. 323# Installs texmf and config files to the system.
300 324
301texlive-module_src_install() { 325texlive-module_src_install() {
302 for i in texmf/fmtutil/format*.cnf; do 326 for i in texmf-dist/fmtutil/format*.cnf; do
303 [ -f "${i}" ] && etexlinks "${i}" 327 [ -f "${i}" ] && etexlinks "${i}"
304 done 328 done
305 329
306 dodir /usr/share 330 dodir /usr/share
307 if [ -z "${PN##*documentation*}" ] || use doc; then 331 if [ -z "${PN##*documentation*}" ] || use doc; then
308 [ -d texmf-doc ] && cp -pR texmf-doc "${D}/usr/share/" 332 [ -d texmf-doc ] && cp -pR texmf-doc "${ED}/usr/share/"
309 else 333 else
310 [ -d texmf/doc ] && rm -rf texmf/doc 334 [ -d texmf/doc ] && rm -rf texmf/doc
311 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc 335 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
312 fi 336 fi
313 337
314 [ -d texmf ] && cp -pR texmf "${D}/usr/share/" 338 [ -d texmf ] && cp -pR texmf "${ED}/usr/share/"
315 [ -d texmf-dist ] && cp -pR texmf-dist "${D}/usr/share/" 339 [ -d texmf-dist ] && cp -pR texmf-dist "${ED}/usr/share/"
316 [ -d tlpkg ] && use source && cp -pR tlpkg "${D}/usr/share/" 340 [ -d tlpkg ] && use source && cp -pR tlpkg "${ED}/usr/share/"
317 341
318 insinto /var/lib/texmf 342 insinto /var/lib/texmf
319 [ -d texmf-var ] && doins -r texmf-var/* 343 [ -d texmf-var ] && doins -r texmf-var/*
320 344
321 insinto /etc/texmf/updmap.d 345 insinto /etc/texmf/updmap.d
339 insinto /etc/texmf/language.dat.lua.d 363 insinto /etc/texmf/language.dat.lua.d
340 doins "${S}/language.${PN}.dat.lua" 364 doins "${S}/language.${PN}.dat.lua"
341 fi 365 fi
342 366
343 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS} 367 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
368 if [ -n "${TEXLIVE_MODULE_BINLINKS}" ] ; then
369 for i in ${TEXLIVE_MODULE_BINLINKS} ; do
370 [ -f "${ED}/usr/bin/${i%:*}" ] || die "Trying to install an invalid BINLINK. This should not happen. Please file a bug."
371 dosym ${i%:*} /usr/bin/${i#*:}
372 done
373 fi
344 374
345 texlive-common_handle_config_files 375 texlive-common_handle_config_files
376 TEXMF_PATH=${TEXMF_DIST_PATH} texlive-common_handle_config_files
346} 377}
347 378
348# @FUNCTION: texlive-module_pkg_postinst 379# @FUNCTION: texlive-module_pkg_postinst
349# @DESCRIPTION: 380# @DESCRIPTION:
350# exported function: 381# exported function:
364 395
365texlive-module_pkg_postrm() { 396texlive-module_pkg_postrm() {
366 etexmf-update 397 etexmf-update
367} 398}
368 399
369EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm 400EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install \
401 pkg_postinst pkg_postrm

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.71

  ViewVC Help
Powered by ViewVC 1.1.20