]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
ts-libvirt-build: Rework to build with meson build-fix-libvirt
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 29 Jul 2022 13:39:52 +0000 (14:39 +0100)
committerAnthony PERARD <anthony.perard@citrix.com>
Thu, 11 Aug 2022 16:25:53 +0000 (17:25 +0100)
libvirt have switch build system to Meson + Ninja, there is no more
autogen.sh script.

Add missing dependency "libtirpc-dev" and "meson".

libvirt needs at least meson 0.54, the version avaiable in Debian
Buster is too old, but we can install it from backports.

In order to find out if Meson is used or not, we'll check if the
"autogen.sh" script is missing. And in the build dir, we will look for
a "Makefile".

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
ts-libvirt-build
ts-xen-build-prep

index e799f00375f721640dbcd1c8d5d59ab0b8cd58a6..16b45cfd02bf0229b0688783e0aac7de8303b21c 100755 (executable)
@@ -50,32 +50,56 @@ sub config() {
     }
     die "no xen prefix" unless $xenprefix;
 
-    # Uses --no-git because otherwise autogen.sh will undo
-    # submodulefixup's attempts to honour
-    # revision_libvirt_gnulib. This in turn requires that we specify
-    # --gnulib-srcdir, but ./autogen.sh doesn't propagate
-    # --gnulib-srcdir to ./bootstap so we use GNULIB_SRCDIR directly.
-    my $gnulib = submodule_find($submodules, "gnulib");
-    target_cmd_build($ho, 3600, $builddir, <<END);
-        cd libvirt
-       mkdir build
-       cd build
-        CFLAGS="-g -I$xenprefix/include/" \\
-        LDFLAGS="-g -L$xenprefix/lib/ -Wl,-rpath-link=$xenprefix/lib/" \\
-        PKG_CONFIG_PATH="$xenprefix/lib/pkgconfig/" \\
-        GNULIB_SRCDIR=$builddir/libvirt/$gnulib->{Path} \\
-            ../autogen.sh --no-git \\
-                         --with-libxl --without-xen --without-xenapi --without-selinux \\
-                         --without-lxc --without-vbox --without-uml \\
-                         --without-qemu --without-openvz --without-vmware \\
-                         --sysconfdir=/etc --localstatedir=/var #/
+    my $cflags = "-g -I$xenprefix/include/";
+    my $ldflags = "-g -L$xenprefix/lib/ -Wl,-rpath-link=$xenprefix/lib/";
+    my $pkg_config_path = "$xenprefix/lib/pkgconfig/";
+
+    if (target_file_exists($ho, "$builddir/libvirt/autogen.sh")) {
+        # Uses --no-git because otherwise autogen.sh will undo
+        # submodulefixup's attempts to honour
+        # revision_libvirt_gnulib. This in turn requires that we specify
+        # --gnulib-srcdir, but ./autogen.sh doesn't propagate
+        # --gnulib-srcdir to ./bootstap so we use GNULIB_SRCDIR directly.
+        my $gnulib = submodule_find($submodules, "gnulib");
+        target_cmd_build($ho, 3600, $builddir, <<END);
+            cd libvirt
+            mkdir build
+            cd build
+            CFLAGS="$cflags" \\
+            LDFLAGS="$ldflags" \\
+            PKG_CONFIG_PATH="$pkg_config_path" \\
+            GNULIB_SRCDIR=$builddir/libvirt/$gnulib->{Path} \\
+                ../autogen.sh --no-git \\
+                             --with-libxl --without-xen --without-xenapi --without-selinux \\
+                             --without-lxc --without-vbox --without-uml \\
+                             --without-qemu --without-openvz --without-vmware \\
+                             --sysconfdir=/etc --localstatedir=/var #/
+END
+    } else {
+        target_cmd_build($ho, 3600, $builddir, <<END);
+            cd libvirt
+            meson setup \\
+                -Dc_args='$cflags' \\
+                -Dc_link_args='$ldflags' \\
+                --pkg-config-path='$pkg_config_path' \\
+                --auto-features=disabled \\
+                -Ddriver_libxl=enabled \\
+                -Ddriver_libvirtd=enabled \\
+                -Ddriver_remote=enabled \\
+                --sysconfdir=/etc --localstatedir=/var \\
+                build
 END
+    }
 }
 
 sub build() {
     target_cmd_build($ho, 3600, $builddir, <<END);
         cd libvirt/build
-        (make $makeflags 2>&1 && touch ../../build-ok-stamp) |tee ../log
+        if [ -e Makefile ]; then
+            (make $makeflags 2>&1 && touch ../../build-ok-stamp) |tee ../log
+        else
+            (ninja 2>&1 && touch ../../build-ok-stamp) |tee ../log
+        fi
         test -f ../../build-ok-stamp #/
         echo ok.
 END
@@ -85,7 +109,11 @@ sub install() {
     target_cmd_build($ho, 300, $builddir, <<END);
         mkdir -p dist
         cd libvirt/build
-        make $makeflags install DESTDIR=$builddir/dist
+        if [ -e Makefile ]; then
+            make $makeflags install DESTDIR=$builddir/dist
+        else
+            DESTDIR=$builddir/dist ninja install
+        fi
         mkdir -p $builddir/dist/etc/init.d
 END
     target_putfilecontents_stash($ho, 60,
index e76c0254bfd062b76471e5ce292034bba8bad0ae..3ae8f215440b4f65ae74e5b032f9dbe73c785f27 100755 (executable)
@@ -199,7 +199,7 @@ END
 sub prep () {
     my @packages = qw(mercurial rsync figlet
                       build-essential bin86 bcc iasl bc
-                      flex bison cmake ninja-build
+                      flex bison cmake ninja-build meson
                       libpci-dev libncurses5-dev libssl-dev python-dev
                       libx11-dev git-core uuid-dev gettext gawk
                       libsdl-dev libyajl-dev libaio-dev libpixman-1-dev
@@ -209,6 +209,7 @@ sub prep () {
                       libdevmapper-dev libxml-xpath-perl libelf-dev
                       ccache nasm checkpolicy ebtables
                      python3-docutils python3-dev
+                      libtirpc-dev
                       libgnutls28-dev);
 
     if ($ho->{Suite} =~ m/squeeze|wheezy|jessie/) {
@@ -251,6 +252,11 @@ END
         target_install_packages($ho, 'libc6-dev-i386');
     }
 
+    if ($ho->{Suite} =~ m/buster/) {
+        # libvirt needs a newer version of "meson"
+        target_install_packages_backport($ho, 'meson');
+    }
+
     some_extradebs($ho, [ 'DebianExtraPackages', 'build', $ho->{Suite} ]);
 }