|
|
|
@ -26,7 +26,7 @@
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
myver='3.0.0'
|
|
|
|
|
startdir=`pwd`
|
|
|
|
|
startdir=$(pwd)
|
|
|
|
|
PKGDEST=$startdir
|
|
|
|
|
|
|
|
|
|
BUILDSCRIPT="PKGBUILD"
|
|
|
|
@ -106,8 +106,8 @@ strip_url() {
|
|
|
|
|
check_option() {
|
|
|
|
|
local i
|
|
|
|
|
for i in ${options[@]}; do
|
|
|
|
|
local uc=`echo $i | tr [:lower:] [:upper:]`
|
|
|
|
|
local lc=`echo $i | tr [:upper:] [:lower:]`
|
|
|
|
|
local uc=$(echo $i | tr [:lower:] [:upper:])
|
|
|
|
|
local lc=$(echo $i | tr [:upper:] [:lower:])
|
|
|
|
|
if [ "$uc" = "$1" -o "$lc" = "$1" ]; then
|
|
|
|
|
echo $1
|
|
|
|
|
return
|
|
|
|
@ -131,7 +131,7 @@ checkdeps() {
|
|
|
|
|
|
|
|
|
|
[ $# -gt 0 ] || return
|
|
|
|
|
|
|
|
|
|
missdep=`pacman $PACMAN_OPTS -T $*`
|
|
|
|
|
missdep=$(pacman $PACMAN_OPTS -T $*)
|
|
|
|
|
ret=$?
|
|
|
|
|
if [ "$ret" != "0" ]; then
|
|
|
|
|
if [ "$ret" = "127" ]; then
|
|
|
|
@ -144,7 +144,7 @@ checkdeps() {
|
|
|
|
|
nl=0
|
|
|
|
|
echo -ne "\n" >&2
|
|
|
|
|
# add this dep to the list
|
|
|
|
|
depname=`echo $dep | sed 's|=.*$||' | sed 's|>.*$||' | sed 's|<.*$||'`
|
|
|
|
|
depname=$(echo $dep | sed 's|=.*$||' | sed 's|>.*$||' | sed 's|<.*$||')
|
|
|
|
|
deplist="$deplist $depname"
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
@ -163,7 +163,7 @@ handledeps() {
|
|
|
|
|
local missingdeps=0
|
|
|
|
|
local deplist="$*"
|
|
|
|
|
local haveperm=0
|
|
|
|
|
if [ \( "`id -u`" = "0" -a "$INFAKEROOT" != "1" \) -o "$DEP_SUDO" = 1 ]; then
|
|
|
|
|
if [ \( "$EUID" = "0" -a "$INFAKEROOT" != "1" \) -o "$DEP_SUDO" = 1 ]; then
|
|
|
|
|
haveperm=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
@ -381,7 +381,7 @@ while [ "$#" -ne "0" ]; do
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# check for sudo
|
|
|
|
|
if [ "$DEP_SUDO" = "1" -a ! "`type -p sudo`" ]; then
|
|
|
|
|
if [ "$DEP_SUDO" = "1" -a ! "$(type -p sudo)" ]; then
|
|
|
|
|
error "Cannot find the sudo binary! Is sudo installed?"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
@ -392,7 +392,7 @@ if [ $? -ne 0 ]; then
|
|
|
|
|
error "Package destination directory does not exist or permission denied."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
PKGDEST=`pwd`
|
|
|
|
|
PKGDEST=$(pwd)
|
|
|
|
|
cd $OLDPWD
|
|
|
|
|
|
|
|
|
|
if [ "$CLEANCACHE" = "1" ]; then
|
|
|
|
@ -402,7 +402,7 @@ if [ "$CLEANCACHE" = "1" ]; then
|
|
|
|
|
rm -rf "${SRCDEST}"/*
|
|
|
|
|
exit 0
|
|
|
|
|
else
|
|
|
|
|
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
if [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
msg "Cleaning up source files from the cache."
|
|
|
|
|
rm -rf /var/cache/pacman/src/*
|
|
|
|
|
exit 0
|
|
|
|
@ -478,9 +478,9 @@ fi
|
|
|
|
|
|
|
|
|
|
# Enter the fakeroot environment if necessary. This will call the makepkg script again
|
|
|
|
|
# as the fake root user. We detect this by passing a sentinel option (-F) to makepkg
|
|
|
|
|
if [ "`id -u`" != "0" ]; then
|
|
|
|
|
if [ "$EUID" != "0" ]; then
|
|
|
|
|
if [ "$USE_FAKEROOT" = "y" -o "$USE_FAKEROOT" = "Y" ]; then
|
|
|
|
|
if [ `type -p fakeroot` ]; then
|
|
|
|
|
if [ $(type -p fakeroot) ]; then
|
|
|
|
|
msg "Entering fakeroot environment"
|
|
|
|
|
fakeroot -- $0 -F $ARGLIST
|
|
|
|
|
exit $?
|
|
|
|
@ -501,25 +501,25 @@ if [ "`id -u`" != "0" ]; then
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
msg "Making package: $pkgname $pkgver-$pkgrel (`date`)"
|
|
|
|
|
msg "Making package: $pkgname $pkgver-$pkgrel ($(date))"
|
|
|
|
|
|
|
|
|
|
unset deplist makedeplist
|
|
|
|
|
# fix flyspray bug #5973 - Dan McGee <dpmcgee@gmail.com>
|
|
|
|
|
if [ `type -p pacman` -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a "$NOBUILD" = "0" ]; then
|
|
|
|
|
if [ $(type -p pacman) -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a "$NOBUILD" = "0" ]; then
|
|
|
|
|
msg "Checking Runtime Dependencies..."
|
|
|
|
|
deplist=`checkdeps ${depends[@]}`
|
|
|
|
|
deplist=$(checkdeps ${depends[@]})
|
|
|
|
|
handledeps $deplist
|
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
# check deps again to make sure they were resolved
|
|
|
|
|
deplist=`checkdeps ${depends[@]}`
|
|
|
|
|
deplist=$(checkdeps ${depends[@]})
|
|
|
|
|
if [ ! -z "$deplist" ]; then
|
|
|
|
|
error "Failed to install missing dependencies."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
msg "Checking Buildtime Dependencies..."
|
|
|
|
|
makedeplist=`checkdeps ${makedepends[@]}`
|
|
|
|
|
makedeplist=$(checkdeps ${makedepends[@]})
|
|
|
|
|
handledeps $makedeplist
|
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
|
exit 1
|
|
|
|
@ -554,9 +554,9 @@ for netfile in ${source[@]}; do
|
|
|
|
|
msg "Aborting..."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
ftpclient=`echo $FTPAGENT | awk {'print $1'}`
|
|
|
|
|
ftpclient=$(echo $FTPAGENT | awk {'print $1'})
|
|
|
|
|
if [ ! -x "$ftpclient" ]; then
|
|
|
|
|
error "ftpclient `basename $ftpclient` is not installed."
|
|
|
|
|
error "ftpclient $(basename $ftpclient) is not installed."
|
|
|
|
|
msg "Aborting..."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
@ -577,11 +577,11 @@ for netfile in ${source[@]}; do
|
|
|
|
|
exit 1
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
if [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src
|
|
|
|
|
if [ -n "$SRCDEST" ]; then
|
|
|
|
|
mkdir -p $SRCDEST && cp "$file" $SRCDEST
|
|
|
|
|
elif [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
elif [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
mkdir -p /var/cache/pacman/src && cp "$file" /var/cache/pacman/src
|
|
|
|
|
else
|
|
|
|
|
cp "$file" ..
|
|
|
|
@ -593,7 +593,6 @@ done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$NOEXTRACT" = "1" ]; then
|
|
|
|
|
warning "Skipping source extraction -- using existing src/ tree"
|
|
|
|
|
warning "Skipping source integrity checks -- using existing src/ tree"
|
|
|
|
|
else
|
|
|
|
|
for integ in ${INTEGRITY_CHECK[@]}; do
|
|
|
|
@ -619,7 +618,7 @@ else
|
|
|
|
|
newline=0
|
|
|
|
|
numsrc=${#source[@]}
|
|
|
|
|
for netfile in "${source[@]}"; do
|
|
|
|
|
file=`strip_url "$netfile"`
|
|
|
|
|
file=$(strip_url "$netfile")
|
|
|
|
|
sum=$(eval "$integrity_name '$file' | cut -d' ' -f 1")
|
|
|
|
|
if [ $ct -eq 0 ]; then
|
|
|
|
|
echo -n "${integrity_name}s=("
|
|
|
|
@ -636,7 +635,6 @@ else
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
plain ""
|
|
|
|
|
exit 0
|
|
|
|
|
#Validate integrity checks
|
|
|
|
|
else
|
|
|
|
|
integrity_sums=($(eval echo \${${integrity_name}s[@]}))
|
|
|
|
@ -662,17 +660,26 @@ else
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
warning "Integrity checks ($INTEGRITY_CHECK) are missing or incomplete."
|
|
|
|
|
warning "Integrity checks ($integ) are missing or incomplete."
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ "$GENINTEG" = "1" ]; then
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#Extract sources
|
|
|
|
|
if [ "$NOEXTRACT" = "1" ]; then
|
|
|
|
|
warning "Skipping source extraction -- using existing src/ tree"
|
|
|
|
|
else
|
|
|
|
|
msg "Extracting Sources..."
|
|
|
|
|
for netfile in "${source[@]}"; do
|
|
|
|
|
unziphack=0
|
|
|
|
|
file=`strip_url "$netfile"`
|
|
|
|
|
file=$(strip_url "$netfile")
|
|
|
|
|
unset cmd
|
|
|
|
|
case "`echo $file |tr "A-Z" "a-z"`" in
|
|
|
|
|
case "$(echo $file |tr "A-Z" "a-z")" in
|
|
|
|
|
*.tar.gz|*.tar.z|*.tgz)
|
|
|
|
|
cmd="tar --use-compress-program=gzip -xf $file" ;;
|
|
|
|
|
*.tar.bz2|*.tbz2)
|
|
|
|
@ -706,7 +713,7 @@ else
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "`id -u`" = "0" ]; then
|
|
|
|
|
if [ "$EUID" = "0" ]; then
|
|
|
|
|
# chown all source files to root.root
|
|
|
|
|
chown -R root.root $startdir/src
|
|
|
|
|
fi
|
|
|
|
@ -718,18 +725,18 @@ if [ -d $startdir/pkg ]; then
|
|
|
|
|
fi
|
|
|
|
|
mkdir -p $startdir/pkg
|
|
|
|
|
|
|
|
|
|
if [ "x$NOBUILD" = "1" ]; then
|
|
|
|
|
if [ "$NOBUILD" = "1" ]; then
|
|
|
|
|
msg "Sources are ready."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# use distcc if requested
|
|
|
|
|
if [ "x$USE_DISTCC" = "y" ]; then
|
|
|
|
|
if [ "$USE_DISTCC" = "y" ]; then
|
|
|
|
|
[ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# use ccache if it's available
|
|
|
|
|
if [ "x$USE_CCACHE" = "1" ]; then
|
|
|
|
|
if [ "$USE_CCACHE" = "1" ]; then
|
|
|
|
|
[ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
@ -740,7 +747,7 @@ msg "Starting build()..."
|
|
|
|
|
echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
|
|
|
|
|
set_e=$?
|
|
|
|
|
|
|
|
|
|
if [ "x$LOGGING" = "1" ]; then
|
|
|
|
|
if [ "$LOGGING" = "1" ]; then
|
|
|
|
|
BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
|
|
|
|
|
if [ -f "$BUILDLOG" ]; then
|
|
|
|
|
i=1
|
|
|
|
@ -774,7 +781,7 @@ else
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! "`check_option KEEPDOCS`" -a "$KEEPDOCS" = "0" ]; then
|
|
|
|
|
if [ ! "$(check_option KEEPDOCS)" -a "$KEEPDOCS" = "0" ]; then
|
|
|
|
|
# remove info/doc files
|
|
|
|
|
msg "Removing info/doc files..."
|
|
|
|
|
cd $startdir
|
|
|
|
@ -790,13 +797,6 @@ if [ -d pkg/usr/share/man ]; then
|
|
|
|
|
rm -rf pkg/usr/share/man
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# remove /usr/share directory if empty
|
|
|
|
|
if [ -d pkg/usr/share ]; then
|
|
|
|
|
if [ -z "`ls -1 pkg/usr/share`" ]; then
|
|
|
|
|
rm -r pkg/usr/share
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# compress man pages
|
|
|
|
|
msg "Compressing man pages..."
|
|
|
|
|
find $startdir/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null | while read i ; do
|
|
|
|
@ -816,7 +816,7 @@ done
|
|
|
|
|
cd $startdir
|
|
|
|
|
|
|
|
|
|
# strip binaries
|
|
|
|
|
if [ ! "`check_option NOSTRIP`" -a "$NOSTRIP" = "0" ]; then
|
|
|
|
|
if [ ! "$(check_option NOSTRIP)" -a "$NOSTRIP" = "0" ]; then
|
|
|
|
|
msg "Stripping debugging symbols from libraries..."
|
|
|
|
|
find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \
|
|
|
|
|
-exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \
|
|
|
|
@ -828,25 +828,25 @@ if [ ! "`check_option NOSTRIP`" -a "$NOSTRIP" = "0" ]; then
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# remove libtool (.la) files
|
|
|
|
|
if [ "`check_option NOLIBTOOL`" -a "x$NOLIBTOOL" = "1" ]; then
|
|
|
|
|
if [ "$(check_option NOLIBTOOL)" -a "$NOLIBTOOL" = "1" ]; then
|
|
|
|
|
msg "Removing libtool .la files..."
|
|
|
|
|
find pkg -type f -name "*.la" -exec rm -f -- '{}' \;
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# remove empty directories
|
|
|
|
|
if [ "`check_option NOEMPTYDIRS`" -a "x$NOEMPTYDIRS" = 1 ]; then
|
|
|
|
|
if [ "$(check_option NOEMPTYDIRS)" -a "$NOEMPTYDIRS" = 1 ]; then
|
|
|
|
|
msg "Removing empty directories..."
|
|
|
|
|
find pkg -depth -type d -empty -delete;
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# get some package meta info
|
|
|
|
|
builddate=`LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y"`
|
|
|
|
|
builddate=$(LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y")
|
|
|
|
|
if [ "$PACKAGER" != "" ]; then
|
|
|
|
|
packager="$PACKAGER"
|
|
|
|
|
else
|
|
|
|
|
packager="Arch Linux (http://www.archlinux.org)"
|
|
|
|
|
fi
|
|
|
|
|
size=`du -cb $startdir/pkg | tail -n 1 | awk '{print $1}'`
|
|
|
|
|
size=$(du -cb $startdir/pkg | tail -n 1 | awk '{print $1}')
|
|
|
|
|
|
|
|
|
|
# write the .PKGINFO file
|
|
|
|
|
msg "Generating .PKGINFO file..."
|
|
|
|
@ -920,7 +920,7 @@ if [ "$CLEANUP" = "1" ]; then
|
|
|
|
|
rm -rf ${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log*
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$RMDEPS" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then
|
|
|
|
|
if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then
|
|
|
|
|
msg "Removing installed dependencies..."
|
|
|
|
|
pacman $PACMAN_OPTS -R $makedeplist $deplist
|
|
|
|
|
elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then
|
|
|
|
@ -936,9 +936,9 @@ elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
msg "Finished making: $pkgname (`date`)"
|
|
|
|
|
msg "Finished making: $pkgname ($(date))"
|
|
|
|
|
|
|
|
|
|
if [ "$INSTALL" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
if [ "$INSTALL" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
|
|
|
|
|
msg "Installing package with pacman -U..."
|
|
|
|
|
pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}
|
|
|
|
|
exit $?
|
|
|
|
@ -956,3 +956,5 @@ elif [ "$INSTALL" = "1" -a "$DEP_SUDO" = "1" ]; then
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
# vim: set ts=2 sw=2 noet:
|
|
|
|
|
|
|
|
|
|