2023-08-25 03:51:20 +08:00
|
|
|
vcpkg_download_distfile(ARCHIVE
|
|
|
|
URLS "https://github.com/libffi/libffi/releases/download/v${VERSION}/libffi-${VERSION}.tar.gz"
|
|
|
|
FILENAME "libffi-${VERSION}.tar.gz"
|
|
|
|
SHA512 88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889
|
2018-03-03 04:28:34 +08:00
|
|
|
)
|
2023-08-25 03:51:20 +08:00
|
|
|
vcpkg_extract_source_archive(
|
|
|
|
SOURCE_PATH
|
|
|
|
ARCHIVE "${ARCHIVE}"
|
|
|
|
PATCHES
|
|
|
|
dll-bindir.diff
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_list(SET options)
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(extra_cflags "-DFFI_BUILDING")
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
string(APPEND extra_cflags " -DFFI_BUILDING_DLL")
|
|
|
|
endif()
|
|
|
|
vcpkg_list(APPEND options "CFLAGS=\${CFLAGS} ${extra_cflags}")
|
|
|
|
endif()
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2023-08-25 03:51:20 +08:00
|
|
|
set(ccas_options "")
|
|
|
|
vcpkg_cmake_get_vars(cmake_vars_file)
|
|
|
|
include("${cmake_vars_file}")
|
|
|
|
if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
|
|
|
set(ccas "${SOURCE_PATH}/msvcc.sh")
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
|
|
|
string(APPEND ccas_options " -m32")
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
|
|
|
string(APPEND ccas_options " -m64")
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
|
|
|
string(APPEND ccas_options " -marm")
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
|
|
|
string(APPEND ccas_options " -marm64")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(ccas "${VCPKG_DETECTED_CMAKE_C_COMPILER}")
|
|
|
|
endif()
|
|
|
|
cmake_path(GET ccas PARENT_PATH ccas_dir)
|
|
|
|
vcpkg_add_to_path("${ccas_dir}")
|
|
|
|
cmake_path(GET ccas FILENAME ccas_command)
|
|
|
|
vcpkg_list(APPEND options "CCAS=${ccas_command}${ccas_options}")
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2023-08-25 03:51:20 +08:00
|
|
|
vcpkg_configure_make(
|
2021-08-31 09:19:44 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2023-08-25 03:51:20 +08:00
|
|
|
DETERMINE_BUILD_TRIPLET
|
|
|
|
USE_WRAPPERS
|
2018-03-03 04:28:34 +08:00
|
|
|
OPTIONS
|
2023-08-25 03:51:20 +08:00
|
|
|
--enable-portable-binary
|
|
|
|
--disable-docs
|
2023-08-31 04:35:47 +08:00
|
|
|
--disable-multi-os-directory
|
2023-08-25 03:51:20 +08:00
|
|
|
${options}
|
2018-04-18 07:18:25 +08:00
|
|
|
)
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2023-08-25 03:51:20 +08:00
|
|
|
vcpkg_install_make()
|
2023-07-06 02:25:06 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2020-07-07 04:40:46 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2023-07-06 02:25:06 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ffi.h" "!defined FFI_BUILDING" "0")
|
2020-02-08 01:36:39 +08:00
|
|
|
endif()
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2023-08-25 03:51:20 +08:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-libffi-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-libffi")
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/libffiConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/share/man3"
|
|
|
|
)
|
|
|
|
|
2023-07-06 02:25:06 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|