Skip to content

Commit 6fa128f

Browse files
authored
[msys2 scripts] Update, adapt to cygwin MACHTYPE (microsoft#45839)
1 parent f2d75c9 commit 6fa128f

File tree

14 files changed

+256
-178
lines changed

14 files changed

+256
-178
lines changed

ports/vcpkg-make/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vcpkg-make",
3-
"version-date": "2025-05-22",
3+
"version-date": "2025-06-10",
44
"documentation": "https://learn.microsoft.com/vcpkg/maintainers/functions/vcpkg_make_configure",
55
"license": null,
66
"supports": "native",

ports/vcpkg-make/wrappers/cl_cpp_wrapper

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#!/usr/bin/bash
2+
23
# cl_cpp_wrapper
3-
# Wrapper around MS's cl.exe to make it act more like Unix cpp
4+
# Wrapper around MS's cl.exe to make it act more like Unix cpp,
5+
# in particular process stdin
46

57
PATH="$PATH:/usr/bin"
68

7-
case $MACHTYPE in
8-
*-msys)
9+
msys2_dll="$(test -f /usr/bin/msys-2.0.dll && echo yes)"
10+
11+
case $msys2_dll,$MACHTYPE in
12+
*-msys | yes,*-cygwin)
913
slash="-"
1014
;;
1115
*)

scripts/buildsystems/make_wrapper/cl_cpp_wrapper

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#!/usr/bin/bash
2+
23
# cl_cpp_wrapper
3-
# Wrapper around MS's cl.exe to make it act more like Unix cpp
4+
# Wrapper around MS's cl.exe to make it act more like Unix cpp,
5+
# in particular process stdin
46

57
PATH="$PATH:/usr/bin"
68

7-
case $MACHTYPE in
8-
*-msys)
9+
msys2_dll="$(test -f /usr/bin/msys-2.0.dll && echo yes)"
10+
11+
case $msys2_dll,$MACHTYPE in
12+
*-msys | yes,*-cygwin)
913
slash="-"
1014
;;
1115
*)
@@ -84,21 +88,12 @@ fi
8488

8589
input_file="${file:-/proc/self/fd/0}"
8690
if [ "$input_file" == "/proc/self/fd/0" ]; then
87-
#echo "STDIN"
8891
# CL does not support reading from STDIN so it is wrapped here.
8992
tmpout=cpp_wrapper_$RANDOM.h
9093
/usr/bin/cp $input_file $tmpout
91-
# from https://stackoverflow.com/questions/36313562/how-to-redirect-stdin-to-file-in-bash
92-
#exec 3> cppstdtmp.h
93-
#while IFS= read -r line; do
94-
# printf '%s' "$line"
95-
#done
96-
#exec 3<&-
97-
#echo "$(</dev/stdin)" > cppstdtmp.h
9894
exec $prog ${cppopt[@]} $tmpout
9995
rm -f $tmpout
10096
else
101-
#echo "FILE"
10297
exec $prog ${cppopt[@]} $input_file
10398
fi
10499

scripts/cmake/vcpkg_acquire_msys.cmake

Lines changed: 101 additions & 105 deletions
Large diffs are not rendered by default.

scripts/cmake/vcpkg_find_acquire_program(PKGCONFIG).cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
macro(z_vcpkg_find_acquire_pkgconfig_msys_declare_packages)
22
z_vcpkg_acquire_msys_declare_package(
3-
URL "https://mirror.msys2.org/mingw/clangarm64/mingw-w64-clang-aarch64-pkgconf-1~2.3.0-1-any.pkg.tar.zst"
4-
SHA512 b93698fc282f39715804cebeb624608584a0ef0755a6a4e321c4f0571586e91a39b3af580441f4895f5f524db151831a1eb6e06eb4de83f43a0db7b0c218bab0
3+
URL "https://mirror.msys2.org/mingw/clangarm64/mingw-w64-clang-aarch64-pkgconf-1~2.4.3-1-any.pkg.tar.zst"
4+
SHA512 c2bb144b71bab8d1461c1c56b3b8d0cfe47ff7afd6757cfb5b7d0e887bfa7a9d0e95789da13169f5981a8d555aa4b0a7e2acc841c5a6b06763073f74966f4239
55
PROVIDES mingw-w64-clang-aarch64-pkg-config
66
)
77
z_vcpkg_acquire_msys_declare_package(
8-
URL "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~2.3.0-1-any.pkg.tar.zst"
9-
SHA512 5373f050060678166968e09a4dd8ad30324c5dc37842c3517ebc9eb7be7e09d37d2873ff9dc4831c283556b68a0776f06fa6f91d799020b04282b4a3f378a2c4
8+
URL "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~2.4.3-1-any.pkg.tar.zst"
9+
SHA512 bd7986cdf104a6e21abc27f270716cf7f93152fdb92733b23dfa0e44465b3e739e9c90a4934419198f856887f1cfe20ba1ef52478b84ea9e795f44e699475e11
1010
PROVIDES mingw-w64-x86_64-pkg-config
1111
)
1212
z_vcpkg_acquire_msys_declare_package(
13-
URL "https://mirror.msys2.org/mingw/mingw32/mingw-w64-i686-pkgconf-1~2.3.0-1-any.pkg.tar.zst"
14-
SHA512 8fc9e91dcc78a05e8d836352e91d424e7466eaacbf961fd781ff6d84aab059308942dad024e19ecfe600175241ebfb81bd4813352c3f7547d8c9bfccec962dab
13+
URL "https://mirror.msys2.org/mingw/mingw32/mingw-w64-i686-pkgconf-1~2.4.3-1-any.pkg.tar.zst"
14+
SHA512 22b3f5b2b25628713cae722e351f105f7670bc8364e41fd3bf68d8c86866c273215f2c31d467657ccf0e106eedd7c207ff474173f0eaeba5f2d7130ce6a0d3db
1515
PROVIDES mingw-w64-i686-pkg-config
1616
)
1717
endmacro()

scripts/cmake/vcpkg_find_fortran.cmake

Lines changed: 47 additions & 50 deletions
Large diffs are not rendered by default.

scripts/test_ports/vcpkg-ci-vcpkg-make/portfile.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
22
include("${CURRENT_HOST_INSTALLED_DIR}/share/unit-test-cmake/test-macros.cmake")
33

4+
if("scripts-cl-cpp-wrapper" IN_LIST FEATURES)
5+
include("${CMAKE_CURRENT_LIST_DIR}/test-scripts-cl_cpp_wrapper.cmake")
6+
endif()
7+
8+
if("vcpkg-make-cl-cpp-wrapper" IN_LIST FEATURES)
9+
include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg-make-cl_cpp_wrapper.cmake")
10+
endif()
11+
412
if("z-vcpkg-make-prepare-compile-flags" IN_LIST FEATURES)
513
include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_prepare_compile_flags.cmake")
614
endif()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
echo "${CPP:-cpp} ${CPPFLAGS} ${CFLAGS} ${TEST_FLAGS} >> stdout.c < source.c"
4+
${CPP:-cpp} ${CPPFLAGS} ${CFLAGS} ${TEST_FLAGS} >> stdout.c < source.c
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#ifdef EXPECT_SUCCESS
2+
/* okay */
3+
#else
4+
#error "Forced error"
5+
#endif
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
block()
2+
set(SOURCE_PATH "${CURRENT_PORT_DIR}/test-cl_cpp_wrapper")
3+
set(VCPKG_BUILD_TYPE release)
4+
5+
vcpkg_backup_env_variables(VARS CPP TEST_FLAGS)
6+
7+
# Test that that CPP processes stdin
8+
# vcpkg_configure_make picks scripts/buildsystems/make_wrapper/cl_cpp_wrapper
9+
10+
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
11+
set(ENV{CPP} "cl_cpp_wrapper")
12+
endif()
13+
14+
unit_test_ensure_fatal_error([[
15+
set(ENV{TEST_FLAGS} -DEXPECT_FAILURE)
16+
vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE USE_WRAPPERS)
17+
]])
18+
19+
unit_test_ensure_success([[
20+
set(ENV{TEST_FLAGS} -DEXPECT_SUCCESS)
21+
vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE USE_WRAPPERS)
22+
]])
23+
24+
vcpkg_restore_env_variables(VARS CPP TEST_FLAGS)
25+
endblock()

0 commit comments

Comments
 (0)