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

Contents of /eclass/texlive-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sat Oct 20 12:51:25 2007 UTC (6 years, 10 months ago) by aballier
Branch: MAIN
Changes since 1.1: +47 -1 lines
add etexlinks helper function, use it for installing modules, bug #196246

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

  ViewVC Help
Powered by ViewVC 1.1.20