Skip to content

Commit

Permalink
meson: convert block
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
elmarco authored and bonzini committed Aug 21, 2020
1 parent 848e8ff commit 5e5733e
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 107 deletions.
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ include $(SRC_PATH)/rules.mak
# lor is defined in rules.mak
CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))

generated-files-y += module_block.h
generated-files-y += target/s390x/gen-features.h
target/s390x/gen-features.h: Makefile.ninja

Expand Down Expand Up @@ -182,8 +181,6 @@ include $(SRC_PATH)/Makefile.objs
endif

dummy := $(call unnest-vars,, \
block-obj-y \
block-obj-m \
storage-daemon-obj-y \
storage-daemon-obj-m \
common-obj-y \
Expand Down Expand Up @@ -304,11 +301,6 @@ ifdef CONFIG_MPATH
scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
endif

module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \
$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
"GEN","$@")

clean: recurse-clean ninja-clean clean-ctlist
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
# avoid old build problems by removing potentially incorrect old files
Expand Down
32 changes: 25 additions & 7 deletions Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ ifeq ($(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)),y)
authz-obj-y = authz/libauthz.fa
authz/libauthz.fa-libs = $(if $(CONFIG_AUTH_PAM),-lpam)

block-obj-y = block/ nbd/ scsi/
block-obj-y += block.o blockjob.o job.o
block-obj-y += qemu-io-cmds.o
block-obj-$(CONFIG_REPLICATION) += replication.o

block-obj-m = block/
block-obj-y += libblock.fa

libblock.fa-libs = $(ZSTD_LIBS)
libblock.fa-libs += $(LIBNFS_LIBS)
libblock.fa-libs += $(LIBISCSI_LIBS)
libblock.fa-libs += $(CURL_LIBS)
libblock.fa-libs += $(RBD_LIBS)
libblock.fa-libs += $(GLUSTERFS_LIBS)
libblock.fa-libs += $(VXHS_LIBS)
libblock.fa-libs += $(LIBSSH_LIBS)
libblock.fa-libs += $(BZIP2_LIBS)
libblock.fa-libs += $(LZFSE_LIBS)
libblock.fa-libs += $(if $(CONFIG_LINUX_AIO),-laio)
libblock.fa-libs += $(LIBXML2_LIBS)

chardev-obj-y = chardev/libchardev.fa

Expand All @@ -40,7 +48,7 @@ storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
# single QEMU executable should support all CPUs and machines.

ifeq ($(CONFIG_SOFTMMU),y)
common-obj-y = blockdev.o blockdev-nbd.o block/
common-obj-y = blockdev.o blockdev-nbd.o
common-obj-y += bootdevice.o iothread.o
common-obj-y += dump/
common-obj-y += job-qmp.o
Expand All @@ -55,6 +63,16 @@ common-obj-$(CONFIG_LINUX) += fsdev/
common-obj-y += accel/
common-obj-y += migration/

common-obj-$(if $(CONFIG_CURL),m) += block-curl$(DSOSUF)
common-obj-$(if $(CONFIG_GLUSTERFS),m) += block-gluster$(DSOSUF)
common-obj-$(if $(CONFIG_LIBISCSI),m) += block-iscsi$(DSOSUF)
common-obj-$(if $(CONFIG_LIBNFS),m) += block-nfs$(DSOSUF)
common-obj-$(if $(CONFIG_LIBSSH),m) += block-ssh$(DSOSUF)
common-obj-$(if $(CONFIG_RBD),m) += block-rbd$(DSOSUF)

common-obj-$(if $(CONFIG_LZFSE),m) += block-dmg-lzfse$(DSOSUF)
common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += block-dmg-bz2$(DSOSUF)

common-obj-y += audio/
common-obj-m += audio/
common-obj-y += hw/
Expand Down
3 changes: 1 addition & 2 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,12 @@ common-obj-m :=
include $(SRC_PATH)/Makefile.objs
dummy := $(call fix-paths,../,, \
authz-obj-y \
block-obj-y \
chardev-obj-y \
crypto-obj-y \
io-obj-y \
qom-obj-y)
dummy := $(call unnest-vars,.., \
block-obj-y \
block-obj-m \
common-obj-y \
common-obj-m)
all-obj-y += $(common-obj-y)
Expand Down
2 changes: 1 addition & 1 deletion block.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "block/nbd.h"
#include "block/qdict.h"
#include "qemu/error-report.h"
#include "module_block.h"
#include "block/module_block.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
#include "qapi/error.h"
Expand Down
75 changes: 0 additions & 75 deletions block/Makefile.objs

This file was deleted.

115 changes: 115 additions & 0 deletions block/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
block_ss.add(genh)
block_ss.add(files(
'accounting.c',
'aio_task.c',
'amend.c',
'backup.c',
'backup-top.c',
'blkdebug.c',
'blklogwrites.c',
'blkreplay.c',
'blkverify.c',
'block-backend.c',
'block-copy.c',
'commit.c',
'copy-on-read.c',
'create.c',
'crypto.c',
'dirty-bitmap.c',
'filter-compress.c',
'io.c',
'mirror.c',
'nbd.c',
'null.c',
'qapi.c',
'qcow2-bitmap.c',
'qcow2-cache.c',
'qcow2-cluster.c',
'qcow2-refcount.c',
'qcow2-snapshot.c',
'qcow2-threads.c',
'qcow2.c',
'quorum.c',
'raw-format.c',
'snapshot.c',
'throttle-groups.c',
'throttle.c',
'vhdx-endian.c',
'vhdx-log.c',
'vhdx.c',
'vmdk.c',
'vpc.c',
'write-threshold.c',
), zstd)

block_ss.add(when: [zlib, 'CONFIG_QCOW1'], if_true: files('qcow.c'))
block_ss.add(when: 'CONFIG_VDI', if_true: files('vdi.c'))
block_ss.add(when: 'CONFIG_CLOOP', if_true: files('cloop.c'))
block_ss.add(when: 'CONFIG_BOCHS', if_true: files('bochs.c'))
block_ss.add(when: 'CONFIG_VVFAT', if_true: files('vvfat.c'))
block_ss.add(when: 'CONFIG_DMG', if_true: files('dmg.c'))
block_ss.add(when: 'CONFIG_QED', if_true: files(
'qed-check.c',
'qed-cluster.c',
'qed-l2-cache.c',
'qed-table.c',
'qed.c',
))
block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: files('parallels.c'))
block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
block_ss.add(when: 'CONFIG_LIBISCSI', if_true: files('iscsi-opts.c'))
block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
block_ss.add(when: 'CONFIG_SHEEPDOG', if_true: files('sheepdog.c'))
block_ss.add(when: ['CONFIG_LINUX_AIO', libaio], if_true: files('linux-aio.c'))
block_ss.add(when: ['CONFIG_LINUX_IO_URING', linux_io_uring], if_true: files('io_uring.c'))

block_modules = {}

modsrc = []
foreach m : [
['CONFIG_CURL', 'curl', [curl, glib], 'curl.c'],
['CONFIG_GLUSTERFS', 'gluster', glusterfs, 'gluster.c'],
['CONFIG_LIBISCSI', 'iscsi', libiscsi, 'iscsi.c'],
['CONFIG_LIBNFS', 'nfs', libnfs, 'nfs.c'],
['CONFIG_LIBSSH', 'ssh', libssh, 'ssh.c'],
['CONFIG_RBD', 'rbd', rbd, 'rbd.c'],
]
if config_host.has_key(m[0])
if enable_modules
modsrc += files(m[3])
endif
module_ss = ss.source_set()
module_ss.add(when: m[2], if_true: files(m[3]))
block_modules += {m[1] : module_ss}
endif
endforeach

# those are not exactly regular block modules, so treat them apart
if 'CONFIG_DMG' in config_host
foreach m : [
['CONFIG_LZFSE', 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
['CONFIG_BZIP2', 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
]
if config_host.has_key(m[0])
module_ss = ss.source_set()
module_ss.add(when: m[2], if_true: files(m[3]))
block_modules += {m[1] : module_ss}
endif
endforeach
endif

module_block_py = find_program('../scripts/modules/module_block.py')
module_block_h = custom_target('module_block.h',
output: 'module_block.h',
input: modsrc,
command: [module_block_py, '@OUTPUT0@', modsrc])
block_ss.add(module_block_h)

block_ss.add(files('stream.c'))

softmmu_ss.add(files('qapi-sysemu.c'))
subdir('monitor')

modules += {'block': block_modules}
2 changes: 0 additions & 2 deletions block/monitor/Makefile.objs

This file was deleted.

2 changes: 2 additions & 0 deletions block/monitor/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
softmmu_ss.add(files('block-hmp-cmds.c'))
block_ss.add(files('bitmap-qmp-cmds.c'))
14 changes: 9 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2692,8 +2692,6 @@ if test "$zstd" != "no" ; then
if $pkg_config --atleast-version=$libzstd_minver libzstd ; then
zstd_cflags="$($pkg_config --cflags libzstd)"
zstd_libs="$($pkg_config --libs libzstd)"
LIBS="$zstd_libs $LIBS"
QEMU_CFLAGS="$QEMU_CFLAGS $zstd_cflags"
zstd="yes"
else
if test "$zstd" = "yes" ; then
Expand Down Expand Up @@ -4111,7 +4109,8 @@ if test "$zlib" != "no" ; then
int main(void) { zlibVersion(); return 0; }
EOF
if compile_prog "" "-lz" ; then
LIBS="$LIBS -lz"
zlib_libs=-lz
LIBS="$LIBS $zlib_libs"
else
error_exit "zlib check failed" \
"Make sure to have the zlib libs and headers installed."
Expand Down Expand Up @@ -7396,7 +7395,11 @@ fi
if test "$posix_memalign" = "yes" ; then
echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
fi

if test "$zlib" != "no" ; then
echo "CONFIG_ZLIB=y" >> $config_host_mak
echo "ZLIB_CFLAGS=$zlib_cflags" >> $config_host_mak
echo "ZLIB_LIBS=$zlib_libs" >> $config_host_mak
fi
if test "$spice" = "yes" ; then
echo "CONFIG_SPICE=y" >> $config_host_mak
fi
Expand Down Expand Up @@ -7466,6 +7469,8 @@ fi

if test "$zstd" = "yes" ; then
echo "CONFIG_ZSTD=y" >> $config_host_mak
echo "ZSTD_CFLAGS=$zstd_cflags" >> $config_host_mak
echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak
fi

if test "$libiscsi" = "yes" ; then
Expand Down Expand Up @@ -7498,7 +7503,6 @@ if test "$qom_cast_debug" = "yes" ; then
fi
if test "$rbd" = "yes" ; then
echo "CONFIG_RBD=m" >> $config_host_mak
echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
fi

Expand Down
Loading

0 comments on commit 5e5733e

Please sign in to comment.