diff --git a/ports/libtommath/bcrypt.patch b/ports/libtommath/bcrypt.patch index dc59d79a14..0772cb2c1a 100644 --- a/ports/libtommath/bcrypt.patch +++ b/ports/libtommath/bcrypt.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6b5c73c..77ca1f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -22,8 +22,10 @@ - #----------------------------------------------------------------------------- +@@ -23,6 +23,8 @@ set(PACKAGE_RELEASE_VERSION 1) include(GNUInstallDirs) include(CheckIPOSupported) include(CMakePackageConfigHelpers) @@ -11,32 +11,30 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt # default is "No tests" option(BUILD_TESTING "" OFF) include(CTest) - include(sources.cmake) -@@ -118,8 +120,19 @@ - target_link_options(${PROJECT_NAME} BEFORE PRIVATE +@@ -119,6 +121,18 @@ target_link_options(${PROJECT_NAME} BEFORE PRIVATE ${LTM_LD_FLAGS} ) +if(MSVC) + cmake_push_check_state() + set(CMAKE_REQUIRED_LIBRARIES bcrypt) -+ check_symbol_exists(BCryptGenRandom "Windows.h;bcrypt.h" BCRYPT_AVAILABLE) ++ check_symbol_exists(BCryptGenRandom "windows.h;bcrypt.h" BCRYPT_AVAILABLE) + cmake_pop_check_state() + if(BCRYPT_AVAILABLE) + target_compile_definitions(${PROJECT_NAME} PRIVATE LTM_WIN32_BCRYPT) + target_link_libraries(${PROJECT_NAME} PRIVATE bcrypt) ++ string(APPEND PC_LIBS_PRIVATE -lbcrypt) + endif() +endif() + set(PUBLIC_HEADERS tommath.h) set(C89 False CACHE BOOL "(Usually maintained automatically) Enable when the library is in c89 mode to package the correct header files on install") if(C89) - list(APPEND PUBLIC_HEADERS tommath_c89.h) diff --git a/bn_s_mp_rand_platform.c b/bn_s_mp_rand_platform.c +index 27339bf..097f7be 100644 --- a/bn_s_mp_rand_platform.c +++ b/bn_s_mp_rand_platform.c -@@ -28,8 +28,19 @@ - #endif +@@ -29,6 +29,17 @@ static mp_err s_read_arc4random(void *p, size_t n) #define WIN32_LEAN_AND_MEAN #include @@ -54,9 +52,7 @@ diff --git a/bn_s_mp_rand_platform.c b/bn_s_mp_rand_platform.c #include static mp_err s_read_wincsp(void *p, size_t n) - { -@@ -45,8 +56,9 @@ - hProv = h; +@@ -46,6 +57,7 @@ static mp_err s_read_wincsp(void *p, size_t n) } return CryptGenRandom(hProv, (DWORD)n, (BYTE *)p) == TRUE ? MP_OKAY : MP_ERR; } @@ -64,4 +60,13 @@ diff --git a/bn_s_mp_rand_platform.c b/bn_s_mp_rand_platform.c #endif /* WIN32 */ #if !defined(BN_S_READ_WINCSP_C) && defined(__linux__) && defined(__GLIBC_PREREQ) - #if __GLIBC_PREREQ(2, 25) +diff --git a/libtommath.pc.in b/libtommath.pc.in +index 7ce50fd..4b8e5fa 100644 +--- a/libtommath.pc.in ++++ b/libtommath.pc.in +@@ -6,4 +6,5 @@ Name: LibTomMath + Description: public domain library for manipulating large integer numbers + Version: @PROJECT_VERSION@ + Libs: -L${libdir} -ltommath ++Libs.private: @PC_LIBS_PRIVATE@ + Cflags: -I${includedir} diff --git a/ports/libtommath/pkgconfig.diff b/ports/libtommath/pkgconfig.diff new file mode 100644 index 0000000000..cd0f6b0f81 --- /dev/null +++ b/ports/libtommath/pkgconfig.diff @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0b84e79..6b5c73c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -168,7 +168,7 @@ install(TARGETS ${PROJECT_NAME} + ) + + # Install libtommath.pc for pkg-config if we build a shared library +-if(BUILD_SHARED_LIBS) ++if(1) + # Let the user override the default directory of the pkg-config file (usually this shouldn't be required to be changed) + set(CMAKE_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE PATH "Folder where to install .pc files") + diff --git a/ports/libtommath/portfile.cmake b/ports/libtommath/portfile.cmake index 6237e8a9a8..e429935178 100644 --- a/ports/libtommath/portfile.cmake +++ b/ports/libtommath/portfile.cmake @@ -5,6 +5,7 @@ vcpkg_from_github( SHA512 3dbd7053a670afa563a069a9785f1aa4cab14a210bcd05d8fc7db25bd3dcce36b10a3f4f54ca92d75a694f891226f01bdf6ac15bacafeb93a8be6b04c579beb3 HEAD_REF develop PATCHES + pkgconfig.diff bcrypt.patch import-lib.patch has-set-double.patch # Remove in next release. @@ -18,8 +19,8 @@ vcpkg_cmake_install() vcpkg_copy_pdbs() vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") vcpkg_fixup_pkgconfig() -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") -file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/libtommath/usage b/ports/libtommath/usage deleted file mode 100644 index e2028c1a8e..0000000000 --- a/ports/libtommath/usage +++ /dev/null @@ -1,9 +0,0 @@ -libtommath provides CMake targets: - - find_package(libtommath CONFIG REQUIRED) - target_link_libraries(main PRIVATE libtommath) - -libtommath provides pkg-config modules: - - # public domain library for manipulating large integer numbers - libtommath diff --git a/ports/libtommath/vcpkg.json b/ports/libtommath/vcpkg.json index f0ab532792..c2c1434c8c 100644 --- a/ports/libtommath/vcpkg.json +++ b/ports/libtommath/vcpkg.json @@ -1,7 +1,7 @@ { "name": "libtommath", "version": "1.3.0", - "port-version": 2, + "port-version": 3, "description": "LibTomMath is a free open source portable number theoretic multiple-precision integer library written entirely in C.", "homepage": "https://www.libtom.net/LibTomMath/", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index 3c450be2c2..bc4526b9d1 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5718,7 +5718,7 @@ }, "libtommath": { "baseline": "1.3.0", - "port-version": 2 + "port-version": 3 }, "libtorch": { "baseline": "2.7.1", diff --git a/versions/l-/libtommath.json b/versions/l-/libtommath.json index 6cae53bc48..5ee531333e 100644 --- a/versions/l-/libtommath.json +++ b/versions/l-/libtommath.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "8c4b429fb5503880f905636d43045d9314be4a42", + "version": "1.3.0", + "port-version": 3 + }, { "git-tree": "22eed88d2b6d6ed3b4534de9bf87900e67050394", "version": "1.3.0",