Skip to contentSkip to conversation

meson: replace submodules with wrap files

PATCH In review Paolo Bonzini 6 participants 32 messages Jun 5, 2023 – Jun 22, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 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. For now, the git-submodule.sh rules are moved from the main Makefile to pc-bios/s390-ccw/ and, to limit the number of configure options, --with-git-submodules is merged with --enable-download.

Patch 1 removes the --with-git= option for consistency, since git cannot be overridden for "meson subprojects download". There is still a GIT environment variable, which I could look at supporting in meson as well.

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

Patches 3-4 are small improvements to git-submodule.sh, which make sense when the submodule updates are split across multiple Makefiles. At the end of the series actually the updates move entirely to pc-bios/s390-ccw/Makefile, but these improvements are useful anyway in my opinion.

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

Patches 6-7 move roms/SLOF handling to pc-bios/s390-ccw. While in the future it is possible that SLOF's networking code will be copied to the s390 ROMs, for now I am going for a smaller change.

Patch 8 converts berkeley-{soft,test}float-3 to subprojects too, contextually moving their build rules out of tests/fp/meson.build.

Patches 9-10 are residual cleanups.

Paolo

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

Paolo Bonzini (10):
configure: remove --with-git= option
configure: rename --enable-pypi to --enable-download, control
subprojects too
git-submodule: allow partial update of .git-submodule-status
build: log submodule update from git-submodule.sh
meson: subprojects: replace submodules with wrap files
configure: move SLOF submodule handling to pc-bios/s390-ccw pc-bios/s390-ccw: always build network bootloader
meson: subprojects: replace berkeley-{soft,test}float-3 with wraps
build: remove git submodule handling from main makefile
configure: remove --with-git-submodules=

 .gitignore                                    |   2 -
 .gitlab-ci.d/buildtest-template.yml           |   4 +-
 .gitmodules                                   |  15 -
 Makefile                                      |  12 -
 configure                                     | 169 ++----
 meson.build                                   |  17 +-
 pc-bios/s390-ccw/Makefile                     |  16 +-
 scripts/archive-source.sh                     |  27 +-
 .../ci/org.centos/stream/8/x86_64/configure   |   3 -
 scripts/git-submodule.sh                      |  69 ++-
 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 +-----------------
 25 files changed, 716 insertions(+), 758 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 v2 1/10 configure: remove --with-git= option

The scenario for which --with-git= was introduced was to use a SOCKS proxy such as tsocks. However, this was back in 2017 when QEMU's submodules used the git:// protocol, and it is not as important when using the "smart HTTP" backend; for example, neither "meson subprojects download" nor scripts/checkpatch.pl do not obey the GIT environment variable.

So remove the knob, but test for the presence of git in the configure and git-submodule.sh scripts, and suggest using --with-git-submodules=validate
+ a manual invocation of git-submodule.sh when git does not work. Hopefully in the future the GIT environment variable will be supported by Meson.

---
 Makefile                                      |  2 +-
 configure                                     |  8 ++------
 meson.build                                   |  1 -
 .../ci/org.centos/stream/8/x86_64/configure   |  2 --
 scripts/git-submodule.sh                      | 19 ++++++++++---------
 5 files changed, 13 insertions(+), 19 deletions(-)
Makefile +1 -1
index 08fb6a3b058..8005f1cc53e 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)), \
+		(GIT=git "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
 		"GIT","$(GIT_SUBMODULES)")
 endif
 
configure +2 -6
index d674a966731..92bacc756c0 100755
@@ -751,8 +751,6 @@ for opt do
   ;;
   --enable-fdt=*) fdt="$optarg"
   ;;
-  --with-git=*) git="$optarg"
-  ;;
   --with-git-submodules=*)
       git_submodules_action="$optarg"
   ;;
@@ -791,7 +789,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 +890,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 +1696,7 @@ fi
 #######################################
 # generate config-host.mak
 
-if ! (GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
+if ! (GIT=git "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
     exit 1
 fi
 
@@ -1709,7 +1706,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 cabf36ec5e9..eb09af6ec82 100644
@@ -4026,7 +4026,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/ci/org.centos/stream/8/x86_64/configure +0 -2
index 6e8983f39cd..de76510978f 100755
@@ -29,14 +29,12 @@
 --extra-cflags="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection" \
 --with-suffix="qemu-kvm" \
 --firmwarepath=/usr/share/qemu-firmware \
---with-git=meson \
 --with-git-submodules=update \
 --target-list="x86_64-softmmu" \
 --block-drv-rw-whitelist="qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,gluster" \
 --audio-drv-list="" \
 --block-drv-ro-whitelist="vmdk,vhdx,vpc,https,ssh" \
 --with-coroutine=ucontext \
---with-git=git \
 --tls-priority=@QEMU,SYSTEM \
 --disable-attr \
 --disable-auth-pam \
scripts/git-submodule.sh +10 -9
index 7be41f59483..0ce1efc44e5 100755
@@ -12,7 +12,7 @@ maybe_modules="$@"
 # if --with-git-submodules=ignore, do nothing
 test "$command" = "ignore" && exit 0
 
-test -z "$GIT" && GIT=git
+test -z "$GIT" && GIT=$(command -v git)
 
 cd "$(dirname "$0")/.."
 
@@ -21,19 +21,14 @@ update_error() {
     echo
     echo "Unable to automatically checkout GIT submodules '$modules'."
     echo "If you require use of an alternative GIT binary (for example to"
-    echo "enable use of a transparent proxy), then please specify it by"
-    echo "running configure by with the '--with-git' argument. e.g."
-    echo
-    echo " $ ./configure --with-git='tsocks git'"
-    echo
-    echo "Alternatively you may disable automatic GIT submodule checkout"
-    echo "with:"
+    echo "enable use of a transparent proxy), please disable automatic"
+    echo "GIT submodule checkout with:"
     echo
     echo " $ ./configure --with-git-submodules=validate"
     echo
     echo "and then manually update submodules prior to running make, with:"
     echo
-    echo " $ scripts/git-submodule.sh update $modules"
+    echo " $ GIT='tsocks git' scripts/git-submodule.sh update $modules"
     echo
     exit 1
 }
@@ -57,6 +52,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
Reviewed-by on v2 1/10
#2 lore raw

Re: [PATCH 01/10] configure: remove --with-git= option

Quoted 6 lines · Paolo Bonzini

The scenario for which --with-git= was introduced was to use a SOCKS proxy such as tsocks. However, this was back in 2017 when QEMU's submodules used the git:// protocol, and it is not as important when using the "smart HTTP" backend; for example, neither "meson subprojects download" nor scripts/checkpatch.pl do not obey the GIT environment variable.

Quoted 6 lines

So remove the knob, but test for the presence of git in the configure and git-submodule.sh scripts, and suggest using --with-git-submodules=validate
+ a manual invocation of git-submodule.sh when git does not work. Hopefully in the future the GIT environment variable will be supported by Meson.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
Reviewed-by on v2 1/10
#3 lore raw

Re: [PATCH 01/10] configure: remove --with-git= option

In reply to Paolo Bonzini
Quoted 5 lines · Paolo Bonzini

The scenario for which --with-git= was introduced was to use a SOCKS proxy such as tsocks. However, this was back in 2017 when QEMU's submodules used the git:// protocol, and it is not as important when using the "smart HTTP" backend; for example, neither "meson subprojects download" nor scripts/checkpatch.pl do not obey the GIT environment variable.

Either "neither ... nor" or "not", but not both, please.

With the sentenced fixed:

#4 lore raw

PATCH v2 2/10 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.

---
 .gitignore             |  2 --
 configure              | 17 +++++++----------
 subprojects/.gitignore |  3 +++
 3 files changed, 10 insertions(+), 12 deletions(-)
 create mode 100644 subprojects/.gitignore
.gitignore +0 -2
index 1ea59f48192..61fa39967b5 100644
@@ -20,5 +20,3 @@ GTAGS
 *.swp
 *.patch
 *.gcov
-
-/subprojects/slirp
configure +7 -10
index 92bacc756c0..52274212310 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"
@@ -754,9 +754,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"
@@ -960,7 +960,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.
 
@@ -977,7 +977,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
 
@@ -1000,7 +1000,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
 
@@ -1940,11 +1940,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 00000000000..7560ebb0b1a
@@ -0,0 +1,3 @@
+/packagecache
+
+/slirp
Signature · 1 line
2.40.1
Reviewed-by on v2 2/10
#5 lore raw

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

Quoted 5 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.

Quoted 7 lines

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.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#6 lore raw

PATCH v2 3/10 git-submodule: allow partial update of .git-submodule-status

In reply to Paolo Bonzini

Allow a specific subdirectory to run git-submodule.sh with only a subset of submodules, without removing the others from the .git-submodule-status file.

This also allows scripts/git-submodule.sh to be more lenient:
validating an empty set of submodules is not a mistake.

---
 scripts/git-submodule.sh | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
scripts/git-submodule.sh +14 -12
index 0ce1efc44e5..b7d8f05352c 100755
@@ -72,12 +72,8 @@ done
 
 case "$command" in
 status|validate)
-    if test -z "$maybe_modules"
-    then
-         test -s ${substat} && validate_error "$command" || exit 0
-    fi
-
     test -f "$substat" || validate_error "$command"
+    test -z "$maybe_modules" && exit 0
     for module in $modules; do
         CURSTATUS=$($GIT submodule status $module)
         OLDSTATUS=$(cat $substat | grep $module)
@@ -88,17 +84,23 @@ status|validate)
     exit 0
     ;;
 update)
-    if test -z "$maybe_modules"
-    then
-        test -e $substat || touch $substat
-        exit 0
-    fi
+    test -e $substat || touch $substat
+    test -z "$maybe_modules" && exit 0
 
     $GIT submodule update --init $modules 1>/dev/null
     test $? -ne 0 && update_error "failed to update modules"
 
-    $GIT submodule status $modules > "${substat}"
-    test $? -ne 0 && update_error "failed to save git submodule status" >&2
+    (while read -r; do
+        for module in $modules; do
+            case $REPLY in
+                *" $module "*) continue 2 ;;
+            esac
+        done
+        printf '%s\n' "$REPLY"
+    done
+    $GIT submodule status $modules
+    test $? -ne 0 && update_error "failed to save git submodule status" >&2) < $substat > $substat.new
+    mv -f $substat.new $substat
     ;;
 esac
 
Signature · 1 line
2.40.1
Reviewed-by on v2 3/10
#7 lore raw

Re: [PATCH 03/10] git-submodule: allow partial update of .git-submodule-status

Quoted 8 lines · Paolo Bonzini

Allow a specific subdirectory to run git-submodule.sh with only a subset of submodules, without removing the others from the .git-submodule-status file.

This also allows scripts/git-submodule.sh to be more lenient:
validating an empty set of submodules is not a mistake.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#8 lore raw

PATCH v2 4/10 build: log submodule update from git-submodule.sh

In reply to Paolo Bonzini

Print exactly which submodules have been updated, by reusing the logic of "git-submodule.sh validate" after executing "git submodule update --init'.

---
 Makefile                 |  4 +---
 scripts/git-submodule.sh | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)
Makefile +1 -3
index 8005f1cc53e..d68196acb9e 100644
@@ -52,9 +52,7 @@ Makefile: .git-submodule-status
 .PHONY: git-submodule-update
 git-submodule-update:
 ifneq ($(GIT_SUBMODULES_ACTION),ignore)
-	$(call quiet-command, \
-		(GIT=git "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
-		"GIT","$(GIT_SUBMODULES)")
+	$(quiet-@)GIT=git "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)
 endif
 
 # 0. ensure the build tree is okay
scripts/git-submodule.sh +11 -5
index b7d8f05352c..38b55c90e11 100755
@@ -46,6 +46,13 @@ validate_error() {
     exit 1
 }
 
+check_updated() {
+    local CURSTATUS OLDSTATUS
+    CURSTATUS=$($GIT submodule status $module)
+    OLDSTATUS=$(grep $module $substat)
+    test "$CURSTATUS" = "$OLDSTATUS"
+}
+
 if test -n "$maybe_modules" && ! test -e ".git"
 then
     echo "$0: unexpectedly called with submodules but no git checkout exists"
@@ -75,11 +82,7 @@ status|validate)
     test -f "$substat" || validate_error "$command"
     test -z "$maybe_modules" && exit 0
     for module in $modules; do
-        CURSTATUS=$($GIT submodule status $module)
-        OLDSTATUS=$(cat $substat | grep $module)
-        if test "$CURSTATUS" != "$OLDSTATUS"; then
-            validate_error "$command"
-        fi
+        check_updated $module || validate_error "$command"
     done
     exit 0
     ;;
@@ -89,6 +92,9 @@ update)
 
     $GIT submodule update --init $modules 1>/dev/null
     test $? -ne 0 && update_error "failed to update modules"
+    for module in $modules; do
+        check_updated $module || echo Updated "$module"
+    done
 
     (while read -r; do
         for module in $modules; do
Signature · 1 line
2.40.1
Reviewed-by on v2 4/10
#9 lore raw

Re: [PATCH 04/10] build: log submodule update from git-submodule.sh

Quoted 4 lines · Paolo Bonzini

Print exactly which submodules have been updated, by reusing the logic of "git-submodule.sh validate" after executing "git submodule update --init'.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
Reviewed-by on v2 4/10
#10 lore raw

Re: [PATCH 04/10] build: log submodule update from git-submodule.sh

In reply to Paolo Bonzini
Quoted 4 lines · Paolo Bonzini

Print exactly which submodules have been updated, by reusing the logic of "git-submodule.sh validate" after executing "git submodule update --init'.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#11 lore raw

PATCH v2 5/10 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                           | 77 ++++++++++++-----------------
 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, 63 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 c9f2e737c09..3c997d7265b 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 f8b2ddf3877..a934c85e4e4 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 +32 -45

144 lines not on this page · raw message

meson.build +1 -14
index eb09af6ec82..badeeffd529 100644
@@ -3046,14 +3046,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
 
@@ -3081,12 +3074,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 dba5ae05b67..b99cb66e412 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 44a9d86a04a..0604e61b814 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 7560ebb0b1a..935e9a72a8f 100644
@@ -1,3 +1,6 @@
 /packagecache
 
+/dtc
+/keycodemapdb
+/libvfio-user
 /slirp
subprojects/dtc deleted +0 -1
deleted file mode 160000
index b6910bec116..00000000000
@@ -1 +0,0 @@
-Subproject commit b6910bec11614980a21e46fbccc35934b671bd81
subprojects/dtc.wrap new file +4 -0
new file mode 100644
index 00000000000..d1bc9174e91
@@ -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 f5772a62ec5..00000000000
@@ -1 +0,0 @@
-Subproject commit f5772a62ec52591ff6870b7e8ef32482371f22c6
subprojects/keycodemapdb.wrap new file +4 -0
new file mode 100644
index 00000000000..dda7b0e5716
@@ -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 0b28d205572..00000000000
@@ -1 +0,0 @@
-Subproject commit 0b28d205572c80b568a1003db2c8f37ca333e4d7
subprojects/libvfio-user.wrap new file +4 -0
new file mode 100644
index 00000000000..416955ca451
@@ -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
Reviewed-by on v2 5/10
#12 lore raw

Re: [PATCH 05/10] meson: subprojects: replace submodules with wrap files

Quoted 39 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                           | 77 ++++++++++++-----------------
 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 -
Quoted 8 lines
 subprojects/libvfio-user.wrap       |  4 ++
 13 files changed, 63 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

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 :|
#13 lore raw

PATCH v2 6/10 configure: move SLOF submodule handling to pc-bios/s390-ccw

In reply to Paolo Bonzini

Move the handling of the roms/SLOF submodule out of the main Makefile, since we are going to remove submodules from the build process of QEMU.

---
 .gitlab-ci.d/buildtest-template.yml |  2 +-
 configure                           |  7 +++----
 pc-bios/s390-ccw/Makefile           | 11 +++++++++++
 3 files changed, 15 insertions(+), 5 deletions(-)
.gitlab-ci.d/buildtest-template.yml +1 -1
index 3c997d7265b..d01d504ec5f 100644
@@ -43,7 +43,7 @@
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   script:
     - scripts/git-submodule.sh update
-        $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
+        roms/SLOF $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
     - meson subprojects download $(cd build/subprojects && echo *)
     - cd build
     - find . -type f -exec touch {} +
configure +3 -4
index 45d43ddbd97..de3904fb59d 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 && \
+    GIT=git "$source_path/scripts/git-submodule.sh" "$git_submodules_action" roms/SLOF >> config.log 2>&1; then
   write_c_skeleton
   do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
   has_z900=$?
@@ -1675,10 +1676,8 @@ if have_target s390x-softmmu && probe_target_compiler s390x-softmmu; then
     config_mak=pc-bios/s390-ccw/config-host.mak
     echo "# Automatically generated by configure - do not modify" > $config_mak
     echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
+    echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_mak
     write_target_makefile >> $config_mak
-    # SLOF is required for building the s390-ccw firmware on s390x,
-    # since it is using the libnet code from SLOF for network booting.
-    git_submodules="${git_submodules} roms/SLOF"
   fi
 fi
 
pc-bios/s390-ccw/Makefile +11 -0
index 10e8f5cb633..9c5276f8ade 100644
@@ -6,6 +6,8 @@ include config-host.mak
 CFLAGS = -O2 -g
 MAKEFLAGS += -rR
 
+GIT_SUBMODULES = roms/SLOF
+
 NULL :=
 SPACE := $(NULL) #
 TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
@@ -80,3 +82,12 @@ clean:
 
 distclean:
 	rm -f config-cc.mak
+
+.PHONY: git-submodule-update
+$(SRC_PATH)/../../.git-submodule-status: git-submodule-update config-host.mak
+Makefile: $(SRC_PATH)/../../.git-submodule-status
+
+git-submodule-update:
+ifneq ($(GIT_SUBMODULES_ACTION),ignore)
+	$(quiet-@)GIT=git "$(SRC_PATH)/../../scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)
+endif
Signature · 1 line
2.40.1
Reviewed-by on v2 6/10
#14 lore raw

Re: [PATCH 06/10] configure: move SLOF submodule handling to pc-bios/s390-ccw

Quoted 9 lines · Paolo Bonzini

Move the handling of the roms/SLOF submodule out of the main Makefile, since we are going to remove submodules from the build process of QEMU.

---
 .gitlab-ci.d/buildtest-template.yml |  2 +-
 configure                           |  7 +++----
 pc-bios/s390-ccw/Makefile           | 11 +++++++++++
 3 files changed, 15 insertions(+), 5 deletions(-)

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 :|
Acked-by on v2 6/10
#15 lore raw

Re: [PATCH 06/10] configure: move SLOF submodule handling to pc-bios/s390-ccw

In reply to Paolo Bonzini
Quoted 9 lines · Paolo Bonzini

Move the handling of the roms/SLOF submodule out of the main Makefile, since we are going to remove submodules from the build process of QEMU.

---
  .gitlab-ci.d/buildtest-template.yml |  2 +-
  configure                           |  7 +++----
  pc-bios/s390-ccw/Makefile           | 11 +++++++++++
  3 files changed, 15 insertions(+), 5 deletions(-)
#16 lore raw

PATCH v2 7/10 pc-bios/s390-ccw: always build network bootloader

In reply to Paolo Bonzini

In the beginning, the network bootloader was considered experimental and thus optional, but it is well established nowadays and configure always checks for roms/SLOF before compiling pc-bios/s390-ccw.

Therefore, it makes sense to always build it together with the other part of the s390-ccw bios.

---
 pc-bios/s390-ccw/Makefile | 5 -----
 1 file changed, 5 deletions(-)
pc-bios/s390-ccw/Makefile +0 -5
index 9c5276f8ade..2e8cc015aa0 100644
@@ -67,12 +67,7 @@ s390-ccw.img: s390-ccw.elf
 
 $(OBJECTS): Makefile
 
-ifneq ($(wildcard $(SRC_PATH)/../../roms/SLOF/lib/libnet),)
 include $(SRC_PATH)/netboot.mak
-else
-s390-netboot.img:
-	@echo "s390-netboot.img not built since roms/SLOF/ is not available."
-endif
 
 ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
 -include $(ALL_OBJS:%.o=%.d)
Signature · 1 line
2.40.1
Reviewed-by on v2 7/10
#17 lore raw

Re: [PATCH 07/10] pc-bios/s390-ccw: always build network bootloader

Quoted 11 lines · Paolo Bonzini

In the beginning, the network bootloader was considered experimental and thus optional, but it is well established nowadays and configure always checks for roms/SLOF before compiling pc-bios/s390-ccw.

Therefore, it makes sense to always build it together with the other part of the s390-ccw bios.

---
 pc-bios/s390-ccw/Makefile | 5 -----
 1 file changed, 5 deletions(-)

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 v2 7/10
#18 lore raw

Re: [PATCH 07/10] pc-bios/s390-ccw: always build network bootloader

In reply to Paolo Bonzini
Quoted 19 lines · Paolo Bonzini

In the beginning, the network bootloader was considered experimental and thus optional, but it is well established nowadays and configure always checks for roms/SLOF before compiling pc-bios/s390-ccw.

Therefore, it makes sense to always build it together with the other part of the s390-ccw bios.

---
  pc-bios/s390-ccw/Makefile | 5 -----
  1 file changed, 5 deletions(-)
pc-bios/s390-ccw/Makefile +0 -0
index 9c5276f8ade..2e8cc015aa0 100644
@@ -67,12 +67,7 @@ s390-ccw.img: s390-ccw.elf
 
  $(OBJECTS): Makefile

pc-bios/s390-ccw/Makefile s390-ccw.img: s390-ccw.elf · line 73

Quoted 10 lines
pc-bios/s390-ccw/Makefile +0 -5
 
-ifneq ($(wildcard $(SRC_PATH)/../../roms/SLOF/lib/libnet),)
  include $(SRC_PATH)/netboot.mak
-else
-s390-netboot.img:
-	@echo "s390-netboot.img not built since roms/SLOF/ is not available."
-endif
 
  ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
  -include $(ALL_OBJS:%.o=%.d)
#19 lore raw

Re: [PATCH 07/10] pc-bios/s390-ccw: always build network bootloader

In reply to Paolo Bonzini
Quoted 3 lines · Paolo Bonzini

In the beginning, the network bootloader was considered experimental and thus optional, but it is well established nowadays and configure always checks for roms/SLOF before compiling pc-bios/s390-ccw.

Only if run in a git repository, not in a tree generated with archive-source.sh which doesn't package roms/SLOF.
So without the check below the build fails.
This is not inteded, is it?

Quoted 26 lines

Therefore, it makes sense to always build it together with the other part of the s390-ccw bios.

---
 pc-bios/s390-ccw/Makefile | 5 -----
 1 file changed, 5 deletions(-)
pc-bios/s390-ccw/Makefile +0 -5
index 9c5276f8ade..2e8cc015aa0 100644
@@ -67,12 +67,7 @@ s390-ccw.img: s390-ccw.elf
 
 $(OBJECTS): Makefile
 
-ifneq ($(wildcard $(SRC_PATH)/../../roms/SLOF/lib/libnet),)
 include $(SRC_PATH)/netboot.mak
-else
-s390-netboot.img:
-	@echo "s390-netboot.img not built since roms/SLOF/ is not available."
-endif
 
 ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
 -include $(ALL_OBJS:%.o=%.d)
#20 lore raw

Re: [PATCH 07/10] pc-bios/s390-ccw: always build network bootloader

Quoted 9 lines · Nina Schoetterl-Glausch
Quoted 3 lines · Paolo Bonzini

In the beginning, the network bootloader was considered experimental and thus optional, but it is well established nowadays and configure always checks for roms/SLOF before compiling pc-bios/s390-ccw.

Only if run in a git repository, not in a tree generated with archive-source.sh which doesn't package roms/SLOF.
So without the check below the build fails.
This is not inteded, is it?

I guess archive-source.sh needs to be changed to include the SLOF sources now? Paolo, what would you recommend?

Thomas

#21 lore raw

Re: [PATCH 07/10] pc-bios/s390-ccw: always build network bootloader

Quoted 7 lines · Thomas Huth
Quoted 5 lines

Only if run in a git repository, not in a tree generated with archive-source.sh which doesn't package roms/SLOF.
So without the check below the build fails.
This is not inteded, is it?

I guess archive-source.sh needs to be changed to include the SLOF sources now? Paolo, what would you recommend?

It's not strictly necessary, I have sent a patch at https://patchew.org/QEMU/[email protected]/ and I'll have to send v2 based on Nina's comments.

Paolo

#22 lore raw

PATCH v2 8/10 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 a934c85e4e4..73cae4cd4da 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 de3904fb59d..4dad32938df 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 b99cb66e412..48996304910 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 0604e61b814..c5db87b3f91 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 935e9a72a8f..adca0266be6 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 00000000000..a8fd87740b1
@@ -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 00000000000..6ad80a37b2a
@@ -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 00000000000..868ae57e805
@@ -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 00000000000..868ae57e805
@@ -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
Reviewed-by on v2 8/10
#23 lore raw

Re: [PATCH 08/10] meson: subprojects: replace berkeley-{soft,test}float-3 with wraps

Quoted 28 lines · 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 +
Quoted 8 lines
 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

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 :|
#24 lore raw

PATCH v2 9/10 build: remove git submodule handling from main makefile

In reply to Paolo Bonzini

The only remaining user of submodules at build time is roms/SLOF, which is handled in pc-bios/s390-ccw/Makefile. Remove the relevant code from the main makefile.

---
 .gitlab-ci.d/buildtest-template.yml |  3 +--
 Makefile                            | 10 ----------
 configure                           |  7 -------
 meson.build                         |  1 -
 4 files changed, 1 insertion(+), 20 deletions(-)
.gitlab-ci.d/buildtest-template.yml +1 -2
index d01d504ec5f..76ff1dfcb6f 100644
@@ -42,8 +42,7 @@
   stage: test
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
   script:
-    - scripts/git-submodule.sh update
-        roms/SLOF $(sed -n '/GIT_SUBMODULES=/ s/.*=// p' build/config-host.mak)
+    - scripts/git-submodule.sh update roms/SLOF
     - meson subprojects download $(cd build/subprojects && echo *)
     - cd build
     - find . -type f -exec touch {} +
Makefile +0 -10
index d68196acb9e..b22bf6fba12 100644
@@ -45,16 +45,6 @@ include config-host.mak
 include Makefile.prereqs
 Makefile.prereqs: config-host.mak
 
-git-submodule-update:
-.git-submodule-status: git-submodule-update config-host.mak
-Makefile: .git-submodule-status
-
-.PHONY: git-submodule-update
-git-submodule-update:
-ifneq ($(GIT_SUBMODULES_ACTION),ignore)
-	$(quiet-@)GIT=git "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)
-endif
-
 # 0. ensure the build tree is okay
 
 # Check that we're not trying to do an out-of-tree build from
configure +0 -7
index 4dad32938df..bc0660f5a32 100755
@@ -253,7 +253,6 @@ else
     git_submodules_action="ignore"
 fi
 
-git_submodules=""
 git="git"
 debug_tcg="no"
 docs="auto"
@@ -1657,18 +1656,12 @@ fi
 #######################################
 # generate config-host.mak
 
-if ! (GIT=git "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
-    exit 1
-fi
-
 config_host_mak="config-host.mak"
 
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo >> $config_host_mak
 
 echo all: >> $config_host_mak
-echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
-echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
 
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
meson.build +0 -1
index badeeffd529..10df2eb1961 100644
@@ -4008,7 +4008,6 @@ endif
 summary_info += {'Doc directory':     get_option('prefix') / get_option('docdir')}
 summary_info += {'Build directory':   meson.current_build_dir()}
 summary_info += {'Source path':       meson.current_source_dir()}
-summary_info += {'GIT submodules':    config_host['GIT_SUBMODULES']}
 summary(summary_info, bool_yn: true, section: 'Directories')
 
 # Host binaries
Signature · 1 line
2.40.1
Reviewed-by on v2 9/10
#25 lore raw

Re: [PATCH 09/10] build: remove git submodule handling from main makefile

Quoted 11 lines · Paolo Bonzini

The only remaining user of submodules at build time is roms/SLOF, which is handled in pc-bios/s390-ccw/Makefile. Remove the relevant code from the main makefile.

---
 .gitlab-ci.d/buildtest-template.yml |  3 +--
 Makefile                            | 10 ----------
 configure                           |  7 -------
 meson.build                         |  1 -
 4 files changed, 1 insertion(+), 20 deletions(-)

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 :|
#26 lore raw

PATCH v2 10/10 configure: remove --with-git-submodules=

In reply to Paolo Bonzini

Reuse --enable/--disable-download to control git submodules as well. Adjust the error messages of git-submodule.sh to refer to the new option.

---
 configure                                     | 40 +++++--------------
 .../ci/org.centos/stream/8/x86_64/configure   |  1 -
 scripts/git-submodule.sh                      |  8 ++--
 3 files changed, 12 insertions(+), 37 deletions(-)
configure +9 -31
index bc0660f5a32..8765b88e12f 100755
@@ -246,13 +246,7 @@ for opt do
 done
 
 
-if test -e "$source_path/.git"
-then
-    git_submodules_action="update"
-else
-    git_submodules_action="ignore"
-fi
-
+git_submodules_action="update"
 git="git"
 debug_tcg="no"
 docs="auto"
@@ -738,12 +732,9 @@ for opt do
   ;;
   --disable-cfi) cfi="false"
   ;;
-  --with-git-submodules=*)
-      git_submodules_action="$optarg"
+  --disable-download) download="disabled"; git_submodules_action=validate;
   ;;
-  --disable-download) download="disabled"
-  ;;
-  --enable-download) download="enabled"
+  --enable-download) download="enabled"; git_submodules_action=update;
   ;;
   --enable-plugins) if test "$mingw32" = "yes"; then
                         error_exit "TCG plugins not currently supported on Windows platforms"
@@ -765,6 +756,11 @@ for opt do
   esac
 done
 
+if ! test -e "$source_path/.git"
+then
+    git_submodules_action="ignore"
+fi
+
 # test for any invalid configuration combinations
 if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
     error_exit "Can't enable plugins on non-TCG builds"
@@ -796,21 +792,6 @@ then
     exit 1
 fi
 
-case $git_submodules_action in
-    update|validate)
-        if test ! -e "$source_path/.git" || ! has git; then
-            echo "ERROR: cannot $git_submodules_action git submodules without .git"
-            exit 1
-        fi
-    ;;
-    ignore)
-    ;;
-    *)
-        echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
-        exit 1
-    ;;
-esac
-
 default_target_list=""
 mak_wilds=""
 
@@ -877,9 +858,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-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)
   --static                 enable static build [$static]
   --bindir=PATH            install binaries in PATH
   --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
@@ -1024,7 +1002,7 @@ fi
 # Consult white-list to determine whether to enable werror
 # by default.  Only enable by default for git builds
 if test -z "$werror" ; then
-    if test "$git_submodules_action" != "ignore" && \
+    if test -e "$source_path/.git" && \
         { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
         werror="yes"
     else
scripts/ci/org.centos/stream/8/x86_64/configure +0 -1
index de76510978f..d02b09a4b9b 100755
@@ -29,7 +29,6 @@
 --extra-cflags="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection" \
 --with-suffix="qemu-kvm" \
 --firmwarepath=/usr/share/qemu-firmware \
---with-git-submodules=update \
 --target-list="x86_64-softmmu" \
 --block-drv-rw-whitelist="qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,gluster" \
 --audio-drv-list="" \
scripts/git-submodule.sh +3 -5
index 38b55c90e11..11fad2137cd 100755
@@ -9,7 +9,7 @@ command=$1
 shift
 maybe_modules="$@"
 
-# if --with-git-submodules=ignore, do nothing
+# if not running in a git checkout, do nothing
 test "$command" = "ignore" && exit 0
 
 test -z "$GIT" && GIT=$(command -v git)
@@ -24,7 +24,7 @@ update_error() {
     echo "enable use of a transparent proxy), please disable automatic"
     echo "GIT submodule checkout with:"
     echo
-    echo " $ ./configure --with-git-submodules=validate"
+    echo " $ ./configure --disable-download"
     echo
     echo "and then manually update submodules prior to running make, with:"
     echo
@@ -39,9 +39,7 @@ validate_error() {
         echo "configured for validate only. Please run"
         echo "  scripts/git-submodule.sh update $maybe_modules"
         echo "from the source directory or call configure with"
-        echo "  --with-git-submodules=update"
-        echo "To disable GIT submodules validation, use"
-        echo "  --with-git-submodules=ignore"
+        echo "  --enable-download"
     fi
     exit 1
 }
Signature · 1 line
2.40.1
Reviewed-by on v2 10/10
#27 lore raw

Re: [PATCH 10/10] configure: remove --with-git-submodules=

Quoted 10 lines · Paolo Bonzini

Reuse --enable/--disable-download to control git submodules as well. Adjust the error messages of git-submodule.sh to refer to the new option.

---
 configure                                     | 40 +++++--------------
 .../ci/org.centos/stream/8/x86_64/configure   |  1 -
 scripts/git-submodule.sh                      |  8 ++--
 3 files changed, 12 insertions(+), 37 deletions(-)

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 :|
#28 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.

Pardon my lack of knowledge, but even after I clone new repo and run:

  ./configure --enable-donwload && make && make test

I still see berkeley-softfloat-3 submodule missing:

git submodule status
...
0c37a43527f0ee2b9584e7fb2fdc805e902635ac roms/vbootrom
fatal: no submodule mapping found in .gitmodules for path
'tests/fp/berkeley-softfloat-3'

Is this expected?

Michal

#29 lore raw
Quoted 10 lines · Michal Prívozník
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.

Pardon my lack of knowledge, but even after I clone new repo and run:

  ./configure --enable-donwload && make && make test

I still see berkeley-softfloat-3 submodule missing:

Quoted 7 lines

git submodule status
...
0c37a43527f0ee2b9584e7fb2fdc805e902635ac roms/vbootrom
fatal: no submodule mapping found in .gitmodules for path
'tests/fp/berkeley-softfloat-3'

Is this expected?

Yet another example of submodules sucking. Once we removed the submodules from .gitmodules, git doesn't know what to do with the existing chcked out submodules from before this time.

Best thing todo is purge all existing submodules, eg

  git submodule deinit --all --force

and if there are stale directories left over, manually delete those too, so you get back to a more pristine checkout state.

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 :|
#30 lore raw
Quoted 23 lines · Daniel P. Berrangé
Quoted 10 lines · Michal Prívozník
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.

Pardon my lack of knowledge, but even after I clone new repo and run:

  ./configure --enable-donwload && make && make test

I still see berkeley-softfloat-3 submodule missing:

Quoted 7 lines

git submodule status
...
0c37a43527f0ee2b9584e7fb2fdc805e902635ac roms/vbootrom
fatal: no submodule mapping found in .gitmodules for path
'tests/fp/berkeley-softfloat-3'

Is this expected?

Yet another example of submodules sucking. Once we removed the submodules from .gitmodules, git doesn't know what to do with the existing chcked out submodules from before this time.

Quoted 6 lines

Best thing todo is purge all existing submodules, eg

  git submodule deinit --all --force

and if there are stale directories left over, manually delete those too, so you get back to a more pristine checkout state.

I'm not sure that helps. I mean:

  git clone https://gitlab.com/qemu-project/qemu.git qemu2.git && \
  cd qemu2.git/ && \
  git submodule status

still complains:

fatal: no submodule mapping found in .gitmodules for path
'tests/fp/berkeley-softfloat-3'

Michal

#31 lore raw

No, Michal is correct. Patch "meson: subprojects: replace berkeley-{soft,test}float-3 with wraps" did not remove the submodules.

Paolo

Quoted 45 lines · Michal Prívozník
Quoted 23 lines · Daniel P. Berrangé
Quoted 10 lines · Michal Prívozník
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.

Pardon my lack of knowledge, but even after I clone new repo and run:

  ./configure --enable-donwload && make && make test

I still see berkeley-softfloat-3 submodule missing:

Quoted 7 lines

git submodule status
...
0c37a43527f0ee2b9584e7fb2fdc805e902635ac roms/vbootrom
fatal: no submodule mapping found in .gitmodules for path
'tests/fp/berkeley-softfloat-3'

Is this expected?

Yet another example of submodules sucking. Once we removed the submodules from .gitmodules, git doesn't know what to do with the existing chcked out submodules from before this time.

Quoted 6 lines

Best thing todo is purge all existing submodules, eg

  git submodule deinit --all --force

and if there are stale directories left over, manually delete those too, so you get back to a more pristine checkout state.

I'm not sure that helps. I mean:

  git clone https://gitlab.com/qemu-project/qemu.git qemu2.git && \
  cd qemu2.git/ && \
  git submodule status

still complains:

fatal: no submodule mapping found in .gitmodules for path
'tests/fp/berkeley-softfloat-3'

Michal