/[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.68
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.68 2014/03/09 18:54:44 ulm 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
96S="${WORKDIR}" 113S="${WORKDIR}"
97 114
98# @FUNCTION: texlive-module_src_unpack 115# @FUNCTION: texlive-module_src_unpack
99# @DESCRIPTION: 116# @DESCRIPTION:
100# Only for TeX Live 2009 and later. 117# 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. 118# After unpacking, the files that need to be relocated are moved accordingly.
104 119
105RELOC_TARGET=texmf-dist 120RELOC_TARGET=texmf-dist
106 121
107texlive-module_src_unpack() { 122texlive-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} 123 unpack ${A}
122 fi
123 124
124 grep RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist" 125 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" 126 { for i in $(<"${T}/reloclist"); do dirname $i; done; } | uniq > "${T}/dirlist"
126 for i in $(<"${T}/dirlist"); do 127 for i in $(<"${T}/dirlist"); do
127 [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}" 128 [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}"
129 for i in $(<"${T}/reloclist"); do 130 for i in $(<"${T}/reloclist"); do
130 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})" 131 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})"
131 done 132 done
132} 133}
133 134
135# @FUNCTION: texlive-module_src_prepare
136# @DESCRIPTION:
137# Apply patches from the PATCHES array and user patches, if any.
138
139texlive-module_src_prepare() {
140 [[ ${#PATCHES[@]} -gt 0 ]] && epatch "${PATCHES[@]}"
141 epatch_user
142}
143
134# @FUNCTION: texlive-module_add_format 144# @FUNCTION: texlive-module_add_format
135# @DESCRIPTION: 145# @DESCRIPTION:
136# Creates/appends to a format.${PN}.cnf file for fmtutil. 146# Creates/appends to a format.${PN}.cnf file for fmtutil.
137# It parses the AddFormat directive of tlpobj files to create it. 147# 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 148# This will make fmtutil generate the formats when asked and allow the remaining
140 150
141texlive-module_add_format() { 151texlive-module_add_format() {
142 local name engine mode patterns options 152 local name engine mode patterns options
143 eval $@ 153 eval $@
144 einfo "Appending to format.${PN}.cnf for $@" 154 einfo "Appending to format.${PN}.cnf for $@"
145 [ -d texmf/fmtutil ] || mkdir -p texmf/fmtutil 155 [ -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; } 156 [ -f texmf-dist/fmtutil/format.${PN}.cnf ] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf-dist/fmtutil/format.${PN}.cnf; }
147 if [ "${mode}" = "disabled" ]; then 157 if [ "${mode}" = "disabled" ]; then
148 printf "#! " >> texmf/fmtutil/format.${PN}.cnf 158 printf "#! " >> texmf-dist/fmtutil/format.${PN}.cnf
149 fi 159 fi
150 [ -z "${patterns}" ] && patterns="-" 160 [ -z "${patterns}" ] && patterns="-"
151 printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf/fmtutil/format.${PN}.cnf 161 printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf-dist/fmtutil/format.${PN}.cnf
152} 162}
153 163
154# @FUNCTION: texlive-module_make_language_def_lines 164# @FUNCTION: texlive-module_make_language_def_lines
155# @DESCRIPTION: 165# @DESCRIPTION:
156# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d. 166# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d.
277 die "No rule to proccess ${command}. Please file a bug." 287 die "No rule to proccess ${command}. Please file a bug."
278 esac 288 esac
279 done 289 done
280 290
281 # Build format files 291 # Build format files
282 for i in texmf/fmtutil/format*.cnf; do 292 for i in texmf-dist/fmtutil/format*.cnf; do
283 if [ -f "${i}" ]; then 293 if [ -f "${i}" ]; then
284 einfo "Building format ${i}" 294 einfo "Building format ${i}"
295 [ -d texmf-var ] || mkdir texmf-var
296 [ -d texmf-var/web2c ] || mkdir texmf-var/web2c
285 VARTEXFONTS="${T}/fonts" TEXMFHOME="${S}/texmf:${S}/texmf-dist:${S}/texmf-var"\ 297 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\ 298 env -u TEXINPUTS fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
287 || die "failed to build format ${i}" 299 || die "failed to build format ${i}"
288 fi 300 fi
289 done 301 done
297# @DESCRIPTION: 309# @DESCRIPTION:
298# exported function: 310# exported function:
299# Installs texmf and config files to the system. 311# Installs texmf and config files to the system.
300 312
301texlive-module_src_install() { 313texlive-module_src_install() {
302 for i in texmf/fmtutil/format*.cnf; do 314 for i in texmf-dist/fmtutil/format*.cnf; do
303 [ -f "${i}" ] && etexlinks "${i}" 315 [ -f "${i}" ] && etexlinks "${i}"
304 done 316 done
305 317
306 dodir /usr/share 318 dodir /usr/share
307 if [ -z "${PN##*documentation*}" ] || use doc; then 319 if [ -z "${PN##*documentation*}" ] || use doc; then
308 [ -d texmf-doc ] && cp -pR texmf-doc "${D}/usr/share/" 320 [ -d texmf-doc ] && cp -pR texmf-doc "${ED}/usr/share/"
309 else 321 else
310 [ -d texmf/doc ] && rm -rf texmf/doc 322 [ -d texmf/doc ] && rm -rf texmf/doc
311 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc 323 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
312 fi 324 fi
313 325
314 [ -d texmf ] && cp -pR texmf "${D}/usr/share/" 326 [ -d texmf ] && cp -pR texmf "${ED}/usr/share/"
315 [ -d texmf-dist ] && cp -pR texmf-dist "${D}/usr/share/" 327 [ -d texmf-dist ] && cp -pR texmf-dist "${ED}/usr/share/"
316 [ -d tlpkg ] && use source && cp -pR tlpkg "${D}/usr/share/" 328 [ -d tlpkg ] && use source && cp -pR tlpkg "${ED}/usr/share/"
317 329
318 insinto /var/lib/texmf 330 insinto /var/lib/texmf
319 [ -d texmf-var ] && doins -r texmf-var/* 331 [ -d texmf-var ] && doins -r texmf-var/*
320 332
321 insinto /etc/texmf/updmap.d 333 insinto /etc/texmf/updmap.d
339 insinto /etc/texmf/language.dat.lua.d 351 insinto /etc/texmf/language.dat.lua.d
340 doins "${S}/language.${PN}.dat.lua" 352 doins "${S}/language.${PN}.dat.lua"
341 fi 353 fi
342 354
343 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS} 355 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
356 if [ -n "${TEXLIVE_MODULE_BINLINKS}" ] ; then
357 for i in ${TEXLIVE_MODULE_BINLINKS} ; do
358 [ -f "${ED}/usr/bin/${i%:*}" ] || die "Trying to install an invalid BINLINK. This should not happen. Please file a bug."
359 dosym ${i%:*} /usr/bin/${i#*:}
360 done
361 fi
344 362
345 texlive-common_handle_config_files 363 texlive-common_handle_config_files
364 TEXMF_PATH=${TEXMF_DIST_PATH} texlive-common_handle_config_files
346} 365}
347 366
348# @FUNCTION: texlive-module_pkg_postinst 367# @FUNCTION: texlive-module_pkg_postinst
349# @DESCRIPTION: 368# @DESCRIPTION:
350# exported function: 369# exported function:
364 383
365texlive-module_pkg_postrm() { 384texlive-module_pkg_postrm() {
366 etexmf-update 385 etexmf-update
367} 386}
368 387
369EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm 388EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install \
389 pkg_postinst pkg_postrm

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

  ViewVC Help
Powered by ViewVC 1.1.20