@@ -109,14 +109,8 @@ if(VCPKG_TARGET_IS_WINDOWS)
109109 set (${OUT_VAR} "${_p} " PARENT_SCOPE )
110110 endfunction ()
111111
112- # Assemble a private, content-addressed MSYS2 root: vcpkg's pinned msys shell
113- # utilities (plus findutils/perl for configure) and our pinned MinGW closure.
114- include ("${CMAKE_CURRENT_LIST_DIR } /../../vcpkg-port-utils/mingw/get-mingw-packages.cmake" )
115- multipass_get_mingw_packages (MINGW_DIRECT_PACKAGES MINGW_URLS MINGW_SHA512S )
116- vcpkg_acquire_msys (MSYS_ROOT
117- PACKAGES findutils perl
118- DIRECT_PACKAGES ${MINGW_DIRECT_PACKAGES}
119- )
112+ include ("${CMAKE_CURRENT_LIST_DIR } /../../vcpkg-port-utils/mingw/acquire-mingw-msys.cmake" )
113+ multipass_acquire_mingw_msys (MSYS_ROOT )
120114
121115 # Run the MSYS2 tools under an explicit MINGW64 environment (no login shell):
122116 # mingw64/bin and usr/bin on PATH, MSYSTEM selecting the MinGW64 personality.
@@ -139,37 +133,6 @@ if(VCPKG_TARGET_IS_WINDOWS)
139133 to_msys_path ("${BUILD_DIR} " BUILD_DIR_UNIX )
140134 to_msys_path ("${CURRENT_PACKAGES_DIR} " INSTALL_PREFIX_UNIX )
141135
142- # vcpkg_acquire_msys() extracts the full MinGW packages but then deletes
143- # every mingw64/lib/pkgconfig on *every* call (the removal sits outside its
144- # "assemble the root once" guard). qemu-img's meson build needs the glib/zstd
145- # .pc files, so we keep a private backup of them (harvested once, gated on the
146- # backup dir) and copy it back into the canonical mingw64/lib/pkgconfig on
147- # every run. The canonical location matters: pkgconf's --define-prefix (on by
148- # default) only rewrites each .pc's absolute `prefix=/mingw64` into the real
149- # Windows path when the file is found under a `.../lib/pkgconfig` layout, and
150- # native mingw gcc can't resolve the bare `/mingw64` POSIX paths otherwise.
151- set (PKGCONFIG_BACKUP "${MSYS_ROOT} /.multipass-qemu-pkgconfig" )
152- if (NOT EXISTS "${PKGCONFIG_BACKUP} " )
153- # Re-extract the pinned packages into a scratch dir and copy out their
154- # .pc files (the headers/libs acquire already installed are untouched).
155- set (_harvest "${CURRENT_BUILDTREES_DIR} /pkgconfig-harvest" )
156- file (REMOVE_RECURSE "${_harvest} " )
157- list (LENGTH MINGW_URLS _mingw_count)
158- math (EXPR _mingw_last "${_mingw_count} - 1" )
159- foreach (_i RANGE ${_mingw_last} )
160- list (GET MINGW_URLS ${_i} _url)
161- list (GET MINGW_SHA512S ${_i} _sha)
162- get_filename_component (_fn "${_url} " NAME )
163- vcpkg_download_distfile (_archive URLS "${_url} " FILENAME "${_fn} " SHA512 "${_sha} " QUIET )
164- file (ARCHIVE_EXTRACT INPUT "${_archive} " DESTINATION "${_harvest} " )
165- endforeach ()
166- file (GLOB _pc_files "${_harvest} /mingw64/lib/pkgconfig/*.pc" )
167- file (COPY ${_pc_files} DESTINATION "${PKGCONFIG_BACKUP} " )
168- file (REMOVE_RECURSE "${_harvest} " )
169- endif ()
170- file (GLOB _pc_backup "${PKGCONFIG_BACKUP} /*.pc" )
171- file (COPY ${_pc_backup} DESTINATION "${MSYS_ROOT} /mingw64/lib/pkgconfig" )
172-
173136 # meson build deps: distlib + QEMU's vendored meson wheel. site-packages
174137 # survives acquire's deletions, so this is a genuine one-time step.
175138 set (PYTHON_STAMP "${MSYS_ROOT} /.multipass-qemu-python-ready" )
@@ -182,7 +145,7 @@ if(VCPKG_TARGET_IS_WINDOWS)
182145 # skips the system emulator, --disable-docs avoids the sphinx dependency, and
183146 # pixman/zstd are pinned off/on so features don't depend on autodetection.
184147 # PKG_CONFIG_PATH/LIBDIR are cleared so pkgconf falls back to its default
185- # search (the canonical mingw64/lib/pkgconfig we restore above ), which is what
148+ # search (the canonical mingw64/lib/pkgconfig restored by the helper ), which is what
186149 # triggers --define-prefix to emit real Windows include/lib paths. --prefix is
187150 # required (meson validates it) though we never install; the binary is copied
188151 # straight from the build tree.
0 commit comments