diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-04-04 13:25:10 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-04-04 13:25:10 +0000 |
commit | 219d8e5ef3186a2e4847b387fc616c46065859ce (patch) | |
tree | 0a826123bcc1bdc3afffad5fdf84a2a597183ab7 /Build | |
parent | d802be47b9863cecbe42225e9fb2cfd3cf946dcb (diff) |
install updmap.pl as linked script for both win32 and unix
git-svn-id: svn://tug.org/texlive/trunk@21958 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/tetex/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/tetex/Makefile.am | 47 | ||||
-rw-r--r-- | Build/source/texk/tetex/Makefile.in | 202 | ||||
-rwxr-xr-x | Build/source/texk/tetex/updmap-sys.sh (renamed from Build/source/texk/tetex/updmap-sys) | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | Build/source/texk/tetex/updmap.pl | 893 |
5 files changed, 670 insertions, 478 deletions
diff --git a/Build/source/texk/tetex/ChangeLog b/Build/source/texk/tetex/ChangeLog index 0c6a6286e56..eede1fea1ba 100644 --- a/Build/source/texk/tetex/ChangeLog +++ b/Build/source/texk/tetex/ChangeLog @@ -1,3 +1,9 @@ +2011-04-04 Peter Breitenlohner <peb@mppmu.mpg.de> + + Rename updmap-sys => updmap-sys.sh. + * Makefile.am: Install updmap and updmap-sys as linked scripts + and use the ../am/script_links.am fragment. + 2011-02-08 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am: Use ../am/man1_links.am for manpage links. diff --git a/Build/source/texk/tetex/Makefile.am b/Build/source/texk/tetex/Makefile.am index b25ae06284a..bcbd8385631 100644 --- a/Build/source/texk/tetex/Makefile.am +++ b/Build/source/texk/tetex/Makefile.am @@ -5,7 +5,13 @@ ## ACLOCAL_AMFLAGS = -I ../../m4 +perl_scripts = \ + updmap + shell_scripts = \ + updmap-sys + +sh_scripts = \ allcm \ allneeded \ dvi2fax \ @@ -22,28 +28,21 @@ shell_scripts = \ texconfig \ texconfig-dialog \ texconfig-sys \ - texlinks \ - updmap \ - updmap-sys + texlinks + +scriptsdir = texmf/scripts/tetex +nodist_bin_SCRIPTS = + +include $(srcdir)/../am/script_links.am -## Handled as alias by runscript.tlu -win32_aliases = \ - fontinst.exe - -if WIN32 -if WIN32_WRAP -## We treat the WIN32 aliases as SCRIPTS to avoid automatic build rules -nodist_bin_SCRIPTS = $(win32_aliases) -runscript = $(srcdir)/../texlive/w32_wrapper/runscript.exe -$(win32_aliases): $(runscript) - $(LN_S) $(runscript) $@ -endif WIN32_WRAP -else !WIN32 -nodist_bin_SCRIPTS = $(shell_scripts) +texmfdir = ${prefix}/$(scriptsdir) +dist_texmf_SCRIPTS = $(perl_scripts:=.pl) $(shell_scripts:=.sh) + +if !WIN32 +dist_bin_SCRIPTS = $(sh_scripts) endif !WIN32 -EXTRA_DIST = $(shell_scripts) -CLEANFILES = $(win32_aliases) +CLEANFILES = $(nodist_bin_SCRIPTS) dist_man1_MANS = \ allcm.man \ @@ -104,6 +103,8 @@ man1_links = $(bin_links) \ include $(top_srcdir)/../am/man1_links.am +install-data-hook: install-perl-links install-shell-links install-man1-links + install-exec-hook: if !WIN32 @cd $(DESTDIR)$(bindir) && \ @@ -116,9 +117,7 @@ if !WIN32 done endif !WIN32 -install-data-hook: install-man1-links - -uninstall-hook: uninstall-man1-links +uninstall-hook: uninstall-links uninstall-man1-links if !WIN32 @for s in $(bin_links); do \ link=`echo $$s | sed 's,.*:,,'`; \ @@ -126,14 +125,14 @@ if !WIN32 done endif !WIN32 -EXTRA_DIST += \ +EXTRA_DIST = \ README.texdoctk ## Not used ## EXTRA_DIST += \ fontinst.bat \ - updmap.pl + updmap ## ## This target is invoked by the top-level make, diff --git a/Build/source/texk/tetex/Makefile.in b/Build/source/texk/tetex/Makefile.in index 8ca3ed8340f..eb8aa1a8136 100644 --- a/Build/source/texk/tetex/Makefile.in +++ b/Build/source/texk/tetex/Makefile.in @@ -33,18 +33,20 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -DIST_COMMON = $(am__configure_deps) $(dist_man1_MANS) \ - $(dist_man5_MANS) $(dist_texconfig_DATA) \ - $(dist_texconfig_SCRIPTS) $(dist_web2c_DATA) \ - $(nobase_dist_texconf_DATA) \ +DIST_COMMON = $(am__configure_deps) $(am__dist_bin_SCRIPTS_DIST) \ + $(dist_man1_MANS) $(dist_man5_MANS) $(dist_texconfig_DATA) \ + $(dist_texconfig_SCRIPTS) $(dist_texmf_SCRIPTS) \ + $(dist_web2c_DATA) $(nobase_dist_texconf_DATA) \ $(srcdir)/../../build-aux/install-sh \ - $(srcdir)/../../build-aux/missing $(srcdir)/Makefile.am \ + $(srcdir)/../../build-aux/missing \ + $(srcdir)/../am/script_links.am $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/../am/man1_links.am \ $(top_srcdir)/configure ../../build-aux/config.guess \ ../../build-aux/config.sub ../../build-aux/depcomp \ ../../build-aux/install-sh ../../build-aux/ltmain.sh \ ../../build-aux/missing ../../build-aux/texinfo.tex \ ../../build-aux/ylwrap ChangeLog +@WIN32_TRUE@@WIN32_WRAP_TRUE@am__append_1 = $(wrappers) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-win32.m4 \ @@ -56,6 +58,10 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +am__dist_bin_SCRIPTS_DIST = allcm allneeded dvi2fax dvired fmtutil \ + fmtutil-sys fontinst kpsetool kpsewhere ps2frag pslatex \ + rubibtex rumakeindex texconfig texconfig-dialog texconfig-sys \ + texlinks am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -77,11 +83,13 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(texconfigdir)" "$(DESTDIR)$(bindir)" \ +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(texconfigdir)" \ + "$(DESTDIR)$(texmfdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" \ "$(DESTDIR)$(texconfigdir)" "$(DESTDIR)$(web2cdir)" \ "$(DESTDIR)$(texconfdir)" -SCRIPTS = $(dist_texconfig_SCRIPTS) $(nodist_bin_SCRIPTS) +SCRIPTS = $(dist_bin_SCRIPTS) $(dist_texconfig_SCRIPTS) \ + $(dist_texmf_SCRIPTS) $(nodist_bin_SCRIPTS) SOURCES = DIST_SOURCES = man1dir = $(mandir)/man1 @@ -187,7 +195,13 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 +perl_scripts = \ + updmap + shell_scripts = \ + updmap-sys + +sh_scripts = \ allcm \ allneeded \ dvi2fax \ @@ -204,18 +218,17 @@ shell_scripts = \ texconfig \ texconfig-dialog \ texconfig-sys \ - texlinks \ - updmap \ - updmap-sys - -win32_aliases = \ - fontinst.exe - -@WIN32_FALSE@nodist_bin_SCRIPTS = $(shell_scripts) -@WIN32_TRUE@@WIN32_WRAP_TRUE@nodist_bin_SCRIPTS = $(win32_aliases) -@WIN32_TRUE@@WIN32_WRAP_TRUE@runscript = $(srcdir)/../texlive/w32_wrapper/runscript.exe -EXTRA_DIST = $(shell_scripts) README.texdoctk fontinst.bat updmap.pl -CLEANFILES = $(win32_aliases) + texlinks + +scriptsdir = texmf/scripts/tetex +nodist_bin_SCRIPTS = $(am__append_1) +all_scripts = $(perl_scripts) $(shell_scripts) +@WIN32_TRUE@@WIN32_WRAP_TRUE@wrappers = $(all_scripts:=.exe) +@WIN32_TRUE@@WIN32_WRAP_TRUE@runscript = $(top_srcdir)/../../texk/texlive/w32_wrapper/runscript.exe +texmfdir = ${prefix}/$(scriptsdir) +dist_texmf_SCRIPTS = $(perl_scripts:=.pl) $(shell_scripts:=.sh) +@WIN32_FALSE@dist_bin_SCRIPTS = $(sh_scripts) +CLEANFILES = $(nodist_bin_SCRIPTS) dist_man1_MANS = \ allcm.man \ allec.man \ @@ -269,6 +282,7 @@ man1_links = $(bin_links) \ texconfig:texconfig-sys \ updmap:updmap-sys +EXTRA_DIST = README.texdoctk fontinst.bat updmap run_texlinks = $(DESTDIR)$(bindir)/texlinks -v \ -f $(DESTDIR)$(web2cdir)/fmtutil.cnf \ -e "$(EXEEXT)" $(DESTDIR)$(bindir) @@ -278,7 +292,7 @@ all: all-am .SUFFIXES: am--refresh: @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/../am/man1_links.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../am/script_links.am $(top_srcdir)/../am/man1_links.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -310,6 +324,40 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): +install-dist_binSCRIPTS: $(dist_bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-dist_binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files install-dist_texconfigSCRIPTS: $(dist_texconfig_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(texconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(texconfigdir)" @@ -344,6 +392,40 @@ uninstall-dist_texconfigSCRIPTS: test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(texconfigdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(texconfigdir)" && rm -f $$files +install-dist_texmfSCRIPTS: $(dist_texmf_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(texmfdir)" || $(MKDIR_P) "$(DESTDIR)$(texmfdir)" + @list='$(dist_texmf_SCRIPTS)'; test -n "$(texmfdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(texmfdir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(texmfdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-dist_texmfSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(dist_texmf_SCRIPTS)'; test -n "$(texmfdir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(texmfdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(texmfdir)" && rm -f $$files install-nodist_binSCRIPTS: $(nodist_bin_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @@ -680,7 +762,7 @@ check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(MANS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(texconfigdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(texconfigdir)" "$(DESTDIR)$(web2cdir)" "$(DESTDIR)$(texconfdir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(texconfigdir)" "$(DESTDIR)$(texmfdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(texconfigdir)" "$(DESTDIR)$(web2cdir)" "$(DESTDIR)$(texconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -731,15 +813,16 @@ info: info-am info-am: install-data-am: install-dist_texconfigDATA \ - install-dist_texconfigSCRIPTS install-dist_web2cDATA \ - install-man install-nobase_dist_texconfDATA + install-dist_texconfigSCRIPTS install-dist_texmfSCRIPTS \ + install-dist_web2cDATA install-man \ + install-nobase_dist_texconfDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-nodist_binSCRIPTS +install-exec-am: install-dist_binSCRIPTS install-nodist_binSCRIPTS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am @@ -780,10 +863,10 @@ ps: ps-am ps-am: -uninstall-am: uninstall-dist_texconfigDATA \ - uninstall-dist_texconfigSCRIPTS uninstall-dist_web2cDATA \ - uninstall-man uninstall-nobase_dist_texconfDATA \ - uninstall-nodist_binSCRIPTS +uninstall-am: uninstall-dist_binSCRIPTS uninstall-dist_texconfigDATA \ + uninstall-dist_texconfigSCRIPTS uninstall-dist_texmfSCRIPTS \ + uninstall-dist_web2cDATA uninstall-man \ + uninstall-nobase_dist_texconfDATA uninstall-nodist_binSCRIPTS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-man: uninstall-man1 uninstall-man5 @@ -796,23 +879,66 @@ uninstall-man: uninstall-man1 uninstall-man5 dist-xz dist-zip distcheck distclean distclean-generic \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-data-hook install-dist_texconfigDATA \ - install-dist_texconfigSCRIPTS install-dist_web2cDATA \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-exec-hook install-html install-html-am install-info \ - install-info-am install-man install-man1 install-man5 \ + install-data-am install-data-hook install-dist_binSCRIPTS \ + install-dist_texconfigDATA install-dist_texconfigSCRIPTS \ + install-dist_texmfSCRIPTS install-dist_web2cDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-exec-hook \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-man5 \ install-nobase_dist_texconfDATA install-nodist_binSCRIPTS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-dist_texconfigDATA uninstall-dist_texconfigSCRIPTS \ + uninstall-dist_binSCRIPTS uninstall-dist_texconfigDATA \ + uninstall-dist_texconfigSCRIPTS uninstall-dist_texmfSCRIPTS \ uninstall-dist_web2cDATA uninstall-hook uninstall-man \ uninstall-man1 uninstall-man5 \ uninstall-nobase_dist_texconfDATA uninstall-nodist_binSCRIPTS -@WIN32_TRUE@@WIN32_WRAP_TRUE@$(win32_aliases): $(runscript) +.PHONY: install-perl-links make-perl-links \ + install-shell-links make-shell-links uninstall-links +@WIN32_TRUE@@WIN32_WRAP_TRUE@$(wrappers): $(runscript) @WIN32_TRUE@@WIN32_WRAP_TRUE@ $(LN_S) $(runscript) $@ + +# We support both multiplatform and non-multiplatform builds. +install-perl-links: +@WIN32_FALSE@ case "$(bindir)" in \ +@WIN32_FALSE@ */bin) $(MAKE) $(AM_MAKEFLAGS) REL=.. make-perl-links;; \ +@WIN32_FALSE@ */bin/*) $(MAKE) $(AM_MAKEFLAGS) REL=../.. make-perl-links;; \ +@WIN32_FALSE@ *) echo "strange directory '$(bindir)' for linked scripts" >&2; \ +@WIN32_FALSE@ exit 1;; \ +@WIN32_FALSE@ esac + +install-shell-links: +@WIN32_FALSE@ case "$(bindir)" in \ +@WIN32_FALSE@ */bin) $(MAKE) $(AM_MAKEFLAGS) REL=.. make-shell-links;; \ +@WIN32_FALSE@ */bin/*) $(MAKE) $(AM_MAKEFLAGS) REL=../.. make-shell-links;; \ +@WIN32_FALSE@ *) echo "strange directory '$(bindir)' for linked scripts" >&2; \ +@WIN32_FALSE@ exit 1;; \ +@WIN32_FALSE@ esac + +make-perl-links: + @cd $(DESTDIR)$(bindir) && \ + for f in $(perl_scripts); do \ + rm -f $$f; \ + echo "creating link '$$f' -> '$(REL)/$(scriptsdir)/$$f.pl'"; \ + $(LN_S) $(REL)/$(scriptsdir)/$$f.pl $$f || exit 1; \ + done + +make-shell-links: + @cd $(DESTDIR)$(bindir) && \ + for f in $(shell_scripts); do \ + rm -f $$f; \ + echo "creating link '$$f' -> '$(REL)/$(scriptsdir)/$$f.sh'"; \ + $(LN_S) $(REL)/$(scriptsdir)/$$f.sh $$f || exit 1; \ + done + +uninstall-links: +@WIN32_FALSE@ @for f in $(all_scripts); do \ +@WIN32_FALSE@ echo "rm -f '$(DESTDIR)$(bindir)/$$f'"; \ +@WIN32_FALSE@ rm -f "$(DESTDIR)$(bindir)/$$f"; \ +@WIN32_FALSE@ done .PHONY: install-man1-links uninstall-man1-links install-man1-links: @@ -831,6 +957,8 @@ uninstall-man1-links: rm -f $(DESTDIR)$(man1dir)/$$link.1; \ done +install-data-hook: install-perl-links install-shell-links install-man1-links + install-exec-hook: @WIN32_FALSE@ @cd $(DESTDIR)$(bindir) && \ @WIN32_FALSE@ for s in $(bin_links); do \ @@ -841,9 +969,7 @@ install-exec-hook: @WIN32_FALSE@ $(LN_S) $$file $$link || exit 1; \ @WIN32_FALSE@ done -install-data-hook: install-man1-links - -uninstall-hook: uninstall-man1-links +uninstall-hook: uninstall-links uninstall-man1-links @WIN32_FALSE@ @for s in $(bin_links); do \ @WIN32_FALSE@ link=`echo $$s | sed 's,.*:,,'`; \ @WIN32_FALSE@ rm -f $(DESTDIR)$(bindir)/$$link; \ diff --git a/Build/source/texk/tetex/updmap-sys b/Build/source/texk/tetex/updmap-sys.sh index 6f3c8365658..6f3c8365658 100755 --- a/Build/source/texk/tetex/updmap-sys +++ b/Build/source/texk/tetex/updmap-sys.sh diff --git a/Build/source/texk/tetex/updmap.pl b/Build/source/texk/tetex/updmap.pl index 3b8a8a9e7c9..77ac6be6b58 100644..100755 --- a/Build/source/texk/tetex/updmap.pl +++ b/Build/source/texk/tetex/updmap.pl @@ -1,58 +1,49 @@ -#!/usr/bin/env perl +#! /usr/bin/env perl ############################################################################### # updmap: utility to maintain map files for outline fonts. # -# Thomas Esser, (C) 2002. Public domain. +# Thomas Esser, (C) 2002. # Fabrice Popineau, for the Perl version. -# -# Commands: -# --edit edit config file -# --help show help message -# -# Options: -# --cnffile file specify configuration file -# --dvipsoutputdir directory specify output directory (dvips syntax) -# --pdftexoutputdir directory specify output directory (pdftex syntax) -# --dvipdfmoutputdir directory specify output directory (dvipdfm syntax) -# --outputdir directory specify output directory (for all files) -# --quiet reduce verbosity -############################################################################### -#$^W=1; - -require "newgetopt.pl"; -use strict; - -# my $IsWin32 = ($^O =~ /MSWin32/i); +# Anyone may freely use, modify, and/or distribute this file, without +# limitation. +############################################################################### +# $Id: updmap.pl 21946 2011-04-04 00:16:58Z karl $ +BEGIN { + $^W=1; + chomp($TEXMFROOT = `kpsewhich -var-value=TEXMFROOT`); + unshift (@INC, "$TEXMFROOT/tlpkg"); +} -# if ($IsWin32) { -# use Win32::Registry; -# use Win32::API; -# } +my $version = '$Id: updmap.pl 21946 2011-04-04 00:16:58Z karl $'; +use strict; +use TeXLive::TLUtils qw(mkdirhier mktexupd win32); +use Getopt::Long; +$Getopt::Long::autoabbrev=0; +Getopt::Long::Configure ("bundling"); -my $progname; +my $progname='updmap'; my $cnfFile; my $cnfFileShort; my $outputdir; my $dvipsoutputdir; my $pdftexoutputdir; -my $dvipdfmoutputdir; my $quiet; -my $texhashEnabled; -my $mkmapEnabled; +my $nohash; +my $nomkmap; -my %enableItem = (); +my $enableItem; my %setOption = (); my @showoptions = (); my @disableItem = (); my $listmaps; -my $needsCleanup; +my $listavailablemaps; +my $syncwithtrees; my $verbose; -my $debug; my $opt_edit; my $opt_help; - +my $dry_run; my $TEXMFMAIN; my $TEXMFVAR; @@ -60,14 +51,25 @@ my $mode; my $dvipsPreferOutline; my $dvipsDownloadBase35; my $pdftexDownloadBase14; -my $dvipdfmDownloadBase14; my $dvips35; my $pdftex35; -my $dvipdfm35; my $ps2pk35; -my @cfg = ( ); +my $newcnf; +my %link; +my %maps; +my @missing; +my $writelog = 0; +my $cache = 0; # don't change! +my $copy; +my $pdftexNoEnc=1; + +# initialize mktexupd +my $updLSR=&mktexupd(); +$updLSR->{mustexist}(0); + +my @cfg = (); my @psADOBE = ( 's/ URWGothicL-Demi / AvantGarde-Demi /x', @@ -190,7 +192,7 @@ my @fileADOBE = ( 's/\buagko8a.pfb\b/agwo____.pfb/x', 's/\bubkd8a.pfb\b/bkd_____.pfb/x', 's/\bubkdi8a.pfb\b/bkdi____.pfb/x', - 's/\bubkl8a.pfb\b/bkl_____.pfb/x', + 's/\bubkl8a.pfb\b/bkl_____.pfb/x', 's/\bubkli8a.pfb\b/bkli____.pfb/x', 's/\bucrb8a.pfb\b/cob_____.pfb/x', 's/\bucrbo8a.pfb\b/cobo____.pfb/x', @@ -222,61 +224,26 @@ my @fileADOBE = ( ); &main; - exit 0; -# if ($IsWin32) { - -# sub GetTempPath { -# my $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', 'N'); -# if(not defined $GetTempPath) { -# die "Can't import API GetTempPath: $!\n"; -# } -# my $lpBuffer = " " x 260; - -# $GetTempPath->Call(80, $lpBuffer); -# } - -# sub ShellExecute { -# my ($command, $file) = @_; -# my $ShellExecute = new Win32::API('shell32', 'ShellExecute', 'NPPPPN', 'N'); -# if(not defined $ShellExecute) { -# die "Can't import API ShellExecute: $!\n"; -# } -# $ShellExecute->Call(0, $command, $file, '', '', 0); -# } - -# sub GetHomeDir { -# my $home = $ENV{'HOME'}; -# # Should check for CSIDL_... -# return $home; -# } -# } - - ############################################################################### -# mkdirhier(directory) -# create a directory and parent directories as needed +# progname() +# return the name of the program. Needed if invoked by a wrapper. ############################################################################### -sub mkdirhier { - my $tree=shift; - my $mode=shift; - my $subdir; - - return if (-d $tree); - my @dirs=split /\//, $tree; - foreach my $dir (@dirs) { - $subdir .= ("$dir" . "/"); - unless (-d $subdir) { - if (defined $mode) { - mkdir ("$subdir", $mode) or die "Can't mkdir '$subdir': $!.\n"; - } else { - mkdir "$subdir" or die "Can't mkdir '$subdir': $!.\n"; - } - } +sub progname { + if (`kpsewhich --var-value=TEXMFVAR` eq `kpsewhich --var-value=TEXMFSYSVAR`) { + return 'updmap-sys'; + } else { + return 'updmap'; } } +# return program name + version string. +sub version { + my $ret = sprintf "%s version %s", &progname(), $version; + return $ret; +} + ############################################################################### # equalize_file(filename[, comment_char]) # read a file and return its processed content as a string. @@ -301,7 +268,6 @@ sub equalize_file { return join('X', sort(@temp)); } - ############################################################################### # files_are_different(file_A, file_B[, comment_char]) # compare two equalized files. @@ -318,7 +284,6 @@ sub files_are_different { return $retval; } - ############################################################################### # files_are_equal(file_A, file_B[, comment_char]) # compare two equalized files. Same as files_are_different() with @@ -328,6 +293,25 @@ sub files_are_equal { return (&files_are_different (@_))? 0:1; } +############################################################################### +# files_are_identical(file_A, file_B) +# compare two files. Same as cmp(1). +############################################################################### +sub files_are_identical { + my $file_A=shift; + my $file_B=shift; + my $retval=0; + + open IN, "$file_A"; + my $A=(<IN>); + close IN; + open IN, "$file_B"; + my $B=(<IN>); + close IN; + + $retval=1 if ($A eq $B); + return $retval; +} ############################################################################### # getLines() @@ -337,9 +321,26 @@ sub getLines { my @lines = (); foreach my $fname (@_) { next if (! $fname); - open FILE, "<$fname" or die "can't get lines from $fname: $!"; - push @lines, <FILE>; - close FILE; + if (! exists $maps{"$fname"}) { + open FILE, "<$fname" or die "can't get lines from $fname: $!"; + my @file=<FILE>; + close FILE; + if ($writelog) { + print LOG ("\n$fname:\n"); + foreach my $line (@file) { + next if $line =~ /^\s*%/; # comment + next if $line =~ /^\s*#/; # comment + next if $line =~ /^\s*$/; # empty line + my $tfm; + ($tfm)=split ' ', $line; + print LOG "$tfm\n"; + } + } + $maps{"$fname"} = [ @file ] if ($cache); + push @lines, @file; + } else { + push @lines, @{$maps{"$fname"}}; + } } chomp @lines; return @lines; @@ -363,6 +364,9 @@ sub writeLines { ############################################################################### sub copyFile { my ($src, $dst) = @_; + my $dir; + ($dir=$dst)=~s/(.*)\/.*/$1/; + mkdirhier $dir; $src eq $dst && return "can't copy $src to itself!\n"; @@ -379,74 +383,74 @@ sub copyFile { } ############################################################################### -# start_redirection(), stop_redirection() -# redirects stdout and stderr to log file (possibly "nul") -############################################################################### -sub start_redirection { - my ($log) = @_; - - # start redirection if asked - if ($log) { - open(SO, ">&STDOUT"); - open(SE, ">&STDERR"); - - close(STDOUT); - close(STDERR); - - open(STDOUT, ">$log"); - open(STDERR,">&STDOUT"); - - select(STDERR); $| = 1; - select(STDOUT); $| = 1; - } -} - -sub stop_redirection { - close(STDOUT); - close(STDERR); - open(STDOUT, ">&SO"); - open(STDERR, ">&SE"); -} - -############################################################################### # help() # display help message and exit ############################################################################### sub help { - print "Usage: $0 [option] ... [command]\n"; - print "\n"; - print "Valid options:\n"; - print " --cnffile file specify configuration file\n"; - print " --dvipsoutputdir directory specify output directory (dvips syntax)\n"; - print " --pdftexoutputdir directory specify output directory (pdftex syntax)\n"; - print " --dvipdfmoutputdir directory specify output directory (dvipdfm syntax)\n"; - print " --outputdir directory specify output directory (for all files)\n"; - print " --nohash do not run texhash\n"; - print " --nomkmap do not recreate map files\n"; - print " --quiet reduce verbosity\n"; - print "\n"; - print "Valid commands:\n"; - print " --edit edit updmap.cfg file\n"; - print " --help show this message\n"; - print " --showoptions item show alternatives for options\n"; - print " --setoption option=value set option where option is one\n"; - print " of dvipsPreferOutline, LW35, dvipsDownloadBase35\n"; - print " or pdftexDownloadBase14\n"; - print " --enable maptype=mapfile add or enable a Map or MixedMap\n"; - print " --disable mapfile disable Map or MixedMap for mapfile\n"; - print " --listmaps list all active and inactive maps\n"; + my $progname=&progname(); + my $usage= <<"EOF"; +Usage: $progname [option] ... [command] + +Update the default font map files used by pdftex, dvips, and dvipdfm, as +determined by updmap.cfg (the one returned by running "kpsewhich +updmap.cfg"). + +Among other things, these font map files are used to determine which +fonts should be used as bitmaps and which as outlines, and to determine +which fonts are included in the output. + +By default, the TeX filename database is also rebuilt (with mktexlsr). + +Valid options: + --cnffile FILE read FILE for the updmap configuration + --dvipsoutputdir DIR specify output directory (dvips syntax) + --pdftexoutputdir DIR specify output directory (pdftex syntax) + --outputdir DIR specify output directory (for all files) + --copy cp generic files rather than using symlinks + --nomkmap do not recreate map files + --nohash do not run texhash + -n, --dry-run only show the configuration, no output + --quiet reduce verbosity + +Valid commands: + --help show this message + --edit edit updmap.cfg file + --showoptions ITEM show alternatives for options + --setoption OPTION VALUE set option, where OPTION is one of: + dvipsPreferOutline, LW35, dvipsDownloadBase35, + or pdftexDownloadBase14 + --setoption OPTION=VALUE see above, just different syntax + --enable MAPTYPE MAPFILE add "MAPTYPE MAPFILE" to updmap.cfg, + where MAPTYPE is either Map or MixedMap + --enable Map=MAPFILE add \"Map MAPFILE\" to updmap.cfg + --enable MixedMap=MAPFILE add \"MixedMap MAPFILE\" to updmap.cfg + --disable MAPFILE disable MAPFILE, whether Map or MixedMap + --syncwithtrees entries with unavailable map files will be + disabled in the config file + --listmaps list all active and inactive maps + --listavailablemaps same as --listmaps, but without + unavailable map files + +Explanation of the map types: the (only) difference between Map and +MixedMap is that MixedMap entries are not added to psfonts_pk.map. The +purpose is to help users with printers that render Type 1 outline fonts +worse than mode-tuned Type 1 bitmap fonts. So MixedMap is used for +fonts that are available as both Type 1 and Metafont. + +To see the precise locations of the various files that will be read and +written, run updmap -n. + +For step-by-step instructions on making new fonts known to TeX, see +http://tug.org/fonts/fontinstall.html. + +Report bugs to: tex-k\@tug.org +TeX Live home page: <http://tug.org/texlive/> +EOF +; + print $usage; exit 0; } -############################################################################### -# abort(errmsg) -# print `errmsg' to stderr and exit with error code 1 -############################################################################### -sub abort { - my ($msg) = @_; - print STDERR "$progname: $msg\n"; - exit 1; -} ############################################################################### # cfgval(variable) @@ -464,12 +468,11 @@ sub cfgval { for my $line (@cfg) { if ($line =~ m/^\s*${variable}[\s=]+(.*)\s*$/) { $value = $1; - print "$variable => " . $value . "\n"; if ($value =~ m/^(true|yes|t|y|1)$/) { - $value = 1; + $value = 1; } elsif ($value =~ m/^(false|no|f|n|0)$/) { - $value = 0; + $value = 0; } last; } @@ -478,19 +481,35 @@ sub cfgval { } ############################################################################### +# SymlinkOrCopy(dir, src, dest) +# create symlinks if possible, otherwise copy files +############################################################################### +sub SymlinkOrCopy { + my ($dir, $src, $dest) = @_; + if (&win32 || $copy) { # always copy + ©File("$dir/$src", "$dir/$dest"); + } else { # symlink if supported by fs, copy otherwise + system("cd \"$dir\" && ln -s $src $dest 2>/dev/null || " + . "cp -p \"$dir/$src\" \"$dir/$dest\""); + } + # remember for "Files generated" in &mkMaps. + $link{"$dest"}="$src"; +} + +############################################################################### # setupSymlinks() # set symlink for psfonts.map according to dvipsPreferOutline variable ############################################################################### sub setupSymlinks { my $src; - if ($dvipsPreferOutline ) { + if ($dvipsPreferOutline) { $src = "psfonts_t1.map"; } else { $src = "psfonts_pk.map"; } unlink "$dvipsoutputdir/psfonts.map"; - ©File("$dvipsoutputdir/$src", "$dvipsoutputdir/psfonts.map"); + &SymlinkOrCopy("$dvipsoutputdir", "$src", "psfonts.map"); if ($pdftexDownloadBase14) { $src = "pdftex_dl14.map"; @@ -498,15 +517,7 @@ sub setupSymlinks { $src = "pdftex_ndl14.map"; } unlink "$pdftexoutputdir/pdftex.map"; - ©File("$pdftexoutputdir/$src", "$pdftexoutputdir/pdftex.map"); - - if ($dvipdfmDownloadBase14) { - $src = "dvipdfm_dl14.map"; - } else { - $src = "dvipdfm_ndl14.map"; - } - unlink "$dvipdfmoutputdir/dvipdfm.map"; - ©File("$dvipdfmoutputdir/$src", "$dvipdfmoutputdir/dvipdfm.map"); + &SymlinkOrCopy("$pdftexoutputdir", "$src", "pdftex.map"); } ############################################################################### @@ -542,13 +553,10 @@ sub transLW35 { # apply kpsewhich with format 'web2c files' ############################################################################### sub locateWeb2c { - my @files = @_; - return @files if ($#files < 0); @files = split (/\n/, `kpsewhich --format="web2c files" @files`); - if (wantarray) { return @files; } @@ -562,13 +570,18 @@ sub locateWeb2c { # apply kpsewhich with format 'dvips config' ############################################################################### sub locateMap { - my @files = @_; + my @maps = @_; + my @files; - chomp @files; - return @files if ($#files < 0); + chomp @maps; + return @maps if ($#maps < 0); - @files = `kpsewhich --format=map @files`; + @files = `kpsewhich --format=map @maps`; chomp @files; + + foreach my $map (@maps) { + push @missing, $map if (! grep /\/$map$/, @files); + } if (wantarray) { return @files; } @@ -589,7 +602,7 @@ sub catMaps { my @maps = grep { $_ =~ m/$map/ } @cfg; map{ $_ =~ s/\#.*//; - $_ =~ s/\s*([^\s]*)\s*([^\s]*)/\2/; + $_ =~ s/\s*([^\s]*)\s*([^\s]*)/$2/; } @maps; @maps = sort(@maps); @maps = grep { ++$count{$_} < 2; } @maps; @@ -627,22 +640,19 @@ sub setOption { my ($opt, $val) = @_; if ($opt eq "LW35") { - if ($val !~ m/^(URWkb|URW|ADOBE|ADOBEkb)$/) { - printf STDERR "invalid value $val for option $opt\n"; - exit 1; - } + if ($val !~ m/^(URWkb|URW|ADOBE|ADOBEkb)$/) { + die "Invalid value $val for option $opt.\n"; + } } - elsif ($opt =~ m/^(dvipsPreferOutline|dvipsDownloadBase35|pdftexDownloadBase14|dvipdfmDownloadBase14)$/) { + elsif ($opt =~ + m/^(dvipsPreferOutline|dvipsDownloadBase35|pdftexDownloadBase14)$/) { if ($val !~ m/^(true|false)$/) { - printf STDERR "invalid value $val for option $opt\n"; - exit 1; + die "invalid value $val for option $opt.\n"; } } else { - printf STDERR "unsupported option $opt\n"; - exit 1; + die "Unsupported option $opt.\n"; } - &configReplace("$cnfFile", "^" . "$opt" . "\\s", "$opt $val"); } @@ -654,8 +664,7 @@ sub enableMap { my ($type, $map) = @_; if ($type !~ m/^(Map|MixedMap)$/) { - printf STDERR "invalid mapType $type\n"; - exit 1; + die "updmap: Invalid mapType $type\n"; } # a map can only have one type, so we carefully disable everything # about map here: @@ -671,14 +680,13 @@ sub enableMap { ############################################################################### sub disableMap { my ($map) = @_; - my %count = ( ); + my %count = (); my $type; my @mapType = grep { my @fields = split; - if ($fields[0] =~ /^(MixedMap|Map)$/ - and $fields[1] eq $map - and ++$count{$fields[0]}) { + if ($fields[0] and $fields[0] =~ /^(MixedMap|Map)$/ + and $fields[1] eq $map and ++$count{$fields[0]}) { $_ = $fields[0]; } else { @@ -697,30 +705,14 @@ sub disableMap { ############################################################################### sub initVars { $progname="updmap"; - $quiet = 0; - $texhashEnabled = 1; - $mkmapEnabled = 1; + $nohash = 0; + $nomkmap = 0; $verbose = 1; - $needsCleanup = 0; - $cnfFile = ""; $cnfFileShort = "updmap.cfg"; $outputdir = ""; - $TEXMFMAIN =`kpsewhich --expand-var="\$TEXMFMAIN"`; - chomp($TEXMFMAIN); - # tmpdir=${TMP-/tmp}/$progname.$$ - # tmp1=$tmpdir/a - # tmp2=$tmpdir/b - # tmp3=$tmpdir/c -} - -############################################################################### -# setupTmpDir() -# set up a temp directory and a trap to remove it -############################################################################### -sub setupTmpDir { - + chomp($TEXMFMAIN =`kpsewhich --var-value=TEXMFMAIN`); } ############################################################################### @@ -728,20 +720,19 @@ sub setupTmpDir { # show Options for an item ############################################################################### sub showOptions { - foreach my $item (@_) { if ($item eq "LW35") { print "URWkb URW ADOBE ADOBEkb\n"; } - elsif ($item =~ m/(dvipsPreferOutline|pdftexDownloadBase14|dvipdfmDownloadBase14|dvipsDownloadBase35)/) { + elsif ($item =~ + m/(dvipsPreferOutline|pdftexDownloadBase14|dvipsDownloadBase35)/) { print "true false\n"; } else { - print "Unknown item \"$item\". Choose one of LW35, dvipsPreferOutline, dvipsDownloadBase35, pdftexDownloadBase14 or dvipdfmDownloadBase14\n"; -# exit 1; + print "Unknown item \"$item\". Choose one of LW35, dvipsPreferOutline,\n" + . " dvipsDownloadBase35, or pdftexDownloadBase14\n"; } } - exit 0 } @@ -758,53 +749,24 @@ sub setupOutputDir { my $rel = "fonts/map/$driver/updmap"; my $tf; # Try TEXMFVAR tree. Use it if variable is set and $rel can - # be written. Copy config file if it does not exist there. - if ($^O=~/^MSWin(32|64)$/) { - $tf = `kpsewhich --expand-var="\$TEXMFVAR"`; - } else { - $tf = `kpsewhich --expand-var="\\\$TEXMFVAR"`; - } - chomp($tf); + # be written. + chomp($tf = `kpsewhich --var-value=TEXMFVAR`); if ($tf) { &mkdirhier("$tf/$rel"); - # system("$TEXMFMAIN/web2c/mktexdir \"$tf/$rel\""); - if (! -d "$tf/$rel" || ! -w "$tf/$rel") { - # forget about TEXMFVAR tree... - $tf = ""; + if (! -w "$tf/$rel") { + die "Directory \"$tf/$rel\" isn't writable.\n"; } } - - # Try something relative to config file, fall back to $TEXMFMAIN. - if (! $tf) { - $tf = $cnfFile; - if ($tf =~ m@/web2c/[^/]*$@) { - $tf =~ s@/web2c/[^/]*$@@; - } - else { - $tf = ""; - } - $tf = $TEXMFMAIN if (! $tf); - } - $od = "$tf/$rel"; } - - # No need to call mktexdir ! - # system("$TEXMFMAIN/bin/win32/mktexdir \"$od\""); &mkdirhier($od); - &abort("output directory `$od' does not exist\n") if (! -d $od); - &abort("output directory `$od' is not writable\n") if (! -w $od); - print "using $driver output directory `$od'\n"; - + print "$driver output dir: \"$od\"\n" if (! $quiet); return $od; } sub setupDestDir { - $dvipsoutputdir = &setupOutputDir($dvipsoutputdir, "dvips"); $pdftexoutputdir = &setupOutputDir($pdftexoutputdir, "pdftex"); - $dvipdfmoutputdir = &setupOutputDir($dvipdfmoutputdir, "dvipdfm"); - } ############################################################################### @@ -812,81 +774,74 @@ sub setupDestDir { # find config file if none specified on cmd line. ############################################################################### sub setupCfgFile { - if (! $cnfFile) { - my $tf = `kpsewhich -expand-var="\$TEXMFVAR"`; + my $tf = `kpsewhich --var-value=TEXMFCONFIG`; chomp($tf); if ($tf && ! -f "$tf/web2c/$cnfFileShort") { &mkdirhier("$tf/web2c") if (! -d "$tf/web2c"); -# &start_redirection("nul"); -# system("mktexdir $tf/web2c"); -# &stop_redirection; if (-d "$tf/web2c" && -w "$tf/web2c") { - unlink "$tf/web2c/$cnfFileShort"; - ©File("$TEXMFMAIN/web2c/$cnfFileShort", "$tf/web2c/$cnfFileShort"); - &start_redirection("nul"); - system("mktexupd $tf/web2c $cnfFileShort"); - &stop_redirection; + unlink "$tf/web2c/$cnfFileShort"; + my $original_cfg=`kpsewhich updmap.cfg`; + chomp($original_cfg); + print("copy $original_cfg => $tf/web2c/$cnfFileShort\n") if (! $quiet); + $newcnf="$tf/web2c/$cnfFileShort"; + ©File("$original_cfg", "$tf/web2c/$cnfFileShort"); + $updLSR->{add}("$tf/web2c/$cnfFileShort"); } } - - $cnfFile = &locateWeb2c("updmap.cfg"); + $cnfFile = "$tf/web2c/updmap.cfg"; if ($cnfFile) { - print "using config file $cnfFile\n" if (! $quiet); + print "Config file: \"$cnfFile\"\n" if (! $quiet); } else { - &abort("config file updmap.cfg not found"); + die "Config file updmap.cfg not found.\n"; } } } - ############################################################################### # processOptions() # process cmd line options ############################################################################### sub processOptions { - - unless (&NGetOpt ("quiet" => \$quiet, - "cnffile=s" => \$cnfFile, - "outputdir=s" => \$outputdir, - "dvipsoutputdir=s" => \$dvipsoutputdir, - "pdftexoutputdir=s" => \$pdftexoutputdir, - "dvipdfmoutputdir=s" => \$dvipdfmoutputdir, - "setoption=s" => \%setOption, - "enable=s" => \%enableItem, - "disable=s" => \@disableItem, - "edit" => \$opt_edit, - "listmaps" => \$listmaps, - "showoptions=s" => \@showoptions, - "hash!" => \$texhashEnabled, - "mkmap!" => \$mkmapEnabled, - "verbose" => \$verbose, - "debug" => \$debug, - "help" => \$opt_help)) { - print STDERR "Try `$0 --help'"; - exit 1; + unless (&GetOptions ( + "q|quiet" => \$quiet, + "cnffile=s" => \$cnfFile, + "outputdir=s" => \$outputdir, + "dvipsoutputdir=s" => \$dvipsoutputdir, + "pdftexoutputdir=s" => \$pdftexoutputdir, + "setoption=s" => \%setOption, + "enable=s" => \$enableItem, + "disable=s" => \@disableItem, + "e|edit" => \$opt_edit, + "l|listmaps" => \$listmaps, + "listavailablemaps" => \$listavailablemaps, + "syncwithtrees" => \$syncwithtrees, + "showoptions=s" => \@showoptions, + "nohash" => \$nohash, + "nomkmap" => \$nomkmap, + "version" => sub { print &version() . "\n"; exit(0) }, + + "n|dry-run" => \$dry_run, + "copy" => \$copy, + "h|help" => \$opt_help)) { + my $progname=&progname(); + die "Try \"$progname --help\".\n"; } if ($outputdir) { $dvipsoutputdir = $outputdir if (! $dvipsoutputdir); $pdftexoutputdir = $outputdir if (! $pdftexoutputdir); - $dvipdfmoutputdir = $outputdir if (! $dvipdfmoutputdir); } if ($cnfFile && ! -f $cnfFile) { - &abort("config file `$cnfFile' not found"); + die "Config file \"$cnfFile\" not found.\n"; } - if ($dvipsoutputdir && ! -d $dvipsoutputdir) { - &abort("dvips output directory `$dvipsoutputdir' not found"); + &mkdirhier ($dvipsoutputdir); } if ($pdftexoutputdir && ! -d $pdftexoutputdir) { - &abort("pdftex output directory `$pdftexoutputdir' not found"); - } - if ($dvipdfmoutputdir && ! -d $dvipdfmoutputdir) { - &abort("dvipdfm output directory `$dvipdfmoutputdir' not found"); + &mkdirhier ($pdftexoutputdir); } - } ############################################################################### @@ -894,11 +849,42 @@ sub processOptions { # list all maps mentioned in the config file ############################################################################### sub listMaps { + my $what=shift; + my @mapfiles; + my @paths; + my @lines = grep { - $_ =~ m/^(\#! *)?(Mixed)?Map/ + if ($what eq 'sync') { + $_ =~ m/^(Mixed)?Map/ + } else { + $_ =~ m/^(\#! *)?(Mixed)?Map/ + } } &getLines($cnfFile); - map { print "$_\n"; } @lines; -# &writeLines("con", @lines); + + if ($what eq 'list') { + # --listmaps + map { print "$_\n"; } @lines; + } else { + @mapfiles=grep { $_ =~ s/^(\#! *)?(Mixed)?Map\s+// } @lines; + @paths=&locateMap(@mapfiles); + + if ($what eq 'avail') { + # --listavailablemaps + map { + my $entry="$_"; + # print "$entry\n" if (grep { $_ =~ m/\/$entry/ } @paths); + } @lines; + } elsif ($what eq 'sync') { + # --syncwithtrees + map { + my $entry="$_"; + unless (grep { $_ =~ m/$entry/ } @paths) { + &disableMap($entry); + print " $entry disabled\n" if (! $quiet); + } + } @lines; + } + } } ############################################################################### @@ -915,7 +901,7 @@ sub normalizeLines { @lines = grep { $_ !~ m/^\s*$/x } @lines; map { $_ =~ s/\s$//x ; $_ =~ s/\s*\"\s*/ \" /gx; - $_ =~ s/\" ([^\"]*) \"/\"\1\"/gx; + $_ =~ s/\" ([^\"]*) \"/\"$1\"/gx; } @lines; @lines = grep {++$count{$_} < 2 } (sort @lines); @@ -924,43 +910,25 @@ sub normalizeLines { } ############################################################################### -# dvips2dvipdfm() -# reads from stdin, writes to stdout. It transforms "dvips"-like syntax into -# "dvipdfm"-like syntax. It is a very ugly hack. +# to_pdftex() +# we could strip "PS_Encoding_Name ReEncodeFont" from map entries because +# they are ignored by pdftex anyway, but it is harmless, and creates +# spurious differences. We want fewer differences, not more. Really +# we want one map file format. ############################################################################### -sub dvips2dvipdfm { - my @lines = @_; - - map { - $_ =~ s@$@ %@; - $_ =~ s@^(([^ ]*).*)@\1\2@; - $_ =~ s@(.*<\[* *([^ ]*)\.enc(.*))@\1 \2@; - $_ = (m/%[^ ]*$/x ? "$_ default" : $_) ; - $_ =~ s@(.*<<* *([^ ]*)\.pf[ab].*)@\1 \2@; - if (m/%[^ ]* [^ ]*$/x) { $_ =~ s@( ([^ ]*).*)$@\1 \2@; } - $_ =~ s@(.* ([\.0-9-][\.0-9-]*) *ExtendFont.*)@\1 -e \2@; - $_ =~ s@(.* ([\.0-9-][\.0-9-]*) *SlantFont.*)@\1 -s \2@; - $_ =~ s@.*%@@ ; - } @lines; - - map { - my @elts = split (' ', $_); - if ($elts[0] eq $elts[2] - && $elts[1] eq "default") { - $elts[1] = ''; - $elts[2] = ''; - }; - $_ = join ' ',@elts; - } @lines; - - map { - if (/^(cm|eu|la|lc|line|msam|xy)/) { - $_ .= " -r" ; - $_ =~ s/(fmex[789]) -r/\1/; - } - } @lines; - - return @lines; +sub to_pdftex { + return @_; +# +# my @in = @_; +# my @out; +# foreach my $line (@in) { +# if ($line =~ /^(.*\s+)(\S+\s+ReEncodeFont\s)(.*)/) { +# $line = "$1$3"; +# $line =~ s/\s+\"\s+\"\s+/ /; +# } +# push @out, $line; +# } +# return @out; } ############################################################################### @@ -969,6 +937,38 @@ sub dvips2dvipdfm { ############################################################################### sub mkMaps { my @lines; + my $logfile; + + $cache=1; + + if (! $dry_run) { + my $TEXMFVAR=`kpsewhich --var-value=TEXMFVAR`; + chomp($TEXMFVAR); + $logfile="$TEXMFVAR/web2c/updmap.log"; + mkdirhier "$TEXMFVAR/web2c"; + open LOG, ">$logfile" + or die "Can't open \"$logfile\""; + $writelog=1; + print LOG &version() . "\n"; + printf LOG "%s\n\n", scalar localtime(); + print LOG "Using config file \"$cnfFile\".\n"; + } + sub wlog () { + my $str=shift; + if ($dry_run) { + print $str; + } else { + print $str if (! $quiet); + print LOG $str; + } + } + sub newline() { + if ($dry_run) { + print "\n"; + } else { + print LOG "\n"; + } + } $mode = &cfgval("LW35"); $mode = "URWkb" unless (defined $mode); @@ -977,37 +977,75 @@ sub mkMaps { $dvipsPreferOutline = 1 unless (defined $dvipsPreferOutline); $dvipsDownloadBase35 = &cfgval("dvipsDownloadBase35"); - $dvipsDownloadBase35 = 0 unless (defined $dvipsDownloadBase35); + $dvipsDownloadBase35 = 1 unless (defined $dvipsDownloadBase35); $pdftexDownloadBase14 = &cfgval("pdftexDownloadBase14"); - $pdftexDownloadBase14 = 0 unless (defined $pdftexDownloadBase14); - - $dvipdfmDownloadBase14 = &cfgval("dvipdfmDownloadBase14"); - $dvipdfmDownloadBase14 = 0 unless (defined $dvipdfmDownloadBase14); - - if (! $quiet) { - print "\ -updmap is creating new map files using the following configuration:\ -\ - config file : " . ($cnfFile ? "true" : "false") ."\ - prefer outlines : " . ($dvipsPreferOutline ? "true" : "false") ."\ - texhash enabled : " . ($texhashEnabled ? "true" : "false") ."\ - download standard fonts (dvips) : " . ($dvipsDownloadBase35 ? "true" : "false") ."\ - download standard fonts (pdftex) : " . ($pdftexDownloadBase14 ? "true" : "false") . "\ - download standard fonts (dvipdfm): " . ($dvipdfmDownloadBase14 ? "true" : "false") . "\ -" - }; - - print "Scanning for LW35 support files\n" if (! $quiet); + $pdftexDownloadBase14 = 1 unless (defined $pdftexDownloadBase14); + + &wlog ("\nupdmap is creating new map files " . + "using the following configuration:" . + "\n LW35 font names : " . + $mode . + "\n prefer outlines : " . + ($dvipsPreferOutline ? "true" : "false") . + "\n texhash enabled : " . + ($nohash ? "false" : "true") . + "\n download standard fonts (dvips) : " . + ($dvipsDownloadBase35 ? "true" : "false") . + "\n download standard fonts (pdftex) : " . + ($pdftexDownloadBase14 ? "true" : "false") . + "\n\n"); + + &wlog ("Scanning for LW35 support files"); $dvips35 = &locateMap("dvips35.map"); $pdftex35 = &locateMap("pdftex35.map"); - $dvipdfm35 = &locateMap("dvipdfm35.map"); $ps2pk35 = &locateMap("ps2pk35.map"); + my $LW35="\n$dvips35\n$pdftex35\n$ps2pk35\n\n"; + if ($dry_run) { + print $LW35; + } else { + print LOG $LW35; + } + printf " [%3d files]\n", 3 unless ($quiet || $dry_run); - print "Scanning for MixedMap entries\n" if (! $quiet); + &wlog ("Scanning for MixedMap entries"); + &newline; my @tmp1 = &catMaps('^MixedMap'); - print "Scanning for Map entries\n" if (! $quiet); + foreach my $line (@tmp1) { + if ($dry_run) { + print "$line\n"; + } else { + print LOG "$line\n"; + } + } + &newline; + printf " [%3d files]\n", scalar @tmp1 + unless ($quiet || $dry_run); + + &wlog ("Scanning for Map entries"); + &newline(); my @tmp2 = &catMaps('^Map'); + foreach my $line (@tmp2) { + if ($dry_run) { + print "$line\n"; + } else { + print LOG "$line\n"; + } + } + &newline; + printf " [%3d files]\n\n", scalar @tmp2 + unless ($quiet || $dry_run); + + if (@missing > 0) { + print STDERR "\nERROR: The following map file(s) couldn't be found:\n\t"; + print STDERR join(' ', @missing); + my $progname=&progname(); + print STDERR "\n\n\tDid you run mktexlsr?\n\n" . + "\tYou can delete non-existent map entries using the command\n". + "\n\t $progname --syncwithtrees\n\n"; + exit (1); + } + exit(0) if $dry_run; # Create psfonts_t1.map, psfonts_pk.map, ps2pk.map and pdftex.map: for my $file ("$dvipsoutputdir/download35.map", @@ -1016,51 +1054,54 @@ updmap is creating new map files using the following configuration:\ "$dvipsoutputdir/psfonts_pk.map", "$pdftexoutputdir/pdftex_dl14.map", "$pdftexoutputdir/pdftex_ndl14.map", - "$dvipdfmoutputdir/dvipdfm_dl14.map", - "$dvipdfmoutputdir/dvipdfm_ndl14.map", "$dvipsoutputdir/ps2pk.map") { open FILE, ">$file"; - print FILE "% $file: maintained by the script updmap.\ -% Don't change this file directly. Edit texmf/web2c/$cnfFileShort\ -% and run updmap to recreate this file.\ + print FILE "% $file:\ +% maintained by updmap[-sys].\ +% Don't change this file directly. Use updmap[-sys] instead.\ +% See texmf/web2c/$cnfFileShort and the updmap documentation.\ +% A log of the run that created this file is available here:\ +% $logfile\ "; close FILE; } -# print "$dvips35 $pdftex35 $dvipdfm35 $ps2pk35 @tmp1 @tmp2\n"; - + print "Generating output for ps2pk...\n" if (! $quiet); my @ps2pk_map = &transLW35($ps2pk35); push @ps2pk_map, &getLines(@tmp1); push @ps2pk_map, &getLines(@tmp2); - &writeLines(">$dvipsoutputdir/ps2pk.map", &normalizeLines(@ps2pk_map)); + &writeLines(">$dvipsoutputdir/ps2pk.map", + &normalizeLines(@ps2pk_map)); + print "Generating output for dvips...\n" if (! $quiet); my @download35_map = &transLW35($ps2pk35); - &writeLines(">$dvipsoutputdir/download35.map", &normalizeLines(@download35_map)); + &writeLines(">$dvipsoutputdir/download35.map", + &normalizeLines(@download35_map)); + my @builtin35_map = &transLW35($dvips35); - &writeLines(">$dvipsoutputdir/builtin35.map", &normalizeLines(@builtin35_map)); + &writeLines(">$dvipsoutputdir/builtin35.map", + &normalizeLines(@builtin35_map)); my $dftdvips = ($dvipsDownloadBase35 ? $ps2pk35 : $dvips35); my @psfonts_t1_map = &transLW35($dftdvips); push @psfonts_t1_map, &getLines(@tmp1); push @psfonts_t1_map, &getLines(@tmp2); - &writeLines(">$dvipsoutputdir/psfonts_t1.map", &normalizeLines(@psfonts_t1_map)); + &writeLines(">$dvipsoutputdir/psfonts_t1.map", + &normalizeLines(@psfonts_t1_map)); my @psfonts_pk_map = &transLW35($dftdvips); push @psfonts_pk_map, &getLines(@tmp2); - &writeLines(">$dvipsoutputdir/psfonts_pk.map", &normalizeLines(@psfonts_pk_map)); + &writeLines(">$dvipsoutputdir/psfonts_pk.map", + &normalizeLines(@psfonts_pk_map)); + print "Generating output for pdftex...\n" if (! $quiet); # remove PaintType due to Sebastian's request my @tmp3 = &transLW35($pdftex35); push @tmp3, &getLines(@tmp1); push @tmp3, &getLines(@tmp2); @tmp3 = grep { $_ !~ m/(^%|PaintType)/ } @tmp3; - my @tmp6 = &transLW35($dvipdfm35); - push @tmp6, &getLines(@tmp1); - push @tmp6, &getLines(@tmp2); - @tmp6 = grep { $_ !~ m/(^%|PaintType)/ } @tmp6; - my @tmp7 = &transLW35($ps2pk35); push @tmp7, &getLines(@tmp1); push @tmp7, &getLines(@tmp2); @@ -1068,48 +1109,58 @@ updmap is creating new map files using the following configuration:\ my @pdftex_ndl14_map = @tmp3; @pdftex_ndl14_map = &normalizeLines(@pdftex_ndl14_map); + @pdftex_ndl14_map = &to_pdftex(@pdftex_ndl14_map) if ($pdftexNoEnc); &writeLines(">$pdftexoutputdir/pdftex_ndl14.map", @pdftex_ndl14_map); my @pdftex_dl14_map = @tmp7; @pdftex_dl14_map = &normalizeLines(@pdftex_dl14_map); + @pdftex_dl14_map = &to_pdftex(@pdftex_dl14_map) if ($pdftexNoEnc); &writeLines(">$pdftexoutputdir/pdftex_dl14.map", @pdftex_dl14_map); - my @dvipdfm_dl14_map = @tmp7; - @dvipdfm_dl14_map = &normalizeLines(&dvips2dvipdfm(&normalizeLines(@dvipdfm_dl14_map))); - &writeLines(">$dvipdfmoutputdir/dvipdfm_dl14.map", @dvipdfm_dl14_map); - - my @dvipdfm_ndl14_map = @tmp6; - @dvipdfm_ndl14_map = &normalizeLines(&dvips2dvipdfm(&normalizeLines(@dvipdfm_ndl14_map))); - &writeLines(">$dvipdfmoutputdir/dvipdfm_ndl14.map", @dvipdfm_ndl14_map); - &setupSymlinks; - if ($texhashEnabled) { - my $cmd = "mktexlsr"; - &start_redirection("nul") if ($quiet); - system($cmd); - &stop_redirection if ($quiet); - } - - if (! $quiet) { - print STDOUT "Files generated:\n"; - for my $f ("$dvipsoutputdir/download35.map", - "$dvipsoutputdir/builtin35.map", - "$dvipsoutputdir/psfonts_t1.map", - "$dvipsoutputdir/psfonts_pk.map", - "$pdftexoutputdir/pdftex_dl14.map", - "$pdftexoutputdir/pdftex_ndl14.map", - "$dvipdfmoutputdir/dvipdfm_dl14.map", - "$dvipdfmoutputdir/dvipdfm_ndl14.map", - "$dvipsoutputdir/ps2pk.map") { - if (-e $f) { - my @stat=stat($f); - printf "%7d %s %s\n", $stat[7], scalar (localtime $stat[9]), $f; + &wlog ("\nFiles generated:\n"); + sub dir { + my ($d, $f, $target)=@_; + if (-e "$d/$f") { + my @stat=lstat("$d/$f"); + my ($s,$m,$h,$D,$M,$Y)=localtime($stat[9]); + my $timestamp=sprintf ("%04d-%02d-%02d %02d:%02d:%02d", + $Y+1900, $M+1, $D, $h, $m, $s); + my $date=sprintf "%12d %s %s", $stat[7], $timestamp, $f; + &wlog ($date); + + if (-l "$d/$f") { + my $lnk=sprintf " -> %s\n", readlink ("$d/$f"); + &wlog ($lnk); + } elsif ($f eq $target) { + if (&files_are_identical("$d/$f", "$d/$link{$target}")) { + &wlog (" = $link{$target}\n"); + } else { + &wlog (" = ?????\n"); # This shouldn't happen. + } } else { - print STDERR "Warning: File $f doesn't exist.\n"; - } + &wlog ("\n"); + } + } else { + print STDERR "Warning: File $d/$f doesn't exist.\n"; + print LOG "Warning: File $d/$f doesn't exist.\n"; } } + my $d; + $d="$dvipsoutputdir"; &wlog (" $d:\n"); + foreach my $f ('builtin35.map', 'download35.map', 'psfonts_pk.map', + 'psfonts_t1.map', 'ps2pk.map', 'psfonts.map') { + dir ($d, $f, 'psfonts.map'); + $updLSR->{add}("$d/$f"); + } + $d="$pdftexoutputdir"; &wlog (" $d:\n"); + foreach my $f ('pdftex_dl14.map', 'pdftex_ndl14.map', 'pdftex.map') { + dir ($d, $f, 'pdftex.map'); + $updLSR->{add}("$d/$f"); + } + close LOG; + print "\nTranscript written on \"$logfile\".\n" if (! $quiet); } ############################################################################### @@ -1117,7 +1168,6 @@ updmap is creating new map files using the following configuration:\ # execution starts here ############################################################################### sub main { - &initVars; &processOptions; @@ -1131,7 +1181,15 @@ sub main { &setupCfgFile; if ($listmaps) { - &listMaps; + &listMaps ('list'); + exit 0; + } + if ($listavailablemaps) { + &listMaps ('avail'); + exit 0; + } + if ($syncwithtrees) { + &listMaps ('sync'); exit 0; } @@ -1142,24 +1200,29 @@ sub main { my $cmd = ''; if ($opt_edit) { - my $editor = `kpsewhich --expand-var \$TEXEDIT`; - chomp($editor); - $editor = "notepad" if ($editor eq ""); + my $editor = undef; + $editor ||= $ENV{'EDITOR'}; + $editor ||= $ENV{'VISUAL'}; + if (&win32) { + $editor ||= "notepad"; + } else { + $editor ||= "vi"; + } $cmd = 'edit'; system("$editor $cnfFile"); } - elsif (keys %setOption) { $cmd = 'setOption'; foreach my $m (keys %setOption) { &setOption ($m, $setOption{$m}); } } - - elsif (keys %enableItem) { + elsif ($enableItem) { $cmd = 'enableMap'; - foreach my $m (keys %enableItem) { - &enableMap($m, $enableItem{$m}); + if ($enableItem=~/=/) { + &enableMap(split('=', $enableItem)); + } else { + &enableMap($enableItem, shift @ARGV); } } elsif (@disableItem) { @@ -1168,19 +1231,17 @@ sub main { &disableMap($m); } } - if ($cmd and &files_are_equal($bakFile, $cnfFile)) { print "$cnfFile unchanged. Map files not recreated.\n" unless ($quiet); } else { - if ($mkmapEnabled) { + if (! $nomkmap) { &setupDestDir; &mkMaps; } - # &cleanup; unlink ($bakFile); } - + $updLSR->{exec}() unless $nohash; } __END__ |