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

Contents of /eclass/texlive-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Feb 14 09:02:11 2008 UTC (6 years, 5 months ago) by aballier
Branch: MAIN
Changes since 1.3: +20 -4 lines
improve comments of texlive eclasses so that they're ready to get a man page, thanks to mren <bugs@rennings.net>, bug #210049

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
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 cd "${D}${TEXMF_PATH}"
32 for f in $(find . -name '*.cnf' -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do
33 if [ "${f#*config}" != "${f}" ] ; then
34 continue
35 fi
36 dodir /etc/texmf/$(dirname ${f}).d
37 mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed."
38 dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f}
39 done
40 }
41
42 # @FUNCTION: texlive-common_is_file_present_in_texmf
43 # @DESCRIPTION:
44 # Return if a file is present in the texmf tree
45 # Call it from the directory containing texmf and texmf-dist
46
47 texlive-common_is_file_present_in_texmf() {
48 local mark="${T}/$1.found"
49 find texmf -name $1 -exec touch "${mark}" \;
50 find texmf-dist -name $1 -exec touch "${mark}" \;
51 [ -f "${mark}" ]
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
66 texlive-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
102 etexlinks() {
103 # Install symlinks from formats to engines
104 texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}')
105 }

  ViewVC Help
Powered by ViewVC 1.1.20