[mpc/mpfr] Add new port / update mpfr (#13081)

* [mpc] add mpc port

* [mpfr] update mpfr to use make.

* [gmp] fix preprocessor define for dlls.

* more fixes

* fix mpfr regression on !windows

* install autoconf-archive in provisioning script

* change indent of patches

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* fix merge error

* update PR

* update baseline

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
This commit is contained in:
Alexander Neumann 2021-01-25 08:01:16 +01:00 committed by GitHub
parent 051b33d36c
commit f2ec6c5a7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 156 additions and 298 deletions

12
ports/gmp/adddef.patch Normal file
View File

@ -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

View File

@ -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)
@ -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
@ -97,6 +103,7 @@ else()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
AUTOCONFIG
OPTIONS ${OPTIONS}
)
vcpkg_install_make()
@ -104,5 +111,6 @@ else()
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()

View File

@ -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)",

5
ports/mpc/CONTROL Normal file
View File

@ -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
ports/mpc/gmpd.patch Normal file
View File

@ -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
ports/mpc/portfile.cmake Normal file
View File

@ -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)

View File

@ -1,281 +0,0 @@
cmake_minimum_required(VERSION 3.3.0)
project(MPFR VERSION 4.0.2 LANGUAGES C)
# Find GMP (or MPIR)
find_library(GMP_LIBRARY NAMES gmp mpir)
find_path(GMP_INCLUDE_DIR "gmp.h")
set(GMP_LIBRARIES ${GMP_LIBRARY})
set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR})
# Sources
set(SRCS
src/abort_prec_max.c
src/acos.c
src/acosh.c
src/add.c
src/add1.c
src/add1sp.c
src/add_d.c
src/add_ui.c
src/agm.c
src/ai.c
src/asin.c
src/asinh.c
src/atan.c
src/atan2.c
src/atanh.c
src/bernoulli.c
src/beta.c
src/buildopt.c
src/cache.c
src/cbrt.c
src/check.c
src/clear.c
src/clears.c
src/cmp.c
src/cmp2.c
src/cmp_abs.c
src/cmp_d.c
src/cmp_ld.c
src/cmp_si.c
src/cmp_ui.c
src/comparisons.c
src/constant.c
src/const_catalan.c
src/const_euler.c
src/const_log2.c
src/const_pi.c
src/copysign.c
src/cos.c
src/cosh.c
src/cot.c
src/coth.c
src/csc.c
src/csch.c
src/digamma.c
src/dim.c
src/div.c
src/div_2exp.c
src/div_2si.c
src/div_2ui.c
src/div_d.c
src/div_ui.c
src/dump.c
src/d_div.c
src/d_sub.c
src/eint.c
src/eq.c
src/erandom.c
src/erf.c
src/erfc.c
src/exceptions.c
src/exp.c
src/exp10.c
src/exp2.c
src/exp3.c
src/expm1.c
src/exp_2.c
src/extract.c
src/factorial.c
src/fits_intmax.c
src/fits_sint.c
src/fits_slong.c
src/fits_sshort.c
src/fits_uint.c
src/fits_uintmax.c
src/fits_ulong.c
src/fits_ushort.c
src/fma.c
src/fmma.c
src/fms.c
src/frac.c
src/free_cache.c
src/frexp.c
src/gamma.c
src/gammaonethird.c
src/gamma_inc.c
src/get_d.c
src/get_d64.c
src/get_exp.c
src/get_f.c
src/get_float128.c
src/get_flt.c
src/get_ld.c
src/get_patches.c
src/get_q.c
src/get_si.c
src/get_sj.c
src/get_str.c
src/get_ui.c
src/get_uj.c
src/get_z.c
src/get_z_exp.c
src/gmp_op.c
src/grandom.c
src/hypot.c
src/init.c
src/init2.c
src/inits.c
src/inits2.c
src/inp_str.c
src/int_ceil_log2.c
src/isinf.c
src/isinteger.c
src/isnan.c
src/isnum.c
src/isqrt.c
src/isregular.c
src/iszero.c
src/jn.c
src/li2.c
src/lngamma.c
src/log.c
src/log10.c
src/log1p.c
src/log2.c
src/logging.c
src/log_ui.c
src/minmax.c
src/min_prec.c
src/modf.c
src/mpfr-gmp.c
src/mpfr-mini-gmp.c
src/mpn_exp.c
src/mp_clz_tab.c
src/mul.c
src/mulders.c
src/mul_2exp.c
src/mul_2si.c
src/mul_2ui.c
src/mul_d.c
src/mul_ui.c
src/neg.c
src/next.c
src/nrandom.c
src/odd_p.c
src/out_str.c
src/pool.c
src/pow.c
src/powerof2.c
src/pow_si.c
src/pow_ui.c
src/pow_z.c
src/printf.c
src/print_raw.c
src/print_rnd_mode.c
src/random_deviate.c
src/rec_sqrt.c
src/reldiff.c
src/rem1.c
src/rint.c
src/rndna.c
src/root.c
src/round_near_x.c
src/round_p.c
src/round_prec.c
src/scale2.c
src/sec.c
src/sech.c
src/set.c
src/setmax.c
src/setmin.c
src/setsign.c
src/set_d.c
src/set_d64.c
src/set_dfl_prec.c
src/set_exp.c
src/set_f.c
src/set_float128.c
src/set_flt.c
src/set_inf.c
src/set_ld.c
src/set_nan.c
src/set_prc_raw.c
src/set_prec.c
src/set_q.c
src/set_rnd.c
src/set_si.c
src/set_si_2exp.c
src/set_sj.c
src/set_str.c
src/set_str_raw.c
src/set_ui.c
src/set_ui_2exp.c
src/set_uj.c
src/set_z.c
src/set_zero.c
src/set_z_exp.c
src/sgn.c
src/signbit.c
src/sin.c
src/sinh.c
src/sinh_cosh.c
src/sin_cos.c
src/si_op.c
src/sqr.c
src/sqrt.c
src/sqrt_ui.c
src/stack_interface.c
src/strtofr.c
src/sub.c
src/sub1.c
src/sub1sp.c
src/subnormal.c
src/sub_d.c
src/sub_ui.c
src/sum.c
src/swap.c
src/tan.c
src/tanh.c
src/ubf.c
src/uceil_exp2.c
src/uceil_log2.c
src/ufloor_log2.c
src/ui_div.c
src/ui_pow.c
src/ui_pow_ui.c
src/ui_sub.c
src/urandom.c
src/urandomb.c
src/vasprintf.c
src/version.c
src/volatile.c
src/yn.c
src/zeta.c
src/zeta_ui.c)
configure_file("src/mparam_h.in" "mparam.h")
# Create and configure the target
add_library(mpfr ${SRCS})
# target_compile_definitions(mpfr PRIVATE HAVE_CONFIG_H)
target_compile_definitions(mpfr PRIVATE __MPFR_WITHIN_MPFR)
target_compile_definitions(mpfr PRIVATE HAVE_STDINT_H)
target_compile_definitions(mpfr PRIVATE HAVE_STDARG)
if(BUILD_SHARED_LIBS)
target_compile_definitions(mpfr PRIVATE __GMP_LIBGMP_DLL)
endif()
target_link_libraries(mpfr ${GMP_LIBRARIES})
target_include_directories(mpfr PUBLIC ${GMP_INCLUDE_DIRS})
target_include_directories(mpfr PRIVATE ${CMAKE_BINARY_DIR})
target_include_directories(mpfr PRIVATE ${PROJECT_SOURCE_DIR})
target_include_directories(mpfr PRIVATE ${PROJECT_SOURCE_DIR}/src)
# Install
install(
TARGETS mpfr
EXPORT MPFRExports
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
)
install(
FILES src/mpfr.h
DESTINATION "include"
)

View File

@ -1,5 +1,5 @@
Source: mpfr
Version: 4.0.2-2
Version: 4.1.0
Homepage: https://www.mpfr.org
Description: The MPFR library is a C library for multiple-precision floating-point computations with correct rounding
Build-Depends: mpir
Build-Depends: gmp

13
ports/mpfr/dll.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/configure.ac b/configure.ac
index fdee5978d..0791b2528 100644
--- a/configure.ac
+++ b/configure.ac
@@ -593,7 +593,7 @@ case $host in
AC_MSG_CHECKING(for DLL/static GMP)
if test "$enable_shared" = yes; then
MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined"
- LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-6.dll.def"
+ LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -W1,--no-undefined"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "gmp.h"
#if !__GMP_LIBGMP_DLL

15
ports/mpfr/gmpd.patch Normal file
View File

@ -0,0 +1,15 @@
diff --git a/configure.ac b/configure.ac
index ea92c1f97..9621a70e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -693,8 +693,9 @@ See 'config.log' for details (search for GMP_NUMB_BITS).])],
dnl Check if we can link with GMP
AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
+ [AC_CHECK_LIB(gmpd, __gmpz_init, [LIBS="-lgmpd $LIBS"],
[AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).
-Please read the INSTALL file -- see "In case of problem".])])
+Please read the INSTALL file -- see "In case of problem".])])])
dnl Check for corresponding 'gmp.h' and libgmp
AC_MSG_CHECKING(if gmp.h version and libgmp version are the same)

View File

@ -1,25 +1,35 @@
set(VERSION 4.1.0)
vcpkg_download_distfile(ARCHIVE
URLS "http://www.mpfr.org/mpfr-4.0.2/mpfr-4.0.2.tar.xz" "https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz"
FILENAME "mpfr-4.0.2.tar.xz"
SHA512 d583555d08863bf36c89b289ae26bae353d9a31f08ee3894520992d2c26e5683c4c9c193d7ad139632f71c0a476d85ea76182702a98bf08dde7b6f65a54f8b88
URLS "http://www.mpfr.org/mpfr-${VERSION}/mpfr-${VERSION}.tar.xz" "https://ftp.gnu.org/gnu/mpfr/mpfr-${VERSION}.tar.xz"
FILENAME "mpfr-${VERSION}.tar.xz"
SHA512 1bd1c349741a6529dfa53af4f0da8d49254b164ece8a46928cdb13a99460285622d57fe6f68cef19c6727b3f9daa25ddb3d7d65c201c8f387e421c7f7bee6273
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES
gmpd.patch
dll.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
file(REMOVE_RECURSE "${SOURCE_PATH}/m4")
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
AUTOCONFIG
ADDITIONAL_MSYS_PACKAGES texinfo gettext autoconf-archive
)
vcpkg_install_cmake()
vcpkg_install_make()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/mpfr.pc" AND VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/mpfr.pc" " -lgmp" " -lgmpd")
endif()
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}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -162,6 +162,11 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
SHA512 2d0a60f2c384e3b9e2bed2212867c85333545e51ee0f583a33914e488e43c265ed0017cd4430a6e3dafdca99c0414b3756a4b9cc92a6f04d5566eff8b68def75
DEPS msys2-runtime
)
msys_package(
URL "https://repo.msys2.org/msys/x86_64/texinfo-6.7-1-x86_64.pkg.tar.xz"
SHA512 d352e06c916ab5d8e34722a8d8bb93ff975525349c9bdf8206e472d93b25158134f97ba5101ffd0d32cd8d88522c0935d3c83847e759aa5376a2276aa2a392b3
DEPS bash perl
)
msys_package(
URL "https://repo.msys2.org/msys/x86_64/bash-4.4.023-2-x86_64.pkg.tar.xz"
SHA512 1cf2a07022113010e00e150e7004732013a793d49e7a6ac7c2be27a0b2c0ce3366150584b9974e30df042f8876a84d6a77c1a46f0607e38ebe18f8a25f51c32d
@ -172,6 +177,11 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
SHA512 66b9c97bd3d1dfe2a2ab576235b6b8c204a9e4c099ba14cf5d0139e564bba1e735e3b1083354b4cac8c6c42233cbdd5e1e277e32cadfe24017b94d2fbdeb5617
DEPS m4
)
msys_package(
URL "https://repo.msys2.org/msys/x86_64/autoconf-archive-2019.01.06-1-any.pkg.tar.xz"
SHA512 77540d3d3644d94a52ade1f5db27b7b4b5910bbcd6995195d511378ca6d394a1dd8d606d57161c744699e6c63c5e55dfe6e8664d032cc8c650af9fdbb2db08b0
DEPS m4
)
msys_package(
URL "https://repo.msys2.org/msys/x86_64/diffutils-3.7-1-x86_64.pkg.tar.xz"
SHA512 0c39837a26b2111bb6310cdfe0bc14656e3d57456ad8023f59c9386634a8f1f236915c79a57348b64c508897c73ed88d8abce2b9ac512a427e9a3956939f2040

View File

@ -2205,8 +2205,8 @@
"port-version": 0
},
"gmp": {
"baseline": "6.2.1-2",
"port-version": 0
"baseline": "6.2.1",
"port-version": 3
},
"google-cloud-cpp": {
"baseline": "1.23.0",
@ -3836,8 +3836,12 @@
"baseline": "1.4.0",
"port-version": 0
},
"mpc": {
"baseline": "1.2.0",
"port-version": 0
},
"mpfr": {
"baseline": "4.0.2-2",
"baseline": "4.1.0",
"port-version": 0
},
"mpg123": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3b7459d7ea886b86c9c80890c0b697df9df3cce1",
"version-string": "6.2.1",
"port-version": 3
},
{
"git-tree": "7f067caae5b946b5906abdfee1fb72b53922fef5",
"version-string": "6.2.1-2",

9
versions/m-/mpc.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "82cc965290366b6d4cbc8996a8b9e335769920c8",
"version-string": "1.2.0",
"port-version": 0
}
]
}

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "6cb77c01fbda04c72b1767e3fbd79078bd29895e",
"version-string": "4.1.0",
"port-version": 0
},
{
"git-tree": "7eefb0bc78d4e4422f50379f1ccd05f13c3ed8c2",
"version-string": "4.0.2-2",