aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/bigint
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/bigint')
-rw-r--r--vcpkg/ports/bigint/CMakeLists.txt42
-rw-r--r--vcpkg/ports/bigint/fix-osx-usage.patch39
-rw-r--r--vcpkg/ports/bigint/portfile.cmake25
-rw-r--r--vcpkg/ports/bigint/vcpkg.json17
4 files changed, 123 insertions, 0 deletions
diff --git a/vcpkg/ports/bigint/CMakeLists.txt b/vcpkg/ports/bigint/CMakeLists.txt
new file mode 100644
index 0000000..fffc941
--- /dev/null
+++ b/vcpkg/ports/bigint/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required(VERSION 3.14.0)
+project(bigint CXX)
+
+if(MSVC)
+ add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS)
+endif()
+
+set(BIGINT_SRCS
+ BigUnsigned.cc
+ BigInteger.cc
+ BigIntegerAlgorithms.cc
+ BigUnsignedInABase.cc
+ BigIntegerUtils.cc
+)
+
+set(BIGINT_HH
+ NumberlikeArray.hh
+ BigUnsigned.hh
+ BigInteger.hh
+ BigIntegerAlgorithms.hh
+ BigUnsignedInABase.hh
+ BigIntegerLibrary.hh
+ BigIntegerUtils.hh
+)
+
+add_library(bigint ${BIGINT_SRCS})
+target_include_directories(bigint PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
+
+install(
+ TARGETS bigint
+ EXPORT bigint-config
+)
+
+install(
+ EXPORT bigint-config
+ NAMESPACE bigint::
+ DESTINATION share/bigint
+)
+
+if(NOT DISABLE_INSTALL_HEADERS)
+ install(FILES ${BIGINT_HH} DESTINATION include/bigint)
+endif()
diff --git a/vcpkg/ports/bigint/fix-osx-usage.patch b/vcpkg/ports/bigint/fix-osx-usage.patch
new file mode 100644
index 0000000..f387d7b
--- /dev/null
+++ b/vcpkg/ports/bigint/fix-osx-usage.patch
@@ -0,0 +1,39 @@
+diff --git a/BigUnsigned.hh b/BigUnsigned.hh
+index adf1c00..9228753 100644
+--- a/BigUnsigned.hh
++++ b/BigUnsigned.hh
+@@ -20,7 +20,7 @@ public:
+ typedef unsigned long Blk;
+
+ typedef NumberlikeArray<Blk>::Index Index;
+- NumberlikeArray<Blk>::N;
++ using NumberlikeArray<Blk>::N;
+
+ protected:
+ // Creates a BigUnsigned with a capacity; for internal use.
+@@ -84,8 +84,8 @@ public:
+ // BIT/BLOCK ACCESSORS
+
+ // Expose these from NumberlikeArray directly.
+- NumberlikeArray<Blk>::getCapacity;
+- NumberlikeArray<Blk>::getLength;
++ using NumberlikeArray<Blk>::getCapacity;
++ using NumberlikeArray<Blk>::getLength;
+
+ /* Returns the requested block, or 0 if it is beyond the length (as if
+ * the number had 0s infinitely to the left). */
+diff --git a/BigUnsignedInABase.hh b/BigUnsignedInABase.hh
+index 8f9bdce..0ea89c6 100644
+--- a/BigUnsignedInABase.hh
++++ b/BigUnsignedInABase.hh
+@@ -100,8 +100,8 @@ public:
+ Base getBase() const { return base; }
+
+ // Expose these from NumberlikeArray directly.
+- NumberlikeArray<Digit>::getCapacity;
+- NumberlikeArray<Digit>::getLength;
++ using NumberlikeArray<Digit>::getCapacity;
++ using NumberlikeArray<Digit>::getLength;
+
+ /* Returns the requested digit, or 0 if it is beyond the length (as if
+ * the number had 0s infinitely to the left). */
diff --git a/vcpkg/ports/bigint/portfile.cmake b/vcpkg/ports/bigint/portfile.cmake
new file mode 100644
index 0000000..d194219
--- /dev/null
+++ b/vcpkg/ports/bigint/portfile.cmake
@@ -0,0 +1,25 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://mattmccutchen.net/bigint/bigint-2010.04.30.tar.bz2"
+ FILENAME "bigint-2010.04.30.tar.bz2"
+ SHA512 bb64380e51991f97a2489c04801ab4372f795b5e23870ad12d71087f1a2afba9b32f74dcdbdcb5228ebf0dd74a37185285bac7653dd3c62d6118d63c298689af
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES fix-osx-usage.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup()
+
+file(INSTALL "${SOURCE_PATH}/README" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/bigint/vcpkg.json b/vcpkg/ports/bigint/vcpkg.json
new file mode 100644
index 0000000..c8d27e6
--- /dev/null
+++ b/vcpkg/ports/bigint/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "bigint",
+ "version-string": "2010.04.30",
+ "port-version": 8,
+ "description": "C++ Big Integer Library",
+ "homepage": "https://mattmccutchen.net/bigint",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}