summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2016-10-12 15:27:26 +1000
committerAllan McRae <allan@archlinux.org>2016-10-22 20:50:29 +1000
commitdfc78129be7acaa0ebe71fe407d63b5141c10150 (patch)
treed5e5aefc511c404797d2caa438cc9820c9e06051 /scripts
parentaca153bfa6b1bcd828f0b35db453bb9fea6a08bf (diff)
Generalise makepkg-wrapper to handle any script using libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am29
-rw-r--r--scripts/wrapper.sh.in (renamed from scripts/makepkg-wrapper.sh.in)4
2 files changed, 20 insertions, 13 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 5d4fd29e..3863a2c1 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -11,9 +11,9 @@ SUBDIRS = po
bin_SCRIPTS = \
$(OURSCRIPTS) \
makepkg-template \
- makepkg-wrapper \
repo-remove \
- repo-elephant
+ repo-elephant \
+ $(WRAPPER)
OURSCRIPTS = \
makepkg \
@@ -25,11 +25,11 @@ OURSCRIPTS = \
EXTRA_DIST = \
makepkg.sh.in \
makepkg-template.pl.in \
- makepkg-wrapper.sh.in \
pacman-db-upgrade.sh.in \
pacman-key.sh.in \
pkgdelta.sh.in \
repo-add.sh.in \
+ wrapper.sh.in \
$(COMPLETION_DIST) \
$(LIBRARY) \
$(LIBMAKEPKG_DIST)
@@ -104,6 +104,9 @@ LIBMAKEPKG_IN = \
LIBMAKEPKG_DIST = \
$(addsuffix .in, $(LIBMAKEPKG_IN))
+WRAPPER = \
+ makepkg-wrapper
+
COMPLETION_IN = \
completion/bash_completion \
completion/zsh_completion
@@ -176,7 +179,7 @@ all-am: $(COMPLETION_IN)
makepkg: \
$(srcdir)/makepkg.sh.in \
- $(srcdir)/makepkg-wrapper.sh.in \
+ $(srcdir)/wrapper.sh.in \
$(srcdir)/library/parseopts.sh \
$(LIBMAKEPKG_IN)
@@ -214,18 +217,20 @@ repo-elephant: $(srcdir)/repo-add.sh.in
$(AM_V_at)$(RM) repo-elephant
$(AM_V_at)$(LN_S) repo-add repo-elephant
-makepkg-wrapper: \
- makepkg
+.SECONDEXPANSION:
+$(WRAPPER): \
+ $$(subst -wrapper,,$$@)
$(AM_V_at)$(MKDIR_P) .lib
- $(AM_V_at)mv -f makepkg .lib
+ $(AM_V_at)mv -f $(subst -wrapper,,$@) .lib
$(AM_V_at)$(RM) $@
$(AM_V_GEN)sed \
-e "s|@PWD[@]|$$(pwd)|" \
+ -e "s|@PROGNAME[@]|$(subst -wrapper,,$@)|g" \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g' \
- $(srcdir)/$@.sh.in > $@
+ $(srcdir)/wrapper.sh.in > $@
$(AM_V_at)chmod +x,a-w $@
- $(AM_V_at)$(LN_S) makepkg-wrapper makepkg
+ $(AM_V_at)$(LN_S) $@ $(subst -wrapper,,$@)
install-data-local:
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
@@ -238,8 +243,10 @@ uninstall-local:
$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
install-exec-hook:
- cd $(DESTDIR)$(bindir) && \
- $(RM) makepkg makepkg-wrapper
+ for wrapper in $(WRAPPER); do \
+ cd $(DESTDIR)$(bindir) && \
+ $(RM) $$wrapper; \
+ done
$(INSTALL) .lib/makepkg $(DESTDIR)$(bindir)/makepkg
for dir in $(LIBMAKEPKGDIRS); do \
$(MKDIR_P) $(DESTDIR)$(libmakepkgdir)/$$dir; \
diff --git a/scripts/makepkg-wrapper.sh.in b/scripts/wrapper.sh.in
index 6e713145..2039c2ac 100644
--- a/scripts/makepkg-wrapper.sh.in
+++ b/scripts/wrapper.sh.in
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# makepkg - a wrapper for running the real makepkg in the source tree
+# @PROGNAME@ - a wrapper for running the real @PROGNAME@ in the source tree
#
# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
#
@@ -20,4 +20,4 @@
DIR="@PWD@"
-LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/makepkg "$@"
+LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/@PROGNAME@ "$@"