Skip to content

Commit

Permalink
Patch Tuesday for December 2024 (#42749)
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal authored Dec 21, 2024
1 parent 4fcf123 commit f06267d
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 146 deletions.
53 changes: 53 additions & 0 deletions ports/ryu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.30)
project(ryu LANGUAGES C)

add_library(ryu
"ryu/f2s.c"
"ryu/d2s.c"
"ryu/d2s.h"
"ryu/d2s_full_table.h"
"ryu/d2s_intrinsics.h"
"ryu/digit_table.h"
"ryu/common.h"
"ryu/ryu.h"
)

target_include_directories(ryu PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

add_library(ryu_printf
"ryu/d2fixed.c"
"ryu/d2s_intrinsics.h"
"ryu/d2fixed_full_table.h"
"ryu/digit_table.h"
"ryu/common.h"
"ryu/ryu2.h"
)

target_include_directories(ryu_printf PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

if(NOT "${CMAKE_STATIC_LIBRARY_SUFFIX}" STREQUAL ".lib")
set_target_properties(ryu PROPERTIES OUTPUT_NAME "libryu")
set_target_properties(ryu_printf PROPERTIES OUTPUT_NAME "libryu_printf")
endif()

if(INSTALL_HEADERS)
install(FILES "ryu/ryu.h" "ryu/ryu2.h" DESTINATION "include/ryu")
endif()

install(TARGETS ryu ryu_printf EXPORT ryuTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(EXPORT ryuTargets
FILE ryuConfig.cmake
NAMESPACE RYU::
DESTINATION share/ryu
)
115 changes: 15 additions & 100 deletions ports/ryu/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,107 +1,22 @@
function(bazel_build build_type)
set(c_flags "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
set(linker_flags "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}")
set(log_suffix "rel")
if (${build_type} STREQUAL "debug")
set(c_flags "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
set(linker_flags "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
set(log_suffix "dbg")
set(destination_modifier "/debug")
endif ()

separate_arguments(conly_opts NATIVE_COMMAND "${c_flags}")
separate_arguments(link_opts NATIVE_COMMAND "${linker_flags}")

if (DEFINED ENV{CC})
list(JOIN conly_opts ":" joined_opts)
set(ENV{BAZEL_CXXOPTS} "${joined_opts}")
list(JOIN link_opts ":" joined_opts)
set(ENV{BAZEL_LINKOPTS} "${joined_opts}")
endif ()

list(TRANSFORM conly_opts PREPEND "--conlyopt=")
list(TRANSFORM link_opts PREPEND "--linkopt=")

vcpkg_execute_build_process(
COMMAND "${BAZEL}" --batch ${BAZEL_OUTPUT} build ${BAZEL_COMPILER} ${BAZEL_CPU} ${conly_opts} ${link_opts} --verbose_failures --strategy=CppCompile=standalone //ryu //ryu:ryu_printf
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "build-${TARGET_TRIPLET}-${log_suffix}"
)

if ("${CMAKE_STATIC_LIBRARY_SUFFIX}" STREQUAL ".lib")
file(INSTALL "${SOURCE_PATH}/bazel-bin/ryu/ryu.lib" DESTINATION "${CURRENT_PACKAGES_DIR}${destination_modifier}/lib")
file(INSTALL "${SOURCE_PATH}/bazel-bin/ryu/ryu_printf.lib" DESTINATION "${CURRENT_PACKAGES_DIR}${destination_modifier}/lib")
else ()
file(INSTALL "${SOURCE_PATH}/bazel-bin/ryu/libryu.a" DESTINATION "${CURRENT_PACKAGES_DIR}${destination_modifier}/lib")
file(INSTALL "${SOURCE_PATH}/bazel-bin/ryu/libryu_printf.a" DESTINATION "${CURRENT_PACKAGES_DIR}${destination_modifier}/lib")
endif ()
endfunction()
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ulfjack/ryu
REF v2.0
SHA512 88a0cca74a4889e8e579987abdc75a6ac87c1cdae557e5a15c29dbfd65733f9e591d6569e97a9374444918475099087f8056e696a97c9be24e38eb737e2304c2
HEAD_REF master
OUT_SOURCE_PATH SOURCE_PATH
REPO ulfjack/ryu
REF v2.0
SHA512 88a0cca74a4889e8e579987abdc75a6ac87c1cdae557e5a15c29dbfd65733f9e591d6569e97a9374444918475099087f8056e696a97c9be24e38eb737e2304c2
HEAD_REF master
)

find_program(BAZEL bazel PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools" REQUIRED)
get_filename_component(BAZEL_DIR "${BAZEL}" DIRECTORY)
vcpkg_add_to_path(PREPEND "${BAZEL_DIR}")
set(ENV{BAZEL_BIN_PATH} "${BAZEL}")

vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
if (VCPKG_HOST_IS_WINDOWS)
if (VCPKG_DETECTED_MSVC)
set(ENV{BAZEL_VC} "$ENV{VCInstallDir}")
elseif (VCPKG_TARGET_IS_MINGW)
if (NOT "${VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
message(FATAL_ERROR "${TARGET_TRIPLET} is not supported on Windows!")
endif ()
set(BAZEL_COMPILER "--compiler=mingw-gcc")
# BAZEL_SH can be propagated to the build environment using VCPKG_KEEP_ENV_VARS
if (NOT DEFINED ENV{BAZEL_SH})
message("BAZEL_SH is not specified, trying to guess...")
get_filename_component(DIR "${VCPKG_DETECTED_CMAKE_C_COMPILER}" DIRECTORY)
# Bazel expects Mingw-w64 to be installed in MSYS2 (pacman -S mingw-w64-x86_64-toolchain).
# From BAZEL_SH it finds MSYS2 root, adds "mingw64" to the root and uses this path as the location of Mingw-w64.
# It is also possible to use non-MSYS2 binaries with Bazel if they are installed to a directory
# whose name ends with "mingw64", such as c:\mingw64 or c:\TDM-GCC-64\mingw64.
string(REGEX REPLACE /mingw64/bin$ "" MSYS2_ROOT "${DIR}")
set(ENV{BAZEL_SH} "${MSYS2_ROOT}/usr/bin/bash.exe")
message("BAZEL_SH $ENV{BAZEL_SH}")
endif ()
else ()
message(FATAL_ERROR "${TARGET_TRIPLET} is not supported!")
endif ()
if ("${VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
set(BAZEL_CPU "--cpu=x64_x86_windows")
elseif ("${VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR "${VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(BAZEL_CPU "--cpu=x64_windows")
elseif ("${VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ARM")
set(BAZEL_CPU "--cpu=x64_arm_windows")
elseif ("${VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ARM64")
set(BAZEL_CPU "--cpu=arm64_windows")
else ()
message(FATAL_ERROR "${TARGET_TRIPLET} is not supported!")
endif ()
else ()
if (NOT DEFINED ENV{USER})
set(ENV{USER} "root")
set(BAZEL_OUTPUT "--output_user_root=/tmp/bazel")
endif ()
set(ENV{BAZEL_USE_CPP_ONLY_TOOLCHAIN} "1")
set(ENV{CC} "${VCPKG_DETECTED_CMAKE_C_COMPILER}")
endif ()
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

bazel_build("release")
if (NOT VCPKG_BUILD_TYPE)
bazel_build("debug")
endif ()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_RELEASE
-DINSTALL_HEADERS=ON
)

file(INSTALL "${SOURCE_PATH}/LICENSE-Boost" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${SOURCE_PATH}/ryu/ryu.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/ryu")
file(INSTALL "${SOURCE_PATH}/ryu/ryu2.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/ryu")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/ryuConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE-Apache2" "${SOURCE_PATH}/LICENSE-Boost")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
26 changes: 0 additions & 26 deletions ports/ryu/ryuConfig.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion ports/ryu/usage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The package ryu provides CMake targets:

find_package(ryu CONFIG REQUIRED)
target_link_libraries(main PRIVATE RYU::ryu)
target_link_libraries(main PRIVATE RYU::ryu RYU::ryu_printf)
7 changes: 4 additions & 3 deletions ports/ryu/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "ryu",
"version": "2.0",
"port-version": 9,
"port-version": 10,
"description": "Ryu generates the shortest decimal representation of a floating point number that maintains round-trip safety.",
"homepage": "https://github.com/ulfjack/ryu",
"license": "Apache-2.0 OR BSL-1.0",
"dependencies": [
{
"name": "vcpkg-cmake-get-vars",
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-tool-bazel",
"name": "vcpkg-cmake-config",
"host": true
}
]
Expand Down
6 changes: 3 additions & 3 deletions scripts/azure-pipelines/android/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# syntax=docker/dockerfile:1.4
# DisableDockerDetector "Used to build the container deployed to Azure Container Registry"
FROM ubuntu:noble-20241011
FROM ubuntu:noble-20241118.1

ADD https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb /packages-microsoft-prod.deb
ADD https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb /packages-microsoft-prod.deb
ADD https://dl.google.com/android/repository/android-ndk-r27c-linux.zip /android-ndk-r27c-linux.zip

# Add apt packages
Expand All @@ -13,7 +13,7 @@ ENV APT_PACKAGES="git curl zip unzip tar"
## Common build prereqs
ENV APT_PACKAGES="$APT_PACKAGES g++ vim pkg-config cmake ca-certificates"

ENV APT_PACKAGES="$APT_PACKAGES autoconf nasm bison python2 flex build-essential libtool libtool-bin libltdl-dev gettext automake autoconf-archive"
ENV APT_PACKAGES="$APT_PACKAGES autoconf nasm bison flex build-essential libtool libtool-bin libltdl-dev gettext automake autoconf-archive"

## Python related
ENV APT_PACKAGES="$APT_PACKAGES python3-setuptools python3-pip python3-venv python3-mako python3-jinja2"
Expand Down
10 changes: 5 additions & 5 deletions scripts/azure-pipelines/android/create-docker-image.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Create Docker image for Android

$Date = (Get-Date -Format 'yyyy-MM-dd')
$ResourceGroupName = "PrAnd-1ES"
$ResourceGroupName = "PrAnd-WUS"
$ContainerRegistryName = "vcpkgandroidwus"
$ErrorActionPreference = 'Stop'

Expand All @@ -14,15 +14,15 @@ try {
docker builder prune -f --filter "until=24h"

docker build . -t $imageName

$remote = [string]::Format('{0}.azurecr.io/{1}:{2}', $ContainerRegistryName, $imageName, $Date)
docker tag $imageName $remote

docker push $remote

#removes from local environment
docker rmi --force $remote $imageName

# pulls and runs ...
docker logout
} finally {
Expand Down
2 changes: 1 addition & 1 deletion scripts/azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: MIT
#
variables:
linux-docker-image: 'vcpkgandroidwus.azurecr.io/vcpkg-android:2024-10-21'
linux-docker-image: 'vcpkgandroidwus.azurecr.io/vcpkg-android:2024-12-16'

parameters:
- name: vcpkgToolSha
Expand Down
2 changes: 1 addition & 1 deletion scripts/azure-pipelines/windows/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
condition: and(succeeded(), contains('^${{ replace(parameters.jobName, '_', '-') }}$', '${{ parameters.tripletPattern }}'))
pool:
name: PrWin-WUS
demands: ImageVersionOverride -equals 2024.11.18
demands: ImageVersionOverride -equals 2024.12.16
workspace:
clean: resources
timeoutInMinutes: 2880 # 2 days
Expand Down
4 changes: 2 additions & 2 deletions scripts/azure-pipelines/windows/deploy-azure-cli.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ if (Test-Path "$PSScriptRoot/utility-prefix.ps1") {
[string]$AzCliUrl
if ([string]::IsNullOrEmpty($SasToken)) {
Write-Host 'Downloading from the Internet'
$AzCliUrl = 'https://azcliprod.blob.core.windows.net/msi/azure-cli-2.66.0-x64.msi'
$AzCliUrl = 'https://azcliprod.blob.core.windows.net/msi/azure-cli-2.67.0-x64.msi'
} else {
Write-Host 'Downloading from vcpkgimageminting using SAS token'
$SasToken = $SasToken.Replace('"', '')
$AzCliUrl = "https://vcpkgimageminting.blob.core.windows.net/assets/azure-cli-2.66.0-x64.msi?$SasToken"
$AzCliUrl = "https://vcpkgimageminting.blob.core.windows.net/assets/azure-cli-2.67.0-x64.msi?$SasToken"
}

DownloadAndInstall -Url $AzCliUrl -Name 'Azure CLI' -Args @('/quiet', '/norestart')
6 changes: 3 additions & 3 deletions scripts/azure-pipelines/windows/deploy-visual-studio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ if (Test-Path "$PSScriptRoot/utility-prefix.ps1") {
. "$PSScriptRoot/utility-prefix.ps1"
}

# See https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history
# 17.11.6
$VisualStudioBootstrapperUrl = 'https://download.visualstudio.microsoft.com/download/pr/1affe83d-fcd4-41b0-bb9b-d62f64a857c4/1f0413df169150ed2475e7fbb5aa9e4105533a5b3f717c2dcc589203ac84f899/vs_Enterprise.exe'
# See https://learn.microsoft.com/visualstudio/releases/2022/release-history
# 17.12.3
$VisualStudioBootstrapperUrl = 'https://download.visualstudio.microsoft.com/download/pr/f2819554-a618-400d-bced-774bb5379965/6dec611eac2a146142b25497888f6b518069eeeb9f5ac32ce29ad5bebd753a64/vs_Enterprise.exe'
$Workloads = @(
'Microsoft.VisualStudio.Workload.NativeDesktop',
'Microsoft.VisualStudio.Workload.Universal',
Expand Down
9 changes: 9 additions & 0 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,15 @@ rtmidi:arm-neon-android=fail
rtmidi:arm64-android=fail
rtmidi:x64-android=fail
salome-medcoupling:x64-linux=fail
# Visual Studio 17.12 compiler bug, fixed in 17.13: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2242053
saucer:arm64-windows-static-md=fail
saucer:arm64-windows-static-md=fail
saucer:arm64-windows=fail
saucer:arm64-windows=fail
saucer:x64-windows-static-md=fail
saucer:x64-windows-static=fail
saucer:x64-windows=fail
saucer:x86-windows=fail
scintilla:arm-neon-android=fail
scintilla:arm64-android=fail
scintilla:x64-android=fail
Expand Down
6 changes: 6 additions & 0 deletions scripts/test_ports/vcpkg-ci-ryu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.30)
project(vcpkg-ci-ryu LANGUAGES C)
find_package(ryu CONFIG REQUIRED)
add_executable(test test.c)
target_link_libraries(test PUBLIC RYU::ryu RYU::ryu_printf)
install(TARGETS test RUNTIME DESTINATION bin/vcpkg-ci-ryu)
9 changes: 9 additions & 0 deletions scripts/test_ports/vcpkg-ci-ryu/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set(VCPKG_POLICY_SKIP_ALL_POST_BUILD_CHECKS enabled)
vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}")
vcpkg_cmake_install()
if(NOT VCPKG_CROSSCOMPILING)
vcpkg_execute_required_process(COMMAND "${CURRENT_PACKAGES_DIR}/bin/vcpkg-ci-ryu/test" WORKING_DIRECTORY "." LOGNAME release-test)
if(NOT VCPKG_BUILD_TYPE)
vcpkg_execute_required_process(COMMAND "${CURRENT_PACKAGES_DIR}/debug/bin/vcpkg-ci-ryu/test" WORKING_DIRECTORY "." LOGNAME debug-test)
endif()
endif()
21 changes: 21 additions & 0 deletions scripts/test_ports/vcpkg-ci-ryu/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <string.h>
#include <stdio.h>

#include <ryu/ryu.h>
#include <ryu/ryu2.h>

int main() {
char* result = d2s(3.14);
if (strcmp(result, "3.14E0") != 0) {
printf("Unexpected ryu: %s\n", result);
return 1;
}

result = d2fixed(3.14159, 1);
if (strcmp(result, "3.1") != 0) {
printf("Unexpected ryu_printf: %s\n", result);
return 2;
}

return 0;
}
11 changes: 11 additions & 0 deletions scripts/test_ports/vcpkg-ci-ryu/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "vcpkg-ci-ryu",
"version-date": "2024-12-17",
"dependencies": [
"ryu",
{
"name": "vcpkg-cmake",
"host": true
}
]
}
Loading

0 comments on commit f06267d

Please sign in to comment.