Skip to content

Commit

Permalink
[meson|scripts] update scripts (#12945)
Browse files Browse the repository at this point in the history
* Update meson to a recent commit to fix a bug with 0.56

* rename static libraries built by meson by default on windows

* apply cmake variables detection to meson.
use native/cross files
make arm builds work.

* update munit

* fix fribidi

* fix _FLAGS variables

* set env SDKROOT and MACOSX_DEPLOYMENT_TARGET in configure_meson

* need osx env while building and configuring

* - remove unused env backup functions
- rename internal functions to be prefixed with _vcpkg_
- fix VCPKG_CHAINLOAD_TOOLCHAIN_FILE for ios/freebsd

* replace _vcpkg with vcpkg since _ has special meaning in functions

* rename functions to vcpkg_internal_meson_generate

* update control tool-meson
  • Loading branch information
Neumann-A authored Nov 18, 2020
1 parent f08e44a commit 3217e25
Show file tree
Hide file tree
Showing 10 changed files with 464 additions and 166 deletions.
1 change: 1 addition & 0 deletions ports/fribidi/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Source: fribidi
Version: 1.0.10
Port-Version: 1
Description: GNU FriBidi is an implementation of the Unicode Bidirectional Algorithm (bidi)
Build-Depends: tool-meson
25 changes: 0 additions & 25 deletions ports/fribidi/fix-win-static-suffix.patch

This file was deleted.

3 changes: 1 addition & 2 deletions ports/fribidi/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ vcpkg_from_github(
REF 5464c284034da9c058269377b7f5013bb089f553 # v1.0.10
SHA512 82e42b022f23d6ecebac5071f997c9f46db6aa41c36f87a7f1a28a79b4ccaada10d68b233bbf687c552fc94d91f4b47161e0ef4909fd1de0b483089f1d1377f9
HEAD_REF master
PATCHES fix-win-static-suffix.patch
)

vcpkg_configure_meson(
Expand All @@ -13,10 +12,10 @@ vcpkg_configure_meson(
-Ddocs=false
-Dbin=false
-Dtests=false
--backend=ninja
)

vcpkg_install_meson()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

# Define static macro
Expand Down
2 changes: 2 additions & 0 deletions ports/munit/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Source: munit
Version: 2019-04-06
Port-Version: 1
Description: A small but full-featured unit testing framework for C
Build-Depends: tool-meson
Supports: !(arm|arm64|uwp)
Homepage: https://github.com/nemequ/munit
2 changes: 0 additions & 2 deletions ports/munit/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ vcpkg_from_github(

vcpkg_configure_meson(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
--backend=ninja
)

vcpkg_install_meson()
Expand Down
2 changes: 1 addition & 1 deletion ports/tool-meson/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: tool-meson
Version: 0.56.0
Version: 0.56.01
Homepage: https://github.com/mesonbuild/meson
Description: Meson build system
528 changes: 397 additions & 131 deletions scripts/cmake/vcpkg_configure_meson.cmake

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions scripts/cmake/vcpkg_find_acquire_program.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,19 @@ function(vcpkg_find_acquire_program VAR)
set(NOEXTRACT ON)
set(HASH 22ea847d8017cd977664d0b13c889cfb13c89143212899a511be217345a4e243d4d8d4099700114a11d26a087e83eb1a3e2b03bdb5e0db48f10403184cd26619)
elseif(VAR MATCHES "MESON")
set(MESON_VERSION 0.56.0)
set(MESON_VERSION 0.56.01)
set(PROGNAME meson)
set(REQUIRED_INTERPRETER PYTHON3)
set(APT_PACKAGE_NAME "meson")
set(BREW_PACKAGE_NAME "meson")
set(SCRIPTNAME meson meson.py)
set(PATHS ${DOWNLOADS}/tools/meson/meson-${MESON_VERSION})
set(URL "https://github.com/mesonbuild/meson/releases/download/${MESON_VERSION}/meson-${MESON_VERSION}.tar.gz")
set(ARCHIVE "meson-${MESON_VERSION}.tar.gz")
set(HASH da426e2ac0f657da5672d66143b8f4f45513c269a9a544e8b4c48b4a702743a50d35cbaa37ef4c4fbd7e18b8784c788314927a54faba6a14bb2d468eeaa87607)
set(PATHS ${DOWNLOADS}/tools/meson/meson-91876b40316962620c1705ae14075ab46f8dd644)
set(URL "https://github.com/mesonbuild/meson/archive/91876b40316962620c1705ae14075ab46f8dd644.tar.gz")
set(ARCHIVE "meson-91876b40316962620c1705ae14075ab46f8dd644.tar.gz")
#set(PATHS ${DOWNLOADS}/tools/meson/meson-${MESON_VERSION})
#set(URL "https://github.com/mesonbuild/meson/releases/download/${MESON_VERSION}/meson-${MESON_VERSION}.tar.gz")
#set(ARCHIVE "meson-${MESON_VERSION}.tar.gz")
set(HASH 784b740a01de70312f9240d38b683b2065f40572c87d30929386fe417b2cc70bcc86213c86e143f349c78121c9cc6d7392526d6e53512ae22a6ec0db57f26e3e)
set(_vfa_SUPPORTED ON)
set(VERSION_CMD --version)
elseif(VAR MATCHES "FLEX" OR VAR MATCHES "BISON")
Expand Down
50 changes: 50 additions & 0 deletions scripts/cmake/vcpkg_install_meson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ function(vcpkg_install_meson)
vcpkg_find_acquire_program(NINJA)
unset(ENV{DESTDIR}) # installation directory was already specified with '--prefix' option

if(VCPKG_TARGET_IS_OSX)
if(DEFINED ENV{SDKROOT})
set(_VCPKG_ENV_SDKROOT_BACKUP $ENV{SDKROOT})
endif()
set(ENV{SDKROOT} "${VCPKG_DETECTED_CMAKE_OSX_SYSROOT}")

if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
set(_VCPKG_ENV_MACOSX_DEPLOYMENT_TARGET_BACKUP $ENV{MACOSX_DEPLOYMENT_TARGET})
endif()
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${VCPKG_DETECTED_CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()

message(STATUS "Package ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND ${NINJA} install -v
Expand All @@ -28,4 +40,42 @@ function(vcpkg_install_meson)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME package-${TARGET_TRIPLET}-dbg
)

set(RENAMED_LIBS)
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL static)
# Meson names all static libraries lib<name>.a which basically breaks the world
file(GLOB_RECURSE LIBRARIES "${CURRENT_PACKAGES_DIR}*/**/lib*.a")
foreach(_library IN LISTS LIBRARIES)
get_filename_component(LIBDIR "${_library}" DIRECTORY )
get_filename_component(LIBNAME "${_library}" NAME)
string(REGEX REPLACE ".a$" ".lib" LIBNAMENEW "${LIBNAME}")
string(REGEX REPLACE "^lib" "" LIBNAMENEW "${LIBNAMENEW}")
file(RENAME "${_library}" "${LIBDIR}/${LIBNAMENEW}")
# For cmake fixes.
string(REGEX REPLACE ".a$" "" LIBRAWNAMEOLD "${LIBNAME}")
string(REGEX REPLACE ".lib$" "" LIBRAWNAMENEW "${LIBNAMENEW}")
list(APPEND RENAMED_LIBS ${LIBRAWNAMENEW})
set(${LIBRAWNAME}_OLD ${LIBRAWNAMEOLD})
set(${LIBRAWNAME}_NEW ${LIBRAWNAMENEW})
endforeach()
file(GLOB_RECURSE CMAKE_FILES "${CURRENT_PACKAGES_DIR}*/*.cmake")
foreach(_cmake IN LISTS CMAKE_FILES)
foreach(_lib IN LISTS RENAMED_LIBS)
vcpkg_replace_string("${_cmake}" "${${_lib}_OLD}" "${${_lib}_NEW}")
endforeach()
endforeach()
endif()

if(VCPKG_TARGET_IS_OSX)
if(DEFINED _VCPKG_ENV_SDKROOT_BACKUP)
set(ENV{SDKROOT} "${_VCPKG_ENV_SDKROOT_BACKUP}")
else()
unset(ENV{SDKROOT})
endif()
if(DEFINED _VCPKG_ENV_MACOSX_DEPLOYMENT_TARGET_BACKUP)
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_VCPKG_ENV_MACOSX_DEPLOYMENT_TARGET_BACKUP}")
else()
unset(ENV{MACOSX_DEPLOYMENT_TARGET})
endif()
endif()
endfunction()
4 changes: 4 additions & 0 deletions scripts/get_cmake_vars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_CROSSCOMPILING
CMAKE_HOST_SYSTEM_NAME
CMAKE_SYSTEM_PROCESSOR
CMAKE_HOST_SYSTEM_PROCESSOR)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_OSX_DEPLOYMENT_TARGET
CMAKE_OSX_SYSROOT)
endif()
# Programs to check
set(PROGLIST AR RANLIB STRIP NM OBJDUMP DLLTOOL MT LINKER)
foreach(prog IN LISTS PROGLIST)
Expand Down

0 comments on commit 3217e25

Please sign in to comment.