Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions ports/gmp/adddef.patch

This file was deleted.

28 changes: 28 additions & 0 deletions ports/gmp/msvc_symbol.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/configure.ac b/configure.ac
index cafdb3c71..bd92bc4bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2703,8 +2703,8 @@ Use "--disable-static --enable-shared" to build just a DLL.])
#
if test "$enable_shared" = yes; then
GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined -Wl,--export-all-symbols"
- LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def"
- LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def"
+ #LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def"
+ #LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def"
LIBGMP_DLL=1
fi
;;
diff --git a/gmp-h.in b/gmp-h.in
index 3d449d427..18a03b753 100644
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -398,7 +398,7 @@ typedef __mpq_struct *mpq_ptr;

/* Microsoft's C compiler accepts __inline */
#ifdef _MSC_VER
-#define __GMP_EXTERN_INLINE __inline
+#define __GMP_EXTERN_INLINE static __inline
#endif

/* Recent enough Sun C compilers want "inline" */
166 changes: 64 additions & 102 deletions ports/gmp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,116 +2,78 @@ if(EXISTS "${CURRENT_INSTALLED_DIR}/include/gmp.h" OR "${CURRENT_INSTALLED_DIR}/
message(FATAL_ERROR "Can't build ${PORT} if mpir is installed. Please remove mpir, and try install ${PORT} again if you need it.")
endif()

if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ShiftMediaProject/gmp
REF 0018c44e8dfcc3b64b43e0aea4b3f419f0b65fd0 #v6.2.1-2
SHA512 2405e2536ca9fe0b890f44f54c936ac0e4b5a9ebe6a19e1c48a9c21b7211d2a1b45865852e3c65a98a6735216a4e27bea75c0fd6e52efeed4baecd95da9895a5
HEAD_REF master
PATCHES
vs.build.patch
runtime.patch
adddef.patch
)
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
)

yasm_tool_helper(OUT_VAR YASM)
file(TO_NATIVE_PATH "${YASM}" YASM)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(PATCHES yasm.patch
msvc_symbol.patch)
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(CONFIGURATION_RELEASE ReleaseDLL)
set(CONFIGURATION_DEBUG DebugDLL)
else()
set(CONFIGURATION_RELEASE Release)
set(CONFIGURATION_DEBUG Debug)
endif()
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE "${ARCHIVE}"
REF gmp-6.2.1
PATCHES
${PATCHES}
tools.patch
)

if(VCPKG_TARGET_IS_UWP)
string(APPEND CONFIGURATION_RELEASE WinRT)
string(APPEND CONFIGURATION_DEBUG WinRT)
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()

#Setup YASM integration
set(_porjectfile)
if(VCPKG_TARGET_IS_UWP)
set(_porjectfile "${SOURCE_PATH}/SMP/libgmp_winrt.vcxproj")
else()
set(_porjectfile "${SOURCE_PATH}/SMP/libgmp.vcxproj")
endif()
set(_file "${_porjectfile}")
file(READ "${_file}" _contents)
string(REPLACE [[<Import Project="$(VCTargetsPath)\BuildCustomizations\yasm.props" />]]
"<Import Project=\"${CURRENT_HOST_INSTALLED_DIR}/share/vs-yasm/yasm.props\" />"
_contents "${_contents}")
string(REPLACE [[<Import Project="$(VCTargetsPath)\BuildCustomizations\yasm.targets" />]]
"<Import Project=\"${CURRENT_HOST_INSTALLED_DIR}/share/vs-yasm/yasm.targets\" />"
_contents "${_contents}")
file(WRITE "${_file}" "${_contents}")
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()

vcpkg_install_msbuild(
USE_VCPKG_INTEGRATION
SOURCE_PATH ${SOURCE_PATH}
PROJECT_SUBPATH SMP/libgmp.sln
PLATFORM ${TRIPLET_SYSTEM_ARCH}
LICENSE_SUBPATH COPYING.LESSERv3
TARGET Rebuild
RELEASE_CONFIGURATION ${CONFIGURATION_RELEASE}
DEBUG_CONFIGURATION ${CONFIGURATION_DEBUG}
SKIP_CLEAN
OPTIONS "/p:YasmPath=${YASM}"
)
get_filename_component(SOURCE_PATH_SUFFIX "${SOURCE_PATH}" NAME)
file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX}/msvc/include" "${CURRENT_PACKAGES_DIR}/include")
set(PACKAGE_VERSION 6.2.1)
set(PACKAGE_NAME gmp)
set(prefix "${CURRENT_INSTALLED_DIR}")
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/include")
set(LIBS -lgmp)
configure_file("${SOURCE_PATH}/gmp.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gmp.pc" @ONLY)
configure_file("${SOURCE_PATH}/gmpxx.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gmpxx.pc" @ONLY)
set(prefix "${CURRENT_INSTALLED_DIR}/debug")
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/../include")
set(LIBS -lgmpd)
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
URLS https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
FILENAME gmp-6.2.1.tar.xz
SHA512 c99be0950a1d05a0297d65641dd35b75b74466f7bf03c9e8a99895a3b2f9a0856cd17887738fa51cf7499781b65c049769271cbcb77d057d2e9f1ec52e07dd84
)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS
${OPTIONS}
--enable-cxx
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF gmp-6.2.1
PATCHES
tools.patch
)
set(tool_names bases fac fib jacobitab psqr trialdivtab)
list(TRANSFORM tool_names PREPEND "gen-")
list(TRANSFORM tool_names APPEND "${VCPKG_HOST_EXECUTABLE_SUFFIX}")

vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
AUTOCONFIG
OPTIONS
--enable-cxx
)
if(VCPKG_CROSSCOMPILING)
list(TRANSFORM tool_names PREPEND "${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}/")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
list(TRANSFORM tool_names PREPEND "${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}/")
list(TRANSFORM tool_names PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}/")

I don't think this is special enough to need a new top-level directory "manual-tools"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual-tools already exists in e.g. the vcpkg-tool-python2 port and it is intended that those tools dont get automatically added to CMAKE_PROGRAM_PATH.

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

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

# # Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYINGv3" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
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}" )
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}/COPYINGv3" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

Loading