* Dan McGee's makepkg updates http://www.archlinux.org/pipermail/pacman-dev/2006-December/000792.html
* configure fixes (CFLAGS) * no-strict-aliasing hacks until full C99 compliance * --with-config-file configure option
This commit is contained in:
parent
f45b3356f8
commit
b308f06a3a
|
@ -4,6 +4,7 @@ prefix = @prefix@
|
|||
CFLAGS = $(subst -Werror,,@CFLAGS@)
|
||||
CFLAGS += $(shell python -c 'from distutils import sysconfig; print "-I" + sysconfig.get_python_inc()')
|
||||
CFLAGS += -I$(top_srcdir)/lib/libalpm
|
||||
CFLAGS += -fno-strict-aliasing # see the swig docs
|
||||
ifeq ($(shell arch),x86_64)
|
||||
CFLAGS += -fPIC
|
||||
endif
|
||||
|
|
26
configure.ac
26
configure.ac
|
@ -1,4 +1,5 @@
|
|||
ENV_CFLAGS=$CFLAGS
|
||||
CFLAGS=""
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
dnl Update it right before the release since $pkgver_foo are all _post_ release snapshots
|
||||
|
@ -31,10 +32,6 @@ AC_SUBST(PM_MICRO_VERSION)
|
|||
AC_SUBST(PM_VERSION)
|
||||
AC_SUBST(PM_VERSION_INFO)
|
||||
|
||||
dnl Define the default config file path for pacman.conf
|
||||
PACCONF=/etc/pacman.conf
|
||||
AC_DEFINE_UNQUOTED([PACCONF], ["$PACCONF"], [pacman.conf location])
|
||||
|
||||
dnl Put out version numbers to config.h
|
||||
AC_DEFINE_UNQUOTED([PM_VERSION], ["$PM_VERSION"], [libalpm version number])
|
||||
|
||||
|
@ -142,6 +139,11 @@ AC_SUBST(CARCHFLAGS)
|
|||
AC_SUBST(MARCHFLAG)
|
||||
AC_SUBST(CHOST)
|
||||
|
||||
dnl Help line for config file
|
||||
AC_ARG_WITH(config-file,
|
||||
AC_HELP_STRING([ --with-config-file=path], [Set the name and path for pacman's config file]),
|
||||
[configfile=$withval], [configfile=/etc/pacman.conf])
|
||||
|
||||
dnl Help line for debug
|
||||
AC_ARG_ENABLE(debug,
|
||||
AC_HELP_STRING([ --enable-debug], [Enable debugging support]),
|
||||
|
@ -308,17 +310,25 @@ fi
|
|||
dnl Check for libarchive
|
||||
AC_CHECK_LIB([archive], [archive_read_data], [AC_CHECK_HEADER([archive.h], [LIBARCHIVE='-larchive'])])
|
||||
if test -n "$LIBARCHIVE"; then
|
||||
CFLAGS="$CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $LIBARCHIVE"
|
||||
else
|
||||
AC_MSG_ERROR("libarchive is needed to compile pacman!");
|
||||
fi
|
||||
|
||||
dnl Set config location
|
||||
AC_MSG_CHECKING(for configuration file name)
|
||||
if test -n "$configfile"; then
|
||||
CFLAGS="$CFLAGS -D'PACCONF=\"$configfile\"'"
|
||||
AC_MSG_RESULT(["$configfile"])
|
||||
else
|
||||
AC_MSG_ERROR(["pacman config file (--with-config-file is not set"])
|
||||
fi
|
||||
|
||||
dnl Enable or disable debug code
|
||||
AC_MSG_CHECKING(for debug mode request)
|
||||
if test x$debug = xyes ; then
|
||||
AM_CONDITIONAL(PACMAN_DEBUG, test x$debug = xyes)
|
||||
CFLAGS="-g -Wall -Werror -std=c99 -DPACMAN_DEBUG"
|
||||
CFLAGS="$CFLAGS -g -Wall -Werror -std=c99 -DPACMAN_DEBUG"
|
||||
LDFLAGS="$LDFLAGS -lmcheck"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
|
@ -336,8 +346,6 @@ else
|
|||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS"
|
||||
|
||||
dnl ==========================================================================
|
||||
|
||||
AC_OUTPUT([
|
||||
|
@ -371,7 +379,7 @@ pacman-$VERSION:
|
|||
compiler flags : ${CFLAGS}
|
||||
|
||||
libalpm version : ${PM_VERSION}
|
||||
pacman.conf location : ${PACCONF}
|
||||
pacman.conf location : ${configfile}
|
||||
|
||||
Architecture CARCH : ${CARCH}
|
||||
Architecture used cflag : ${CARCHFLAGS}
|
||||
|
|
|
@ -55,6 +55,8 @@ KEEPDOCS=0
|
|||
NOLIBTOOL=0
|
||||
#-- Don't remove empty directories from package?
|
||||
NOEMPTYDIRS=0
|
||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||
INTEGRITY_CHECK=(md5)
|
||||
|
||||
|
||||
#########################################################################
|
||||
|
@ -63,22 +65,7 @@ NOEMPTYDIRS=0
|
|||
#
|
||||
#-- Destination: specify a fixed directory where all packages will be placed
|
||||
#PKGDEST=/home/packages
|
||||
#-- Source cache: specify a fixed directory where source files will be cached
|
||||
#SRCDEST=/home/source
|
||||
#-- Packager: name/email of the person or organization building packages
|
||||
#PACKAGER="John Doe <john@doe.com>"
|
||||
|
||||
#########################################################################
|
||||
# Functionality Configuration
|
||||
# Most of this will probably not need to be changed by an end user
|
||||
#########################################################################
|
||||
#
|
||||
#-- Name of the script which makepkg reads
|
||||
BUILDSCRIPT="PKGBUILD"
|
||||
#-- Extension of the resultant package
|
||||
PKGEXT="pkg.tar.gz"
|
||||
#-- File integrity checks to use. Valid:
|
||||
# md5, sha1, sha256, sha384, sha512
|
||||
INTEGRITY_CHECK=(md5 sha1)
|
||||
#-- The root to use when building from source
|
||||
source "/etc/abs/abs.conf"
|
||||
SRCROOT=$ABSROOT
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
AUTOMAKE_OPTIONS = gnu
|
||||
DEFINES = -pedantic -D_GNU_SOURCE
|
||||
AM_CFLAGS = $(DEFINES)
|
||||
#libalpm isn't fully C99 safe with the strict aliasing rules
|
||||
# to be fixed in the future
|
||||
AM_CFLAGS = $(DEFINES) -fno-strict-aliasing
|
||||
SUBDIRS = po
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
|
|
|
@ -250,7 +250,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
|
|||
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &skip_this);
|
||||
if(skip_this) {
|
||||
pmpkg_t *pkg = NULL;
|
||||
lp = _alpm_list_remove(lp, miss->depend.name, name_cmp, (void **)&pkg);
|
||||
lp = _alpm_list_remove(lp, (void *)miss->depend.name, name_cmp, (void **)&pkg);
|
||||
FREEPKG(pkg);
|
||||
}
|
||||
}
|
||||
|
|
112
scripts/makepkg
112
scripts/makepkg
|
@ -25,10 +25,16 @@
|
|||
# USA.
|
||||
#
|
||||
|
||||
myver='2.9.8'
|
||||
myver='3.0.0'
|
||||
startdir=`pwd`
|
||||
PKGDEST=$startdir
|
||||
|
||||
BUILDSCRIPT="PKGBUILD"
|
||||
PKGEXT="pkg.tar.gz"
|
||||
|
||||
source "/etc/abs/abs.conf"
|
||||
SRCROOT=$ABSROOT
|
||||
|
||||
# Options
|
||||
CLEANUP=0
|
||||
CLEANCACHE=0
|
||||
|
@ -178,7 +184,7 @@ handledeps() {
|
|||
# in fakeroot so it will go ahead and install the dependencies.
|
||||
FAKEROOTKEY2=$FAKEROOTKEY
|
||||
unset FAKEROOTKEY
|
||||
fi
|
||||
fi
|
||||
sudo pacman $PACMAN_OPTS -D $deplist
|
||||
if [ "$?" = "127" ]; then
|
||||
error "Failed to install missing dependencies."
|
||||
|
@ -266,12 +272,14 @@ usage() {
|
|||
echo " -k, --keepdocs Keep doc and info directories"
|
||||
echo " -L, --log Log package build process"
|
||||
echo " -m, --nocolor Disable colorized output messages"
|
||||
echo " -n, --nostrip Do not strip binaries/libraries"
|
||||
echo " -n, --nostrip Do not strip symbols from binaries/libraries"
|
||||
echo " -o, --nobuild Download and extract files only"
|
||||
echo " -p <buildscript> Use an alternate build script (instead of '$BUILDSCRIPT')"
|
||||
echo " -r, --rmdeps Remove installed dependencies after a successful build"
|
||||
echo " -s, --syncdeps Install missing dependencies with pacman"
|
||||
echo " -S, --sudosync Install missing dependencies with pacman and sudo"
|
||||
# fix flyspray feature request #5223 - Dan McGee <dpmcgee@gmail.com>
|
||||
echo " -t <sourcedir> Cache source files in <sourcedir>"
|
||||
echo " -w <destdir> Write package to <destdir> instead of the working dir"
|
||||
echo
|
||||
echo "These options can be passed to pacman:"
|
||||
|
@ -279,13 +287,13 @@ usage() {
|
|||
echo " --noconfirm Do not ask for confirmation when resolving dependencies"
|
||||
echo " --noprogressbar Do not show a progress bar when downloading files"
|
||||
echo
|
||||
echo "If -p is not specified, makepkg will look for './$BUILDSCRIPT'"
|
||||
echo "If -p is not specified, makepkg will look for '$BUILDSCRIPT'"
|
||||
echo
|
||||
}
|
||||
|
||||
ARGLIST=$@
|
||||
|
||||
if [ -f /etc//makepkg.conf ]; then
|
||||
if [ -f /etc/makepkg.conf ]; then
|
||||
source /etc/makepkg.conf
|
||||
else
|
||||
error "/etc/makepkg.conf not found. cannot continue"
|
||||
|
@ -327,7 +335,7 @@ while [ "$#" -ne "0" ]; do
|
|||
exit 1
|
||||
;;
|
||||
-*)
|
||||
while getopts "bBcCdefghij:Lmnop:rsSw:-" opt; do
|
||||
while getopts "bBcCdefghij:kLmnop:rsSt:w:-" opt; do
|
||||
case $opt in
|
||||
b) DEP_SRC=1 ;;
|
||||
B) USE_CCACHE=0 ;;
|
||||
|
@ -352,6 +360,7 @@ while [ "$#" -ne "0" ]; do
|
|||
r) RMDEPS=1 ;;
|
||||
s) DEP_BIN=1 ;;
|
||||
S) DEP_SUDO=1 ;;
|
||||
t) SRCDEST=$OPTARG ;;
|
||||
w) PKGDEST=$OPTARG ;;
|
||||
-)
|
||||
OPTIND=0
|
||||
|
@ -387,21 +396,27 @@ PKGDEST=`pwd`
|
|||
cd $OLDPWD
|
||||
|
||||
if [ "$CLEANCACHE" = "1" ]; then
|
||||
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
||||
msg "Cleaning up source files from the cache."
|
||||
rm -rf /var/cache/pacman/src/*
|
||||
exit 0
|
||||
else
|
||||
error "You must be root to clean the cache."
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$SRCDEST" ]; then
|
||||
msg "Cleaning up source files from the cache."
|
||||
rm -rf /var/cache/pacman/src/*
|
||||
rm -rf "${SRCDEST}"/*
|
||||
exit 0
|
||||
else
|
||||
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
||||
msg "Cleaning up source files from the cache."
|
||||
rm -rf /var/cache/pacman/src/*
|
||||
exit 0
|
||||
else
|
||||
error "You must be root to clean the cache."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force
|
||||
unset replaces depends conflicts backup source install build makedepends
|
||||
unset options
|
||||
|
||||
|
||||
# some applications (eg, blackbox) will not build with some languages
|
||||
unset LC_ALL LANG
|
||||
umask 0022
|
||||
|
@ -409,11 +424,13 @@ umask 0022
|
|||
if [ ! -f $BUILDSCRIPT ]; then
|
||||
error "$BUILDSCRIPT does not exist."
|
||||
exit 1
|
||||
else
|
||||
#this is fun.... we'll unset
|
||||
for var in $(grep "=" $BUILDSCRIPT | sed "s|.*\(\<.*\>\)=.*|\1|g"); do
|
||||
unset $var
|
||||
done
|
||||
#TODO this is an attempt at a generic way to unset all package specific
|
||||
#variables in a PKGBUILD
|
||||
#else
|
||||
# #this is fun.... we'll unset
|
||||
# for var in $(grep "=" $BUILDSCRIPT | sed "s|.*\(\<.*\>\)=.*|\1|g"); do
|
||||
# unset $var
|
||||
# done
|
||||
fi
|
||||
|
||||
source $BUILDSCRIPT
|
||||
|
@ -437,6 +454,8 @@ if [ $(echo $pkgrel | grep '-') ]; then
|
|||
fi
|
||||
if ! in_array $CARCH ${arch[@]}; then
|
||||
error "$pkgname is not available for the '$CARCH' architecture."
|
||||
plain "Note that many packages may need a line added to their $BUILDSCRIPT"
|
||||
plain "such as arch=('$CARCH')."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -457,9 +476,6 @@ if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT} -a "$FORCE" =
|
|||
fi
|
||||
fi
|
||||
|
||||
# some applications (eg, blackbox) will not build with some languages
|
||||
unset LC_ALL LANG
|
||||
|
||||
# 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
|
||||
|
@ -488,7 +504,8 @@ fi
|
|||
msg "Making package: $pkgname $pkgver-$pkgrel (`date`)"
|
||||
|
||||
unset deplist makedeplist
|
||||
if [ `type -p pacman` -a "$NODEPS" = "0" ]; then
|
||||
# fix flyspray bug #5973 - Dan McGee <dpmcgee@gmail.com>
|
||||
if [ `type -p pacman` -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a "$NOBUILD" = "0" ]; then
|
||||
msg "Checking Runtime Dependencies..."
|
||||
deplist=`checkdeps ${depends[@]}`
|
||||
handledeps $deplist
|
||||
|
@ -507,7 +524,7 @@ if [ `type -p pacman` -a "$NODEPS" = "0" ]; then
|
|||
if [ $? -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$NODEPS" = "1" ]; then
|
||||
elif [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" ]; then
|
||||
warning "skipping dependency checks."
|
||||
else
|
||||
warning "pacman was not found in PATH. skipping dependency checks."
|
||||
|
@ -520,13 +537,16 @@ msg "Retrieving Sources..."
|
|||
mkdir -p src
|
||||
cd $startdir/src
|
||||
for netfile in ${source[@]}; do
|
||||
file=`strip_url $netfile`
|
||||
if [ -f ../$file ]; then
|
||||
file=$(strip_url $netfile)
|
||||
if [ -f "../$file" ]; then
|
||||
msg " Found $file in build dir"
|
||||
cp ../$file .
|
||||
elif [ -f /var/cache/pacman/src/$file ]; then
|
||||
msg " Using local copy of $file"
|
||||
cp /var/cache/pacman/src/$file .
|
||||
cp "../$file" .
|
||||
elif [ -f "$SRCDEST/$file" ]; then
|
||||
msg " Using cached copy of $file"
|
||||
cp "$SRCDEST$file" .
|
||||
elif [ -f "/var/cache/pacman/src/$file" ]; then
|
||||
msg " Using cached copy of $file"
|
||||
cp "/var/cache/pacman/src/$file" .
|
||||
else
|
||||
# check for a download utility
|
||||
if [ -z "$FTPAGENT" ]; then
|
||||
|
@ -535,28 +555,33 @@ for netfile in ${source[@]}; do
|
|||
exit 1
|
||||
fi
|
||||
ftpclient=`echo $FTPAGENT | awk {'print $1'}`
|
||||
if [ ! -x $ftpclient ]; then
|
||||
if [ ! -x "$ftpclient" ]; then
|
||||
error "ftpclient `basename $ftpclient` is not installed."
|
||||
msg "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
proto=`echo $netfile | sed 's|://.*||'`
|
||||
proto=$(echo "$netfile" | sed 's|://.*||')
|
||||
if [ "$proto" != "ftp" -a "$proto" != "http" -a "$proto" != "https" ]; then
|
||||
error "$netfile was not found in the build directory and is not a proper URL."
|
||||
msg "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
msg " Downloading $file"
|
||||
$FTPAGENT $netfile 2>&1
|
||||
if [ ! -f $file ]; then
|
||||
$FTPAGENT "$netfile" 2>&1
|
||||
if [ ! -f "$file" ]; then
|
||||
error "Failed to download $file"
|
||||
msg "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
||||
mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src
|
||||
else
|
||||
cp $file ..
|
||||
if [ -n "$SRCDEST" ]; then
|
||||
mkdir -p $SRCDEST && cp "$file" $SRCDEST
|
||||
elif [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
||||
mkdir -p /var/cache/pacman/src && cp "$file" /var/cache/pacman/src
|
||||
else
|
||||
cp "$file" ..
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@ -582,6 +607,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
#Generate integrity checks
|
||||
if [ "$GENINTEG" = "1" ]; then
|
||||
msg "Generating ${integrity_name}s for source files"
|
||||
plain ""
|
||||
|
@ -607,7 +633,8 @@ else
|
|||
done
|
||||
plain ""
|
||||
exit 0
|
||||
else #validation
|
||||
#Validate integrity checks
|
||||
else
|
||||
integrity_sums=($(eval echo \${${integrity_name}s[@]}))
|
||||
|
||||
if [ ${#integrity_sums[@]} -eq ${#source[@]} ]; then
|
||||
|
@ -705,10 +732,6 @@ fi
|
|||
# build
|
||||
msg "Starting build()..."
|
||||
|
||||
#check for "exit on syntax error" shell option
|
||||
echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
|
||||
set_e=$?
|
||||
|
||||
if [ "x$LOGGING" = "1" ]; then
|
||||
BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
|
||||
if [ -f "$BUILDLOG" ]; then
|
||||
|
@ -723,6 +746,7 @@ if [ "x$LOGGING" = "1" ]; then
|
|||
mv "$BUILDLOG" "$BUILDLOG.$i"
|
||||
fi
|
||||
|
||||
#check for "exit on syntax error" shell option
|
||||
echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
|
||||
set_e=$?
|
||||
|
||||
|
@ -771,12 +795,12 @@ fi
|
|||
|
||||
# compress man pages
|
||||
msg "Compressing man pages..."
|
||||
find $startdir/pkg/{usr{,/local,/share},opt/*}/man -type f 2>/dev/null | while read i ; do
|
||||
find $startdir/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null | while read i ; do
|
||||
ext="${i##*.}"
|
||||
fn="${i##*/}"
|
||||
if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
|
||||
# update symlinks to this manpage
|
||||
find $startdir/pkg/{usr{,/local,/share},opt/*}/man -lname "$fn" 2> /dev/null | while read ln ; do
|
||||
find $startdir/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2> /dev/null | while read ln ; do
|
||||
rm -f "$ln"
|
||||
ln -sf "${fn}.gz" "${ln}.gz"
|
||||
done
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
#include "sync.h"
|
||||
#include "deptest.h"
|
||||
|
||||
#define PACCONF "/etc/pacman.conf"
|
||||
|
||||
#if defined(__OpenBSD__) || defined(__APPLE__)
|
||||
#define BSD
|
||||
#endif
|
||||
|
@ -506,6 +504,7 @@ int main(int argc, char *argv[])
|
|||
if(config->configfile == NULL) {
|
||||
config->configfile = strdup(PACCONF);
|
||||
}
|
||||
|
||||
if(alpm_parse_config(config->configfile, cb_db_register, "") != 0) {
|
||||
ERR(NL, _("failed to parse config (%s)\n"), alpm_strerror(pm_errno));
|
||||
cleanup(1);
|
||||
|
|
Loading…
Reference in New Issue