Skip to contentSkip to conversation

meson: replace submodules with wrap files

PATCH Superseded Paolo Bonzini 4 participants 24 messages May 27, 2023 – May 30, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover meson: replace submodules with wrap files

This series replaces git submodules for bundled libraries with .wrap files that can be used directly by meson for subprojects. These have several advantages, either immediate or potential:

* option parsing and downloading is delegated to meson

* the commit is stored in a text file instead of a magic entry in the git tree object, and can be a branch name or a version number as well

* now that QEMU's configure script knows how to install missing Python dependencies, we could stop shipping external dependencies that are only used as a fallback, and download them on demand if the build platform lacks them. For example dtc could be downloaded at build time, controlled by --enable-download, even when building from a tarball. This is _not_ done in this patch series, but Marc-André has tried it before[1].

* we could also add .wrap files for other dependencies that are missing on the GCC compile farm machines, or for people who build on Windows and might enjoy getting the mandatory dependencies (pixman, zlib, glib, possibly SDL?) via wraps. In theory meson already supports "meson wrap update-db" to automatically use wraps for anything required but missing, but one would need to test that it actually works; see for example https://github.com/mesonbuild/meson/issues/11821.

dtc and keycodemapdb both support meson, and previously reviewed patches already run their build system via subproject(), so the wraps are automatically taken into account. Two other submodules, berkeley-softfloat-3 and berkeley-testfloat-3, are used to test QEMU and can be changed to use wraps; however this requires a few more changes to extract the corresponding parts of tests/fp/meson.build. It's mostly code movement rather than new code.

The remaining submodules consist of tests/lcitool/libvirt-ci and the firmware in roms/. The former is only used in very specific cases, while the latter is mostly used only as a pointer used to create the QEMU tarball. Unfortunately, git-submodule.sh is still needed for roms/SLOF, parts of which are used in the QEMU build process for pc-bios/s390-ccw; more on this later in this cover letter.

I'm not sure what's the best way to proceed for roms/SLOF. Some possibilities, in no particular order, include:

* doing nothing

* merging --with-git-submodules with --enable-download, and moving the git-submodule.sh rules from the main Makefile to pc-bios/s390-ccw/ (my favorite option)

* copying the relevant SLOF files into pc-bios/

Also, getting into more overengineered territory:

* same as the second option, but also replace the roms/ submodules with text files, in a format similar to .wrap files; meson uses the standard configparser to read them, so it would not be a lot of code. The files would be parsed by scripts/make-release and pc-bios/s390-ccw/Makefile.

* adding support for firmware with a meson build system to configure; turn SLOF into a wrap and roms/SLOF into a symlink for ../pc-bios/s390-ccw/subprojects/SLOF. I'm mentioning this for completeness but this is not something I would like. On the other hand it could reuse some (or most?) of the code currently used to generate config-meson.cross, so maybe it isn't that bad...

Patch 1 removes the --with-git= option for consistency, since git cannot be overridden for "meson subprojects download".

Patch 2 renames the recently introduced --enable-pypi command line option to --enable-download, and makes it control meson's -Dwrapmode option as well.

Patch 3 replaces submodule update with meson's subproject download for existing subprojects (including libfdt and keycodemapdb).

Patch 5 converts berkeley-{soft,test}float-3 to subprojects too. However, those are the submodules that are used in configure to check the validity of the source tree, so patch 4 adds an extra check for the presence of the aforementioned SLOF submodule.

Still a bit RFCish, in case people prefer to have a solution for git-submodule.sh and roms/SLOF before the switch to wraps. For this reason, and because I have exhausted my gitlab CI minutes for this month, it's only tested lightly (it passed gitlab CI in a previous version and passes vm-build-netbsd in this one).

Paolo

Supersedes: <[email protected]>

[1] https://patchew.org/QEMU/[email protected]/[email protected]/

Paolo Bonzini (5):
configure: remove --with-git= option
configure: rename --enable-pypi to --enable-download, control
subprojects too
meson: subprojects: replace submodules with wrap files
configure: check for SLOF submodule before building pc-bios/s390-ccw
meson: subprojects: replace berkeley-{soft,test}float-3 with wraps

 .gitlab-ci.d/buildtest-template.yml           |   1 +
 .gitmodules                                   |  15 -
 Makefile                                      |   2 +-
 configure                                     | 126 ++--
 meson.build                                   |  16 +-
 scripts/archive-source.sh                     |  27 +-
 scripts/git-submodule.sh                      |   8 +-
 scripts/make-release                          |   5 +
 subprojects/.gitignore                        |   8 +
 subprojects/berkeley-softfloat-3.wrap         |   5 +
 subprojects/berkeley-testfloat-3.wrap         |   5 +
 subprojects/dtc                               |   1 -
 subprojects/dtc.wrap                          |   4 +
 subprojects/keycodemapdb                      |   1 -
 subprojects/keycodemapdb.wrap                 |   4 +
 subprojects/libvfio-user                      |   1 -
 subprojects/libvfio-user.wrap                 |   4 +
 .../berkeley-softfloat-3/meson.build          | 339 +++++++++++
 .../berkeley-softfloat-3/meson_options.txt    |   1 +
 .../berkeley-testfloat-3/meson.build          | 220 +++++++
 .../berkeley-testfloat-3/meson_options.txt    |   1 +
 tests/fp/meson.build                          | 541 +-----------------
 22 files changed, 668 insertions(+), 667 deletions(-)
 create mode 100644 subprojects/.gitignore
 create mode 100644 subprojects/berkeley-softfloat-3.wrap
 create mode 100644 subprojects/berkeley-testfloat-3.wrap
 delete mode 160000 subprojects/dtc
 create mode 100644 subprojects/dtc.wrap
 delete mode 160000 subprojects/keycodemapdb
 create mode 100644 subprojects/keycodemapdb.wrap
 delete mode 160000 subprojects/libvfio-user
 create mode 100644 subprojects/libvfio-user.wrap
 create mode 100644 subprojects/packagefiles/berkeley-softfloat-3/meson.build
 create mode 100644 subprojects/packagefiles/berkeley-softfloat-3/meson_options.txt
 create mode 100644 subprojects/packagefiles/berkeley-testfloat-3/meson.build
 create mode 100644 subprojects/packagefiles/berkeley-testfloat-3/meson_options.txt
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/5 configure: remove --with-git= option

There is not really any scenario where one would use any other git binary than "the first git in the PATH" aka $(command -v git). In fact for example "meson subprojects download" or scripts/checkpatch.pl do not obey the GIT environment variable.

Remove the unnecessary knob, but test for the presence of git in the configure and git-submodule.sh scripts.

---
 Makefile                 | 2 +-
 configure                | 6 ++----
 meson.build              | 1 -
 scripts/git-submodule.sh | 8 +++++++-
 4 files changed, 10 insertions(+), 7 deletions(-)
Makefile +1 -1
index 08fb6a3b058a..eaeab979966c 100644
@@ -53,7 +53,7 @@ Makefile: .git-submodule-status
 git-submodule-update:
 ifneq ($(GIT_SUBMODULES_ACTION),ignore)
 	$(call quiet-command, \
-		(GIT="$(GIT)" "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
+		("$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
 		"GIT","$(GIT_SUBMODULES)")
 endif
 
configure +2 -4
index d674a9667310..370e038e63d7 100755
@@ -791,7 +791,7 @@ fi
 
 case $git_submodules_action in
     update|validate)
-        if test ! -e "$source_path/.git"; then
+        if test ! -e "$source_path/.git" || ! has git; then
             echo "ERROR: cannot $git_submodules_action git submodules without .git"
             exit 1
         fi
@@ -892,7 +892,6 @@ Advanced options (experts only):
   --python=PYTHON          use specified python [$python]
   --ninja=NINJA            use specified ninja [$ninja]
   --smbd=SMBD              use specified smbd [$smbd]
-  --with-git=GIT           use specified git [$git]
   --with-git-submodules=update   update git submodules (default if .git dir exists)
   --with-git-submodules=validate fail if git submodules are not up to date
   --with-git-submodules=ignore   do not update or check git submodules (default if no .git dir)
@@ -1699,7 +1698,7 @@ fi
 #######################################
 # generate config-host.mak
 
-if ! (GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
+if ! ("$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
     exit 1
 fi
 
@@ -1709,7 +1708,6 @@ echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo >> $config_host_mak
 
 echo all: >> $config_host_mak
-echo "GIT=$git" >> $config_host_mak
 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
 
meson.build +0 -1
index 2d48aa1e2ef3..b11773ab39e8 100644
@@ -4027,7 +4027,6 @@ summary(summary_info, bool_yn: true, section: 'Directories')
 
 # Host binaries
 summary_info = {}
-summary_info += {'git':               config_host['GIT']}
 summary_info += {'python':            '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
 summary_info += {'sphinx-build':      sphinx_build}
 if config_host.has_key('HAVE_GDB_BIN')
scripts/git-submodule.sh +7 -1
index 7be41f594832..33e995bef1ff 100755
@@ -12,7 +12,7 @@ maybe_modules="$@"
 # if --with-git-submodules=ignore, do nothing
 test "$command" = "ignore" && exit 0
 
-test -z "$GIT" && GIT=git
+GIT=$(command -v git)
 
 cd "$(dirname "$0")/.."
 
@@ -57,6 +57,12 @@ then
     exit 1
 fi
 
+if test -n "$maybe_modules" && test -z "$GIT"
+then
+    echo "$0: unexpectedly called with submodules but git binary not found"
+    exit 1
+fi
+
 modules=""
 for m in $maybe_modules
 do
Signature · 1 line
2.40.1
#2 lore raw

Re: [PATCH 1/5] configure: remove --with-git= option

Quoted 8 lines · Paolo Bonzini

There is not really any scenario where one would use any other git binary than "the first git in the PATH" aka $(command -v git). In fact for example "meson subprojects download" or scripts/checkpatch.pl do not obey the GIT environment variable.

Remove the unnecessary knob, but test for the presence of git in the configure and git-submodule.sh scripts.

Quoted 7 lines
---
  Makefile                 | 2 +-
  configure                | 6 ++----
  meson.build              | 1 -
  scripts/git-submodule.sh | 8 +++++++-
  4 files changed, 10 insertions(+), 7 deletions(-)

The commit cc84d63a42e31c2a that introduce this switch gave a rationale:

Some users can't run a bare 'git' command, due to need for a transparent proxying solution such as 'tsocks'. This adds an argument to configure to let users specify such a thing:

./configure --with-git="tsocks git"

But if the plain "git" command is unusable on their system, they should likely introduce a proper wrapper on their end for this command anyway, so IMHO it's ok if we remove this again. Daniel, what do you think?

Thomas

#3 lore raw

Re: [PATCH 1/5] configure: remove --with-git= option

Quoted 8 lines · Thomas Huth

The commit cc84d63a42e31c2a that introduce this switch gave a rationale:

Some users can't run a bare 'git' command, due to need for a transparent proxying solution such as 'tsocks'. This adds an argument to configure to let users specify such a thing:

./configure --with-git="tsocks git"

I see, thanks for the additional information--it makes sense to include it in the commit message.

My impression is that the "smart HTTP" protocol has made this concern less important. Smart HTTP was introduced in 2009, but back in 2017 the git protocol running on port 9418 was still quite common. QEMU itself switched from git to https in 2018 with commit a897f22b596b62, about a year after --with-git was introduced.

Paolo

Quoted 4 lines

But if the plain "git" command is unusable on their system, they should likely introduce a proper wrapper on their end for this command anyway, so IMHO it's ok if we remove this again. Daniel, what do you think?

#4 lore raw

Re: [PATCH 1/5] configure: remove --with-git= option

Quoted 10 lines · Paolo Bonzini
Quoted 8 lines · Thomas Huth

The commit cc84d63a42e31c2a that introduce this switch gave a rationale:

Some users can't run a bare 'git' command, due to need for a transparent proxying solution such as 'tsocks'. This adds an argument to configure to let users specify such a thing:

./configure --with-git="tsocks git"

Quoted 8 lines

I see, thanks for the additional information--it makes sense to include it in the commit message.

My impression is that the "smart HTTP" protocol has made this concern less important. Smart HTTP was introduced in 2009, but back in 2017 the git protocol running on port 9418 was still quite common. QEMU itself switched from git to https in 2018 with commit a897f22b596b62, about a year after --with-git was introduced.

Here is the original thread:

https://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg05005.html

yes it was about 'git://' protocol, and yes, creating a wrapper script call 'git' was a viable option too. I just added --with-git as a convenience.

Quoted 5 lines
Quoted 4 lines

But if the plain "git" command is unusable on their system, they should likely introduce a proper wrapper on their end for this command anyway, so IMHO it's ok if we remove this again. Daniel, what do you think?

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Reviewed-by on v1 1/5
#5 lore raw

Re: [PATCH 1/5] configure: remove --with-git= option

In reply to Paolo Bonzini
Quoted 8 lines · Paolo Bonzini

There is not really any scenario where one would use any other git binary than "the first git in the PATH" aka $(command -v git). In fact for example "meson subprojects download" or scripts/checkpatch.pl do not obey the GIT environment variable.

Remove the unnecessary knob, but test for the presence of git in the configure and git-submodule.sh scripts.

Quoted 7 lines
---
 Makefile                 | 2 +-
 configure                | 6 ++----
 meson.build              | 1 -
 scripts/git-submodule.sh | 8 +++++++-
 4 files changed, 10 insertions(+), 7 deletions(-)

If you just update the commit message to say we are intentionally reverting functionality from cc84d63a42e31c2afa884fc78610a65ab8ecc06a and people should create a wrapper script instead:

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#6 lore raw

PATCH 2/5 configure: rename --enable-pypi to --enable-download, control subprojects too

In reply to Paolo Bonzini

The behavior of --{enable,disable}-pypi is similar to that of -Dwrapmode={default,nodownload} respectively. In particular, in both cases a feature needs to be explicitly enabled for the dependency to be downloaded.

So, use a single option to control both cases. Now, --enable-slirp will trigger cloning and building of libslirp if the .pc file is not found on the machine.

---
 configure              | 17 +++++++----------
 subprojects/.gitignore |  3 +++
 2 files changed, 10 insertions(+), 10 deletions(-)
 create mode 100644 subprojects/.gitignore
configure +7 -10
index 370e038e63d7..2f908660e4f1 100755
@@ -266,7 +266,7 @@ bsd_user=""
 plugins="$default_feature"
 ninja=""
 python=
-pypi="enabled"
+download="enabled"
 bindir="bin"
 skip_meson=no
 vfio_user_server="disabled"
@@ -756,9 +756,9 @@ for opt do
   --with-git-submodules=*)
       git_submodules_action="$optarg"
   ;;
-  --disable-pypi) pypi="disabled"
+  --disable-download) download="disabled"
   ;;
-  --enable-pypi) pypi="enabled"
+  --enable-download) download="enabled"
   ;;
   --enable-plugins) if test "$mingw32" = "yes"; then
                         error_exit "TCG plugins not currently supported on Windows platforms"
@@ -962,7 +962,7 @@ python="$(command -v "$python")"
 # - venv is allowed to use system packages;
 # - all setup can be performed offline;
 # - missing packages may be fetched from PyPI,
-#   unless --disable-pypi is passed.
+#   unless --disable-download is passed.
 # - pip is not installed into the venv when possible,
 #   but ensurepip is called as a fallback when necessary.
 
@@ -979,7 +979,7 @@ python="$python -B"
 mkvenv="$python ${source_path}/python/scripts/mkvenv.py"
 
 mkvenv_flags=""
-if test "$pypi" = "enabled" ; then
+if test "$download" = "enabled" ; then
     mkvenv_flags="--online"
 fi
 
@@ -1002,7 +1002,7 @@ meson="$(cd pyvenv/bin; pwd)/meson"
 # Conditionally ensure Sphinx is installed.
 
 mkvenv_flags=""
-if test "$pypi" = "enabled" -a "$docs" = "enabled" ; then
+if test "$download" = "enabled" -a "$docs" = "enabled" ; then
     mkvenv_flags="--online"
 fi
 
@@ -1942,11 +1942,8 @@ if test "$skip_meson" = no; then
 
   rm -rf meson-private meson-info meson-logs
 
-  # Prevent meson from automatically downloading wrapped subprojects when missing.
-  # You can use 'meson subprojects download' before running configure.
-  meson_option_add "--wrap-mode=nodownload"
-
   # Built-in options
+  test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload"
   test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
   test "$default_feature" = no && meson_option_add -Dauto_features=disabled
   test "$static" = yes && meson_option_add -Dprefer_static=true
subprojects/.gitignore new file +3 -0
new file mode 100644
index 000000000000..7560ebb0b1a0
@@ -0,0 +1,3 @@
+/packagecache
+
+/slirp
Signature · 1 line
2.40.1
#7 lore raw

Re: [PATCH 2/5] configure: rename --enable-pypi to --enable-download, control subprojects too

Quoted 25 lines · Paolo Bonzini

The behavior of --{enable,disable}-pypi is similar to that of -Dwrapmode={default,nodownload} respectively. In particular, in both cases a feature needs to be explicitly enabled for the dependency to be downloaded.

So, use a single option to control both cases. Now, --enable-slirp will trigger cloning and building of libslirp if the .pc file is not found on the machine.

---
configure | 17 +++++++----------
subprojects/.gitignore | 3 +++

2 files changed, 10 insertions(+), 10 deletions(-)

create mode 100644 subprojects/.gitignore

configure +0 -0
index 370e038e63d7..2f908660e4f1 100755
@@ -266,7 +266,7 @@ bsd_user=""

plugins="$default_feature"
ninja=""
python=

configure bsd_user="" · line 269

Quoted 2 lines
configure +1 -1
-pypi="enabled"
+download="enabled"

Is this the default? Can it default to disabled so it won't download anytihng unless asked to do that? By default it should just report if something is missing and let the users decide how they want to install it.

Regards,
BALATON Zoltan

Quoted 65 lines

bindir="bin"
skip_meson=no
vfio_user_server="disabled"

configure +3 -3
@@ -756,9 +756,9 @@ for opt do
  --with-git-submodules=*)
      git_submodules_action="$optarg"
  ;;
-  --disable-pypi) pypi="disabled"
+  --disable-download) download="disabled"
  ;;
-  --enable-pypi) pypi="enabled"
+  --enable-download) download="enabled"
  ;;
  --enable-plugins) if test "$mingw32" = "yes"; then
                        error_exit "TCG plugins not currently supported on Windows platforms"
@@ -962,7 +962,7 @@ python="$(command -v "$python")"
 # - venv is allowed to use system packages;
 # - all setup can be performed offline;
 # - missing packages may be fetched from PyPI,
-#   unless --disable-pypi is passed.
+#   unless --disable-download is passed.
 # - pip is not installed into the venv when possible,
 #   but ensurepip is called as a fallback when necessary.
 
@@ -979,7 +979,7 @@ python="$python -B"

mkvenv="$python ${source_path}/python/scripts/mkvenv.py"

mkvenv_flags=""

configure +1 -1
-if test "$pypi" = "enabled" ; then
+if test "$download" = "enabled" ; then
    mkvenv_flags="--online"

fi

configure +0 -0
@@ -1002,7 +1002,7 @@ meson="$(cd pyvenv/bin; pwd)/meson"
 # Conditionally ensure Sphinx is installed.
 

mkvenv_flags=""

configure +1 -1
-if test "$pypi" = "enabled" -a "$docs" = "enabled" ; then
+if test "$download" = "enabled" -a "$docs" = "enabled" ; then
    mkvenv_flags="--online"

fi

configure +1 -4
@@ -1942,11 +1942,8 @@ if test "$skip_meson" = no; then
 
  rm -rf meson-private meson-info meson-logs
 
-  # Prevent meson from automatically downloading wrapped subprojects when missing.
-  # You can use 'meson subprojects download' before running configure.
-  meson_option_add "--wrap-mode=nodownload"
-
  # Built-in options
+  test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload"
  test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
  test "$default_feature" = no && meson_option_add -Dauto_features=disabled
  test "$static" = yes && meson_option_add -Dprefer_static=true
subprojects/.gitignore new file +3 -0
new file mode 100644
index 000000000000..7560ebb0b1a0
@@ -0,0 +1,3 @@
+/packagecache
+
+/slirp
#8 lore raw

Re: [PATCH 2/5] configure: rename --enable-pypi to --enable-download, control subprojects too

Il sab 27 mag 2023, 18:49 BALATON Zoltan <[email protected]> ha scritto:

Quoted 10 lines · Paolo Bonzini
Quoted 4 lines

The behavior of --{enable,disable}-pypi is similar to that of -Dwrapmode={default,nodownload} respectively. In particular, in both cases a feature needs to be explicitly enabled for the dependency to be downloaded.

Is this the default? Can it default to disabled so it won't download anytihng unless asked to do that? By default it should just report if something is missing and let the users decide how they want to install it.

It is the default but only for features that are explicitly enabled on the configure command line. For example sphinx will not be installed unless --enable-docs is present.

However, if in the future we remove the bundled dtc sources from the tarball, that might be an exception in that dtc would be downloaded anyway. To be clear, this is not something that is changed by this series.

Paolo

Quoted 72 lines

Regards,
BALATON Zoltan

Quoted 5 lines

bindir="bin"
skip_meson=no
vfio_user_server="disabled"

configure +0 -0
@@ -756,9 +756,9 @@ for opt do
  --with-git-submodules=*)

configure for opt do · line 764

Quoted 10 lines
configure +2 -2
      git_submodules_action="$optarg"
  ;;
-  --disable-pypi) pypi="disabled"
+  --disable-download) download="disabled"
  ;;
-  --enable-pypi) pypi="enabled"
+  --enable-download) download="enabled"
  ;;
  --enable-plugins) if test "$mingw32" = "yes"; then
                        error_exit "TCG plugins not currently supported

on Windows platforms"

Quoted 28 lines
configure +1 -1
@@ -962,7 +962,7 @@ python="$(command -v "$python")"
 # - venv is allowed to use system packages;
 # - all setup can be performed offline;
 # - missing packages may be fetched from PyPI,
-#   unless --disable-pypi is passed.
+#   unless --disable-download is passed.
 # - pip is not installed into the venv when possible,
 #   but ensurepip is called as a fallback when necessary.
 
@@ -979,7 +979,7 @@ python="$python -B"

mkvenv="$python ${source_path}/python/scripts/mkvenv.py"

mkvenv_flags=""

configure +1 -1
-if test "$pypi" = "enabled" ; then
+if test "$download" = "enabled" ; then
    mkvenv_flags="--online"

fi

configure +0 -0
@@ -1002,7 +1002,7 @@ meson="$(cd pyvenv/bin; pwd)/meson"
 # Conditionally ensure Sphinx is installed.
 

mkvenv_flags=""

configure +1 -1
-if test "$pypi" = "enabled" -a "$docs" = "enabled" ; then
+if test "$download" = "enabled" -a "$docs" = "enabled" ; then
    mkvenv_flags="--online"

fi

configure if test "$skip_meson" = no; then · line 1945

Quoted 4 lines
configure +0 -1
@@ -1942,11 +1942,8 @@ if test "$skip_meson" = no; then
 
  rm -rf meson-private meson-info meson-logs
 
-  # Prevent meson from automatically downloading wrapped subprojects

when missing.

configure if test "$skip_meson" = no; then

Quoted 5 lines
configure +1 -3
-  # You can use 'meson subprojects download' before running configure.
-  meson_option_add "--wrap-mode=nodownload"
-
  # Built-in options
+  test "$download" = "disabled" && meson_option_add

"--wrap-mode=nodownload"

Review if test "$skip_meson" = no; then · line 1948

Quoted 2 lines
(quoted diff) +0 -0
  test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
  test "$default_feature" = no && meson_option_add

-Dauto_features=disabled

Quoted 11 lines
configure +0 -0
  test "$static" = yes && meson_option_add -Dprefer_static=true
subprojects/.gitignore new file +3 -0
new file mode 100644
index 000000000000..7560ebb0b1a0
@@ -0,0 +1,3 @@
+/packagecache
+
+/slirp
Reviewed-by on v1 2/5
#9 lore raw

Re: [PATCH 2/5] configure: rename --enable-pypi to --enable-download, control subprojects too

In reply to Paolo Bonzini
Quoted 9 lines · Paolo Bonzini

The behavior of --{enable,disable}-pypi is similar to that of -Dwrapmode={default,nodownload} respectively. In particular, in both cases a feature needs to be explicitly enabled for the dependency to be downloaded.

So, use a single option to control both cases. Now, --enable-slirp will trigger cloning and building of libslirp if the .pc file is not found on the machine.

Quoted 7 lines
---
  configure              | 17 +++++++----------
  subprojects/.gitignore |  3 +++
  2 files changed, 10 insertions(+), 10 deletions(-)

create mode 100644 subprojects/.gitignore

#10 lore raw

PATCH 3/5 meson: subprojects: replace submodules with wrap files

In reply to Paolo Bonzini

Compared to submodules, .wrap files have several advantages:

* option parsing and downloading is delegated to meson

* the commit is stored in a text file instead of a magic entry in the git tree object

* we could stop shipping external dependencies that are only used as a fallback, but not break compilation on platforms that lack them. For example it may make sense to download dtc at build time, controlled by --enable-download, even when building from a tarball. Right now, this patch does the opposite: make-release treats dtc like libvfio-user (which is not stable API and therefore hasn't found its way into any distros) and keycodemap (which is a copylib, for better or worse).

dependency() can fall back to a wrap automatically. However, this is only possible for libraries that come with a .pc file, and this is not very common for libfdt even though the upstream project in principle provides it; it also removes the control that we provide with --enable-fdt={system,internal}. Therefore, the logic to pick system vs. internal libfdt is left untouched.

--enable-fdt=git is removed; it was already a synonym for --enable-fdt=internal.

---
 .gitlab-ci.d/buildtest-template.yml |  1 +
 .gitmodules                         |  9 ----
 configure                           | 75 ++++++++++++-----------------
 meson.build                         | 15 +-----
 scripts/archive-source.sh           | 11 ++++-
 scripts/make-release                |  5 ++
 subprojects/.gitignore              |  3 ++
 subprojects/dtc                     |  1 -
 subprojects/dtc.wrap                |  4 ++
 subprojects/keycodemapdb            |  1 -
 subprojects/keycodemapdb.wrap       |  4 ++
 subprojects/libvfio-user            |  1 -
 subprojects/libvfio-user.wrap       |  4 ++
 13 files changed, 61 insertions(+), 73 deletions(-)
 delete mode 160000 subprojects/dtc
 create mode 100644 subprojects/dtc.wrap
 delete mode 160000 subprojects/keycodemapdb
 create mode 100644 subprojects/keycodemapdb.wrap
 delete mode 160000 subprojects/libvfio-user
 create mode 100644 subprojects/libvfio-user.wrap
.gitlab-ci.d/buildtest-template.yml +1 -0
index c9f2e737c09a..3c997d7265b2 100644
@@ -44,6 +44,7 @@
   script:
     - scripts/git-submodule.sh update
         $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
+    - meson subprojects download $(cd build/subprojects && echo *)
     - cd build
     - find . -type f -exec touch {} +
     # Avoid recompiling by hiding ninja with NINJA=":"
.gitmodules +0 -9
index f8b2ddf3877c..a934c85e4e40 100644
@@ -13,9 +13,6 @@
 [submodule "roms/qemu-palcode"]
 	path = roms/qemu-palcode
 	url = https://gitlab.com/qemu-project/qemu-palcode.git
-[submodule "subprojects/dtc"]
-	path = subprojects/dtc
-	url = https://gitlab.com/qemu-project/dtc.git
 [submodule "roms/u-boot"]
 	path = roms/u-boot
 	url = https://gitlab.com/qemu-project/u-boot.git
@@ -25,9 +22,6 @@
 [submodule "roms/QemuMacDrivers"]
 	path = roms/QemuMacDrivers
 	url = https://gitlab.com/qemu-project/QemuMacDrivers.git
-[submodule "subprojects/keycodemapdb"]
-	path = subprojects/keycodemapdb
-	url = https://gitlab.com/qemu-project/keycodemapdb.git
 [submodule "roms/seabios-hppa"]
 	path = roms/seabios-hppa
 	url = https://gitlab.com/qemu-project/seabios-hppa.git
@@ -55,6 +49,3 @@
 [submodule "tests/lcitool/libvirt-ci"]
 	path = tests/lcitool/libvirt-ci
 	url = https://gitlab.com/libvirt/libvirt-ci.git
-[submodule "subprojects/libvfio-user"]
-	path = subprojects/libvfio-user
-	url = https://gitlab.com/qemu-project/libvfio-user.git
configure +30 -45

142 lines not on this page · raw message

meson.build +1 -14
index b11773ab39e8..610f47d24593 100644
@@ -3047,14 +3047,7 @@ endif
 
 libvfio_user_dep = not_found
 if have_system and vfio_user_server_allowed
-  have_internal = fs.exists(meson.current_source_dir() / 'subprojects/libvfio-user/meson.build')
-
-  if not have_internal
-    error('libvfio-user source not found - please pull git submodule')
-  endif
-
-  libvfio_user_proj = subproject('libvfio-user')
-
+  libvfio_user_proj = subproject('libvfio-user', required: true)
   libvfio_user_dep = libvfio_user_proj.get_variable('libvfio_user_dep')
 endif
 
@@ -3082,12 +3075,6 @@ if fdt_required.length() > 0 or fdt_opt == 'enabled'
   endif
   if not fdt.found()
     assert(fdt_opt == 'internal')
-    have_internal = fs.exists(meson.current_source_dir() / 'subprojects/dtc/meson.build')
-
-    if not have_internal
-      error('libfdt source not found - please pull git submodule')
-    endif
-
     libfdt_proj = subproject('dtc', required: true,
                              default_options: ['tools=false',  'yaml=disabled',
                                                'python=disabled', 'default_library=static'])
scripts/archive-source.sh +9 -2
index dba5ae05b67e..b99cb66e4122 100755
@@ -26,8 +26,8 @@ sub_file="${sub_tdir}/submodule.tar"
 # independent of what the developer currently has initialized
 # in their checkout, because the build environment is completely
 # different to the host OS.
-submodules="subprojects/dtc subprojects/keycodemapdb"
-submodules="$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
+subprojects="dtc keycodemapdb libvfio-user"
+submodules="tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
 sub_deinit=""
 
 function cleanup() {
@@ -70,4 +70,11 @@ for sm in $submodules; do
     tar --concatenate --file "$tar_file" "$sub_file"
     test $? -ne 0 && error "failed append submodule $sm to $tar_file"
 done
+
+for sp in $subprojects; do
+    meson subprojects download $sp
+    test $? -ne 0 && error "failed to download subproject $sp"
+    tar --append --file "$tar_file" --exclude=.git subprojects/$sp
+    test $? -ne 0 && error "failed to append subproject $sp to $tar_file"
+done
 exit 0
scripts/make-release +5 -0
index 44a9d86a04a7..0604e61b8143 100755
@@ -16,6 +16,9 @@ if [ $# -ne 2 ]; then
     exit 0
 fi
 
+# Only include wraps that are invoked with subproject()
+SUBPROJECTS="dtc libvfio-user keycodemapdb"
+
 src="$1"
 version="$2"
 destination=qemu-${version}
@@ -26,6 +29,8 @@ git clone --single-branch -b "v${version}" -c advice.detachedHead=false \
 pushd ${destination}
 
 git submodule update --init --single-branch
+meson subprojects download $SUBPROJECTS
+
 (cd roms/seabios && git describe --tags --long --dirty > .version)
 (cd roms/skiboot && ./make_version.sh > .version)
 # Fetch edk2 submodule's submodules, since it won't have access to them via
subprojects/.gitignore +3 -0
index 7560ebb0b1a0..935e9a72a8f9 100644
@@ -1,3 +1,6 @@
 /packagecache
 
+/dtc
+/keycodemapdb
+/libvfio-user
 /slirp
subprojects/dtc deleted +0 -1
deleted file mode 160000
index b6910bec1161..000000000000
@@ -1 +0,0 @@
-Subproject commit b6910bec11614980a21e46fbccc35934b671bd81
subprojects/dtc.wrap new file +4 -0
new file mode 100644
index 000000000000..d1bc9174e913
@@ -0,0 +1,4 @@
+[wrap-git]
+url = https://gitlab.com/qemu-project/dtc.git
+revision = b6910bec11614980a21e46fbccc35934b671bd81
+depth = 1
subprojects/keycodemapdb deleted +0 -1
deleted file mode 160000
index f5772a62ec52..000000000000
@@ -1 +0,0 @@
-Subproject commit f5772a62ec52591ff6870b7e8ef32482371f22c6
subprojects/keycodemapdb.wrap new file +4 -0
new file mode 100644
index 000000000000..dda7b0e5716f
@@ -0,0 +1,4 @@
+[wrap-git]
+url = https://gitlab.com/qemu-project/keycodemapdb.git
+revision = f5772a62ec52591ff6870b7e8ef32482371f22c6
+depth = 1
subprojects/libvfio-user deleted +0 -1
deleted file mode 160000
index 0b28d205572c..000000000000
@@ -1 +0,0 @@
-Subproject commit 0b28d205572c80b568a1003db2c8f37ca333e4d7
subprojects/libvfio-user.wrap new file +4 -0
new file mode 100644
index 000000000000..416955ca4515
@@ -0,0 +1,4 @@
+[wrap-git]
+url = https://gitlab.com/qemu-project/libvfio-user.git
+revision = 0b28d205572c80b568a1003db2c8f37ca333e4d7
+depth = 1
Signature · 1 line
2.40.1
#11 lore raw

Re: [PATCH 3/5] meson: subprojects: replace submodules with wrap files

Quoted 162 lines · Paolo Bonzini

Compared to submodules, .wrap files have several advantages:

* option parsing and downloading is delegated to meson

* the commit is stored in a text file instead of a magic entry in the git tree object

* we could stop shipping external dependencies that are only used as a fallback, but not break compilation on platforms that lack them. For example it may make sense to download dtc at build time, controlled by --enable-download, even when building from a tarball. Right now, this patch does the opposite: make-release treats dtc like libvfio-user (which is not stable API and therefore hasn't found its way into any distros) and keycodemap (which is a copylib, for better or worse).

dependency() can fall back to a wrap automatically. However, this is only possible for libraries that come with a .pc file, and this is not very common for libfdt even though the upstream project in principle provides it; it also removes the control that we provide with --enable-fdt={system,internal}. Therefore, the logic to pick system vs. internal libfdt is left untouched.

--enable-fdt=git is removed; it was already a synonym for --enable-fdt=internal.

---
 .gitlab-ci.d/buildtest-template.yml |  1 +
 .gitmodules                         |  9 ----
 configure                           | 75 ++++++++++++-----------------
 meson.build                         | 15 +-----
 scripts/archive-source.sh           | 11 ++++-
 scripts/make-release                |  5 ++
 subprojects/.gitignore              |  3 ++
 subprojects/dtc                     |  1 -
 subprojects/dtc.wrap                |  4 ++
 subprojects/keycodemapdb            |  1 -
 subprojects/keycodemapdb.wrap       |  4 ++
 subprojects/libvfio-user            |  1 -
 subprojects/libvfio-user.wrap       |  4 ++
 13 files changed, 61 insertions(+), 73 deletions(-)
 delete mode 160000 subprojects/dtc
 create mode 100644 subprojects/dtc.wrap
 delete mode 160000 subprojects/keycodemapdb
 create mode 100644 subprojects/keycodemapdb.wrap
 delete mode 160000 subprojects/libvfio-user
 create mode 100644 subprojects/libvfio-user.wrap
.gitlab-ci.d/buildtest-template.yml +1 -0
index c9f2e737c09a..3c997d7265b2 100644
@@ -44,6 +44,7 @@
   script:
     - scripts/git-submodule.sh update
         $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
+    - meson subprojects download $(cd build/subprojects && echo *)
     - cd build
     - find . -type f -exec touch {} +
     # Avoid recompiling by hiding ninja with NINJA=":"
.gitmodules +0 -9
index f8b2ddf3877c..a934c85e4e40 100644
@@ -13,9 +13,6 @@
 [submodule "roms/qemu-palcode"]
 	path = roms/qemu-palcode
 	url = https://gitlab.com/qemu-project/qemu-palcode.git
-[submodule "subprojects/dtc"]
-	path = subprojects/dtc
-	url = https://gitlab.com/qemu-project/dtc.git
 [submodule "roms/u-boot"]
 	path = roms/u-boot
 	url = https://gitlab.com/qemu-project/u-boot.git
@@ -25,9 +22,6 @@
 [submodule "roms/QemuMacDrivers"]
 	path = roms/QemuMacDrivers
 	url = https://gitlab.com/qemu-project/QemuMacDrivers.git
-[submodule "subprojects/keycodemapdb"]
-	path = subprojects/keycodemapdb
-	url = https://gitlab.com/qemu-project/keycodemapdb.git
 [submodule "roms/seabios-hppa"]
 	path = roms/seabios-hppa
 	url = https://gitlab.com/qemu-project/seabios-hppa.git
@@ -55,6 +49,3 @@
 [submodule "tests/lcitool/libvirt-ci"]
 	path = tests/lcitool/libvirt-ci
 	url = https://gitlab.com/libvirt/libvirt-ci.git
-[submodule "subprojects/libvfio-user"]
-	path = subprojects/libvfio-user
-	url = https://gitlab.com/qemu-project/libvfio-user.git
configure +5 -21
index 2f908660e4f1..1d1b8736c0eb 100755
@@ -253,7 +253,7 @@ else
     git_submodules_action="ignore"
 fi
 
-git_submodules="subprojects/keycodemapdb"
+git_submodules=""
 git="git"
 debug_tcg="no"
 docs="auto"
@@ -269,7 +269,6 @@ python=
 download="enabled"
 bindir="bin"
 skip_meson=no
-vfio_user_server="disabled"
 use_containers="yes"
 gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
 gdb_arches=""
@@ -281,16 +280,13 @@ unset target_list_exclude
 
 # The following Meson options are handled manually (still they
 # are included in the automatically generated help message)
-
-# 1. Track which submodules are needed
-fdt="auto"
-
-# 2. Automatically enable/disable other options
+# because they automatically enable/disable other options
 tcg="auto"
 cfi="false"
 
-# 3. Need to check for -static-pie before Meson runs.  Also,
-# Meson has PIE as a boolean rather than enabled/disabled/auto.
+# Meson has PIE as a boolean rather than enabled/disabled/auto,
+# and we also need to check for -static-pie before Meson runs
+# which requires knowing whether --static is enabled.
 pie=""
 static="no"
 
@@ -743,14 +739,6 @@ for opt do
   ;;
   --disable-cfi) cfi="false"
   ;;
-  --disable-fdt) fdt="disabled"
-  ;;
-  --enable-fdt) fdt="enabled"
-  ;;
-  --enable-fdt=git) fdt="internal"
-  ;;
-  --enable-fdt=*) fdt="$optarg"
-  ;;
   --with-git=*) git="$optarg"
   ;;
   --with-git-submodules=*)
@@ -774,10 +762,6 @@ for opt do
   ;;
   --gdb=*) gdb_bin="$optarg"
   ;;
-  --enable-vfio-user-server) vfio_user_server="enabled"
-  ;;
-  --disable-vfio-user-server) vfio_user_server="disabled"
-  ;;
   # everything else has the same name in configure and meson
   --*) meson_option_parse "$opt" "$optarg"
   ;;
@@ -789,6 +773,30 @@ if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
     error_exit "Can't enable plugins on non-TCG builds"
 fi

configure if test "$plugins" = "yes" -a "$tcg" = "disabled"; then · line 784

Quoted 10 lines
configure +9 -0
 
+if ! test -f "$source_path/subprojects/keycodemapdb/README" \
+    && test -f "$download" = disabled
+then
+    echo
+    echo "ERROR: missing subprojects"
+    echo
+    if test -e "$source_path/.git"; then
+        echo "--disable-download specified but subprojects were not"
+        echo "checked out.  Please download subprojects."

Building from tarball will be ok as we bundle everything affected. This errror will hit anyone building from git with --disable-download though.

How should developers/users download the subprojects ? Can we tell them what command is needed ?

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#12 lore raw

Re: [PATCH 3/5] meson: subprojects: replace submodules with wrap files

Quoted 6 lines · Daniel P. Berrangé

configure if test "$plugins" = "yes" -a "$tcg" = "disabled"; then · line 784

Quoted 3 lines
configure +3 -0
+    if test -e "$source_path/.git"; then
+        echo "--disable-download specified but subprojects were not"
+        echo "checked out.  Please download subprojects."

Building from tarball will be ok as we bundle everything affected. This errror will hit anyone building from git with --disable-download though.

Right, just like it hits people doing --with-git-submodule=ignore; but you're right that --disable-download is more generic and therefore this error is more likely to happen.

Quoted 2 lines

How should developers/users download the subprojects ? Can we tell them what command is needed ?

For those that want to use --disable-download, I can include "meson subprojects download" in the error message, e.g "Please invoke "meson subprojects download" before configuring QEMU, or remove --disable-download from the command line."

Paolo

#13 lore raw

Re: [PATCH 3/5] meson: subprojects: replace submodules with wrap files

Quoted 12 lines · Paolo Bonzini
Quoted 6 lines · Daniel P. Berrangé

configure if test "$plugins" = "yes" -a "$tcg" = "disabled"; then · line 784

Quoted 3 lines
configure +3 -0
+    if test -e "$source_path/.git"; then
+        echo "--disable-download specified but subprojects were not"
+        echo "checked out.  Please download subprojects."

Building from tarball will be ok as we bundle everything affected. This errror will hit anyone building from git with --disable-download though.

Right, just like it hits people doing --with-git-submodule=ignore; but you're right that --disable-download is more generic and therefore this error is more likely to happen.

Quoted 7 lines
Quoted 2 lines

How should developers/users download the subprojects ? Can we tell them what command is needed ?

For those that want to use --disable-download, I can include "meson subprojects download" in the error message, e.g "Please invoke "meson subprojects download" before configuring QEMU, or remove --disable-download from the command line."

Ok, that sounds reasonable to add to the message.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#14 lore raw

PATCH 4/5 configure: check for SLOF submodule before building pc-bios/s390-ccw

In reply to Paolo Bonzini

SLOF is required for building the s390-ccw firmware on s390x, since it is using the libnet code from SLOF for network booting.

If SLOF is absent and submodules are not updated, pc-bios/s390-ccw cannot be built.

---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
configure +2 -1
index 1d1b8736c0eb..c92a3b30b9a4 100755
@@ -1662,7 +1662,8 @@ fi
 
 # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
 # (which is the lowest architecture level that Clang supports)
-if have_target s390x-softmmu && probe_target_compiler s390x-softmmu; then
+if have_target s390x-softmmu && probe_target_compiler s390x-softmmu && \
+    ( test "$git_submodules_action" != ignore || test -f roms/SLOF/VERSION ); then
   write_c_skeleton
   do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
   has_z900=$?
Signature · 1 line
2.40.1
#15 lore raw

Re: [PATCH 4/5] configure: check for SLOF submodule before building pc-bios/s390-ccw

Quoted 16 lines · Paolo Bonzini

SLOF is required for building the s390-ccw firmware on s390x, since it is using the libnet code from SLOF for network booting.

If SLOF is absent and submodules are not updated, pc-bios/s390-ccw cannot be built.

---
  configure | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
configure +0 -0
index 1d1b8736c0eb..c92a3b30b9a4 100755

configure fi · line 1669

Quoted 9 lines
configure +2 -1
@@ -1662,7 +1662,8 @@ fi
 
  # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
  # (which is the lowest architecture level that Clang supports)
-if have_target s390x-softmmu && probe_target_compiler s390x-softmmu; then
+if have_target s390x-softmmu && probe_target_compiler s390x-softmmu && \
+    ( test "$git_submodules_action" != ignore || test -f roms/SLOF/VERSION ); then
    write_c_skeleton
    do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
    has_z900=$?

Not sure if we really need this. Only the networking part of the s390-ccw bios cannot be build without SLOF, but the main binary still builds fine also without it.

Thomas

#16 lore raw

Re: [PATCH 4/5] configure: check for SLOF submodule before building pc-bios/s390-ccw

Quoted 18 lines · Thomas Huth
Quoted 17 lines · Paolo Bonzini

SLOF is required for building the s390-ccw firmware on s390x, since it is using the libnet code from SLOF for network booting.

If SLOF is absent and submodules are not updated, pc-bios/s390-ccw cannot be built.

---
  configure | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
configure +0 -0
index 1d1b8736c0eb..c92a3b30b9a4 100755
@@ -1662,7 +1662,8 @@ fi
 
Quoted 12 lines

configure fi · line 1669

Quoted 8 lines
configure +2 -1
  # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
  # (which is the lowest architecture level that Clang supports)
-if have_target s390x-softmmu && probe_target_compiler s390x-softmmu; then
+if have_target s390x-softmmu && probe_target_compiler s390x-softmmu && \
+    ( test "$git_submodules_action" != ignore || test -f roms/SLOF/VERSION ); then
    write_c_skeleton
    do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
    has_z900=$?

Not sure if we really need this. Only the networking part of the s390-ccw bios cannot be build without SLOF, but the main binary still builds fine also without it.

Thinking more about it---considering we have prebuilt s390-ccw binaries, why would someone want to rebuild only one of the ROMs and risk breaking the other? Should we keep this patch, and also include $(SRC_PATH)/netboot.mak unconditionally from pc-bios/s390-ccw/Makefile?

Paolo

#17 lore raw

Re: [PATCH 4/5] configure: check for SLOF submodule before building pc-bios/s390-ccw

Quoted 32 lines · Paolo Bonzini
Quoted 18 lines · Thomas Huth
Quoted 17 lines · Paolo Bonzini

SLOF is required for building the s390-ccw firmware on s390x, since it is using the libnet code from SLOF for network booting.

If SLOF is absent and submodules are not updated, pc-bios/s390-ccw cannot be built.

---
   configure | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
configure +0 -0
index 1d1b8736c0eb..c92a3b30b9a4 100755
@@ -1662,7 +1662,8 @@ fi
 
Quoted 12 lines

configure fi · line 1669

Quoted 8 lines
configure +2 -1
   # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
   # (which is the lowest architecture level that Clang supports)
-if have_target s390x-softmmu && probe_target_compiler s390x-softmmu; then
+if have_target s390x-softmmu && probe_target_compiler s390x-softmmu && \
+    ( test "$git_submodules_action" != ignore || test -f roms/SLOF/VERSION ); then
     write_c_skeleton
     do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
     has_z900=$?

Not sure if we really need this. Only the networking part of the s390-ccw bios cannot be build without SLOF, but the main binary still builds fine also without it.

Quoted 5 lines

Thinking more about it---considering we have prebuilt s390-ccw binaries, why would someone want to rebuild only one of the ROMs and risk breaking the other? Should we keep this patch, and also include $(SRC_PATH)/netboot.mak unconditionally from pc-bios/s390-ccw/Makefile?

Yes, I think it makes sense nowadays. In the beginning, the network bootloader was considered experimental and thus optional, but I think it is well established nowadays, so it makes sense to always build it together with the other part of the s390-ccw bios.

Thomas

#18 lore raw

PATCH 5/5 meson: subprojects: replace berkeley-{soft, test}float-3 with wraps

In reply to Paolo Bonzini

Unlike other subprojects, these require an overlay directory to include meson rules to build the libraries. The rules are basically lifted from tests/fp/meson.build, with a few changes to create platform.h and publish a dependency.

The build defines are passed through a subproject option, and posted back to users of the library via the dependency's compile_args.

The only remaining user of GIT_SUBMODULES and GIT_SUBMODULES_ACTION is roms/SLOF, which is used to build pc-bios/s390-ccw. All other roms submodules are only present to satisfy the license on pre-built firmware blobs.

Best reviewed with --color-moved.

---
 .gitmodules                                   |   6 -
 configure                                     |  27 -
 scripts/archive-source.sh                     |  22 +-
 scripts/make-release                          |   2 +-
 subprojects/.gitignore                        |   2 +
 subprojects/berkeley-softfloat-3.wrap         |   5 +
 subprojects/berkeley-testfloat-3.wrap         |   5 +
 .../berkeley-softfloat-3/meson.build          | 339 +++++++++++
 .../berkeley-softfloat-3/meson_options.txt    |   1 +
 .../berkeley-testfloat-3/meson.build          | 220 +++++++
 .../berkeley-testfloat-3/meson_options.txt    |   1 +
 tests/fp/meson.build                          | 541 +-----------------
 12 files changed, 590 insertions(+), 581 deletions(-)
 create mode 100644 subprojects/berkeley-softfloat-3.wrap
 create mode 100644 subprojects/berkeley-testfloat-3.wrap
 create mode 100644 subprojects/packagefiles/berkeley-softfloat-3/meson.build
 create mode 100644 subprojects/packagefiles/berkeley-softfloat-3/meson_options.txt
 create mode 100644 subprojects/packagefiles/berkeley-testfloat-3/meson.build
 create mode 100644 subprojects/packagefiles/berkeley-testfloat-3/meson_options.txt
.gitmodules +0 -6
index a934c85e4e40..73cae4cd4da0 100644
@@ -28,12 +28,6 @@
 [submodule "roms/u-boot-sam460ex"]
 	path = roms/u-boot-sam460ex
 	url = https://gitlab.com/qemu-project/u-boot-sam460ex.git
-[submodule "tests/fp/berkeley-testfloat-3"]
-	path = tests/fp/berkeley-testfloat-3
-	url = https://gitlab.com/qemu-project/berkeley-testfloat-3.git
-[submodule "tests/fp/berkeley-softfloat-3"]
-	path = tests/fp/berkeley-softfloat-3
-	url = https://gitlab.com/qemu-project/berkeley-softfloat-3.git
 [submodule "roms/edk2"]
 	path = roms/edk2
 	url = https://gitlab.com/qemu-project/edk2.git
configure +0 -27
index c92a3b30b9a4..119c6e161377 100755
@@ -805,28 +805,6 @@ case $git_submodules_action in
         fi
     ;;
     ignore)
-        if ! test -f "$source_path/tests/fp/berkeley-testfloat-3/README.md"
-        then
-            echo
-            echo "ERROR: missing GIT submodules"
-            echo
-            if test -e "$source_path/.git"; then
-                echo "--with-git-submodules=ignore specified but submodules were not"
-                echo "checked out.  Please initialize and update submodules."
-            else
-                echo "This is not a GIT checkout but module content appears to"
-                echo "be missing. Do not use 'git archive' or GitHub download links"
-                echo "to acquire QEMU source archives. Non-GIT builds are only"
-                echo "supported with source archives linked from:"
-                echo
-                echo "  https://www.qemu.org/download/#source"
-                echo
-                echo "Developers working with GIT can use scripts/archive-source.sh"
-                echo "if they need to create valid source archives."
-            fi
-            echo
-            exit 1
-        fi
     ;;
     *)
         echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
@@ -1142,11 +1120,6 @@ if test "$tcg" = "auto"; then
   fi
 fi
 
-if test "$tcg" = "enabled"; then
-    git_submodules="$git_submodules tests/fp/berkeley-testfloat-3"
-    git_submodules="$git_submodules tests/fp/berkeley-softfloat-3"
-fi
-
 ##########################################
 # big/little endian test
 cat > $TMPC << EOF
scripts/archive-source.sh +1 -21
index b99cb66e4122..489963049102 100755
@@ -26,8 +26,7 @@ sub_file="${sub_tdir}/submodule.tar"
 # independent of what the developer currently has initialized
 # in their checkout, because the build environment is completely
 # different to the host OS.
-subprojects="dtc keycodemapdb libvfio-user"
-submodules="tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
+subprojects="dtc keycodemapdb libvfio-user berkeley-softfloat-3 berkeley-testfloat-3"
 sub_deinit=""
 
 function cleanup() {
@@ -51,25 +50,6 @@ function tree_ish() {
 
 git archive --format tar "$(tree_ish)" > "$tar_file"
 test $? -ne 0 && error "failed to archive qemu"
-for sm in $submodules; do
-    status="$(git submodule status "$sm")"
-    smhash="${status#[ +-]}"
-    smhash="${smhash%% *}"
-    case "$status" in
-        -*)
-            sub_deinit="$sub_deinit $sm"
-            git submodule update --init "$sm"
-            test $? -ne 0 && error "failed to update submodule $sm"
-            ;;
-        +*)
-            echo "WARNING: submodule $sm is out of sync"
-            ;;
-    esac
-    (cd $sm; git archive --format tar --prefix "$sm/" $(tree_ish)) > "$sub_file"
-    test $? -ne 0 && error "failed to archive submodule $sm ($smhash)"
-    tar --concatenate --file "$tar_file" "$sub_file"
-    test $? -ne 0 && error "failed append submodule $sm to $tar_file"
-done
 
 for sp in $subprojects; do
     meson subprojects download $sp
scripts/make-release +1 -1
index 0604e61b8143..c5db87b3f91b 100755
@@ -17,7 +17,7 @@ if [ $# -ne 2 ]; then
 fi
 
 # Only include wraps that are invoked with subproject()
-SUBPROJECTS="dtc libvfio-user keycodemapdb"
+SUBPROJECTS="dtc libvfio-user keycodemapdb berkeley-softfloat-3 berkeley-testfloat-3"
 
 src="$1"
 version="$2"
subprojects/.gitignore +2 -0
index 935e9a72a8f9..adca0266be69 100644
@@ -1,5 +1,7 @@
 /packagecache
 
+/berkeley-softfloat-3
+/berkeley-testfloat-3
 /dtc
 /keycodemapdb
 /libvfio-user
subprojects/berkeley-softfloat-3.wrap new file +5 -0
new file mode 100644
index 000000000000..a8fd87740b15
@@ -0,0 +1,5 @@
+[wrap-git]
+url = https://gitlab.com/qemu-project/berkeley-softfloat-3
+revision = b64af41c3276f97f0e181920400ee056b9c88037
+patch_directory = berkeley-softfloat-3
+depth = 1
subprojects/berkeley-testfloat-3.wrap new file +5 -0
new file mode 100644
index 000000000000..6ad80a37b2aa
@@ -0,0 +1,5 @@
+[wrap-git]
+url = https://gitlab.com/qemu-project/berkeley-testfloat-3
+revision = 40619cbb3bf32872df8c53cc457039229428a263
+patch_directory = berkeley-testfloat-3
+depth = 1
subprojects/packagefiles/berkeley-softfloat-3/meson.build new file +339 -0

339 lines not on this page · raw message

subprojects/packagefiles/berkeley-softfloat-3/meson_options.txt new file +1 -0
new file mode 100644
index 000000000000..868ae57e805e
@@ -0,0 +1 @@
+option('defines', type : 'array', value : [])
subprojects/packagefiles/berkeley-testfloat-3/meson.build new file +220 -0

220 lines not on this page · raw message

subprojects/packagefiles/berkeley-testfloat-3/meson_options.txt new file +1 -0
new file mode 100644
index 000000000000..868ae57e805e
@@ -0,0 +1 @@
+option('defines', type : 'array', value : [])
tests/fp/meson.build +15 -526

579 lines not on this page · raw message

Signature · 1 line
2.40.1
#19 lore raw
In reply to Paolo Bonzini
Quoted 2 lines · Paolo Bonzini

This series replaces git submodules for bundled libraries with .wrap files that can be used directly by meson for subprojects.

...

Quoted 2 lines

The remaining submodules consist of tests/lcitool/libvirt-ci and the firmware in roms/.

We talked about moving the contents of roms/ to a separate repository a couple of times ... maybe it's time now that we really do it?

(However, when I tried to tackle the "do we need to ship the firmware sources with the main tarball" problem the last time, there was no consensus how to do it best, see https://lore.kernel.org/qemu-devel/[email protected]/ ... maybe something to discuss at KVM forum...)

Quoted 9 lines

The former is only used in very specific cases,
while the latter is mostly used only as a pointer used to create the QEMU tarball. Unfortunately, git-submodule.sh is still needed for roms/SLOF, parts of which are used in the QEMU build process for pc-bios/s390-ccw; more on this later in this cover letter.

I'm not sure what's the best way to proceed for roms/SLOF. Some possibilities, in no particular order, include:

Quoted 7 lines

* doing nothing

* merging --with-git-submodules with --enable-download, and moving the git-submodule.sh rules from the main Makefile to pc-bios/s390-ccw/ (my favorite option)

* copying the relevant SLOF files into pc-bios/

Considering that SLOF is also rather on life support already (there is now VOF for the sPAPR machine instead, Alexey left IBM, ...), I also wouldn't mind the third option, I think.

But of course we can also start with option 2 and go for option 3 later.

Thomas

#20 lore raw
Quoted 31 lines · Thomas Huth
Quoted 2 lines · Paolo Bonzini

This series replaces git submodules for bundled libraries with .wrap files that can be used directly by meson for subprojects.

...

Quoted 2 lines

The remaining submodules consist of tests/lcitool/libvirt-ci and the firmware in roms/.

We talked about moving the contents of roms/ to a separate repository a couple of times ... maybe it's time now that we really do it?

(However, when I tried to tackle the "do we need to ship the firmware sources with the main tarball" problem the last time, there was no consensus how to do it best, see
https://lore.kernel.org/qemu-devel/[email protected]/
... maybe something to discuss at KVM forum...)

Quoted 15 lines

The former is only used in very specific cases,
while the latter is mostly used only as a pointer used to create the QEMU tarball. Unfortunately, git-submodule.sh is still needed for roms/SLOF, parts of which are used in the QEMU build process for pc-bios/s390-ccw; more on this later in this cover letter.

I'm not sure what's the best way to proceed for roms/SLOF. Some possibilities, in no particular order, include:

* doing nothing

* merging --with-git-submodules with --enable-download, and moving the git-submodule.sh rules from the main Makefile to pc-bios/s390-ccw/ (my favorite option)

Quoted 7 lines
Quoted 1 line

* copying the relevant SLOF files into pc-bios/

Considering that SLOF is also rather on life support already (there is now VOF for the sPAPR machine instead, Alexey left IBM, ...), I also wouldn't mind the third option, I think.

But of course we can also start with option 2 and go for option 3 later.

My inclination would be for option 3 too, just copy the relevant files into s390-ccw dir, so the two distinct ROMs are fully separated from each other.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#21 lore raw
Quoted 15 lines · Daniel P. Berrangé
Quoted 15 lines
Quoted 10 lines

I'm not sure what's the best way to proceed for roms/SLOF. Some possibilities, in no particular order, include:

* doing nothing

* merging --with-git-submodules with --enable-download, and moving the git-submodule.sh rules from the main Makefile to pc-bios/s390-ccw/ (my favorite option)

* copying the relevant SLOF files into pc-bios/

Considering that SLOF is also rather on life support already (there is now VOF for the sPAPR machine instead, Alexey left IBM, ...), I also wouldn't mind the third option, I think.

Quoted 5 lines
Quoted 1 line

But of course we can also start with option 2 and go for option 3 later.

My inclination would be for option 3 too, just copy the relevant files into s390-ccw dir, so the two distinct ROMs are fully separated from each other.

Note that the amount of code is not small (7.000 lines of source for the network stack and 1.000 for libc); but yeah, that can be done.

Paolo

#22 lore raw
In reply to Paolo Bonzini
Quoted 26 lines · Paolo Bonzini

The remaining submodules consist of tests/lcitool/libvirt-ci and the firmware in roms/. The former is only used in very specific cases, while the latter is mostly used only as a pointer used to create the QEMU tarball. Unfortunately, git-submodule.sh is still needed for roms/SLOF, parts of which are used in the QEMU build process for pc-bios/s390-ccw; more on this later in this cover letter.

I'm not sure what's the best way to proceed for roms/SLOF. Some possibilities, in no particular order, include:

* doing nothing

* merging --with-git-submodules with --enable-download, and moving the git-submodule.sh rules from the main Makefile to pc-bios/s390-ccw/ (my favorite option)

* copying the relevant SLOF files into pc-bios/

Also, getting into more overengineered territory:

* same as the second option, but also replace the roms/ submodules with text files, in a format similar to .wrap files; meson uses the standard configparser to read them, so it would not be a lot of code. The files would be parsed by scripts/make-release and pc-bios/s390-ccw/Makefile.

Quoted 6 lines

* adding support for firmware with a meson build system to configure; turn SLOF into a wrap and roms/SLOF into a symlink for ../pc-bios/s390-ccw/subprojects/SLOF. I'm mentioning this for completeness but this is not something I would like. On the other hand it could reuse some (or most?) of the code currently used to generate config-meson.cross, so maybe it isn't that bad...

Is there a reason why SLOF/s390-ccw is handled differently from the other ROMs ? ie, why haven't we checked in the pre-built firmware binaries, such that we don't build SLOF by default ?

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#23 lore raw
Quoted 10 lines · Daniel P. Berrangé
Quoted 6 lines

* adding support for firmware with a meson build system to configure; turn SLOF into a wrap and roms/SLOF into a symlink for ../pc-bios/s390-ccw/subprojects/SLOF. I'm mentioning this for completeness but this is not something I would like. On the other hand it could reuse some (or most?) of the code currently used to generate config-meson.cross, so maybe it isn't that bad...

Is there a reason why SLOF/s390-ccw is handled differently from the other ROMs ? ie, why haven't we checked in the pre-built firmware binaries, such that we don't build SLOF by default ?

The SLOF ROM is checked in.

s390-ccw is also checked in, but it is a QEMU-specific ROM like, on x86, linuxboot.bin or multiboot.bin. Therefore it's rebuilt by "make" and its build system is part of QEMU's.

The relationship between s390-ccw and SLOF is that s390-ccw _reuses_ the network stack of SLOF, and pc-bios/s390-ccw/Makefile does so by simply looking at sources at $(SOURCE_PATH)../../roms/SLOF.

Paolo

Quoted 9 lines

With regards,
Daniel
--

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|