makepkg: run locally with libtool style wrapper

Build makepkg to scripts/.lib/makepkg and add a wrapper script to
call it. This is not useful at the moment, but is the first step
to allowing makepkg to be split into smaller pieces.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Ashley: rebased]
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
This commit is contained in:
Allan McRae 2013-09-22 11:25:29 +01:00
parent 0308df07d3
commit c9ab8a7f6c
3 changed files with 49 additions and 0 deletions

1
scripts/.gitignore vendored
View file

@ -1,5 +1,6 @@
makepkg makepkg
makepkg-template makepkg-template
makepkg-wrapper
pacman-db-upgrade pacman-db-upgrade
pacman-key pacman-key
pacman-optimize pacman-optimize

View file

@ -6,6 +6,7 @@ SUBDIRS = po
bin_SCRIPTS = \ bin_SCRIPTS = \
$(OURSCRIPTS) \ $(OURSCRIPTS) \
makepkg-template \ makepkg-template \
makepkg-wrapper \
repo-remove \ repo-remove \
repo-elephant repo-elephant
@ -20,6 +21,7 @@ OURSCRIPTS = \
EXTRA_DIST = \ EXTRA_DIST = \
makepkg.sh.in \ makepkg.sh.in \
makepkg-template.pl.in \ makepkg-template.pl.in \
makepkg-wrapper.sh.in \
pacman-db-upgrade.sh.in \ pacman-db-upgrade.sh.in \
pacman-key.sh.in \ pacman-key.sh.in \
pacman-optimize.sh.in \ pacman-optimize.sh.in \
@ -37,6 +39,9 @@ LIBRARY = \
# Files that should be removed, but which Automake does not know. # Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(bin_SCRIPTS) MOSTLYCLEANFILES = $(bin_SCRIPTS)
clean-local:
$(AM_V_at)$(RM) -r .lib
if USE_GIT_VERSION if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//') GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
REAL_PACKAGE_VERSION = $(GIT_VERSION) REAL_PACKAGE_VERSION = $(GIT_VERSION)
@ -77,6 +82,7 @@ $(OURSCRIPTS): Makefile
makepkg: \ makepkg: \
$(srcdir)/makepkg.sh.in \ $(srcdir)/makepkg.sh.in \
$(srcdir)/makepkg-wrapper.sh.in \
$(srcdir)/library/parseopts.sh $(srcdir)/library/parseopts.sh
makepkg-template: \ makepkg-template: \
@ -117,7 +123,26 @@ repo-elephant: $(srcdir)/repo-add.sh.in
$(AM_V_at)$(RM) repo-elephant $(AM_V_at)$(RM) repo-elephant
$(AM_V_at)$(LN_S) repo-add repo-elephant $(AM_V_at)$(LN_S) repo-add repo-elephant
makepkg-wrapper: \
Makefile \
$(srcdir)/makepkg-wrapper.sh.in \
$(srcdir)/makepkg.sh.in \
$(srcdir)/library/parseopts.sh \
| makepkg
$(AM_V_at)$(MKDIR_P) .lib
$(AM_V_at)mv -f makepkg .lib
$(AM_V_at)$(RM) $@
$(AM_V_GEN)sed \
-e "s|@PWD[@]|$$(pwd)|" \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g' \
$(srcdir)/$@.sh.in > $@
$(AM_V_at)chmod +x,a-w $@
$(AM_V_at)$(LN_S) makepkg-wrapper makepkg
install-data-hook: install-data-hook:
cd $(DESTDIR)$(bindir) && \
$(RM) makepkg makepkg-wrapper
$(INSTALL) .lib/makepkg $(DESTDIR)$(bindir)/makepkg
cd $(DESTDIR)$(bindir) && \ cd $(DESTDIR)$(bindir) && \
$(RM) repo-elephant && \ $(RM) repo-elephant && \
( $(LN_S) repo-add repo-elephant || \ ( $(LN_S) repo-add repo-elephant || \

View file

@ -0,0 +1,23 @@
#!/bin/bash
#
# makepkg - a wrapper for running the real makepkg in the source tree
#
# Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
DIR="@PWD@"
LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/makepkg "$@"