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

Diff of /eclass/texlive-common.eclass

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

Revision 1.1 Revision 1.4
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2008 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-common.eclass,v 1.1 2007/10/14 07:44:09 aballier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-common.eclass,v 1.4 2008/02/14 09:02:11 aballier Exp $
4 4
5# @ECLASS: texlive-common.eclass
6# @MAINTAINER:
7# tex@gentoo.org
5# 8#
6# Original Author: Alexis Ballier <aballier@gentoo.org> 9# Original Author: Alexis Ballier <aballier@gentoo.org>
10# @BLURB: Provide various functions used by both texlive-core and texlive modules
11# @DESCRIPTION:
7# Purpose: Provide various functions used by both texlive-core and texlive 12# Purpose: Provide various functions used by both texlive-core and texlive
8# modules. 13# modules.
14#
9# Note that this eclass *must* not assume the presence of any standard tex tool 15# Note that this eclass *must* not assume the presence of any standard tex tool
10#
11 16
12 17
13TEXMF_PATH=/usr/share/texmf 18TEXMF_PATH=/usr/share/texmf
14TEXMF_DIST_PATH=/usr/share/texmf-dist 19TEXMF_DIST_PATH=/usr/share/texmf-dist
15TEXMF_VAR_PATH=/usr/share/texmf-var 20TEXMF_VAR_PATH=/var/lib/texmf
16 21
22# @FUNCTION: texlive-common_handle_config_files
23# @DESCRIPTION:
17# Has to be called in src_install after having installed the files in ${D} 24# Has to be called in src_install after having installed the files in ${D}
18# This function will move the relevant files to /etc/texmf and symling them 25# This function will move the relevant files to /etc/texmf and symling them
19# from their original location. This is to allow easy update of texlive's 26# from their original location. This is to allow easy update of texlive's
20# configuration 27# configuration
21 28
30 mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed." 37 mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed."
31 dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f} 38 dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f}
32 done 39 done
33} 40}
34 41
35 42# @FUNCTION: texlive-common_is_file_present_in_texmf
43# @DESCRIPTION:
36# Return if a file is present in the texmf tree 44# Return if a file is present in the texmf tree
37# Call it from the directory containing texmf and texmf-dist 45# Call it from the directory containing texmf and texmf-dist
38 46
39texlive-common_is_file_present_in_texmf() { 47texlive-common_is_file_present_in_texmf() {
40 local mark="${T}/$1.found" 48 local mark="${T}/$1.found"
41 find texmf -name $1 -exec touch "${mark}" \; 49 find texmf -name $1 -exec touch "${mark}" \;
42 find texmf-dist -name $1 -exec touch "${mark}" \; 50 find texmf-dist -name $1 -exec touch "${mark}" \;
43 [ -f "${mark}" ] 51 [ -f "${mark}" ]
44} 52}
53
54# @FUNCTION: texlive-common_do_symlinks
55# @USAGE: < src > < dest >
56# @DESCRIPTION:
57# Mimic the install_link function of texlinks
58#
59# Should have the same behavior as the one in /usr/bin/texlinks
60# except that it is under the control of the package manager
61# Note that $1 corresponds to $src and $2 to $dest in this function
62# ( Arguments are switched because texlinks main function sends them switched )
63# This function should not be called from an ebuild, prefer etexlinks that will
64# also do the fmtutil file parsing.
65
66texlive-common_do_symlinks() {
67 while [ $# != 0 ]; do
68 case $1 in
69 cont-??|metafun|mptopdf)
70 elog "Symlink $1 skipped (special case)"
71 ;;
72 *)
73 if [ $1 = $2 ];
74 then
75 elog "Symlink $1 -> $2 skipped"
76 elif [ -e "${D}/usr/bin/$1" ];
77 then
78 elog "Symlink $1 skipped (file exists)"
79 else
80 elog "Making symlink from $1 to $2"
81 dosym $2 /usr/bin/$1
82 fi
83 ;;
84 esac
85 shift; shift;
86 done
87}
88
89# @FUNCTION: etexlinks
90# @USAGE: < file >
91# @DESCRIPTION:
92# Mimic texlinks on a fmtutil format file
93#
94# $1 has to be a fmtutil format file like fmtutil.cnf
95# etexlinks foo will install the symlinks that texlinks --cnffile foo would have
96# created. We cannot use texlinks with portage as it is not DESTDIR aware.
97# (It would not fail but will not create the symlinks if the target is not in
98# the same dir as the source)
99# Also, as this eclass must not depend on a tex distribution to be installed we
100# cannot use texlinks from here.
101
102etexlinks() {
103 # Install symlinks from formats to engines
104 texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}')
105}
106

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.20