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
|
2023-06-27 07:17:15 +02:00
|
|
|
URLS
|
|
|
|
"https://ftpmirror.gnu.org/gmp/gmp-${VERSION}.tar.xz"
|
|
|
|
"https://ftp.gnu.org/gnu/gmp/gmp-${VERSION}.tar.xz"
|
|
|
|
"https://gmplib.org/download/gmp/gmp-${VERSION}.tar.xz"
|
2022-11-18 21:57:45 +01:00
|
|
|
FILENAME "gmp-${VERSION}.tar.xz"
|
2024-03-01 23:35:31 +01:00
|
|
|
SHA512 e85a0dab5195889948a3462189f0e0598d331d3457612e2d3350799dba2e244316d256f8161df5219538eb003e4b5343f989aaa00f96321559063ed8c8f29fd2
|
2022-03-23 20:14:40 +01:00
|
|
|
)
|
2020-10-28 14:26:41 -07:00
|
|
|
|
2022-11-18 21:57:45 +01:00
|
|
|
vcpkg_extract_source_archive(SOURCE_PATH
|
2022-03-23 20:14:40 +01:00
|
|
|
ARCHIVE "${ARCHIVE}"
|
2022-11-18 21:57:45 +01:00
|
|
|
SOURCE_BASE "v${VERSION}"
|
2022-03-23 20:14:40 +01:00
|
|
|
PATCHES
|
2022-11-18 21:57:45 +01:00
|
|
|
asmflags.patch
|
|
|
|
cross-tools.patch
|
|
|
|
subdirs.patch
|
|
|
|
msvc_symbol.patch
|
|
|
|
arm64-coff.patch
|
2022-03-23 20:14:40 +01:00
|
|
|
)
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-11-18 21:57:45 +01:00
|
|
|
vcpkg_list(SET OPTIONS)
|
|
|
|
if("fat" IN_LIST FEATURES)
|
|
|
|
vcpkg_list(APPEND OPTIONS "--enable-fat")
|
|
|
|
endif()
|
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
2022-11-18 21:57:45 +01:00
|
|
|
vcpkg_list(APPEND OPTIONS
|
|
|
|
"ac_cv_func_memset=yes"
|
|
|
|
"gmp_cv_asm_w32=.word"
|
2023-08-07 18:10:14 +02:00
|
|
|
"gmp_cv_check_libm_for_build=no"
|
2022-11-18 21:57:45 +01:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(disable_assembly OFF)
|
|
|
|
set(ccas "")
|
|
|
|
set(asmflags "-c")
|
|
|
|
vcpkg_cmake_get_vars(cmake_vars_file)
|
|
|
|
include("${cmake_vars_file}")
|
|
|
|
if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
|
|
|
string(APPEND asmflags " --target=i686-pc-windows-msvc")
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
|
|
|
string(APPEND asmflags " --target=x86_64-pc-windows-msvc")
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
|
|
|
string(APPEND asmflags " --target=arm64-pc-windows-msvc")
|
|
|
|
else()
|
|
|
|
set(disable_assembly ON)
|
2020-05-08 22:55:11 +02:00
|
|
|
endif()
|
2022-11-18 21:57:45 +01:00
|
|
|
if(NOT disable_assembly)
|
|
|
|
vcpkg_find_acquire_program(CLANG)
|
|
|
|
set(ccas "${CLANG}")
|
|
|
|
endif()
|
2023-02-23 21:46:13 +01:00
|
|
|
elseif(VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
# not exporting asm functions
|
|
|
|
set(disable_assembly ON)
|
2023-05-09 23:48:09 +02:00
|
|
|
elseif(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
|
|
|
set(ccas "${VCPKG_DETECTED_CMAKE_C_COMPILER}")
|
|
|
|
vcpkg_list(APPEND OPTIONS "ABI=32")
|
|
|
|
string(APPEND asmflags " -m32")
|
2023-02-10 21:02:13 +01:00
|
|
|
else()
|
2022-11-18 21:57:45 +01:00
|
|
|
set(ccas "${VCPKG_DETECTED_CMAKE_C_COMPILER}")
|
2022-03-23 20:14:40 +01:00
|
|
|
endif()
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-11-18 21:57:45 +01:00
|
|
|
if(disable_assembly)
|
|
|
|
vcpkg_list(APPEND OPTIONS "--enable-assembly=no")
|
|
|
|
elseif(ccas)
|
|
|
|
cmake_path(GET ccas PARENT_PATH ccas_dir)
|
|
|
|
vcpkg_add_to_path("${ccas_dir}")
|
|
|
|
cmake_path(GET ccas FILENAME ccas_command)
|
2022-03-23 20:14:40 +01:00
|
|
|
endif()
|
2023-02-23 21:46:13 +01:00
|
|
|
vcpkg_list(APPEND OPTIONS "CCAS=${ccas_command}" "ASMFLAGS=${asmflags}")
|
2020-10-28 14:26:41 -07:00
|
|
|
|
2022-11-18 21:57:45 +01:00
|
|
|
if(VCPKG_CROSSCOMPILING)
|
|
|
|
set(ENV{HOST_TOOLS_PREFIX} "${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}")
|
2022-08-16 18:33:28 +02:00
|
|
|
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-11-18 21:57:45 +01:00
|
|
|
--with-readline=no
|
|
|
|
"gmp_cv_prog_exeext_for_build=${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
2022-03-23 20:14:40 +01:00
|
|
|
)
|
|
|
|
vcpkg_install_make()
|
2022-11-18 21:57:45 +01:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2020-05-08 22:55:11 +02:00
|
|
|
|
2022-03-23 20:14:40 +01:00
|
|
|
if(NOT VCPKG_CROSSCOMPILING)
|
2022-11-18 21:57:45 +01:00
|
|
|
file(INSTALL
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/gen-bases${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/gen-fac${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/gen-fib${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/gen-jacobitab${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/gen-psqr${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
2024-03-01 23:35:31 +01:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/gen-sieve${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
2022-11-18 21:57:45 +01:00
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/gen-trialdivtab${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
|
|
|
DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}"
|
|
|
|
USE_SOURCE_PERMISSIONS
|
|
|
|
)
|
|
|
|
vcpkg_copy_tool_dependencies("${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}")
|
2021-04-30 01:13:35 +02:00
|
|
|
endif()
|
2022-03-23 20:14:40 +01:00
|
|
|
|
2022-11-18 21:57:45 +01:00
|
|
|
file(REMOVE_RECURSE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
|
|
)
|
2022-03-23 20:14:40 +01:00
|
|
|
|
2022-08-19 01:39:56 +08:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2022-11-18 21:57:45 +01:00
|
|
|
|
|
|
|
vcpkg_install_copyright(
|
|
|
|
FILE_LIST
|
|
|
|
"${SOURCE_PATH}/README"
|
|
|
|
"${SOURCE_PATH}/COPYING.LESSERv3"
|
|
|
|
"${SOURCE_PATH}/COPYINGv3"
|
|
|
|
"${SOURCE_PATH}/COPYINGv2"
|
|
|
|
)
|