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

Contents of /eclass/texlive-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Fri Jan 8 15:19:20 2010 UTC (4 years, 8 months ago) by aballier
Branch: MAIN
Changes since 1.9: +2 -1 lines
Add an einfo when moving config files

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

  ViewVC Help
Powered by ViewVC 1.1.20