зеркало из https://github.com/microsoft/vcpkg.git
[vcpkg_find_acquire_program] Enable find_acquire(PKGCONFIG) (#12626)
Co-authored-by: Robert Schumacher <roschuma@microsoft.com> Co-authored-by: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com>
This commit is contained in:
Родитель
739209b51a
Коммит
bc88079632
|
@ -2,7 +2,7 @@ set(GEOGRAM_VERSION 1.7.5)
|
|||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://gforge.inria.fr/frs/download.php/file/38314/geogram_${GEOGRAM_VERSION}.tar.gz"
|
||||
FILENAME "geogram_${GEOGRAM_VERSION}.tar.gz"
|
||||
FILENAME "geogram_${GEOGRAM_VERSION}_47dcbb8.tar.gz"
|
||||
SHA512 47dcbb8a5c4e5f791feb8d9b209b04b575b0757e8b89de09c82ef2324a36d4056a1f3001537038c8a752045b0e6b6eedf5421ad49132214c0f60163ff095c36f
|
||||
)
|
||||
|
||||
|
|
|
@ -413,16 +413,7 @@ function(vcpkg_configure_make)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ENV{PKG_CONFIG})
|
||||
find_program(PKGCONFIG pkg-config PATHS "${MSYS_ROOT}/usr/bin" REQUIRED)
|
||||
debug_message("Using pkg-config from: ${PKGCONFIG}")
|
||||
if(NOT PKGCONFIG)
|
||||
message(STATUS "${PORT} requires pkg-config from the system package manager (example: \"sudo apt-get install pkg-config\")")
|
||||
endif()
|
||||
else()
|
||||
debug_message("ENV{PKG_CONFIG} found! Using: $ENV{PKG_CONFIG}")
|
||||
set(PKGCONFIG $ENV{PKG_CONFIG})
|
||||
endif()
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND NOT PKGCONFIG STREQUAL "--static")
|
||||
set(PKGCONFIG "${PKGCONFIG} --static")
|
||||
endif()
|
||||
|
|
|
@ -100,21 +100,10 @@ function(vcpkg_configure_meson)
|
|||
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
|
||||
vcpkg_add_to_path("${NINJA_PATH}")
|
||||
|
||||
if(NOT ENV{PKG_CONFIG})
|
||||
find_program(PKGCONFIG pkg-config)
|
||||
if(NOT PKGCONFIG AND CMAKE_HOST_WIN32)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES pkg-config)
|
||||
vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
|
||||
endif()
|
||||
find_program(PKGCONFIG pkg-config REQUIRED)
|
||||
else()
|
||||
debug_message(STATUS "PKG_CONFIG found in ENV! Using $ENV{PKG_CONFIG}")
|
||||
set(PKGCONFIG $ENV{PKG_CONFIG})
|
||||
endif()
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
get_filename_component(PKGCONFIG_PATH ${PKGCONFIG} DIRECTORY)
|
||||
vcpkg_add_to_path("${PKGCONFIG_PATH}")
|
||||
set(PKGCONFIG_SHARE_DIR "${CURRENT_INSTALLED_DIR}/share/pkgconfig/")
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_SHARE_DIR "${PKGCONFIG_SHARE_DIR}")
|
||||
endif()
|
||||
# configure debug
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
||||
|
@ -123,20 +112,14 @@ function(vcpkg_configure_meson)
|
|||
#setting up PKGCONFIG
|
||||
if(NOT PKGCONFIG MATCHES "--define-variable=prefix")
|
||||
set(PKGCONFIG_PREFIX "${CURRENT_INSTALLED_DIR}/debug")
|
||||
# if(WIN32)
|
||||
# string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_PREFIX "${PKGCONFIG_PREFIX}")
|
||||
# endif()
|
||||
set(ENV{PKG_CONFIG} "${PKGCONFIG} --define-variable=prefix=${PKGCONFIG_PREFIX}")
|
||||
endif()
|
||||
set(PKGCONFIG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig/")
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_INSTALLED_DIR "${PKGCONFIG_INSTALLED_DIR}")
|
||||
endif()
|
||||
if(ENV{PKG_CONFIG_PATH})
|
||||
set(BACKUP_ENV_PKG_CONFIG_PATH_DEBUG $ENV{PKG_CONFIG_PATH})
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}: $ENV{PKG_CONFIG_PATH}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PKG_CONFIG_PATH}")
|
||||
else()
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_SHARE_DIR}")
|
||||
endif()
|
||||
|
||||
set(CFLAGS "-Dc_args=[${MESON_COMMON_CFLAGS} ${MESON_DEBUG_CFLAGS}]")
|
||||
|
@ -191,20 +174,14 @@ function(vcpkg_configure_meson)
|
|||
#setting up PKGCONFIG
|
||||
if(NOT PKGCONFIG MATCHES "--define-variable=prefix")
|
||||
set(PKGCONFIG_PREFIX "${CURRENT_INSTALLED_DIR}")
|
||||
# if(WIN32)
|
||||
# string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_PREFIX "${PKGCONFIG_PREFIX}")
|
||||
# endif()
|
||||
set(ENV{PKG_CONFIG} "${PKGCONFIG} --define-variable=prefix=${PKGCONFIG_PREFIX}")
|
||||
endif()
|
||||
set(PKGCONFIG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/")
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_INSTALLED_DIR "${PKGCONFIG_INSTALLED_DIR}")
|
||||
endif()
|
||||
if(ENV{PKG_CONFIG_PATH})
|
||||
set(BACKUP_ENV_PKG_CONFIG_PATH_RELEASE $ENV{PKG_CONFIG_PATH})
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}: $ENV{PKG_CONFIG_PATH}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PKG_CONFIG_PATH}")
|
||||
else()
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_SHARE_DIR}")
|
||||
endif()
|
||||
|
||||
# Normalize flags for meson (i.e. " /string /with /flags " -> ['/string', '/with', '/flags'])
|
||||
|
|
|
@ -378,6 +378,47 @@ function(vcpkg_find_acquire_program VAR)
|
|||
set(URL "https://github.com/aria2/aria2/releases/download/release-1.34.0/aria2-1.34.0-win-32bit-build1.zip")
|
||||
set(ARCHIVE "aria2-1.34.0-win-32bit-build1.zip")
|
||||
set(HASH 2a5480d503ac6e8203040c7e516a3395028520da05d0ebf3a2d56d5d24ba5d17630e8f318dd4e3cc2094cc4668b90108fb58e8b986b1ffebd429995058063c27)
|
||||
elseif(VAR MATCHES "PKGCONFIG")
|
||||
set(PROGNAME pkg-config)
|
||||
if(ENV{PKG_CONFIG})
|
||||
debug_message(STATUS "PKG_CONFIG found in ENV! Using $ENV{PKG_CONFIG}")
|
||||
set(PKGCONFIG $ENV{PKG_CONFIG} PARENT_SCOPE)
|
||||
return()
|
||||
elseif(CMAKE_HOST_WIN32)
|
||||
set(PROG_PATH_SUBDIR "${DOWNLOADS}/tools/${PROGNAME}/0.29.2-1")
|
||||
set(PKGCONFIG "${PROG_PATH_SUBDIR}/mingw32/bin/pkg-config.exe")
|
||||
if(NOT EXISTS "${PKGCONFIG}")
|
||||
vcpkg_download_distfile(PKGCONFIG_ARCHIVE
|
||||
URLS "https://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-1-any.pkg.tar.xz"
|
||||
SHA512 3b1b706a24d9aef7bbdf3ce4427aaa813ba6fbd292ed9dda181b4300e117c3d59a159ddcca8b013fd01ce76da2d95d590314ff9628c0d68a6966bac4842540f0
|
||||
FILENAME mingw-w64-i686-pkg-config-0.29.2-1-any.pkg.tar.xz
|
||||
)
|
||||
vcpkg_download_distfile(LIBWINPTHREAD_ARCHIVE
|
||||
URLS "https://repo.msys2.org/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst"
|
||||
SHA512 2c3d9e6b2eee6a4c16fd69ddfadb6e2dc7f31156627d85845c523ac85e5c585d4cfa978659b1fe2ec823d44ef57bc2b92a6127618ff1a8d7505458b794f3f01c
|
||||
FILENAME mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst
|
||||
)
|
||||
file(REMOVE_RECURSE ${PROG_PATH_SUBDIR} ${PROG_PATH_SUBDIR}.tmp)
|
||||
file(MAKE_DIRECTORY ${PROG_PATH_SUBDIR}.tmp)
|
||||
vcpkg_execute_required_process(
|
||||
ALLOW_IN_DOWNLOAD_MODE
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${LIBWINPTHREAD_ARCHIVE}
|
||||
WORKING_DIRECTORY ${PROG_PATH_SUBDIR}.tmp
|
||||
)
|
||||
vcpkg_execute_required_process(
|
||||
ALLOW_IN_DOWNLOAD_MODE
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${PKGCONFIG_ARCHIVE}
|
||||
WORKING_DIRECTORY ${PROG_PATH_SUBDIR}.tmp
|
||||
)
|
||||
file(RENAME ${PROG_PATH_SUBDIR}.tmp ${PROG_PATH_SUBDIR})
|
||||
endif()
|
||||
set(${VAR} "${${VAR}}" PARENT_SCOPE)
|
||||
return()
|
||||
else()
|
||||
set(BREW_PACKAGE_NAME pkg-config)
|
||||
set(APT_PACKAGE_NAME pkg-config)
|
||||
set(PATHS "/bin" "/usr/bin" "/usr/local/bin")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL "unknown tool ${VAR} -- unable to acquire.")
|
||||
endif()
|
||||
|
|
|
@ -39,18 +39,8 @@
|
|||
## Just call vcpkg_fixup_pkgconfig() after any install step which installs *.pc files.
|
||||
function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config _system_libs _ignore_flags)
|
||||
# Setup pkg-config paths
|
||||
if(CMAKE_HOST_WIN32)
|
||||
# Those replacements are probably only necessary since we use pkg-config from msys
|
||||
string(REPLACE " " "\ " _VCPKG_INSTALLED_PKGCONF "${CURRENT_INSTALLED_DIR}")
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_PKGCONF "${_VCPKG_INSTALLED_PKGCONF}")
|
||||
string(REPLACE "\\" "/" _VCPKG_INSTALLED_PKGCONF "${_VCPKG_INSTALLED_PKGCONF}")
|
||||
string(REPLACE " " "\ " _VCPKG_PACKAGES_PKGCONF "${CURRENT_PACKAGES_DIR}")
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PACKAGES_PKGCONF "${_VCPKG_PACKAGES_PKGCONF}")
|
||||
string(REPLACE "\\" "/" _VCPKG_PACKAGES_PKGCONF "${_VCPKG_PACKAGES_PKGCONF}")
|
||||
else()
|
||||
set(_VCPKG_INSTALLED_PKGCONF "${CURRENT_INSTALLED_DIR}")
|
||||
set(_VCPKG_PACKAGES_PKGCONF "${CURRENT_PACKAGES_DIR}")
|
||||
endif()
|
||||
set(_VCPKG_INSTALLED_PKGCONF "${CURRENT_INSTALLED_DIR}")
|
||||
set(_VCPKG_PACKAGES_PKGCONF "${CURRENT_PACKAGES_DIR}")
|
||||
|
||||
set(PATH_SUFFIX_DEBUG /debug)
|
||||
set(PKGCONFIG_INSTALLED_DIR "${_VCPKG_INSTALLED_PKGCONF}${PATH_SUFFIX_${_config}}/lib/pkgconfig")
|
||||
|
@ -60,9 +50,9 @@ function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config _system_lib
|
|||
|
||||
if(ENV{PKG_CONFIG_PATH})
|
||||
set(BACKUP_ENV_PKG_CONFIG_PATH_${_config} $ENV{PKG_CONFIG_PATH})
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}:${PKGCONFIG_INSTALLED_SHARE_DIR}:${PKGCONFIG_PACKAGES_DIR}:${PKGCONFIG_PACKAGES_SHARE_DIR}:$ENV{PKG_CONFIG_PATH}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PKG_CONFIG_PATH}")
|
||||
else()
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}:${PKGCONFIG_INSTALLED_SHARE_DIR}:${PKGCONFIG_PACKAGES_DIR}:${PKGCONFIG_PACKAGES_SHARE_DIR}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}")
|
||||
endif()
|
||||
|
||||
# First make sure everything is ok with the package and its deps
|
||||
|
@ -260,7 +250,6 @@ function(vcpkg_fixup_pkgconfig)
|
|||
set(PKGCONFIG_STATIC --static)
|
||||
endif()
|
||||
|
||||
message(STATUS "Fixing pkgconfig")
|
||||
if(_vfpkg_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "vcpkg_fixup_pkgconfig was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
@ -275,27 +264,16 @@ function(vcpkg_fixup_pkgconfig)
|
|||
list(FILTER _vfpkg_DEBUG_FILES INCLUDE REGEX "${CURRENT_PACKAGES_DIR}/debug/")
|
||||
endif()
|
||||
|
||||
if(NOT PKGCONFIG)
|
||||
find_program(PKGCONFIG pkg-config PATHS "bin" "/usr/bin" "/usr/local/bin")
|
||||
if(NOT PKGCONFIG AND CMAKE_HOST_WIN32)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES pkg-config)
|
||||
find_program(PKGCONFIG pkg-config PATHS "${MSYS_ROOT}/usr/bin" REQUIRED)
|
||||
endif()
|
||||
debug_message("Using pkg-config from: ${PKGCONFIG}")
|
||||
if(NOT PKGCONFIG AND NOT _vfpkg_SKIP_CHECK)
|
||||
message(WARNING "Unable to find pkg-config to validate *.pc files. Skipping checkes!")
|
||||
set(_vfpkg_SKIP_CHECK TRUE)
|
||||
endif()
|
||||
endif()
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
debug_message("Using pkg-config from: ${PKGCONFIG}")
|
||||
|
||||
#Absolute Unix like paths
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}")
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}")
|
||||
|
||||
message(STATUS "Fixing pkgconfig - release")
|
||||
debug_message("Files: ${_vfpkg_RELEASE_FILES}")
|
||||
debug_message("Release Files: ${_vfpkg_RELEASE_FILES}")
|
||||
foreach(_file ${_vfpkg_RELEASE_FILES})
|
||||
message(STATUS "Checking file: ${_file}")
|
||||
message(STATUS "Fixing pkgconfig file: ${_file}")
|
||||
get_filename_component(PKG_LIB_SEARCH_PATH "${_file}" DIRECTORY)
|
||||
file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}")
|
||||
string(REGEX REPLACE "/$" "" RELATIVE_PC_PATH "${RELATIVE_PC_PATH}")
|
||||
|
@ -317,10 +295,9 @@ function(vcpkg_fixup_pkgconfig)
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
message(STATUS "Fixing pkgconfig - debug")
|
||||
debug_message("Files: ${_vfpkg_DEBUG_FILES}")
|
||||
debug_message("Debug Files: ${_vfpkg_DEBUG_FILES}")
|
||||
foreach(_file ${_vfpkg_DEBUG_FILES})
|
||||
message(STATUS "Checking file: ${_file}")
|
||||
message(STATUS "Fixing pkgconfig file: ${_file}")
|
||||
get_filename_component(PKG_LIB_SEARCH_PATH "${_file}" DIRECTORY)
|
||||
file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}/debug/")
|
||||
string(REGEX REPLACE "/$" "" RELATIVE_PC_PATH "${RELATIVE_PC_PATH}")
|
||||
|
@ -348,7 +325,7 @@ function(vcpkg_fixup_pkgconfig)
|
|||
vcpkg_fixup_pkgconfig_check_files("${PKGCONFIG}" "${_file}" "DEBUG" "${_vfpkg_SYSTEM_LIBRARIES}" "${_vfpkg_IGNORE_FLAGS}")
|
||||
endforeach()
|
||||
endif()
|
||||
message(STATUS "Fixing pkgconfig --- finished")
|
||||
debug_message("Fixing pkgconfig --- finished")
|
||||
|
||||
set(VCPKG_FIXUP_PKGCONFIG_CALLED TRUE CACHE INTERNAL "See below" FORCE)
|
||||
# Variable to check if this function has been called!
|
||||
|
|
Загрузка…
Ссылка в новой задаче