scripts: do autoconf path replacement right

This should finally get the path replacement in our scripts right. This
is the way the autoconf package itself does it and should not need much
further tweaking.

Threw in a few trailing whitespace corrections from the scripts as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-05-30 11:04:49 -04:00
parent dd926c7a1c
commit b6387b954f
11 changed files with 131 additions and 94 deletions

View File

@ -137,22 +137,22 @@ esac
# Check for architecture
case "${host}" in
i686-*)
i686-*)
CARCH="i686"
CARCHFLAGS="i686"
ARCHSWITCH="march"
;;
x86_64-*)
x86_64-*)
CARCH="x86_64"
CARCHFLAGS="x86-64"
ARCHSWITCH="march"
;;
ia64-*)
ia64-*)
CARCH="ia64"
CARCHFLAGS="ia64"
ARCHSWITCH="march"
;;
sparc-*)
sparc-*)
CARCH="sparc"
CARCHFLAGS="v9"
ARCHSWITCH="mcpu"
@ -162,7 +162,7 @@ case "${host}" in
CARCHFLAGS="750"
ARCHSWITCH="mcpu"
;;
i386-*)
i386-*)
CARCH="i386"
CARCHFLAGS="i386"
ARCHSWITCH="march"
@ -236,15 +236,6 @@ AC_SUBST(PKGEXT)
AC_DEFINE_UNQUOTED([PM_EXT_DB], "$DBEXT", [The file extension used by pacman databases])
AC_SUBST(DBEXT)
# Set up localedir substitution, double eval to get full path
localedir="$(eval echo ${localedir})"
LOCALEDIR="$(eval echo ${localedir})"
AC_SUBST(LOCALEDIR)
sysconfdir="$(eval echo ${sysconfdir})"
SYSCONFDIR="$(eval echo ${sysconfdir})"
AC_SUBST(SYSCONFDIR)
# Configuration files
AC_CONFIG_FILES([
lib/libalpm/Makefile
@ -253,15 +244,6 @@ src/pacman/Makefile
src/pacman/po/Makefile.in
src/util/Makefile
scripts/Makefile
scripts/abs
scripts/gensync
scripts/makepkg
scripts/makeworld
scripts/pacman-optimize
scripts/rankmirrors
scripts/repo-add
scripts/repo-remove
scripts/updatesync
doc/Makefile
etc/Makefile
etc/makepkg.conf
@ -279,6 +261,7 @@ echo "
$PACKAGE_STRING:
prefix : ${prefix}
sysconfdir : $(eval echo ${sysconfdir})
source code location : ${srcdir}
compiler : ${CC}
compiler flags : ${CFLAGS}

View File

@ -12,4 +12,49 @@ bin_SCRIPTS = \
repo-remove \
updatesync
abs gensync makepkg makeworld pacman-optimize rankmirrors repo-add repo-remove re-pacman updatesync:
EXTRA_DIST = \
abs.in \
gensync.in \
makepkg.in \
makeworld.in \
pacman-optimize.in \
rankmirrors.in \
repo-add.in \
repo-remove.in \
updatesync.in
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(bin_SCRIPTS) *.tmp
#### Taken from the autoconf scripts Makefile.am ####
edit = sed \
-e 's|@localedir[@]|$(localedir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@prefix[@]|$(prefix)|g' \
-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g' \
-e 's|@DBPATH[@]|$(DBPATH)|g' \
-e 's|@LOCKFILE[@]|$(LOCKFILE)|g' \
-e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
## All the scripts depend on Makefile so that they are rebuilt when the
## prefix etc. changes. Use chmod -w to prevent people from editing the
## wrong file by accident.
$(bin_SCRIPTS): Makefile
rm -f $@ $@.tmp
$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
chmod +x $@.tmp
chmod a-w $@.tmp
mv $@.tmp $@
abs: $(srcdir)/abs.in
gensync: $(srcdir)/gensync.in
makepkg: $(srcdir)/makepkg.in
makeworld: $(srcdir)/makeworld.in
pacman-optimize: $(srcdir)/pacman-optimize.in
rankmirrors: $(srcdir)/rankmirrors.in
repo-add: $(srcdir)/repo-add.in
repo-remove: $(srcdir)/repo-remove.in
re-pacman: $(srcdir)/re-pacman.in
updatesync: $(srcdir)/updatesync.in

View File

@ -1,27 +1,28 @@
#!/bin/bash
#
# abs
#
#
# abs - download a PKGBUILD tree from a CVS repository
# @configure_input@
#
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
myver='@PACKAGE_VERSION@'
CONFDIR="@SYSCONFDIR@/abs"
CONFDIR="@sysconfdir@/abs"
CONNMODE="m"
[ -f "$CONFDIR/abs.conf" ] && source "$CONFDIR/abs.conf"
@ -65,7 +66,7 @@ update() {
cd "$ABSROOT"
fi
done
}
}
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage

View File

@ -1,22 +1,23 @@
#!/bin/bash
#
#
# gensync
#
# @configure_input@
#
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
@ -37,9 +38,9 @@ usage() {
echo
echo "note: The <destfile> name is important. It must be of the form"
echo " {treename}.db.tar.gz where {treename} is the name of the custom"
echo " package repository you configured in @SYSCONFDIR@/pacman.conf. The"
echo " package repository you configured in @sysconfdir@/pacman.conf. The"
echo " generated database must reside in the same directory as your"
echo " custom packages (also configured in @SYSCONFDIR@/pacman.conf)"
echo " custom packages (also configured in @sysconfdir@/pacman.conf)"
echo
echo "example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz"
echo
@ -94,10 +95,10 @@ if [ $# -lt 2 ]; then
fi
# source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf
if [ -r @sysconfdir@/makepkg.conf ]; then
source @sysconfdir@/makepkg.conf
else
echo "ERROR: @SYSCONFDIR@/makepkg.conf not found. Can not continue." >&2
echo "ERROR: @sysconfdir@/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes
fi

View File

@ -1,8 +1,9 @@
#!/bin/bash
#
# makepkg - make packages compatable for use with pacman
# @configure_input@
#
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@ -21,7 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
@ -30,7 +31,7 @@ source gettext.sh
TEXTDOMAIN=makepkg
export TEXTDOMAIN
TEXTDOMAINDIR='@LOCALEDIR@'
TEXTDOMAINDIR='@localedir@'
export TEXTDOMAINDIR
myver='@PACKAGE_VERSION@'
@ -38,14 +39,14 @@ startdir=$(pwd)
# Only use ABSROOT if we haven't been passed a SRCROOT on the command line.
if [ -z "$SRCROOT" ]; then
if [ -r @SYSCONFDIR@/abs/abs.conf ]; then
source @SYSCONFDIR@/abs/abs.conf
if [ -r @sysconfdir@/abs/abs.conf ]; then
source @sysconfdir@/abs/abs.conf
fi
if [ -r ~/.abs.conf ]; then
source ~/.abs.conf
fi
SRCROOT=$ABSROOT
fi
fi
# Options
ASROOT=0
@ -649,8 +650,8 @@ _PKGDEST=${PKGDEST}
_SRCDEST=${SRCDEST}
# Source makepkg.conf; fail if it is not found
if [ -r @SYSCONFDIR@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf
if [ -r @sysconfdir@/makepkg.conf ]; then
source @sysconfdir@/makepkg.conf
else
error "$(gettext "/etc/makepkg.conf not found. cannot continue")"
exit 1 # $E_CONFIG_ERROR # TODO: error codes
@ -1024,7 +1025,7 @@ else
fi
done
#Validate integrity checks
else
else
integrity_sums=($(eval echo \${${integrity_name}s[@]}))
if [ ${#integrity_sums[@]} -eq ${#source[@]} ]; then
@ -1103,7 +1104,7 @@ else
fi
fi
done
if [ "$EUID" = "0" ]; then
# chown all source files to root.root
chown -R root.root "$startdir/src"

View File

@ -1,22 +1,23 @@
#!/bin/bash
#
#
# makeworld
#
# @configure_input@
#
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#

View File

@ -1,22 +1,23 @@
#!/bin/bash
#
#
# pacman-optimize
#
# @configure_input@
#
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
@ -39,7 +40,7 @@ error() {
usage() {
echo "pacman-optimize (pacman) $myver"
echo "usage: $0 [pacman_db_root]"
echo
echo
echo "pacman-optimize is a little hack that should improve the performance"
echo "of pacman when reading/writing to its filesystem-based database."
echo

View File

@ -1,6 +1,7 @@
#! /usr/bin/python
#
# rankmirrors : read a list of mirrors from a file and rank them by speed
# rankmirrors - read a list of mirrors from a file and rank them by speed
# @configure_input@
#
# Original Idea copyright (c) 2006 R.G. <chesercat>
# Modified 2006 by Dan McGee <dan@archlinux.org>

View File

@ -1,22 +1,23 @@
#!/bin/bash
#
# repo-add : add a package to a given repo database file
#
# repo-add - add a package to a given repo database file
# @configure_input@
#
# Copyright (c) 2006 Aaron Griffin <aaron@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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
myver='@PACKAGE_VERSION@'
@ -99,7 +100,7 @@ db_write_entry()
builddate=""
packager=""
csize=""
size=""
size=""
_groups=""
_depends=""
_backups=""
@ -138,7 +139,7 @@ db_write_entry()
if [ -z "$pkgname" -o -z "$pkgver" ]; then
echo " error: invalid package file"
return 1
fi
fi
# remove any other package in the DB with same name
for existing in *; do
@ -237,8 +238,8 @@ if [ $# -lt 2 ]; then
fi
# source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf
if [ -r @sysconfdir@/makepkg.conf ]; then
source @sysconfdir@/makepkg.conf
else
echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes

View File

@ -1,22 +1,23 @@
#!/bin/bash
#
# repo-remove : remove a package entry from a given repo database file
#
# repo-remove - remove a package entry from a given repo database file
# @configure_input@
#
# Copyright (c) 2007 Dan McGee <dan@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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
myver='@PACKAGE_VERSION@'
@ -93,8 +94,8 @@ if [ $# -lt 2 ]; then
fi
# source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf
if [ -r @sysconfdir@/makepkg.conf ]; then
source @sysconfdir@/makepkg.conf
else
echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes

View File

@ -1,23 +1,24 @@
#!/bin/bash
#
#
# updatesync
#
# @configure_input@
#
# Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
# Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
@ -96,8 +97,8 @@ if [ $# -lt 3 ]; then
fi
# source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf
if [ -r @sysconfdir@/makepkg.conf ]; then
source @sysconfdir@/makepkg.conf
else
echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes