[pacman-dev] [PATCH] RFC: Allow building against internal libarchive

Dan McGee dpmcgee at gmail.com
Thu Oct 7 18:39:18 EDT 2010


On Wed, Sep 29, 2010 at 1:31 AM, Allan McRae <allan at archlinux.org> wrote:
> The idea behind this patch is to allow putting a libarchive source
> folder in the pacman source directory and then build against that
> libarchive version.  This is handy for testing pacman out on systems
> when libarchive is not available (and you do not want to or unable to
> install it for some reason).  It would also allow easy testing of
> patches to libarchive and how they affected pacman without touching
> your system libarchive.
>
> Currently, the following works:
> 1) extract the libarchive source in the root of the pacman source and
> rename or symlink the folder to be called libarchive.
> 2) build libarchive using:
>        ./configure --prefix=$PWD/install
>        make
>        make install
> 3) build pacman in the usual way
>
> The pacman build will then link against/use headers from the libarchive
> version in ./libarchive/install/{lib,include}. Note that the "make install"
> step is necessary to put the needed files in a clean place or all sorts of
> weird build issues happen...  Hence the weird --prefix to the ./configure.
>
> It should be possible to automate the building of libarchive as necessary,
> even to the extent of not running ./configure if the Makefile is there and
> possible doing necessary stuff for using SVN checkouts of libarchive.
> But I have absolutely no idea how...  Help!
> ---

+1 on idea, but we need some work on the implementation.

First, this doesn't work on cygwin/Windows, because of
case-insensitive filesystems- they have an INSTALL file in there. :)

>  configure.ac |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index e709fc4..8f34776 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -133,8 +133,17 @@ AM_GNU_GETTEXT([external])
>  AM_GNU_GETTEXT_VERSION(0.13.1)
>
>  # Check for libarchive
> -AC_CHECK_LIB([archive], [archive_read_data], ,
> -       AC_MSG_ERROR([libarchive is needed to compile pacman!]))
> +if test -d ${srcdir}/libarchive; then
This should probably be using AS_IF instead.

> +       # Do not test libarchive as it is in the source tree and the library
> +       # has not been built yet
Part of me is not keen on this. I think by the time this runs, we
should assume it is built and installed there. It will clean up this
logic a lot as the only thing we will be doing is "if
libarchive/whateverinstalldir exists, add it to the lib path", and
then just proceeding as normal.

We can leave the building to some little supplementary fetch_deps.sh
script that does the svn checkout, configure, build, etc.

> +       libarchivedir=`(cd $srcdir && pwd)`/libarchive/install
> +       CFLAGS="-I${libarchivedir}/include $CFLAGS"
> +       LIBS="-L${libarchivedir}/lib -larchive $LIBS"
> +       AM_CONDITIONAL(INTERNAL_LIBARCHIVE, true)
> +else
> +       AC_CHECK_LIB([archive], [archive_read_data], ,
> +               AC_MSG_ERROR([libarchive is needed to compile pacman!]))
> +fi
>
>  # Check for OpenSSL
>  AC_MSG_CHECKING(whether to link with libssl)
> --
> 1.7.3


More information about the pacman-dev mailing list