| 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.3 2007/11/06 23:34:43 aballier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/texlive-common.eclass,v 1.4 2008/02/14 09:02:11 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 | |
| 13 | TEXMF_PATH=/usr/share/texmf |
18 | TEXMF_PATH=/usr/share/texmf |
| 14 | TEXMF_DIST_PATH=/usr/share/texmf-dist |
19 | TEXMF_DIST_PATH=/usr/share/texmf-dist |
| 15 | TEXMF_VAR_PATH=/var/lib/texmf |
20 | TEXMF_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 | |
| … | |
… | |
| 30 | mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed." |
37 | 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} |
38 | dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f} |
| 32 | done |
39 | done |
| 33 | } |
40 | } |
| 34 | |
41 | |
| 35 | |
42 | # @FUNCTION: texlive-common_is_file_present_in_texmf |
|
|
43 | # @DESCRIPTION: |
| 36 | # Return if a file is present in the texmf tree |
44 | # Return if a file is present in the texmf tree |
| 37 | # Call it from the directory containing texmf and texmf-dist |
45 | # Call it from the directory containing texmf and texmf-dist |
| 38 | |
46 | |
| 39 | texlive-common_is_file_present_in_texmf() { |
47 | texlive-common_is_file_present_in_texmf() { |
| 40 | local mark="${T}/$1.found" |
48 | local mark="${T}/$1.found" |
| 41 | find texmf -name $1 -exec touch "${mark}" \; |
49 | find texmf -name $1 -exec touch "${mark}" \; |
| 42 | find texmf-dist -name $1 -exec touch "${mark}" \; |
50 | find texmf-dist -name $1 -exec touch "${mark}" \; |
| 43 | [ -f "${mark}" ] |
51 | [ -f "${mark}" ] |
| 44 | } |
52 | } |
| 45 | |
53 | |
|
|
54 | # @FUNCTION: texlive-common_do_symlinks |
|
|
55 | # @USAGE: < src > < dest > |
|
|
56 | # @DESCRIPTION: |
| 46 | # Mimic the install_link function of texlinks |
57 | # Mimic the install_link function of texlinks |
|
|
58 | # |
| 47 | # Should have the same behavior as the one in /usr/bin/texlinks |
59 | # Should have the same behavior as the one in /usr/bin/texlinks |
| 48 | # except that it is under the control of the package manager |
60 | # 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 |
61 | # Note that $1 corresponds to $src and $2 to $dest in this function |
| 50 | # ( Arguments are switched because texlinks main function sends them switched ) |
62 | # ( Arguments are switched because texlinks main function sends them switched ) |
| 51 | # This function should not be called from an ebuild, prefer etexlinks that will |
63 | # This function should not be called from an ebuild, prefer etexlinks that will |
| … | |
… | |
| 72 | esac |
84 | esac |
| 73 | shift; shift; |
85 | shift; shift; |
| 74 | done |
86 | done |
| 75 | } |
87 | } |
| 76 | |
88 | |
|
|
89 | # @FUNCTION: etexlinks |
|
|
90 | # @USAGE: < file > |
|
|
91 | # @DESCRIPTION: |
| 77 | # Mimic texlinks on a fmtutil format file |
92 | # Mimic texlinks on a fmtutil format file |
|
|
93 | # |
| 78 | # $1 has to be a fmtutil format file like fmtutil.cnf |
94 | # $1 has to be a fmtutil format file like fmtutil.cnf |
| 79 | # etexlinks foo will install the symlinks that texlinks --cnffile foo would have |
95 | # 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. |
96 | # 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 |
97 | # (It would not fail but will not create the symlinks if the target is not in |
| 82 | # the same dir as the source) |
98 | # the same dir as the source) |