summaryrefslogtreecommitdiff
path: root/Build/source/am/script_links.am
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
committerKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
commitad547a6b5986815fda458221149728d9d9ab1d87 (patch)
tree16296910eb3eca724371474ea9aea3994dc69614 /Build/source/am/script_links.am
parent947b43de3dd21d58ccc2ffadefc4441ea1c2a813 (diff)
restore Build,TODO from r57911
git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/am/script_links.am')
-rw-r--r--Build/source/am/script_links.am87
1 files changed, 87 insertions, 0 deletions
diff --git a/Build/source/am/script_links.am b/Build/source/am/script_links.am
new file mode 100644
index 00000000000..e12e09edc9c
--- /dev/null
+++ b/Build/source/am/script_links.am
@@ -0,0 +1,87 @@
+## am/script_links.am: Makefile fragment for lua/perl/shell script links.
+##
+## Copyright (C) 2011-2014 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+## Install/uninstall 'linked scripts' or win32 wrappers:
+## Add the prerequisite uninstall-links to uninstall-hook and one or
+## or more of install-{perl,shell,sh}-scripts to install-data-hook
+##
+## The sh_scripts are special because they have no corresponding
+## win32 wrapper, whereas shell_scripts do have such wrappers.
+##
+## requires conditionals WIN32 and WIN32_WRAP
+## requires $(scriptsdir): e.g., texmf/scripts/chktex
+## appends to $(nodist_bin_SCRIPTS) and $(EXTRA_DIST)
+##
+## install-lua-scripts requires $(lua_scripts), e.g., pmx2pdf
+## install-perl-scripts requires $(perl_scripts), e.g., deweb
+## install-shell-scripts requires $(shell_scripts), e.g. htlatex
+## install-sh-scripts requires $(sh_scripts), e.g. getafm
+##
+.PHONY: install-lua-links install-perl-links install-shell-links install-sh-links \
+ install-links uninstall-links
+
+all_scripts = $(lua_scripts) $(perl_scripts) $(shell_scripts)
+
+if WIN32
+if WIN32_WRAP
+## We treat the WIN32 wrappers as SCRIPTS to avoid automatic build rules
+wrappers = $(all_scripts:=.exe)
+nodist_bin_SCRIPTS += $(wrappers)
+runscript = $(top_srcdir)/../../texk/texlive/$(WIN_WRAPPER)/runscript.exe
+$(wrappers): $(runscript)
+ $(AM_V_GEN)$(LN_S) $(runscript) $@
+endif WIN32_WRAP
+endif WIN32
+
+install-lua-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=lua EXT=lua install-links
+endif !WIN32
+
+install-perl-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=perl EXT=pl install-links
+endif !WIN32
+
+install-shell-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=shell EXT=sh install-links
+endif !WIN32
+
+install-sh-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=sh EXT=sh install-links
+endif !WIN32
+
+EXTRA_DIST += $(top_builddir)/../../build-aux/relpath
+
+# We support native builds, multiplatform or not, as well as distro builds.
+install-links:
+ @relpath="$(top_srcdir)/../../build-aux/relpath"; \
+ test -r $$relpath || { \
+ echo 'script_links.am:install-links: could not find relpath script'; \
+ exit 1; \
+ }; \
+ REL=`$(SHELL) $$relpath '$(DESTDIR)' '$(bindir)' '$(datarootdir)'`; \
+ if test -z "$$REL"; then \
+ echo 'script_links.am:install_links: unable to compute relative path for linked $(TYPE) scripts' >&2; \
+ exit 1; \
+ fi; \
+ cd $(DESTDIR)$(bindir) && \
+ for f in $($(TYPE)_scripts); do \
+ rm -f $$f; \
+ if $(AM_V_P); then echo "creating link '$$f' -> '$$REL/$(scriptsdir)/$$f.$(EXT)'"; \
+ else echo " LINK $$f"; fi; \
+ $(LN_S) $$REL/$(scriptsdir)/$$f.$(EXT) $$f || exit 1; \
+ done
+
+uninstall-links:
+if !WIN32
+ @for f in $(all_scripts) $(sh_scripts); do \
+ echo "rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+endif !WIN32
+