diff --git a/eng/pipelines/templates/steps/ci.test.yml b/eng/pipelines/templates/steps/ci.test.yml index b415e1f567..d6d9a67f7e 100644 --- a/eng/pipelines/templates/steps/ci.test.yml +++ b/eng/pipelines/templates/steps/ci.test.yml @@ -103,7 +103,9 @@ steps: # Validate all the files are saved as ASCII only without a UTF-8 BOM. - bash: | # Run grep recursive excluding git folder and known expected files and save a file with results. - grep -I -P -n "[^\x00-\x7F]" -r --exclude-dir ".git" --exclude-dir "vcpkg_installed" --exclude-dir "_deps" --exclude-dir "docs" --exclude-dir "eng" --exclude-dir "tools" --exclude "*CodeCoverage.cmake*" --exclude "grepResults" . > grepResults + # ".github" holds repo tooling/skill markdown (not shippable SDK source) which intentionally + # contains non-ASCII characters (e.g. em dashes); exclude it like eng/docs/tools. + grep -I -P -n "[^\x00-\x7F]" -r --exclude-dir ".git" --exclude-dir ".github" --exclude-dir "vcpkg_installed" --exclude-dir "_deps" --exclude-dir "docs" --exclude-dir "eng" --exclude-dir "tools" --exclude "*CodeCoverage.cmake*" --exclude "grepResults" . > grepResults # Display results to console. cat grepResults diff --git a/eng/vcpkg-overlay-ports/cmocka/portfile.cmake b/eng/vcpkg-overlay-ports/cmocka/portfile.cmake new file mode 100644 index 0000000000..2f35513d0b --- /dev/null +++ b/eng/vcpkg-overlay-ports/cmocka/portfile.cmake @@ -0,0 +1,48 @@ +# Overlay port: cmocka +# +# Why this overlay exists: +# The upstream vcpkg `cmocka` port downloads the source from gitlab.com via +# `vcpkg_from_gitlab(...)`. 1ES build agents permanently block gitlab.com, so the +# download fails hard with `curl error code 7 (Couldn't connect to server)` and the +# Linux unit-test job cannot build. See Azure/azure-sdk-for-c#3464. +# +# What this overlay changes: +# It sources the *same* cmocka release (2.0.2) from the project's official file +# server (https://cmocka.org/files) instead of gitlab.com. The SHA512 below was +# computed from https://cmocka.org/files/2.0/cmocka-2.0.2.tar.xz. Every other build +# step is identical to the upstream port. +# +# Scope / lifetime: +# This is a SHORT-TERM unblock. cmocka.org is itself slated to be denied on build +# agents, so the durable fix is vcpkg + Terrapin (an approved download mirror / +# asset cache) configured at the pipeline level. Remove this overlay once Terrapin +# (or an equivalent approved asset source) is in place. See #3464 for details. + +vcpkg_download_distfile(ARCHIVE + URLS "https://cmocka.org/files/2.0/cmocka-${VERSION}.tar.xz" + FILENAME "cmocka-${VERSION}.tar.xz" + SHA512 d02d65f0881f18f30b9e46c325acfa349261339daa2c1bf3a4e6360976f13b31588e997415197220f6def156f77d9864994d4e3cfd09c8f16a8594d0a4789a16 +) + +vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${ARCHIVE}" +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DUNIT_TESTING=OFF + -DWITH_EXAMPLES=OFF + -DPICKY_DEVELOPER=OFF +) + +vcpkg_cmake_install() + +vcpkg_copy_pdbs() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}) +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/eng/vcpkg-overlay-ports/cmocka/vcpkg.json b/eng/vcpkg-overlay-ports/cmocka/vcpkg.json new file mode 100644 index 0000000000..74bfcded9b --- /dev/null +++ b/eng/vcpkg-overlay-ports/cmocka/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "cmocka", + "version": "2.0.2", + "description": "An elegant unit testing framework for C with support for mock objects", + "homepage": "https://cmocka.org", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/eng/vcpkg-overlay-ports/libuuid/CMakeLists.txt b/eng/vcpkg-overlay-ports/libuuid/CMakeLists.txt new file mode 100644 index 0000000000..50827ae79a --- /dev/null +++ b/eng/vcpkg-overlay-ports/libuuid/CMakeLists.txt @@ -0,0 +1,64 @@ +cmake_minimum_required(VERSION 3.21) +project(libuuid C) + +configure_file(config.linux.h config.h COPYONLY) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_library(uuid STATIC + clear.c + compare.c + copy.c + gen_uuid.c + isnull.c + pack.c + parse.c + randutils.c + unpack.c + unparse.c + uuid_time.c +) +target_compile_options(uuid PRIVATE -include "${CMAKE_CURRENT_BINARY_DIR}/config.h") +target_include_directories(uuid PUBLIC "$") + +add_executable(test_uuid test_uuid.c) +target_link_libraries(test_uuid uuid) + +if(CMAKE_BUILD_TYPE STREQUAL "Release") + install(FILES uuid.h DESTINATION include/uuid) +endif() + +install( + TARGETS uuid + EXPORT uuid_targets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +include(CMakePackageConfigHelpers) +set(PACKAGE_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libuuid-config.cmake") +set(INSTALL_CONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/unofficial-libuuid") + +configure_package_config_file(unofficial-libuuid-config.cmake.in + "${PACKAGE_CONFIG_FILE}" + INSTALL_DESTINATION "${INSTALL_CONFIG_DIR}" +) + +export(EXPORT uuid_targets + NAMESPACE unofficial::UUID:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libuuid-targets.cmake" +) + +install(EXPORT uuid_targets + NAMESPACE unofficial::UUID:: + FILE unofficial-libuuid-targets.cmake + DESTINATION "${INSTALL_CONFIG_DIR}" +) + +install( + FILES + "${PACKAGE_CONFIG_FILE}" + DESTINATION + "${INSTALL_CONFIG_DIR}" +) diff --git a/eng/vcpkg-overlay-ports/libuuid/config.linux.h b/eng/vcpkg-overlay-ports/libuuid/config.linux.h new file mode 100644 index 0000000000..38b53cac1c --- /dev/null +++ b/eng/vcpkg-overlay-ports/libuuid/config.linux.h @@ -0,0 +1,13 @@ +#define HAVE_DECL__SC_HOST_NAME_MAX 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_SRANDOM 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_SYS_FILE_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_USLEEP 1 +#define PACKAGE_STRING "libuuid 1.0.3" diff --git a/eng/vcpkg-overlay-ports/libuuid/portfile.cmake b/eng/vcpkg-overlay-ports/libuuid/portfile.cmake new file mode 100644 index 0000000000..d77cba7f5d --- /dev/null +++ b/eng/vcpkg-overlay-ports/libuuid/portfile.cmake @@ -0,0 +1,65 @@ +# Overlay port: libuuid +# +# Why this overlay exists: +# The upstream vcpkg `libuuid` port downloads the source from SourceForge via +# `vcpkg_from_sourceforge(...)`. 1ES build agents permanently block sourceforge.net +# (every mirror returns `curl error code 7 (Couldn't connect to server)`), so any +# Linux job that builds libuuid fails. libuuid is a transitive dependency of both +# `paho-mqtt` and `curl`, which the root vcpkg.json manifest installs on every +# Linux job. See Azure/azure-sdk-for-c#3464 (same class as the cmocka/gitlab block). +# +# What this overlay changes: +# It sources the *same* libuuid release (1.0.3) from the MacPorts distfiles mirror +# instead of SourceForge. The SHA512 below is unchanged from the upstream port and +# was re-verified against +# https://distfiles.macports.org/libuuid/libuuid-1.0.3.tar.gz (identical bytes). +# Every other build step is identical to the upstream port. +# +# Scope / lifetime: +# This is a SHORT-TERM unblock. The durable fix is vcpkg + Terrapin (an approved +# download mirror / asset cache) configured at the pipeline level, which removes the +# need for any blocked-origin download. Remove this overlay once that is in place. + +set(LIBUUID_VERSION 1.0.3) + +vcpkg_download_distfile(ARCHIVE + URLS "https://distfiles.macports.org/libuuid/libuuid-${LIBUUID_VERSION}.tar.gz" + FILENAME "libuuid-${LIBUUID_VERSION}.tar.gz" + SHA512 77488caccc66503f6f2ded7bdfc4d3bc2c20b24a8dc95b2051633c695e99ec27876ffbafe38269b939826e1fdb06eea328f07b796c9e0aaca12331a787175507 +) + +vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${ARCHIVE}" +) + +file(COPY + "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" + "${CMAKE_CURRENT_LIST_DIR}/config.linux.h" + "${CMAKE_CURRENT_LIST_DIR}/unofficial-libuuid-config.cmake.in" + DESTINATION "${SOURCE_PATH}" +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + +set(prefix "${CURRENT_INSTALLED_DIR}") +set(exec_prefix \$\{prefix\}) +set(libdir \$\{exec_prefix\}/lib) +set(includedir \$\{prefix\}/include) +configure_file("${SOURCE_PATH}/uuid.pc.in" "${SOURCE_PATH}/uuid.pc" @ONLY) +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(INSTALL "${SOURCE_PATH}/uuid.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") +endif() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(INSTALL "${SOURCE_PATH}/uuid.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") +endif() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/unofficial-libuuid PACKAGE_NAME unofficial-libuuid) +vcpkg_fixup_pkgconfig() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") + +vcpkg_copy_pdbs() diff --git a/eng/vcpkg-overlay-ports/libuuid/unofficial-libuuid-config.cmake.in b/eng/vcpkg-overlay-ports/libuuid/unofficial-libuuid-config.cmake.in new file mode 100644 index 0000000000..19123d9470 --- /dev/null +++ b/eng/vcpkg-overlay-ports/libuuid/unofficial-libuuid-config.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-libuuid-targets.cmake") diff --git a/eng/vcpkg-overlay-ports/libuuid/vcpkg.json b/eng/vcpkg-overlay-ports/libuuid/vcpkg.json new file mode 100644 index 0000000000..4cefc114b9 --- /dev/null +++ b/eng/vcpkg-overlay-ports/libuuid/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "libuuid", + "version": "1.0.3", + "port-version": 16, + "description": "Universally unique id library", + "homepage": "https://sourceforge.net/projects/libuuid/", + "license": "BSD-3-Clause", + "supports": "!osx & !windows", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000000..1924602513 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", + "overlay-ports": [ + "./eng/vcpkg-overlay-ports" + ] +}