Patchwork [RFC,v3,5/5] block: build qed and curl as shared library

login
register
mail settings
Submitter Fam Zheng
Date Sept. 10, 2013, 1:02 a.m.
Message ID <1378774978-22602-6-git-send-email-famz@redhat.com>
Download mbox | patch
Permalink /patch/273739/
State New
Headers show

Comments

Fam Zheng - Sept. 10, 2013, 1:02 a.m.
Curl and qed block drivers are built as shared object module.  We have
per object cflags and libs support now, move CURL_CFLAGS and CURL_LIBS
from global option variables to a per object basis.

"make install" is not installing them yet, manually copy it to
${prefix}/qemu/block/ to make it loaded.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/Makefile.objs | 7 ++++---
 configure           | 5 ++---
 2 files changed, 6 insertions(+), 6 deletions(-)
Paolo Bonzini - Sept. 10, 2013, 6:49 a.m.
Il 10/09/2013 03:02, Fam Zheng ha scritto:
> Curl and qed block drivers are built as shared object module.  We have
> per object cflags and libs support now, move CURL_CFLAGS and CURL_LIBS
> from global option variables to a per object basis.
> 
> "make install" is not installing them yet, manually copy it to
> ${prefix}/qemu/block/ to make it loaded.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/Makefile.objs | 7 ++++---
>  configure           | 5 ++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/block/Makefile.objs b/block/Makefile.objs
> index 3bb85b5..741b92f 100644
> --- a/block/Makefile.objs
> +++ b/block/Makefile.objs
> @@ -1,7 +1,6 @@
>  block-obj-y += raw_bsd.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
>  block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o
> -block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
> -block-obj-y += qed-check.o
> +block-obj-m += qed.mo
>  block-obj-y += vhdx.o
>  block-obj-y += parallels.o blkdebug.o blkverify.o
>  block-obj-y += snapshot.o qapi.o
> @@ -23,4 +22,6 @@ common-obj-y += commit.o
>  common-obj-y += mirror.o
>  common-obj-y += backup.o
>  
> -$(obj)/curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS)
> +curl.o-cflags := $(CURL_CFLAGS)
> +curl.o-libs := $(CURL_LIBS)
> +qed.mo-objs := qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o qed-check.o
> diff --git a/configure b/configure
> index a2858c2..136ac1a 100755
> --- a/configure
> +++ b/configure
> @@ -2213,8 +2213,6 @@ EOF
>    curl_libs=`$curlconfig --libs 2>/dev/null`
>    if compile_prog "$curl_cflags" "$curl_libs" ; then
>      curl=yes
> -    libs_tools="$curl_libs $libs_tools"
> -    libs_softmmu="$curl_libs $libs_softmmu"
>    else
>      if test "$curl" = "yes" ; then
>        feature_not_found "curl"
> @@ -3893,8 +3891,9 @@ if test "$bswap_h" = "yes" ; then
>    echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
>  fi
>  if test "$curl" = "yes" ; then
> -  echo "CONFIG_CURL=y" >> $config_host_mak
> +  echo "CONFIG_CURL=m" >> $config_host_mak
>    echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
> +  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
>  fi
>  if test "$brlapi" = "yes" ; then
>    echo "CONFIG_BRLAPI=y" >> $config_host_mak
> 

Looks good.  For v4, however, please introduce --enable-modules so we
get closer to the final picture.  The implementation can be as simple as

if ($(CONFIG_MODULES),y)
modules-m = $(block-obj-m) $(common-obj-m)
else
block-obj-y += $(block-obj-m)
common-obj-y += $(common-obj-m)
block-obj-m =
common-obj-m
endif

Paolo

Patch

diff --git a/block/Makefile.objs b/block/Makefile.objs
index 3bb85b5..741b92f 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -1,7 +1,6 @@ 
 block-obj-y += raw_bsd.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
 block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o
-block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
-block-obj-y += qed-check.o
+block-obj-m += qed.mo
 block-obj-y += vhdx.o
 block-obj-y += parallels.o blkdebug.o blkverify.o
 block-obj-y += snapshot.o qapi.o
@@ -23,4 +22,6 @@  common-obj-y += commit.o
 common-obj-y += mirror.o
 common-obj-y += backup.o
 
-$(obj)/curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS)
+curl.o-cflags := $(CURL_CFLAGS)
+curl.o-libs := $(CURL_LIBS)
+qed.mo-objs := qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o qed-check.o
diff --git a/configure b/configure
index a2858c2..136ac1a 100755
--- a/configure
+++ b/configure
@@ -2213,8 +2213,6 @@  EOF
   curl_libs=`$curlconfig --libs 2>/dev/null`
   if compile_prog "$curl_cflags" "$curl_libs" ; then
     curl=yes
-    libs_tools="$curl_libs $libs_tools"
-    libs_softmmu="$curl_libs $libs_softmmu"
   else
     if test "$curl" = "yes" ; then
       feature_not_found "curl"
@@ -3893,8 +3891,9 @@  if test "$bswap_h" = "yes" ; then
   echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
 fi
 if test "$curl" = "yes" ; then
-  echo "CONFIG_CURL=y" >> $config_host_mak
+  echo "CONFIG_CURL=m" >> $config_host_mak
   echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
+  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
 fi
 if test "$brlapi" = "yes" ; then
   echo "CONFIG_BRLAPI=y" >> $config_host_mak