[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 2/2] ts-libvirt-build: Rework to build with meson


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 2 Aug 2022 11:26:02 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Tue, 02 Aug 2022 10:26:29 +0000
  • Ironport-data: A9a23:N4oXtaKTpytA+5mlFE+RtZUlxSXFcZb7ZxGr2PjKsXjdYENS3mMEy jNJXWvSPf7eMzGjL9t+b47gp0JS68SBztAxQFZlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vraP65xZVF/fngbqLmD+LZMTxGSwZhSSMw4TpugOd8iYNz6TSDK1rlV eja/ouOYzdJ5xYuajhOs/Lb8ks21BjPkGhwUmIWNKgjUGD2zxH5PLpHTYmtIn3xRJVjH+LSb 44vG5ngows1Vz90Yj+Uuu6Tnn8iG9Y+DiDX4pZiYICwgwAqm8AH+v1T2Mzwy6tgo27hc9hZk L2hvHErIOsjFvWkdO81C3G0H8ziVEHvFXCuzXWX6KSuI0P6n3TExtx2EWA4P90hqvt0JzENr vNGEh0zYUXW7w626OrTpuhEg80iKI/gPZ8Fu2EmxjbcZRokacmdGeOQv4YehWpuwJAVdRrdT 5NxhT5HZRLcYxpJKxEPBYg3huuAjXjjaTxI7lmSoMLb5kCMklArjOK2aLI5fPSbTp16mVq8j 1if1F/rBz4WCIPHkz6apyfEaujnwnqgBdN6+KeD3v91gnWDy2oLEhoUWFCn5/6jhSaWS99Zb kAZ5Ccqhawz71CwCMnwWQWip3yJtQJaXMBfe9DW8ynUlPCSuVzAQDFZEHgRM7TKqfPaWxQv/ 0eUvt3rVQU/rb6zGTHG+emugA29bH19wXA5WcMUcecUy4C9/dBv1k+WE4wL/L2d1YOsR2ypq 9yehG1n3uhI05ZWv0mu1Qqf6w9AsKQlWeLcCu//emu+pj10a4e+D2BDwQiKtK0QRGp1o7Tog ZTlpyR9xLpXZX11vHbRKNjh5Znwjxp/DBXSgER0A74q/Cm39niocOh4uW8jdRw2Y55dIm64O Sc/XD+9A7cKZROXgVJfOdrtW6zGM4C6fTgaahwkRoUXOcUgHON21CpveVSRzwjQraTYqolmY M/zWZv9Uh4n5VFPlmXeqxE1jeB2nUjTBAr7GfjG8vhQ+eHGOi7LGedcYQHmgyJQxPrsnTg5O u13b6OioyizmsWkCsUL2eb/9Ww3EEU=
  • Ironport-hdrordr: A9a23:0ZkUh6CgYJd0UW7lHemq55DYdb4zR+YMi2TC1yhKJiC9Ffbo8P xG/c5rrCMc5wxxZJhNo7290ey7MBHhHP1OkO0s1NWZPDUO0VHAROoJ0WKh+UyEJ8SXzJ866U 4KScZD4bPLYWSS9fyKgzWFLw==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
 ts-libvirt-build  | 70 +++++++++++++++++++++++++++++++++--------------
 ts-xen-build-prep |  8 +++++-
 2 files changed, 56 insertions(+), 22 deletions(-)

diff --git a/ts-libvirt-build b/ts-libvirt-build
index e799f00375f7..16b45cfd02bf 100755
--- a/ts-libvirt-build
+++ b/ts-libvirt-build
@@ -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,
diff --git a/ts-xen-build-prep b/ts-xen-build-prep
index e76c0254bfd0..3ae8f215440b 100755
--- a/ts-xen-build-prep
+++ b/ts-xen-build-prep
@@ -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} ]);
 }
 
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.