autotools plugin does not allow specifying a build directory different from source directory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
New
|
Undecided
|
Unassigned |
Bug Description
I am trying to build a newer version of libvirt from source but recently there was a change made to force the build directory to be different from the source directory:
https:/
Which results in "configure: error: Build directory must be different from source directory" when I try to build it.
https:/
The relevant snapcraft.yaml part.
libvirt:
source: .
source-subdir: libvirt-6.0.0
# ...
override-build: |
rm -Rf libvirt-6.0.0
apt source libvirt
dpkg-source --before-build libvirt-6.0.0
snapcraftctl build
Without snapcraft it would look like this:
➜ libvirt git:(master) ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-
libtoolize: putting macros in AC_CONFIG_
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:53: installing 'build-aux/compile'
configure.ac:51: installing 'build-
configure.ac:51: installing 'build-
configure.ac:32: installing 'build-
configure.ac:32: installing 'build-aux/missing'
examples/
parallel-tests: installing 'build-
autoreconf: Leaving directory `.'
configure: error: Build directory must be different from source directory
In a different directory:
➜ libvirt git:(master) mkdir build
➜ libvirt git:(master) cd build
➜ build git:(master) ../autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-
libtoolize: putting macros in AC_CONFIG_
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:53: installing 'build-aux/compile'
configure.ac:32: installing 'build-aux/missing'
examples/
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
# ...
Now type 'make' to compile libvirt
I came up with a pretty terrible workaround:
libvirt: 6.0.0/build- subdir 6.0.0/build- subdir 6.0.0/build- subdir
source: .
source-subdir: libvirt-
# ...
override-build: |
# ...
mkdir libvirt-
cd libvirt-
../autogen.sh
echo "#!/bin/sh
exit 0
" >> autogen.sh
chmod +x autogen.sh
ln -s ../configure configure
cd ../..
# Build
snapcraftctl build
But it would be nice to have something more sane.