1 |
use 5.006; |
use 5.006; |
2 |
use ExtUtils::MakeMaker; |
use ExtUtils::MakeMaker; |
3 |
|
|
4 |
|
my $prefix; # for use in constants and postamble |
5 |
|
|
6 |
# See lib/ExtUtils/MakeMaker.pm for details of how to influence |
# See lib/ExtUtils/MakeMaker.pm for details of how to influence |
7 |
# the contents of the Makefile that is written. |
# the contents of the Makefile that is written. |
8 |
WriteMakefile( |
WriteMakefile( |
15 |
AUTHOR => 'Thomas M. Widmann <twid@cpan.org>') : ()), |
AUTHOR => 'Thomas M. Widmann <twid@cpan.org>') : ()), |
16 |
); |
); |
17 |
|
|
|
# set up path to let us install in TEXMF tree |
|
18 |
package MY; |
package MY; |
|
sub pasthru { |
|
|
chomp(my $inherited = shift->SUPER::pasthru(@_)); |
|
19 |
|
|
20 |
# we might want to test for $PREFIX, too! |
# we don't modify anything, but we have to find out what the |
21 |
|
# installation prefix is -- is there any direct way? |
22 |
|
sub constants { |
23 |
|
my $inherited = shift->SUPER::constants(@_); |
24 |
|
$inherited =~ /PREFIX = (.*)/ and $prefix = $1; |
25 |
|
return $inherited; |
26 |
|
} |
27 |
|
|
28 |
chomp(my $dir = `kpsewhich --expand-var=\'\$TEXMFLOCAL\'`); |
sub postamble { |
29 |
unless (-e $dir) { |
my $dir; |
30 |
chomp($dir = `kpsewhich --expand-var=\'\$TEXMFMAIN\'`); |
if ($prefix =~ /^\/usr/) { |
31 |
|
# probably installing centrally |
32 |
|
chomp($dir = `kpsewhich --expand-var=\'\$TEXMFLOCAL\'`); |
33 |
|
unless (-e $dir) { |
34 |
|
chomp($dir = `kpsewhich --expand-var=\'\$TEXMFMAIN\'`); |
35 |
|
} |
36 |
|
} else { |
37 |
|
# probably installing in user's home directory |
38 |
|
chomp($dir = `kpsewhich --expand-var=\'\$HOMETEXMF\'`); |
39 |
} |
} |
40 |
return $inherited |
|
41 |
. "\\\n TEXMF=$dir\n" |
# plain cp will fail if the directory doesn't exist |
42 |
|
# -- which command should be used instead? |
43 |
|
return <<"EOF"; |
44 |
|
install:: |
45 |
|
\@echo Now updating the TEXMF tree... |
46 |
|
cp BibTeX/bib2xml.bst $dir/bibtex/bst/misc/ |
47 |
|
cp LaTeX/bibulus.sty $dir/tex/latex/misc/ |
48 |
|
mktexlsr |
49 |
|
|
50 |
|
EOF |
51 |
} |
} |