Skip to content

Commit

Permalink
[libffi] Add pkgconfig file (#12126)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
c72578 committed Jul 6, 2020
1 parent 2463788 commit a05cec9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 0 additions & 2 deletions ports/libffi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions ports/libffi/CONTROL
Original file line number Diff line number Diff line change
@@ -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
26 changes: 25 additions & 1 deletion ports/libffi/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set(VERSION 3.3)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libffi/libffi
Expand All @@ -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
Expand All @@ -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)

0 comments on commit a05cec9

Please sign in to comment.