2005-03-14 20:51:43 -05:00
|
|
|
#!/bin/bash
|
2007-05-30 11:04:49 -04:00
|
|
|
#
|
2005-03-14 20:51:43 -05:00
|
|
|
# makeworld
|
2007-05-30 11:04:49 -04:00
|
|
|
# @configure_input@
|
|
|
|
#
|
2007-04-11 16:30:48 -04:00
|
|
|
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
2007-05-30 11:04:49 -04:00
|
|
|
#
|
2005-03-14 20:51:43 -05:00
|
|
|
# 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.
|
2007-05-30 11:04:49 -04:00
|
|
|
#
|
2005-03-14 20:51:43 -05:00
|
|
|
# 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.
|
2007-05-30 11:04:49 -04:00
|
|
|
#
|
2005-03-14 20:51:43 -05:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-12-10 23:55:22 -05:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-03-14 20:51:43 -05:00
|
|
|
#
|
|
|
|
|
2007-11-09 13:43:48 -05:00
|
|
|
# gettext initialization
|
|
|
|
export TEXTDOMAIN='pacman'
|
|
|
|
export TEXTDOMAINDIR='@localedir@'
|
|
|
|
|
2007-06-04 01:02:32 -04:00
|
|
|
myver="@PACKAGE_VERSION@"
|
2007-11-09 13:43:48 -05:00
|
|
|
BUG_REPORT_EMAIL='@PACKAGE_BUGREPORT@'
|
2007-01-25 21:13:16 -05:00
|
|
|
toplevel=$(pwd)
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
usage() {
|
2007-06-04 01:02:32 -04:00
|
|
|
printf "makeworld (pacman) %s\n" "$myver"
|
2007-11-09 13:43:48 -05:00
|
|
|
echo "$(gettext "Usage: %s [options] <destdir> <category> [category] ...")" "$0"
|
|
|
|
echo "$(gettext "Options:")"
|
|
|
|
echo "$(gettext " -b, --builddeps Build missing dependencies from source")"
|
|
|
|
echo "$(gettext " -B, --noccache Do not use ccache during build")"
|
|
|
|
echo "$(gettext " -c, --clean Clean up work files after build")"
|
|
|
|
echo "$(gettext " -C, --cleancache Clean up source files from the cache")"
|
|
|
|
echo "$(gettext " -d, --nodeps Skip all dependency checks")"
|
|
|
|
echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")"
|
|
|
|
echo "$(gettext " -f, --force Overwrite existing packages")"
|
|
|
|
echo "$(gettext " -i, --install Install package after successful build")"
|
|
|
|
echo "$(gettext " -m, --nocolor Disable colorized output messages")"
|
|
|
|
echo "$(gettext " -h, --help This help")"
|
|
|
|
echo "$(gettext " -o, --nobuild Download and extract files only")"
|
|
|
|
echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")"
|
|
|
|
echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")"
|
|
|
|
echo "$(gettext " -S, --usesudo Use sudo when running pacman commands")"
|
2005-03-14 20:51:43 -05:00
|
|
|
echo
|
2007-11-09 13:43:48 -05:00
|
|
|
echo "$(gettext "These options can be passed to pacman:")"
|
2006-02-07 13:29:32 -05:00
|
|
|
echo
|
2007-11-09 13:43:48 -05:00
|
|
|
echo "$(gettext " --noconfirm Do not ask for confirmation when resolving dependencies")"
|
|
|
|
echo "$(gettext " --noprogressbar Do not show a progress bar when downloading files")"
|
2006-02-07 13:29:32 -05:00
|
|
|
echo
|
2007-11-09 13:43:48 -05:00
|
|
|
echo "$(gettext "Where <category> is one or more directory names under the ABS root")"
|
|
|
|
echo "$(gettext "eg: makeworld -c /packages base lib editors")"
|
2005-03-14 20:51:43 -05:00
|
|
|
echo
|
2007-11-09 13:43:48 -05:00
|
|
|
echo "$(gettext "This should be run from the toplevel directory of ABS (usually /var/abs)")"
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
|
2007-04-11 16:30:48 -04:00
|
|
|
version() {
|
2007-06-04 01:02:32 -04:00
|
|
|
printf "makeworld (pacman) %s\n" "$myver"
|
2007-11-09 13:43:48 -05:00
|
|
|
printf "$(gettext "\
|
2007-07-06 19:35:32 -04:00
|
|
|
Copyright (C) 2002-2007 Judd Vinet <jvinet@zeroflux.org>.\n\n\
|
|
|
|
This is free software; see the source for copying conditions.\n\
|
2007-11-09 13:43:48 -05:00
|
|
|
There is NO WARRANTY, to the extent permitted by law.\n")"
|
2007-04-11 16:30:48 -04:00
|
|
|
}
|
|
|
|
|
2005-03-14 20:51:43 -05:00
|
|
|
MAKEPKG_OPTS=
|
|
|
|
for arg in $*; do
|
|
|
|
case $arg in
|
2006-12-20 20:53:40 -05:00
|
|
|
# pacman
|
2006-02-07 13:29:32 -05:00
|
|
|
--noconfirm) MAKEPKG_OPTS="$MAKEPKG_OPTS --noconfirm" ;;
|
|
|
|
--noprogressbar) MAKEPKG_OPTS="$MAKEPKG_OPTS --noprogressbar" ;;
|
2006-12-20 20:53:40 -05:00
|
|
|
# makepkg
|
2007-02-12 04:37:02 -05:00
|
|
|
--clean) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
|
|
|
|
--install) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
|
|
|
|
--syncdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;;
|
|
|
|
--usesudo) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;;
|
|
|
|
--builddeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
|
|
|
|
--nodeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
|
|
|
|
--force) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
|
|
|
|
--rmdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;;
|
|
|
|
--noccache) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;;
|
|
|
|
--cleancache) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;;
|
|
|
|
--noextract) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;;
|
|
|
|
--nobuild) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;;
|
|
|
|
--nocolor) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;;
|
2005-03-14 20:51:43 -05:00
|
|
|
--help)
|
2007-05-29 16:53:15 -04:00
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
2007-04-11 16:30:48 -04:00
|
|
|
--version)
|
2007-05-29 16:53:15 -04:00
|
|
|
version
|
|
|
|
exit 0
|
|
|
|
;;
|
2005-03-14 20:51:43 -05:00
|
|
|
--*)
|
2007-05-29 16:53:15 -04:00
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
2005-03-14 20:51:43 -05:00
|
|
|
-*)
|
2007-05-29 16:53:15 -04:00
|
|
|
while getopts "chisSbdfrBCemoSV-" opt; do
|
|
|
|
case $opt in
|
|
|
|
c) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
|
|
|
|
i) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
|
|
|
|
s) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;;
|
|
|
|
b) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
|
|
|
|
d) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
|
|
|
|
f) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
|
|
|
|
r) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;;
|
|
|
|
B) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;;
|
|
|
|
C) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;;
|
|
|
|
e) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;;
|
|
|
|
m) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;;
|
|
|
|
o) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;;
|
|
|
|
S) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;;
|
|
|
|
h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
V)
|
|
|
|
version
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-)
|
|
|
|
OPTIND=0
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
;;
|
2005-03-14 20:51:43 -05:00
|
|
|
*)
|
2007-05-29 16:53:15 -04:00
|
|
|
dest=$arg
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
2005-03-14 20:51:43 -05:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
if [ "$dest" != "" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$dest" = "" ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2007-04-11 16:51:20 -04:00
|
|
|
if [ $# -lt 1 ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-03-14 20:51:43 -05:00
|
|
|
# convert a (possibly) relative path to absolute
|
2007-03-20 15:16:17 -04:00
|
|
|
cd "$dest"
|
|
|
|
dest="$(pwd)"
|
2005-03-14 20:51:43 -05:00
|
|
|
cd - &>/dev/null
|
|
|
|
|
2007-01-25 21:13:16 -05:00
|
|
|
sd=$(date +"[%b %d %H:%M]")
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
for category in $*; do
|
2007-03-20 15:16:17 -04:00
|
|
|
for port in $(find "$toplevel/$category" -maxdepth 1 -mindepth 1 -type d | sort); do
|
2005-03-14 20:51:43 -05:00
|
|
|
cd $port
|
|
|
|
if [ -f PKGBUILD ]; then
|
|
|
|
. PKGBUILD
|
|
|
|
buildstatus=0
|
2007-03-20 15:16:17 -04:00
|
|
|
if [ ! -f "$dest/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" ]; then
|
|
|
|
PKGDEST="$dest" makepkg $MAKEPKG_OPTS -m 2>>$toplevel/makepkg.log
|
2005-03-14 20:51:43 -05:00
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
buildstatus=2
|
|
|
|
else
|
|
|
|
buildstatus=1
|
|
|
|
fi
|
|
|
|
fi
|
2007-01-25 21:13:16 -05:00
|
|
|
d=$(date +"[%b %d %H:%M]")
|
2005-03-14 20:51:43 -05:00
|
|
|
echo -n "$d " >>$toplevel/build.log
|
|
|
|
case $buildstatus in
|
|
|
|
0) echo "$pkgname already built -- skipping" >>$toplevel/build.log ;;
|
|
|
|
1) echo "$pkgname was built successfully" >>$toplevel/build.log ;;
|
|
|
|
2) echo "$pkgname build failed" >>$toplevel/build.log ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2007-01-30 00:41:13 -05:00
|
|
|
ed=$(date +"[%b %d %H:%M]")
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
echo "makeworld complete." >>$toplevel/build.log
|
|
|
|
echo " started: $sd" >>$toplevel/build.log
|
|
|
|
echo " finished: $ed" >>$toplevel/build.log
|
|
|
|
|
|
|
|
exit 0
|
2006-12-20 20:53:40 -05:00
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 noet:
|