Skip to content

Commit

Permalink
Merge pull request #509 from microsoft/master
Browse files Browse the repository at this point in the history
[mpc/mpfr] Add new port / update mpfr (microsoft#13081)
  • Loading branch information
Jimmy-Hu authored Jan 25, 2021
2 parents 3a601ae + f2ec6c5 commit 3e7e447
Show file tree
Hide file tree
Showing 16 changed files with 156 additions and 298 deletions.
12 changes: 12 additions & 0 deletions ports/gmp/adddef.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/SMP/libgmp.def b/SMP/libgmp.def
index 289f0e2d1..632274ab2 100644
--- a/SMP/libgmp.def
+++ b/SMP/libgmp.def
@@ -16,6 +16,7 @@ __gmp_randclear
__gmp_urandomb_ui
__gmp_urandomm_ui
__gmp_asprintf
+__gmp_vasprintf
__gmp_fprintf
__gmp_printf
__gmp_snprintf
12 changes: 10 additions & 2 deletions ports/gmp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ if(VCPKG_TARGET_IS_WINDOWS)
REF 0018c44e8dfcc3b64b43e0aea4b3f419f0b65fd0 #v6.2.1-2
SHA512 2405e2536ca9fe0b890f44f54c936ac0e4b5a9ebe6a19e1c48a9c21b7211d2a1b45865852e3c65a98a6735216a4e27bea75c0fd6e52efeed4baecd95da9895a5
HEAD_REF master
PATCHES
PATCHES
vs.build.patch
runtime.patch
adddef.patch
)

include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake)
Expand Down Expand Up @@ -80,6 +81,11 @@ if(VCPKG_TARGET_IS_WINDOWS)
configure_file("${SOURCE_PATH}/gmp.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gmp.pc" @ONLY)
configure_file("${SOURCE_PATH}/gmpxx.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gmpxx.pc" @ONLY)
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/gmp.h"
"#if defined(DLL_EXPORT) && defined(NO_ASM)"
"#if 1")
endif()
else()
vcpkg_download_distfile(
ARCHIVE
Expand All @@ -97,12 +103,14 @@ else()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
AUTOCONFIG
OPTIONS ${OPTIONS}
)

vcpkg_install_make()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share/")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

# # Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYINGv3" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
endif()
endif()
3 changes: 2 additions & 1 deletion ports/gmp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "gmp",
"version-string": "6.2.1-2",
"version-string": "6.2.1",
"port-version": 3,
"description": "The GNU Multiple Precision Arithmetic Library",
"homepage": "https://gmplib.org",
"supports": "windows & !(arm | arm64)",
Expand Down
5 changes: 5 additions & 0 deletions ports/mpc/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Source: mpc
Version: 1.2.0
Homepage: http://www.multiprecision.org/mpc/
Description: GNU MPC is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.
Build-Depends: gmp, mpfr
15 changes: 15 additions & 0 deletions ports/mpc/gmpd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/configure.ac b/configure.ac
index ab3da6092..2533df1d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,7 +151,9 @@ AC_CHECK_FUNCS([dup dup2],,

AC_CHECK_LIB([gmp], [__gmpz_init],
[LIBS="-lgmp $LIBS"],
- [AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).])])
+ [AC_CHECK_LIB([gmpd], [__gmpz_init],
+ [LIBS="-lgmpd $LIBS"],
+ [AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).])])])

AC_MSG_CHECKING(for MPFR)
LIBS="-lmpfr $LIBS"
27 changes: 27 additions & 0 deletions ports/mpc/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.gnu.org/gnu/mpc/mpc-1.2.0.tar.gz"
FILENAME "mpc-1.2.0.tar.gz"
SHA512 84fa3338f51d369111456a63ad040256a1beb70699e21e2a932c779aa1c3bd08b201412c1659ecbb58403ea0548faacc35996d94f88f0639549269b7563c61b7
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES gmpd.patch
)

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
)

vcpkg_install_make()

vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

# # Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING.LESSER" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

281 changes: 0 additions & 281 deletions ports/mpfr/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 3e7e447

Please sign in to comment.