From dfc78129be7acaa0ebe71fe407d63b5141c10150 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Wed, 12 Oct 2016 15:27:26 +1000 Subject: Generalise makepkg-wrapper to handle any script using libmakepkg Signed-off-by: Allan McRae --- scripts/Makefile.am | 29 ++++++++++++++++++----------- scripts/makepkg-wrapper.sh.in | 23 ----------------------- scripts/wrapper.sh.in | 23 +++++++++++++++++++++++ 3 files changed, 41 insertions(+), 34 deletions(-) delete mode 100644 scripts/makepkg-wrapper.sh.in create mode 100644 scripts/wrapper.sh.in 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/makepkg-wrapper.sh.in deleted file mode 100644 index 6e713145..00000000 --- a/scripts/makepkg-wrapper.sh.in +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# makepkg - a wrapper for running the real makepkg in the source tree -# -# Copyright (c) 2013-2016 Pacman Development Team -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -DIR="@PWD@" - -LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/makepkg "$@" diff --git a/scripts/wrapper.sh.in b/scripts/wrapper.sh.in new file mode 100644 index 00000000..2039c2ac --- /dev/null +++ b/scripts/wrapper.sh.in @@ -0,0 +1,23 @@ +#!/bin/bash +# +# @PROGNAME@ - a wrapper for running the real @PROGNAME@ in the source tree +# +# Copyright (c) 2013-2016 Pacman Development Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +DIR="@PWD@" + +LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/@PROGNAME@ "$@" -- cgit v1.2.3-70-g09d2