2020-08-06 05:08:18 +08:00
|
|
|
if(EXISTS "${CURRENT_INSTALLED_DIR}/include/gmp.h" OR "${CURRENT_INSTALLED_DIR}/include/gmpxx.h")
|
|
|
|
message(FATAL_ERROR "Can't build ${PORT} if mpir is installed. Please remove mpir, and try install ${PORT} again if you need it.")
|
|
|
|
endif()
|
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
|
|
|
URLS https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
|
|
|
|
FILENAME gmp-6.2.1.tar.xz
|
|
|
|
SHA512 c99be0950a1d05a0297d65641dd35b75b74466f7bf03c9e8a99895a3b2f9a0856cd17887738fa51cf7499781b65c049769271cbcb77d057d2e9f1ec52e07dd84
|
|
|
|
)
|
2020-10-28 14:26:41 -07:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
|
|
|
set(PATCHES yasm.patch
|
|
|
|
msvc_symbol.patch)
|
|
|
|
endif()
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
vcpkg_extract_source_archive_ex(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
ARCHIVE "${ARCHIVE}"
|
|
|
|
REF gmp-6.2.1
|
|
|
|
PATCHES
|
|
|
|
${PATCHES}
|
|
|
|
tools.patch
|
|
|
|
)
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
|
|
|
set(ENV{CCAS} "${CURRENT_HOST_INSTALLED_DIR}/tools/yasm/yasm${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
|
|
|
set(asmflag win64)
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
|
|
|
set(asmflag win32)
|
2020-05-08 22:55:11 +02:00
|
|
|
endif()
|
2022-03-23 20:14:40 +01:00
|
|
|
set(ENV{ASMFLAGS} "-Xvc -f ${asmflag} -pgas -rraw")
|
|
|
|
set(OPTIONS ac_cv_func_memset=yes
|
|
|
|
"gmp_cv_asm_w32=.word"
|
|
|
|
)
|
|
|
|
|
|
|
|
endif()
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
if(VCPKG_CROSSCOMPILING)
|
|
|
|
# Silly trick to make configure accept CC_FOR_BUILD but in reallity CC_FOR_BUILD is deactivated.
|
|
|
|
set(ENV{CC_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true")
|
|
|
|
set(ENV{CPP_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true")
|
|
|
|
endif()
|
2020-10-28 14:26:41 -07:00
|
|
|
|
2022-08-16 18:33:28 +02:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^(arm|arm64)$")
|
|
|
|
list(APPEND OPTIONS --enable-assembly=no)
|
|
|
|
endif()
|
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
vcpkg_configure_make(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
AUTOCONFIG
|
|
|
|
OPTIONS
|
|
|
|
${OPTIONS}
|
|
|
|
--enable-cxx
|
2022-06-15 19:58:03 +02:00
|
|
|
--with-pic
|
2022-03-23 20:14:40 +01:00
|
|
|
)
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
set(tool_names bases fac fib jacobitab psqr trialdivtab)
|
|
|
|
list(TRANSFORM tool_names PREPEND "gen-")
|
|
|
|
list(TRANSFORM tool_names APPEND "${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
if(VCPKG_CROSSCOMPILING)
|
|
|
|
list(TRANSFORM tool_names PREPEND "${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}/")
|
|
|
|
file(COPY ${tool_names} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/" )
|
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
|
|
file(COPY ${tool_names} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/" )
|
|
|
|
endif()
|
|
|
|
endif()
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
vcpkg_install_make()
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
if(NOT VCPKG_CROSSCOMPILING)
|
|
|
|
list(TRANSFORM tool_names PREPEND "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/")
|
|
|
|
file(COPY ${tool_names} DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}" )
|
2021-04-30 01:13:35 +02:00
|
|
|
endif()
|
2022-03-23 20:14:40 +01:00
|
|
|
|
|
|
|
vcpkg_fixup_pkgconfig()
|
2022-08-29 20:53:49 +02:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
2022-03-23 20:14:40 +01:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
2022-08-29 20:53:49 +02:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/info")
|
2022-03-23 20:14:40 +01:00
|
|
|
|
|
|
|
# Handle copyright
|
|
|
|
file(INSTALL "${SOURCE_PATH}/COPYINGv3" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
2022-08-19 01:39:56 +08:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|