aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/mpir
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/mpir
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/mpir')
-rw-r--r--vcpkg/ports/mpir/enable-runtimelibrary-toggle.patch27
-rw-r--r--vcpkg/ports/mpir/fix-static-include-files.patch69
-rw-r--r--vcpkg/ports/mpir/portfile.cmake83
-rw-r--r--vcpkg/ports/mpir/vcpkg.json16
4 files changed, 195 insertions, 0 deletions
diff --git a/vcpkg/ports/mpir/enable-runtimelibrary-toggle.patch b/vcpkg/ports/mpir/enable-runtimelibrary-toggle.patch
new file mode 100644
index 0000000..391d4e1
--- /dev/null
+++ b/vcpkg/ports/mpir/enable-runtimelibrary-toggle.patch
@@ -0,0 +1,27 @@
+diff --git a/build.vc/mpir_debug_lib.props b/build.vc/mpir_debug_lib.props
+index b2fd57b..3937570 100644
+--- a/build.vc/mpir_debug_lib.props
++++ b/build.vc/mpir_debug_lib.props
+@@ -9,7 +9,8 @@
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <ObjectFileName>$(IntDir)dum\my\%(RelativeDir)</ObjectFileName>
+- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
++ <RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary>
++ <DebugInformationFormat>OldStyle</DebugInformationFormat>
+ <ProgramDataBaseFileName>$(TargetDir)$(TargetName).pdb</ProgramDataBaseFileName>
+ </ClCompile>
+ <Link>
+diff --git a/build.vc/mpir_release_lib.props b/build.vc/mpir_release_lib.props
+index 6cdff3e..3937570 100644
+--- a/build.vc/mpir_release_lib.props
++++ b/build.vc/mpir_release_lib.props
+@@ -9,7 +9,7 @@
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <ObjectFileName>$(IntDir)dum\my\%(RelativeDir)</ObjectFileName>
+- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
++ <RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary>
+ <ProgramDataBaseFileName>$(TargetDir)$(TargetName).pdb</ProgramDataBaseFileName>
+ </ClCompile>
+ <Link>
diff --git a/vcpkg/ports/mpir/fix-static-include-files.patch b/vcpkg/ports/mpir/fix-static-include-files.patch
new file mode 100644
index 0000000..5ae3073
--- /dev/null
+++ b/vcpkg/ports/mpir/fix-static-include-files.patch
@@ -0,0 +1,69 @@
+diff --git a/build.vc/postbuild.bat b/build.vc/postbuild.bat
+index de1ed08..e4ecceb 100644
+--- a/build.vc/postbuild.bat
++++ b/build.vc/postbuild.bat
+@@ -37,12 +37,10 @@ set bin_dir="..\%extn%\%plat%\%conf%\"
+ set hdr_dir="..\%extn%\%plat%\%conf%\"
+
+ rem output parametrers for the MPIR tests
+-if /i "%filename%" EQU "mpirxx" goto skip
+ echo (set ldir=%loc%) > output_params.bat
+ echo (set libr=%extn%) >> output_params.bat
+ echo (set plat=%plat%) >> output_params.bat
+ echo (set conf=%conf%) >> output_params.bat
+-:skip
+
+ echo copying outputs from %tgt_dir% to %bin_dir%
+ if not exist %bin_dir% md %bin_dir%
+diff --git a/build.vc15/lib_mpir_cxx/lib_mpir_cxx.vcxproj b/build.vc15/lib_mpir_cxx/lib_mpir_cxx.vcxproj
+index 3a23f01..1f44b22 100644
+--- a/build.vc15/lib_mpir_cxx/lib_mpir_cxx.vcxproj
++++ b/build.vc15/lib_mpir_cxx/lib_mpir_cxx.vcxproj
+@@ -70,6 +70,11 @@
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mpirxx</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
++ <PreBuildEvent>
++ <Command>cd ..\..\build.vc
++prebuild gc Win32 15
++ </Command>
++ </PreBuildEvent>
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+@@ -82,6 +87,11 @@ postbuild "$(TargetPath)" 15
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
++ <PreBuildEvent>
++ <Command>cd ..\..\build.vc
++prebuild gc Win32 15
++ </Command>
++ </PreBuildEvent>
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;WIN32;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+@@ -94,6 +104,11 @@ postbuild "$(TargetPath)" 15
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
++ <PreBuildEvent>
++ <Command>cd ..\..\build.vc
++prebuild gc Win32 15
++ </Command>
++ </PreBuildEvent>
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+@@ -106,6 +121,11 @@ postbuild "$(TargetPath)" 15
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
++ <PreBuildEvent>
++ <Command>cd ..\..\build.vc
++prebuild gc Win32 15
++ </Command>
++ </PreBuildEvent>
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;WIN32;_LIB;HAVE_CONFIG_H;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
diff --git a/vcpkg/ports/mpir/portfile.cmake b/vcpkg/ports/mpir/portfile.cmake
new file mode 100644
index 0000000..3ce9ca3
--- /dev/null
+++ b/vcpkg/ports/mpir/portfile.cmake
@@ -0,0 +1,83 @@
+if(EXISTS "${CURRENT_INSTALLED_DIR}/include/gmp.h" OR EXISTS "${CURRENT_INSTALLED_DIR}/include/gmpxx.h")
+ message(FATAL_ERROR "Can't build ${PORT} if gmp is installed. Please remove gmp, and try to install ${PORT} again if you need it.")
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO wbhart/mpir
+ REF cdd444aedfcbb190f00328526ef278428702d56e # 3.0.0
+ SHA512 f46e45bdba27c9f89953ba23186b694486fd3010bd370ea2de71a4649a2816e716a6520c9baa96936f1884437ef03f92b21c0b1fb5b757beba5a05fed30b2bfc
+ HEAD_REF master
+ PATCHES
+ enable-runtimelibrary-toggle.patch
+ fix-static-include-files.patch
+)
+
+if(NOT VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_find_acquire_program(YASM)
+
+ set(SHARED_STATIC --disable-static --enable-shared)
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ set(SHARED_STATIC --enable-static --disable-shared --with-pic)
+ endif()
+
+ set(OPTIONS --disable-silent-rules --enable-gmpcompat --enable-cxx ${SHARED_STATIC})
+
+ string(APPEND VCPKG_C_FLAGS " -Wno-implicit-function-declaration")
+ string(APPEND VCPKG_CXX_FLAGS " -Wno-implicit-function-declaration")
+
+ # on Linux, autoconf is required; on macOS, it isn't
+ if(VCPKG_TARGET_IS_LINUX)
+ set(AUTOCONFIG "AUTOCONFIG")
+ endif()
+
+ vcpkg_configure_make(
+ SOURCE_PATH "${SOURCE_PATH}"
+ ${AUTOCONFIG}
+ OPTIONS ${OPTIONS}
+ )
+ vcpkg_install_make()
+else()
+ set(MSVC_VERSION 14)
+ if(VCPKG_PLATFORM_TOOLSET MATCHES "v14(1|2|3)")
+ set(MSVC_VERSION 15)
+ endif()
+
+ set(DLL_OR_LIB dll)
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ set(DLL_OR_LIB lib)
+ endif()
+
+ # Note: Could probably be moved to use vcpkg_configure_make on windows
+ vcpkg_msbuild_install(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PROJECT_SUBPATH "build.vc${MSVC_VERSION}/${DLL_OR_LIB}_mpir_gc/${DLL_OR_LIB}_mpir_gc.vcxproj"
+ )
+
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ vcpkg_msbuild_install(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PROJECT_SUBPATH "build.vc${MSVC_VERSION}/${DLL_OR_LIB}_mpir_cxx/${DLL_OR_LIB}_mpir_cxx.vcxproj"
+ )
+ endif()
+
+ file(GLOB HEADERS
+ "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/*/Release/gmp.h"
+ "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/*/Release/gmpxx.h"
+ "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/*/Release/mpir.h"
+ "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/*/Release/mpirxx.h"
+ )
+ file(INSTALL ${HEADERS} DESTINATION "${CURRENT_PACKAGES_DIR}/include")
+
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/COPYING.LIB" "${CURRENT_PACKAGES_DIR}/debug/lib/COPYING.LIB")
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
+endif()
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+ )
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING" "${SOURCE_PATH}/COPYING.LIB")
diff --git a/vcpkg/ports/mpir/vcpkg.json b/vcpkg/ports/mpir/vcpkg.json
new file mode 100644
index 0000000..9df67f4
--- /dev/null
+++ b/vcpkg/ports/mpir/vcpkg.json
@@ -0,0 +1,16 @@
+{
+ "name": "mpir",
+ "version-date": "2022-03-02",
+ "port-version": 3,
+ "description": "Multiple Precision Integers and Rationals",
+ "homepage": "https://github.com/wbhart/mpir",
+ "license": null,
+ "supports": "!(uwp | arm)",
+ "dependencies": [
+ {
+ "name": "vcpkg-msbuild",
+ "host": true,
+ "platform": "windows"
+ }
+ ]
+}