/[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.5
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.5 2008/07/03 21:01:53 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
22texlive-common_handle_config_files() { 29texlive-common_handle_config_files() {
23 # Handle config files properly 30 # Handle config files properly
31 [ -d "${D}${TEXMF_PATH}" ] || return
24 cd "${D}${TEXMF_PATH}" 32 cd "${D}${TEXMF_PATH}"
25 for f in $(find . -name '*.cnf' -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do 33 for f in $(find . -name '*.cnf' -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do
26 if [ "${f#*config}" != "${f}" ] ; then 34 if [ "${f#*config}" != "${f}" ] ; then
27 continue 35 continue
28 fi 36 fi
30 mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed." 38 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} 39 dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f}
32 done 40 done
33} 41}
34 42
35 43# @FUNCTION: texlive-common_is_file_present_in_texmf
44# @DESCRIPTION:
36# Return if a file is present in the texmf tree 45# Return if a file is present in the texmf tree
37# Call it from the directory containing texmf and texmf-dist 46# Call it from the directory containing texmf and texmf-dist
38 47
39texlive-common_is_file_present_in_texmf() { 48texlive-common_is_file_present_in_texmf() {
40 local mark="${T}/$1.found" 49 local mark="${T}/$1.found"
41 find texmf -name $1 -exec touch "${mark}" \; 50 find texmf -name $1 -exec touch "${mark}" \;
42 find texmf-dist -name $1 -exec touch "${mark}" \; 51 find texmf-dist -name $1 -exec touch "${mark}" \;
43 [ -f "${mark}" ] 52 [ -f "${mark}" ]
44} 53}
54
55# @FUNCTION: texlive-common_do_symlinks
56# @USAGE: < src > < dest >
57# @DESCRIPTION:
58# Mimic the install_link function of texlinks
59#
60# Should have the same behavior as the one in /usr/bin/texlinks
61# except that it is under the control of the package manager
62# Note that $1 corresponds to $src and $2 to $dest in this function
63# ( Arguments are switched because texlinks main function sends them switched )
64# This function should not be called from an ebuild, prefer etexlinks that will
65# also do the fmtutil file parsing.
66
67texlive-common_do_symlinks() {
68 while [ $# != 0 ]; do
69 case $1 in
70 cont-??|metafun|mptopdf)
71 elog "Symlink $1 skipped (special case)"
72 ;;
73 *)
74 if [ $1 = $2 ];
75 then
76 elog "Symlink $1 -> $2 skipped"
77 elif [ -e "${D}/usr/bin/$1" ];
78 then
79 elog "Symlink $1 skipped (file exists)"
80 else
81 elog "Making symlink from $1 to $2"
82 dosym $2 /usr/bin/$1
83 fi
84 ;;
85 esac
86 shift; shift;
87 done
88}
89
90# @FUNCTION: etexlinks
91# @USAGE: < file >
92# @DESCRIPTION:
93# Mimic texlinks on a fmtutil format file
94#
95# $1 has to be a fmtutil format file like fmtutil.cnf
96# etexlinks foo will install the symlinks that texlinks --cnffile foo would have
97# created. We cannot use texlinks with portage as it is not DESTDIR aware.
98# (It would not fail but will not create the symlinks if the target is not in
99# the same dir as the source)
100# Also, as this eclass must not depend on a tex distribution to be installed we
101# cannot use texlinks from here.
102
103etexlinks() {
104 # Install symlinks from formats to engines
105 texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}')
106}
107

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

  ViewVC Help
Powered by ViewVC 1.1.20