diff --git a/ports/gmp/arm64-coff.patch b/ports/gmp/arm64-coff.patch new file mode 100644 index 00000000000000..67bf5bf2073a2a --- /dev/null +++ b/ports/gmp/arm64-coff.patch @@ -0,0 +1,73 @@ +diff --git a/configure.ac b/configure.ac +index bd92bc4..bd2c0af 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3704,6 +3704,8 @@ if test "$gmp_asm_syntax_testing" != no; then + case $host in + *-*-darwin*) + GMP_INCLUDE_MPN(arm64/darwin.m4) ;; ++ *-pc-mingw32) ++ GMP_INCLUDE_MPN(arm64/coff.m4) ;; + *) + GMP_INCLUDE_MPN(arm64/arm64-defs.m4) ;; + esac +diff --git a/mpn/arm64/coff.m4 b/mpn/arm64/coff.m4 +new file mode 100644 +index 0000000..88605b3 +--- /dev/null ++++ b/mpn/arm64/coff.m4 +@@ -0,0 +1,54 @@ ++divert(-1) ++ ++dnl m4 macros for ARM64 COFF assembler. ++ ++dnl Copyright 2020 Free Software Foundation, Inc. ++ ++dnl This file is part of the GNU MP Library. ++dnl ++dnl The GNU MP Library is free software; you can redistribute it and/or modify ++dnl it under the terms of either: ++dnl ++dnl * the GNU Lesser General Public License as published by the Free ++dnl Software Foundation; either version 3 of the License, or (at your ++dnl option) any later version. ++dnl ++dnl or ++dnl ++dnl * the GNU General Public License as published by the Free Software ++dnl Foundation; either version 2 of the License, or (at your option) any ++dnl later version. ++dnl ++dnl or both in parallel, as here. ++dnl ++dnl The GNU MP Library is distributed in the hope that it will be useful, but ++dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++dnl for more details. ++dnl ++dnl You should have received copies of the GNU General Public License and the ++dnl GNU Lesser General Public License along with the GNU MP Library. If not, ++dnl see https://www.gnu.org/licenses/. ++ ++ ++dnl Standard commenting is with @, the default m4 # is for constants and we ++dnl don't want to disable macro expansions in or after them. ++ ++changecom ++ ++ ++dnl LEA_HI(reg,gmp_symbol), LEA_LO(reg,gmp_symbol) ++dnl ++dnl Load the address of gmp_symbol into a register. We split this into two ++dnl parts to allow separation for manual insn scheduling. ++ ++define(`LEA_HI', `ldr $1, =$2')dnl ++define(`LEA_LO')dnl ++ ++dnl Usage: ALIGN(bytes) ++dnl ++dnl Emit a ".align" directive. ++ ++define(`ALIGN', ` .align 8')dnl ++ ++divert`'dnl diff --git a/ports/gmp/portfile.cmake b/ports/gmp/portfile.cmake index 00abc340a96996..b3c45190a19a34 100644 --- a/ports/gmp/portfile.cmake +++ b/ports/gmp/portfile.cmake @@ -12,6 +12,41 @@ vcpkg_download_distfile( if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) set(PATCHES yasm.patch msvc_symbol.patch) + + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + # Hint to use clang x86/x64 version in emulation mode on an ARM device + vcpkg_add_to_path("$ENV{VCINSTALLDIR}/Tools/Llvm/bin") + + find_program(clang-cl-check clang-cl) + if (NOT clang-cl-check) + message(FATAL_ERROR "${PORT} requires Clang installed for ${VCPKG_TARGET_ARCHITECTURE} target architecture. For instance, Clang can be installed by using Visual Studio or LLVM installers") + endif() + + set(ENV{CCAS} "clang-cl --target=arm64-pc-win32 -c") + # Avoid the x18 register since it is reserved on Darwin. + vcpkg_download_distfile( + ARM64PATCH + URLS https://gmplib.org/repo/gmp/raw-rev/5f32dbc41afc + FILENAME gmp-arm64-asm-fix-5f32dbc41afc.patch + SHA512 4a7c50dc0a78e6c297c0ac53129ed367dbf669100a613653987d0eddf175376296254ed26ecce15d02b0544b99e44719af49635e54982b22e745f22e2f8d1eda + ) + + list(APPEND PATCHES "${ARM64PATCH}" arm64-coff.patch) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + list(APPEND OPTIONS --enable-assembly=no) + else() + 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) + endif() + set(ENV{ASMFLAGS} "-Xvc -f ${asmflag} -pgas -rraw") + endif() + + list(APPEND OPTIONS ac_cv_func_memset=yes + "gmp_cv_asm_w32=.word" + ) endif() vcpkg_extract_source_archive_ex( @@ -23,30 +58,12 @@ vcpkg_extract_source_archive_ex( tools.patch ) -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) - endif() - set(ENV{ASMFLAGS} "-Xvc -f ${asmflag} -pgas -rraw") - set(OPTIONS ac_cv_func_memset=yes - "gmp_cv_asm_w32=.word" - ) - -endif() - if(VCPKG_CROSSCOMPILING) - # Silly trick to make configure accept CC_FOR_BUILD but in reallity CC_FOR_BUILD is deactivated. + # 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() -if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^(arm|arm64)$") - list(APPEND OPTIONS --enable-assembly=no) -endif() - vcpkg_configure_make( SOURCE_PATH "${SOURCE_PATH}" AUTOCONFIG diff --git a/ports/gmp/vcpkg.json b/ports/gmp/vcpkg.json index 1398c8233d1808..0f90198bbfaf42 100644 --- a/ports/gmp/vcpkg.json +++ b/ports/gmp/vcpkg.json @@ -1,7 +1,7 @@ { "name": "gmp", "version": "6.2.1", - "port-version": 13, + "port-version": 14, "description": "The GNU Multiple Precision Arithmetic Library", "homepage": "https://gmplib.org", "license": "LGPL-3.0-only OR GPL-2.0-only", diff --git a/versions/baseline.json b/versions/baseline.json index 95b9b98a324c74..f39dc73809c962 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2690,7 +2690,7 @@ }, "gmp": { "baseline": "6.2.1", - "port-version": 13 + "port-version": 14 }, "gmsh": { "baseline": "4.9.0", diff --git a/versions/g-/gmp.json b/versions/g-/gmp.json index 8fd6673aae8147..0a9bfe4ee75eed 100644 --- a/versions/g-/gmp.json +++ b/versions/g-/gmp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "bbdf09a738d5ead125ea27d5b4cd6ffd957b2fae", + "version": "6.2.1", + "port-version": 14 + }, { "git-tree": "28b5b46e27a69da50c1cd0a8be5d0a32cbca120b", "version": "6.2.1",