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

Contents of /eclass/texlive-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Thu Nov 6 19:51:30 2008 UTC (5 years, 10 months ago) by aballier
Branch: MAIN
Changes since 1.8: +5 -3 lines
Change a bit the dobin_texmf_scripts behavior to symlink instead of installing the file twice. That saves a few bits and we can afford it now that we ensure the permissions are preserved when installing the texmf tree.

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.8 2008/10/14 06:42:44 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 mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed."
39 dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f}
40 done
41 }
42
43 # @FUNCTION: texlive-common_is_file_present_in_texmf
44 # @DESCRIPTION:
45 # Return if a file is present in the texmf tree
46 # Call it from the directory containing texmf and texmf-dist
47
48 texlive-common_is_file_present_in_texmf() {
49 local mark="${T}/$1.found"
50 find texmf -name $1 -exec touch "${mark}" \;
51 find texmf-dist -name $1 -exec touch "${mark}" \;
52 [ -f "${mark}" ]
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
67 texlive-common_do_symlinks() {
68 while [ $# != 0 ]; do
69 case $1 in
70 cont-??|metafun|mptopdf)
71 einfo "Symlink $1 skipped (special case)"
72 ;;
73 mf)
74 einfo "Symlink $1 -> $2 skipped (texlive-core takes care of it)"
75 ;;
76 *)
77 if [ $1 = $2 ];
78 then
79 einfo "Symlink $1 -> $2 skipped"
80 elif [ -e "${D}/usr/bin/$1" ];
81 then
82 einfo "Symlink $1 skipped (file exists)"
83 else
84 einfo "Making symlink from $1 to $2"
85 dosym $2 /usr/bin/$1
86 fi
87 ;;
88 esac
89 shift; shift;
90 done
91 }
92
93 # @FUNCTION: etexlinks
94 # @USAGE: < file >
95 # @DESCRIPTION:
96 # Mimic texlinks on a fmtutil format file
97 #
98 # $1 has to be a fmtutil format file like fmtutil.cnf
99 # etexlinks foo will install the symlinks that texlinks --cnffile foo would have
100 # created. We cannot use texlinks with portage as it is not DESTDIR aware.
101 # (It would not fail but will not create the symlinks if the target is not in
102 # the same dir as the source)
103 # Also, as this eclass must not depend on a tex distribution to be installed we
104 # cannot use texlinks from here.
105
106 etexlinks() {
107 # Install symlinks from formats to engines
108 texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}')
109 }
110
111 # @FUNCTION: dobin_texmf_scripts
112 # @USAGE: < file1 file2 ... >
113 # @DESCRIPTION:
114 # Symlinks a script from the texmf tree to /usr/bin. Requires permissions to be
115 # correctly set for the file that it will point to.
116
117 dobin_texmf_scripts() {
118 while [ $# -gt 0 ] ; do
119 local trg=$(basename ${1} | sed 's,\.[^/]*$,,' | tr '[:upper:]' '[:lower:]')
120 einfo "Installing ${1} as ${trg} bin wrapper"
121 dosym ../share/${1} /usr/bin/${trg} || die "failed to install ${1} as $trg"
122 shift
123 done
124 }

  ViewVC Help
Powered by ViewVC 1.1.20