Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg-tool-meson] Fix warnings, cmake, llvm 18 #38796

Merged
merged 4 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ports/vcpkg-tool-meson/meson-1.4-llvm-18.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 86bbbb1368b8..54fb50af117d 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -188,6 +188,8 @@ def get_llvm_tool_names(tool: str) -> T.List[str]:
# unless it becomes a stable release.
suffixes = [
'', # base (no suffix)
+ '-18.1', '18.1',
+ '-18', '18',
'-17', '17',
'-16', '16',
'-15', '15',
1 change: 1 addition & 0 deletions ports/vcpkg-tool-meson/meson.template.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pkg-config= ['@PKGCONFIG@']
[properties]
cmake_toolchain_file = '@SCRIPTS@/buildsystems/vcpkg.cmake'
[cmake]
CMAKE_BUILD_TYPE = '@buildconfig@'
VCPKG_TARGET_TRIPLET = '@TARGET_TRIPLET@'
VCPKG_HOST_TRIPLET = '@_HOST_TRIPLET@'
VCPKG_CHAINLOAD_TOOLCHAIN_FILE = '@VCPKG_CHAINLOAD_TOOLCHAIN_FILE@'
Expand Down
45 changes: 25 additions & 20 deletions ports/vcpkg-tool-meson/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,41 @@

set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled)

set(files
vcpkg.json
portfile.cmake
vcpkg-port-config.cmake
vcpkg_configure_meson.cmake
vcpkg_install_meson.cmake
set(patches
meson-intl.patch
adjust-python-dep.patch
adjust-args.patch
remove-freebsd-pcfile-specialization.patch
meson-1.4-llvm-18.diff
)
set(scripts
vcpkg-port-config.cmake
vcpkg_configure_meson.cmake
vcpkg_install_meson.cmake
meson.template.in
)
set(to_hash
"${CMAKE_CURRENT_LIST_DIR}/vcpkg.json"
"${CMAKE_CURRENT_LIST_DIR}/portfile.cmake"
)
foreach(file IN LISTS patches scripts)
set(filepath "${CMAKE_CURRENT_LIST_DIR}/${file}")
list(APPEND to_hash "${filepath}")
file(COPY "${filepath}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
endforeach()

set(MESON_PATH_HASH "")
foreach(to_hash IN LISTS files)
file(SHA1 ${CMAKE_CURRENT_LIST_DIR}/${to_hash} to_append)
string(APPEND MESON_PATH_HASH "${to_append}")
set(meson_path_hash "")
foreach(filepath IN LISTS to_hash)
file(SHA1 "${filepath}" to_append)
string(APPEND meson_path_hash "${to_append}")
endforeach()
string(SHA512 MESON_PATH_HASH "${MESON_PATH_HASH}")
string(SHA512 meson_path_hash "${meson_path_hash}")

string(SUBSTRING "${meson_path_hash}" 0 6 MESON_SHORT_HASH)
list(TRANSFORM patches REPLACE [[^(..*)$]] [["${CMAKE_CURRENT_LIST_DIR}/\0"]])
list(JOIN patches "\n " PATCHES)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg_configure_meson.cmake"
"${CMAKE_CURRENT_LIST_DIR}/vcpkg_install_meson.cmake"
"${CMAKE_CURRENT_LIST_DIR}/meson-intl.patch"
"${CMAKE_CURRENT_LIST_DIR}/adjust-python-dep.patch"
"${CMAKE_CURRENT_LIST_DIR}/adjust-args.patch"
"${CMAKE_CURRENT_LIST_DIR}/remove-freebsd-pcfile-specialization.patch"
"${CMAKE_CURRENT_LIST_DIR}/meson.template.in"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

vcpkg_install_copyright(FILE_LIST "${VCPKG_ROOT_DIR}/LICENSE.txt")

include("${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake")
include("${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake")
8 changes: 2 additions & 6 deletions ports/vcpkg-tool-meson/vcpkg-port-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_configure_meson.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_install_meson.cmake")

set(meson_path_hash @MESON_PATH_HASH@)
string(SUBSTRING "${meson_path_hash}" 0 6 meson_short_hash)
set(meson_short_hash @MESON_SHORT_HASH@)

# Setup meson:
set(program MESON)
Expand Down Expand Up @@ -34,10 +33,7 @@ if(NOT SCRIPT_MESON)
z_vcpkg_apply_patches(
SOURCE_PATH "${path_to_search}-tmp/meson-${ref}"
PATCHES
"${CMAKE_CURRENT_LIST_DIR}/adjust-args.patch"
"${CMAKE_CURRENT_LIST_DIR}/meson-intl.patch"
"${CMAKE_CURRENT_LIST_DIR}/adjust-python-dep.patch"
"${CMAKE_CURRENT_LIST_DIR}/remove-freebsd-pcfile-specialization.patch"
@PATCHES@
)
file(MAKE_DIRECTORY "${path_to_search}")
file(RENAME "${path_to_search}-tmp/meson-${ref}/meson.py" "${path_to_search}/meson.py")
Expand Down
2 changes: 1 addition & 1 deletion ports/vcpkg-tool-meson/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vcpkg-tool-meson",
"version": "1.3.2",
"port-version": 2,
"port-version": 3,
"description": "Meson build system",
"homepage": "https://github.com/mesonbuild/meson",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions ports/vcpkg-tool-meson/vcpkg_configure_meson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function(vcpkg_configure_meson)
set(meson_input_file_${buildname} "${CURRENT_BUILDTREES_DIR}/meson-${TARGET_TRIPLET}-${suffix_${buildname}}.log")
endif()

vcpkg_list(APPEND arg_OPTIONS --backend ninja --wrap-mode nodownload -Dbuildtype=plain -Doptimization=plain)
vcpkg_list(APPEND arg_OPTIONS --backend ninja --wrap-mode nodownload -Doptimization=plain)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes

WARNING: Recommend using either -Dbuildtype or -Doptimization + -Ddebug. Using both is redundant since they override each other. See: https://mesonbuild.com/Builtin-options.html#build-type-options

We use

vcpkg build type -Doptimization -Ddebug meson build type (implied)
release plain false plain
debug plain true custom


z_vcpkg_get_build_and_host_system(MESON_HOST_MACHINE MESON_BUILD_MACHINE IS_CROSS)

Expand Down Expand Up @@ -434,7 +434,7 @@ function(vcpkg_configure_meson)
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/meson.template.in" "${meson_input_file_${buildtype}}" @ONLY)

vcpkg_execute_required_process(
COMMAND ${MESON} ${arg_OPTIONS} ${arg_OPTIONS_${buildtype}} ${arg_SOURCE_PATH}
COMMAND ${MESON} setup ${arg_OPTIONS} ${arg_OPTIONS_${buildtype}} ${arg_SOURCE_PATH}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}"
LOGNAME config-${TARGET_TRIPLET}-${suffix_${buildtype}}
SAVE_LOG_FILES
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -9098,7 +9098,7 @@
},
"vcpkg-tool-meson": {
"baseline": "1.3.2",
"port-version": 2
"port-version": 3
},
"vcpkg-tool-mozbuild": {
"baseline": "4.0.2",
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vcpkg-tool-meson.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "fbf4e4c53dcb75ef6bd7d62c7985fe7a4225b6e0",
"version": "1.3.2",
"port-version": 3
},
{
"git-tree": "8408112396883b134bd25e2522f9a806ceaae3ea",
"version": "1.3.2",
Expand Down