Skip to content

Commit

Permalink
[vcpkg-tool-meson] Update meson to 1.3.2 (microsoft#28084)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neumann-A authored Mar 11, 2024
1 parent 431eb6b commit a664e41
Show file tree
Hide file tree
Showing 35 changed files with 849 additions and 101 deletions.
12 changes: 12 additions & 0 deletions ports/gdk-pixbuf/fix-static-deps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
index d7aa127b48..c313dc272d 100644
--- a/gdk-pixbuf/meson.build
+++ b/gdk-pixbuf/meson.build
@@ -214,6 +214,7 @@ gdkpixbuf = library('gdk_pixbuf-2.0',
dependencies: [
gdk_pixbuf_deps,
included_loaders_deps,
+ loaders_deps
],
install: true)

2 changes: 1 addition & 1 deletion ports/gdk-pixbuf/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org/
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -10,6 +9,7 @@ vcpkg_from_gitlab(
fix_build_error_windows.patch
loaders-cache.patch
use-libtiff-4-pkgconfig.patch
fix-static-deps.patch
)

if("introspection" IN_LIST FEATURES)
Expand Down
2 changes: 1 addition & 1 deletion ports/gdk-pixbuf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gdk-pixbuf",
"version": "2.42.10",
"port-version": 2,
"port-version": 3,
"description": "Image loading library.",
"homepage": "https://gitlab.gnome.org/GNOME/gdk-pixbuf",
"license": "LGPL-2.1-or-later",
Expand Down
2 changes: 1 addition & 1 deletion ports/glib/libintl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ diff --git a/meson.build b/meson.build
libintl_prefix = '#include <libintl.h>'
-libintl = dependency('intl', required: false)
-if libintl.found() and libintl.type_name() != 'internal'
+libintl = dependency('Intl', method:'cmake', required: true)
+libintl = dependency('intl', required : true)
+libintl_deps = [libintl]
+if false
# libintl supports different threading APIs, which may not
Expand Down
1 change: 1 addition & 0 deletions ports/glib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "glib",
"version": "2.78.4",
"port-version": 1,
"description": "Portable, general-purpose utility library.",
"homepage": "https://developer.gnome.org/glib/",
"license": "LGPL-2.1-or-later",
Expand Down
10 changes: 7 additions & 3 deletions ports/gobject-introspection/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ vcpkg_find_acquire_program(FLEX)
vcpkg_find_acquire_program(BISON)

set(OPTIONS_DEBUG -Dbuild_introspection_data=false)
set(OPTIONS_RELEASE -Dbuild_introspection_data=true)
if(VCPKG_CROSSCOMPILING AND
NOT (CMAKE_HOST_WIN32 AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86"))
if(VCPKG_CROSSCOMPILING)
list(APPEND OPTIONS_RELEASE -Dgi_cross_use_prebuilt_gi=true)
list(APPEND OPTIONS_RELEASE -Dbuild_introspection_data=false)
# g-ir-scanner is not correctly setup for the cross build and
# fails to correctly link against x86 libs (uses x64 instead)
else()
list(APPEND OPTIONS_RELEASE -Dbuild_introspection_data=true)
endif()

vcpkg_configure_meson(
Expand All @@ -41,6 +44,7 @@ vcpkg_configure_meson(
g-ir-annotation-tool='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-annotation-tool'
g-ir-compiler='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-compiler${VCPKG_HOST_EXECUTABLE_SUFFIX}'
g-ir-scanner='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-scanner'
python='${CURRENT_HOST_INSTALLED_DIR}/tools/python3/python${VCPKG_HOST_EXECUTABLE_SUFFIX}'
)

vcpkg_host_path_list(APPEND ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
Expand Down
6 changes: 5 additions & 1 deletion ports/gobject-introspection/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gobject-introspection",
"version": "1.72.0",
"port-version": 7,
"port-version": 8,
"description": "A middleware layer between C libraries (using GObject) and language bindings.",
"homepage": "https://gi.readthedocs.io/en/latest/",
"license": null,
Expand All @@ -25,6 +25,10 @@
},
"libffi",
"python3",
{
"name": "python3",
"host": true
},
{
"name": "vcpkg-tool-meson",
"host": true
Expand Down
8 changes: 6 additions & 2 deletions ports/libnice/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libnice",
"version": "0.1.21",
"port-version": 1,
"port-version": 2,
"description": "Libnice is an implementation of the IETF's Interactive Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal Utilities for NAT (STUN) standard (RFC 5389).",
"homepage": "https://nice.freedesktop.org",
"license": "LGPL-2.1-only AND MPL-1.1",
Expand All @@ -13,6 +13,10 @@
"host": true,
"default-features": false
},
"openssl"
"openssl",
{
"name": "vcpkg-tool-meson",
"host": true
}
]
}
5 changes: 5 additions & 0 deletions ports/mesa/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ vcpkg_from_gitlab(
)

x_vcpkg_get_python_packages(PYTHON_VERSION "3" OUT_PYTHON_VAR "PYTHON3" PACKAGES setuptools mako)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path(PREPEND "${PYTHON3_DIR}")

vcpkg_find_acquire_program(FLEX)
get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY)
Expand Down Expand Up @@ -103,6 +105,9 @@ vcpkg_configure_meson(
#-D egl-lib-suffix=_mesa
-Dbuild-tests=false
${MESA_OPTIONS}
ADDITIONAL_BINARIES
python=['${PYTHON3}','-I']
python3=['${PYTHON3}','-I']
)
vcpkg_install_meson()
vcpkg_fixup_pkgconfig()
Expand Down
1 change: 1 addition & 0 deletions ports/mesa/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "mesa",
"version": "23.2.1",
"port-version": 1,
"description": "Mesa - The 3D Graphics Library",
"homepage": "https://www.mesa3d.org/",
"license": "MIT AND BSL-1.0 AND SGI-B-2.0",
Expand Down
4 changes: 2 additions & 2 deletions ports/thorvg/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ vcpkg_configure_meson(
OPTIONS
${BUILD_OPTIONS}
# see ${SOURCE_PATH}/meson_options.txt
-Dengines=sw
-Dengines=['sw']
-Dloaders=all
-Dsavers=tvg
-Dvector=true
-Dvector=true # This assumes AVX
-Dbindings=capi
-Dtests=false
-Dexamples=false
Expand Down
1 change: 1 addition & 0 deletions ports/thorvg/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "thorvg",
"version": "0.12.1",
"port-version": 1,
"description": "ThorVG is a platform-independent portable library for drawing vector-based scenes and animations",
"homepage": "https://www.thorvg.org",
"license": "MIT",
Expand Down
12 changes: 12 additions & 0 deletions ports/vcpkg-tool-meson/adjust-args.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py
index abf2cf6..477629e 100644
--- a/mesonbuild/cmake/toolchain.py
+++ b/mesonbuild/cmake/toolchain.py
@@ -204,6 +204,6 @@ class CMakeToolchain:
@staticmethod
def is_cmdline_option(compiler: 'Compiler', arg: str) -> bool:
if compiler.get_argument_syntax() == 'msvc':
- return arg.startswith('/')
+ return arg.startswith(('/','-'))
else:
return arg.startswith('-')
46 changes: 46 additions & 0 deletions ports/vcpkg-tool-meson/adjust-python-dep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py
index 38e3d5f..6427980 100644
--- a/mesonbuild/dependencies/python.py
+++ b/mesonbuild/dependencies/python.py
@@ -208,7 +208,8 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
# compile args
+ verdot = self.variables.get('py_version_short')
inc_paths = mesonlib.OrderedSet([
self.variables.get('INCLUDEPY'),
- self.paths.get('include'),
+ self.paths.get('include') + f'/../../../include/python${verdot}',
self.paths.get('platinclude')])

self.compile_args += ['-I' + path for path in inc_paths if path]
@@ -279,9 +279,9 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
else:
libpath = Path(f'python{vernum}.dll')
else:
if limited_api:
vernum = vernum[0]
- libpath = Path('libs') / f'python{vernum}.lib'
+ libpath = Path('libs') / f'..' / f'..' / f'..' / f'lib' / f'python{vernum}.lib'
# For a debug build, pyconfig.h may force linking with
# pythonX_d.lib (see meson#10776). This cannot be avoided
# and won't work unless we also have a debug build of
@@ -296,6 +296,8 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
vscrt = self.env.coredata.options[mesonlib.OptionKey('b_vscrt')].value
if vscrt in {'mdd', 'mtd', 'from_buildtype', 'static_from_buildtype'}:
vscrt_debug = True
+ if is_debug_build:
+ libpath = Path('libs') / f'..' / f'..' / f'..' / f'debug/lib' / f'python{vernum}_d.lib'
if is_debug_build and vscrt_debug and not self.variables.get('Py_DEBUG'):
mlog.warning(textwrap.dedent('''\
Using a debug build type with MSVC or an MSVC-compatible compiler
@@ -390,10 +390,7 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice',
set_env('PKG_CONFIG_PATH', old_pkg_path)

candidates.append(functools.partial(wrap_in_pythons_pc_dir, pkg_name, env, kwargs, installation))
+ candidates.append(functools.partial(PythonPkgConfigDependency, pkg_name, env, kwargs, installation))
- # We only need to check both, if a python install has a LIBPC. It might point to the wrong location,
- # e.g. relocated / cross compilation, but the presence of LIBPC indicates we should definitely look for something.
- if pkg_libdir is not None:
- candidates.append(functools.partial(PythonPkgConfigDependency, pkg_name, env, kwargs, installation))
else:
candidates.append(functools.partial(PkgConfigDependency, 'python3', env, kwargs))

5 changes: 3 additions & 2 deletions ports/vcpkg-tool-meson/meson-intl.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -610,7 +610,8 @@ iconv_factory = DependencyFactory(
@@ -593,7 +593,8 @@ iconv_factory = DependencyFactory(

intl_factory = DependencyFactory(
packages['intl'] = intl_factory = DependencyFactory(
'intl',
+ [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
+ cmake_name='Intl',
Expand Down
41 changes: 41 additions & 0 deletions ports/vcpkg-tool-meson/meson.template.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[binaries]
cmake = ['@CMAKE_COMMAND@']
ninja = ['@NINJA@']
pkg-config= ['@PKGCONFIG@']
@MESON_MT@
@MESON_AR@
@MESON_RC@
@MESON_C@
@MESON_C_LD@
@MESON_CXX@
@MESON_CXX_LD@
@MESON_OBJC@
@MESON_OBJC_LD@
@MESON_OBJCPP@
@MESON_OBJCPP_LD@
@MESON_FC@
@MESON_FC_LD@
@MESON_WINDRES@
@MESON_ADDITIONAL_BINARIES@
[properties]
cmake_toolchain_file = '@SCRIPTS@/buildsystems/vcpkg.cmake'
[cmake]
VCPKG_TARGET_TRIPLET = '@TARGET_TRIPLET@'
VCPKG_HOST_TRIPLET = '@_HOST_TRIPLET@'
VCPKG_CHAINLOAD_TOOLCHAIN_FILE = '@VCPKG_CHAINLOAD_TOOLCHAIN_FILE@'
VCPKG_CRT_LINKAGE = '@VCPKG_CRT_LINKAGE@'
_VCPKG_INSTALLED_DIR = '@_VCPKG_INSTALLED_DIR@'
@MESON_HOST_MACHINE@
@MESON_BUILD_MACHINE@
[built-in options]
default_library = '@MESON_DEFAULT_LIBRARY@'
werror = false
@MESON_CFLAGS@
@MESON_CXXFLAGS@
@MESON_FCFLAGS@
@MESON_OBJCFLAGS@
@MESON_OBJCPPFLAGS@
# b_vscrt
@MESON_VSCRT_LINKAGE@
# c_winlibs/cpp_winlibs
@MESON_WINLIBS@
86 changes: 33 additions & 53 deletions ports/vcpkg-tool-meson/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,38 @@
# In the future, it is expected that this port acquires and installs Meson.
# Currently is used in ports that call vcpkg_find_acquire_program(MESON) in order to force rebuilds.

set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

set(program MESON)
set(program_version 0.63.0)
set(program_name meson)
set(search_names meson meson.py)
set(interpreter PYTHON3)
set(apt_package_name "meson")
set(brew_package_name "meson")
set(paths_to_search "${CURRENT_PACKAGES_DIR}/tools/meson")
set(supported_on_unix ON)
set(version_command --version)
set(extra_search_args EXACT_VERSION_MATCH)

vcpkg_find_acquire_program(PYTHON3)

# Reenable if no patching of meson is required within vcpkg
# z_vcpkg_find_acquire_program_find_external("${program}"
# ${extra_search_args}
# PROGRAM_NAME "${program_name}"
# MIN_VERSION "${program_version}"
# INTERPRETER "${interpreter}"
# NAMES ${search_names}
# VERSION_COMMAND ${version_command}
# )

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mesonbuild/meson
REF bb91cea0d66d8d036063dedec1f194d663399cdf
SHA512 e5888eb35dd4ab5fc0a16143cfbb5a7849f6d705e211a80baf0a8b753e2cf877a4587860a79cad129ec5f3474c12a73558ffe66439b1633d80b8044eceaff2da
PATCHES
meson-intl.patch
remove-freebsd-pcfile-specialization.patch
)

vcpkg_execute_required_process(
COMMAND "${CMAKE_COMMAND}"
"-DSOURCE_PATH=${SOURCE_PATH}"
"-DCURRENT_PACKAGES_DIR=${CURRENT_PACKAGES_DIR}"
-P "${CURRENT_PORT_DIR}/install.cmake"
WORKING_DIRECTORY "${VCPKG_ROOT_DIR}"
LOGNAME install
)

file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

z_vcpkg_find_acquire_program_find_internal("${program}"
INTERPRETER "${interpreter}"
PATHS ${paths_to_search}
NAMES ${search_names}
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
meson-intl.patch
adjust-python-dep.patch
adjust-args.patch
remove-freebsd-pcfile-specialization.patch
meson.template.in
)

message(STATUS "Using meson: ${MESON}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/meson/version.txt" "${program_version}") # For vcpkg_find_acquire_program
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}")
endforeach()
string(SHA512 MESON_PATH_HASH "${MESON_PATH_HASH}")

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")
Loading

0 comments on commit a664e41

Please sign in to comment.