* configure fixes (CFLAGS)
* no-strict-aliasing hacks until full C99 compliance
* --with-config-file configure option
This commit is contained in:
Aaron Griffin 2006-12-14 05:23:08 +00:00
parent f45b3356f8
commit b308f06a3a
7 changed files with 95 additions and 74 deletions

View File

@ -4,6 +4,7 @@ prefix = @prefix@
CFLAGS = $(subst -Werror,,@CFLAGS@) CFLAGS = $(subst -Werror,,@CFLAGS@)
CFLAGS += $(shell python -c 'from distutils import sysconfig; print "-I" + sysconfig.get_python_inc()') CFLAGS += $(shell python -c 'from distutils import sysconfig; print "-I" + sysconfig.get_python_inc()')
CFLAGS += -I$(top_srcdir)/lib/libalpm CFLAGS += -I$(top_srcdir)/lib/libalpm
CFLAGS += -fno-strict-aliasing # see the swig docs
ifeq ($(shell arch),x86_64) ifeq ($(shell arch),x86_64)
CFLAGS += -fPIC CFLAGS += -fPIC
endif endif

View File

@ -1,4 +1,5 @@
ENV_CFLAGS=$CFLAGS ENV_CFLAGS=$CFLAGS
CFLAGS=""
AC_PREREQ(2.59) AC_PREREQ(2.59)
dnl Update it right before the release since $pkgver_foo are all _post_ release snapshots 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)
AC_SUBST(PM_VERSION_INFO) 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 dnl Put out version numbers to config.h
AC_DEFINE_UNQUOTED([PM_VERSION], ["$PM_VERSION"], [libalpm version number]) AC_DEFINE_UNQUOTED([PM_VERSION], ["$PM_VERSION"], [libalpm version number])
@ -142,6 +139,11 @@ AC_SUBST(CARCHFLAGS)
AC_SUBST(MARCHFLAG) AC_SUBST(MARCHFLAG)
AC_SUBST(CHOST) 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 dnl Help line for debug
AC_ARG_ENABLE(debug, AC_ARG_ENABLE(debug,
AC_HELP_STRING([ --enable-debug], [Enable debugging support]), AC_HELP_STRING([ --enable-debug], [Enable debugging support]),
@ -308,17 +310,25 @@ fi
dnl Check for libarchive dnl Check for libarchive
AC_CHECK_LIB([archive], [archive_read_data], [AC_CHECK_HEADER([archive.h], [LIBARCHIVE='-larchive'])]) AC_CHECK_LIB([archive], [archive_read_data], [AC_CHECK_HEADER([archive.h], [LIBARCHIVE='-larchive'])])
if test -n "$LIBARCHIVE"; then if test -n "$LIBARCHIVE"; then
CFLAGS="$CFLAGS"
LDFLAGS="$LDFLAGS $LIBARCHIVE" LDFLAGS="$LDFLAGS $LIBARCHIVE"
else else
AC_MSG_ERROR("libarchive is needed to compile pacman!"); AC_MSG_ERROR("libarchive is needed to compile pacman!");
fi 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 dnl Enable or disable debug code
AC_MSG_CHECKING(for debug mode request) AC_MSG_CHECKING(for debug mode request)
if test x$debug = xyes ; then if test x$debug = xyes ; then
AM_CONDITIONAL(PACMAN_DEBUG, test x$debug = xyes) 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" LDFLAGS="$LDFLAGS -lmcheck"
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
else else
@ -336,8 +346,6 @@ else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
CFLAGS="$CFLAGS"
dnl ========================================================================== dnl ==========================================================================
AC_OUTPUT([ AC_OUTPUT([
@ -371,7 +379,7 @@ pacman-$VERSION:
compiler flags : ${CFLAGS} compiler flags : ${CFLAGS}
libalpm version : ${PM_VERSION} libalpm version : ${PM_VERSION}
pacman.conf location : ${PACCONF} pacman.conf location : ${configfile}
Architecture CARCH : ${CARCH} Architecture CARCH : ${CARCH}
Architecture used cflag : ${CARCHFLAGS} Architecture used cflag : ${CARCHFLAGS}

View File

@ -55,6 +55,8 @@ KEEPDOCS=0
NOLIBTOOL=0 NOLIBTOOL=0
#-- Don't remove empty directories from package? #-- Don't remove empty directories from package?
NOEMPTYDIRS=0 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 #-- Destination: specify a fixed directory where all packages will be placed
#PKGDEST=/home/packages #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: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>" #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

View File

@ -1,6 +1,8 @@
AUTOMAKE_OPTIONS = gnu AUTOMAKE_OPTIONS = gnu
DEFINES = -pedantic -D_GNU_SOURCE 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 SUBDIRS = po
localedir = $(datadir)/locale localedir = $(datadir)/locale

View File

@ -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); QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &skip_this);
if(skip_this) { if(skip_this) {
pmpkg_t *pkg = NULL; 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); FREEPKG(pkg);
} }
} }

View File

@ -25,10 +25,16 @@
# USA. # USA.
# #
myver='2.9.8' myver='3.0.0'
startdir=`pwd` startdir=`pwd`
PKGDEST=$startdir PKGDEST=$startdir
BUILDSCRIPT="PKGBUILD"
PKGEXT="pkg.tar.gz"
source "/etc/abs/abs.conf"
SRCROOT=$ABSROOT
# Options # Options
CLEANUP=0 CLEANUP=0
CLEANCACHE=0 CLEANCACHE=0
@ -178,7 +184,7 @@ handledeps() {
# in fakeroot so it will go ahead and install the dependencies. # in fakeroot so it will go ahead and install the dependencies.
FAKEROOTKEY2=$FAKEROOTKEY FAKEROOTKEY2=$FAKEROOTKEY
unset FAKEROOTKEY unset FAKEROOTKEY
fi fi
sudo pacman $PACMAN_OPTS -D $deplist sudo pacman $PACMAN_OPTS -D $deplist
if [ "$?" = "127" ]; then if [ "$?" = "127" ]; then
error "Failed to install missing dependencies." error "Failed to install missing dependencies."
@ -266,12 +272,14 @@ usage() {
echo " -k, --keepdocs Keep doc and info directories" echo " -k, --keepdocs Keep doc and info directories"
echo " -L, --log Log package build process" echo " -L, --log Log package build process"
echo " -m, --nocolor Disable colorized output messages" 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 " -o, --nobuild Download and extract files only"
echo " -p <buildscript> Use an alternate build script (instead of '$BUILDSCRIPT')" echo " -p <buildscript> Use an alternate build script (instead of '$BUILDSCRIPT')"
echo " -r, --rmdeps Remove installed dependencies after a successful build" echo " -r, --rmdeps Remove installed dependencies after a successful build"
echo " -s, --syncdeps Install missing dependencies with pacman" echo " -s, --syncdeps Install missing dependencies with pacman"
echo " -S, --sudosync Install missing dependencies with pacman and sudo" 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 " -w <destdir> Write package to <destdir> instead of the working dir"
echo echo
echo "These options can be passed to pacman:" echo "These options can be passed to pacman:"
@ -279,13 +287,13 @@ usage() {
echo " --noconfirm Do not ask for confirmation when resolving dependencies" echo " --noconfirm Do not ask for confirmation when resolving dependencies"
echo " --noprogressbar Do not show a progress bar when downloading files" echo " --noprogressbar Do not show a progress bar when downloading files"
echo echo
echo "If -p is not specified, makepkg will look for './$BUILDSCRIPT'" echo "If -p is not specified, makepkg will look for '$BUILDSCRIPT'"
echo echo
} }
ARGLIST=$@ ARGLIST=$@
if [ -f /etc//makepkg.conf ]; then if [ -f /etc/makepkg.conf ]; then
source /etc/makepkg.conf source /etc/makepkg.conf
else else
error "/etc/makepkg.conf not found. cannot continue" error "/etc/makepkg.conf not found. cannot continue"
@ -327,7 +335,7 @@ while [ "$#" -ne "0" ]; do
exit 1 exit 1
;; ;;
-*) -*)
while getopts "bBcCdefghij:Lmnop:rsSw:-" opt; do while getopts "bBcCdefghij:kLmnop:rsSt:w:-" opt; do
case $opt in case $opt in
b) DEP_SRC=1 ;; b) DEP_SRC=1 ;;
B) USE_CCACHE=0 ;; B) USE_CCACHE=0 ;;
@ -352,6 +360,7 @@ while [ "$#" -ne "0" ]; do
r) RMDEPS=1 ;; r) RMDEPS=1 ;;
s) DEP_BIN=1 ;; s) DEP_BIN=1 ;;
S) DEP_SUDO=1 ;; S) DEP_SUDO=1 ;;
t) SRCDEST=$OPTARG ;;
w) PKGDEST=$OPTARG ;; w) PKGDEST=$OPTARG ;;
-) -)
OPTIND=0 OPTIND=0
@ -387,21 +396,27 @@ PKGDEST=`pwd`
cd $OLDPWD cd $OLDPWD
if [ "$CLEANCACHE" = "1" ]; then if [ "$CLEANCACHE" = "1" ]; then
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then if [ -n "$SRCDEST" ]; then
msg "Cleaning up source files from the cache." msg "Cleaning up source files from the cache."
rm -rf /var/cache/pacman/src/* rm -rf /var/cache/pacman/src/*
exit 0 rm -rf "${SRCDEST}"/*
else exit 0
error "You must be root to clean the cache." else
exit 1 if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
fi 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 fi
unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force
unset replaces depends conflicts backup source install build makedepends unset replaces depends conflicts backup source install build makedepends
unset options unset options
# some applications (eg, blackbox) will not build with some languages # some applications (eg, blackbox) will not build with some languages
unset LC_ALL LANG unset LC_ALL LANG
umask 0022 umask 0022
@ -409,11 +424,13 @@ umask 0022
if [ ! -f $BUILDSCRIPT ]; then if [ ! -f $BUILDSCRIPT ]; then
error "$BUILDSCRIPT does not exist." error "$BUILDSCRIPT does not exist."
exit 1 exit 1
else #TODO this is an attempt at a generic way to unset all package specific
#this is fun.... we'll unset #variables in a PKGBUILD
for var in $(grep "=" $BUILDSCRIPT | sed "s|.*\(\<.*\>\)=.*|\1|g"); do #else
unset $var # #this is fun.... we'll unset
done # for var in $(grep "=" $BUILDSCRIPT | sed "s|.*\(\<.*\>\)=.*|\1|g"); do
# unset $var
# done
fi fi
source $BUILDSCRIPT source $BUILDSCRIPT
@ -437,6 +454,8 @@ if [ $(echo $pkgrel | grep '-') ]; then
fi fi
if ! in_array $CARCH ${arch[@]}; then if ! in_array $CARCH ${arch[@]}; then
error "$pkgname is not available for the '$CARCH' architecture." 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 exit 1
fi fi
@ -457,9 +476,6 @@ if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT} -a "$FORCE" =
fi fi
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 # 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 # as the fake root user. We detect this by passing a sentinel option (-F) to makepkg
if [ "`id -u`" != "0" ]; then if [ "`id -u`" != "0" ]; then
@ -488,7 +504,8 @@ fi
msg "Making package: $pkgname $pkgver-$pkgrel (`date`)" msg "Making package: $pkgname $pkgver-$pkgrel (`date`)"
unset deplist makedeplist 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..." msg "Checking Runtime Dependencies..."
deplist=`checkdeps ${depends[@]}` deplist=`checkdeps ${depends[@]}`
handledeps $deplist handledeps $deplist
@ -507,7 +524,7 @@ if [ `type -p pacman` -a "$NODEPS" = "0" ]; then
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
exit 1 exit 1
fi fi
elif [ "$NODEPS" = "1" ]; then elif [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" ]; then
warning "skipping dependency checks." warning "skipping dependency checks."
else else
warning "pacman was not found in PATH. skipping dependency checks." warning "pacman was not found in PATH. skipping dependency checks."
@ -520,13 +537,16 @@ msg "Retrieving Sources..."
mkdir -p src mkdir -p src
cd $startdir/src cd $startdir/src
for netfile in ${source[@]}; do for netfile in ${source[@]}; do
file=`strip_url $netfile` file=$(strip_url $netfile)
if [ -f ../$file ]; then if [ -f "../$file" ]; then
msg " Found $file in build dir" msg " Found $file in build dir"
cp ../$file . cp "../$file" .
elif [ -f /var/cache/pacman/src/$file ]; then elif [ -f "$SRCDEST/$file" ]; then
msg " Using local copy of $file" msg " Using cached copy of $file"
cp /var/cache/pacman/src/$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 else
# check for a download utility # check for a download utility
if [ -z "$FTPAGENT" ]; then if [ -z "$FTPAGENT" ]; then
@ -535,28 +555,33 @@ for netfile in ${source[@]}; do
exit 1 exit 1
fi fi
ftpclient=`echo $FTPAGENT | awk {'print $1'}` ftpclient=`echo $FTPAGENT | awk {'print $1'}`
if [ ! -x $ftpclient ]; then if [ ! -x "$ftpclient" ]; then
error "ftpclient `basename $ftpclient` is not installed." error "ftpclient `basename $ftpclient` is not installed."
msg "Aborting..." msg "Aborting..."
exit 1 exit 1
fi fi
proto=`echo $netfile | sed 's|://.*||'` proto=$(echo "$netfile" | sed 's|://.*||')
if [ "$proto" != "ftp" -a "$proto" != "http" -a "$proto" != "https" ]; then 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." error "$netfile was not found in the build directory and is not a proper URL."
msg "Aborting..." msg "Aborting..."
exit 1 exit 1
fi fi
msg " Downloading $file" msg " Downloading $file"
$FTPAGENT $netfile 2>&1 $FTPAGENT "$netfile" 2>&1
if [ ! -f $file ]; then if [ ! -f "$file" ]; then
error "Failed to download $file" error "Failed to download $file"
msg "Aborting..." msg "Aborting..."
exit 1 exit 1
fi fi
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src
else if [ -n "$SRCDEST" ]; then
cp $file .. 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
fi fi
done done
@ -582,6 +607,7 @@ else
exit 1 exit 1
fi fi
#Generate integrity checks
if [ "$GENINTEG" = "1" ]; then if [ "$GENINTEG" = "1" ]; then
msg "Generating ${integrity_name}s for source files" msg "Generating ${integrity_name}s for source files"
plain "" plain ""
@ -607,7 +633,8 @@ else
done done
plain "" plain ""
exit 0 exit 0
else #validation #Validate integrity checks
else
integrity_sums=($(eval echo \${${integrity_name}s[@]})) integrity_sums=($(eval echo \${${integrity_name}s[@]}))
if [ ${#integrity_sums[@]} -eq ${#source[@]} ]; then if [ ${#integrity_sums[@]} -eq ${#source[@]} ]; then
@ -705,10 +732,6 @@ fi
# build # build
msg "Starting 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 if [ "x$LOGGING" = "1" ]; then
BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log" BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
if [ -f "$BUILDLOG" ]; then if [ -f "$BUILDLOG" ]; then
@ -723,6 +746,7 @@ if [ "x$LOGGING" = "1" ]; then
mv "$BUILDLOG" "$BUILDLOG.$i" mv "$BUILDLOG" "$BUILDLOG.$i"
fi fi
#check for "exit on syntax error" shell option
echo $SHELLOPTS | grep errexit 2>&1 >/dev/null echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
set_e=$? set_e=$?
@ -771,12 +795,12 @@ fi
# compress man pages # compress man pages
msg "Compressing 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##*.}" ext="${i##*.}"
fn="${i##*/}" fn="${i##*/}"
if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
# update symlinks to this manpage # 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" rm -f "$ln"
ln -sf "${fn}.gz" "${ln}.gz" ln -sf "${fn}.gz" "${ln}.gz"
done done

View File

@ -57,8 +57,6 @@
#include "sync.h" #include "sync.h"
#include "deptest.h" #include "deptest.h"
#define PACCONF "/etc/pacman.conf"
#if defined(__OpenBSD__) || defined(__APPLE__) #if defined(__OpenBSD__) || defined(__APPLE__)
#define BSD #define BSD
#endif #endif
@ -506,6 +504,7 @@ int main(int argc, char *argv[])
if(config->configfile == NULL) { if(config->configfile == NULL) {
config->configfile = strdup(PACCONF); config->configfile = strdup(PACCONF);
} }
if(alpm_parse_config(config->configfile, cb_db_register, "") != 0) { if(alpm_parse_config(config->configfile, cb_db_register, "") != 0) {
ERR(NL, _("failed to parse config (%s)\n"), alpm_strerror(pm_errno)); ERR(NL, _("failed to parse config (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);