[libffi] Add pkgconfig file (#12126)

* [libffi] Add pkgconfig file

- Configure and add the libffi.pc file.
- Furthermore, enable the check for same 32/64bit-ness in
  libffiConfigVersion.cmake again, which had caused issues in the past
  with newer versions of glib using meson build, e.g. when building for
  x86-windows target on an x64-windows host.
  Now, libffi is found by current glib (e.g. 2.64.3) during
  meson build using the libffi pkgconfig file.

* Check VCPKG_BUILD_TYPE to handle release/debug
This commit is contained in:
Wolfgang Stöggl 2020-07-06 22:40:46 +02:00 committed by GitHub
parent 24637886f8
commit a05cec95a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 5 deletions

View File

@ -186,8 +186,6 @@ include(CMakePackageConfigHelpers)
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION share/${PROJECT_NAME})
# Disable check for same 32/64bit-ness in libffiConfigVersion.cmake by setting CMAKE_SIZEOF_VOID_P
set (CMAKE_SIZEOF_VOID_P "")
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${VERSION}

View File

@ -1,4 +1,4 @@
Source: libffi
Version: 3.3-2
Version: 3.3-3
Homepage: https://github.com/libffi/libffi
Description: Portable, high level programming interface to various calling conventions
Description: Portable, high level programming interface to various calling conventions

View File

@ -1,3 +1,5 @@
set(VERSION 3.3)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libffi/libffi
@ -19,8 +21,30 @@ vcpkg_configure_cmake(
)
vcpkg_install_cmake()
# Create pkgconfig file
set(PACKAGE_VERSION ${VERSION})
set(prefix "${CURRENT_INSTALLED_DIR}")
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(toolexeclibdir "\${libdir}")
set(includedir "\${prefix}/include")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
configure_file("${SOURCE_PATH}/libffi.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libffi.pc" @ONLY)
endif()
# debug
set(prefix "${CURRENT_INSTALLED_DIR}/debug")
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(toolexeclibdir "\${libdir}")
set(includedir "\${prefix}/../include")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
configure_file("${SOURCE_PATH}/libffi.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libffi.pc" @ONLY)
endif()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
vcpkg_fixup_pkgconfig()
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/ffi.h
@ -32,4 +56,4 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
)
endif()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)