2021-05-29 01:09:56 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(PATCHES
|
|
|
|
"0001-Use-libtre.patch"
|
|
|
|
"0002-Change-zlib-lib-name-to-match-CMake-output.patch"
|
|
|
|
"0003-Fix-WIN32-macro-checks.patch"
|
|
|
|
"0004-Typedef-POSIX-types-on-Windows.patch"
|
|
|
|
"0005-Include-dirent.h-for-S_ISREG-and-S_ISDIR.patch"
|
|
|
|
"0006-Remove-Wrap-POSIX-headers.patch"
|
|
|
|
"0007-Substitute-unistd-macros-for-MSVC.patch"
|
|
|
|
"0008-Add-FILENO-defines.patch"
|
|
|
|
"0010-Properly-check-for-the-presence-of-bitmasks.patch"
|
|
|
|
"0011-Remove-pipe-related-functions-in-funcs.c.patch"
|
|
|
|
"0012-Convert-MSYS2-paths-to-Windows-paths.patch"
|
|
|
|
"0013-Check-for-backslash-in-argv-0-on-Windows.patch"
|
|
|
|
"0015-MSYS2-Remove-ioctl-call.patch"
|
2023-10-18 02:09:26 +08:00
|
|
|
"0016-Fix-file_famagic-function.patch"
|
2021-05-29 01:09:56 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-01-07 06:29:12 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO file/file
|
2023-10-31 05:42:44 +08:00
|
|
|
REF FILE5_45
|
|
|
|
SHA512 fdd4c5d13d5ea1d25686c76d8ebc3252c54040c4871e3f0f623c4548b3841795d4e36050292a9453eedf0fbf932573890e9d6ac9fa63ccf577215598ae84b9ea
|
2021-05-29 01:09:56 +08:00
|
|
|
HEAD_REF master
|
|
|
|
PATCHES ${PATCHES}
|
2020-01-07 06:29:12 +08:00
|
|
|
)
|
|
|
|
|
2021-05-29 01:09:56 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS")
|
|
|
|
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS")
|
|
|
|
endif()
|
|
|
|
|
2020-01-07 06:29:12 +08:00
|
|
|
vcpkg_configure_make(
|
2020-08-14 04:32:55 +08:00
|
|
|
AUTOCONFIG
|
2021-11-09 12:39:26 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2020-01-07 06:29:12 +08:00
|
|
|
)
|
2021-05-29 01:09:56 +08:00
|
|
|
|
|
|
|
if(VCPKG_CROSSCOMPILING)
|
2021-11-09 12:39:26 +08:00
|
|
|
vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/libmagic/bin")
|
2021-05-29 01:09:56 +08:00
|
|
|
elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
set(EXTRA_ARGS "ADD_BIN_TO_PATH")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_install_make(${EXTRA_ARGS})
|
2021-11-09 12:39:26 +08:00
|
|
|
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
|
|
|
|
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin")
|
|
|
|
vcpkg_fixup_pkgconfig()
|
2020-01-07 06:29:12 +08:00
|
|
|
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
2021-11-09 12:39:26 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
2020-01-07 06:29:12 +08:00
|
|
|
endif()
|
|
|
|
|
2021-05-29 01:09:56 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
2021-11-09 12:39:26 +08:00
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/share/misc")
|
|
|
|
file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}/misc/magic.mgc" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/share/misc")
|
2021-05-29 01:09:56 +08:00
|
|
|
endif()
|
|
|
|
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
2021-11-09 12:39:26 +08:00
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/share/misc")
|
|
|
|
file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}/misc/magic.mgc" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/share/misc")
|
2021-05-29 01:09:56 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-11-09 12:39:26 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man5")
|
2020-01-07 06:29:12 +08:00
|
|
|
|
2023-12-01 18:21:55 +08:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
configure_package_config_file(
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/unofficial-${PORT}-config.cmake.in"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake"
|
|
|
|
INSTALL_DESTINATION "share/unofficial-${PORT}"
|
|
|
|
)
|
|
|
|
|
|
|
|
# Handle copyright and usage
|
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|