git: edab87269924 - main - math/libtommath: add missing patch

From: Pietro Cerutti <gahr_at_FreeBSD.org>
Date: Thu, 04 Apr 2024 04:05:29 UTC
The branch main has been updated by gahr:

URL: https://cgit.FreeBSD.org/ports/commit/?id=edab8726992480217bcef72d40947150d6932690

commit edab8726992480217bcef72d40947150d6932690
Author:     Pietro Cerutti <gahr@FreeBSD.org>
AuthorDate: 2024-04-04 04:04:16 +0000
Commit:     Pietro Cerutti <gahr@FreeBSD.org>
CommitDate: 2024-04-04 04:05:26 +0000

    math/libtommath: add missing patch
---
 math/libtommath/files/patch-CMakeLists.txt | 124 +++++++++++++++++++++++++++++
 1 file changed, 124 insertions(+)

diff --git a/math/libtommath/files/patch-CMakeLists.txt b/math/libtommath/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..fe22d8758e0f
--- /dev/null
+++ b/math/libtommath/files/patch-CMakeLists.txt
@@ -0,0 +1,124 @@
+--- CMakeLists.txt.orig	2024-03-27 13:30:15 UTC
++++ CMakeLists.txt
+@@ -29,11 +29,6 @@ include(sources.cmake)
+ include(sources.cmake)
+ 
+ #-----------------------------------------------------------------------------
+-# Options
+-#-----------------------------------------------------------------------------
+-option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"ON\", default is static" OFF)
+-
+-#-----------------------------------------------------------------------------
+ # Add support for ccache if desired
+ #-----------------------------------------------------------------------------
+ find_program(CCACHE ccache)
+@@ -103,6 +98,7 @@ add_library(${PROJECT_NAME}
+ # library target
+ #-----------------------------------------------------------------------------
+ add_library(${PROJECT_NAME}
++    OBJECT
+     ${SOURCES}
+     ${HEADERS}
+ )
+@@ -125,12 +121,23 @@ endif()
+     list(APPEND PUBLIC_HEADERS tommath_c89.h)
+ endif()
+ 
++add_library(${PROJECT_NAME}_shared SHARED $<TARGET_OBJECTS:${PROJECT_NAME}>)
++add_library(${PROJECT_NAME}_static STATIC $<TARGET_OBJECTS:${PROJECT_NAME}>)
+ set_target_properties(${PROJECT_NAME} PROPERTIES
++    POSITION_INDEPENDENT_CODE TRUE
++)
++set_target_properties(${PROJECT_NAME}_shared PROPERTIES
+     OUTPUT_NAME tommath
+     VERSION ${PROJECT_VERSION}
+     SOVERSION ${PROJECT_VERSION_MAJOR}
+     PUBLIC_HEADER "${PUBLIC_HEADERS}"
+ )
++set_target_properties(${PROJECT_NAME}_static PROPERTIES
++    OUTPUT_NAME tommath
++    VERSION ${PROJECT_VERSION}
++    SOVERSION ${PROJECT_VERSION_MAJOR}
++    PUBLIC_HEADER "${PUBLIC_HEADERS}"
++)
+ 
+ option(COMPILE_LTO "Build with LTO enabled")
+ if(COMPILE_LTO)
+@@ -159,7 +166,7 @@ set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
+ set(PROJECT_CONFIG_FILE "${PROJECT_NAME}-config.cmake")
+ set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
+ 
+-install(TARGETS ${PROJECT_NAME}
++install(TARGETS ${PROJECT_NAME}_shared ${PROJECT_NAME}_static
+     EXPORT ${TARGETS_EXPORT_NAME}
+     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries
+@@ -168,20 +175,18 @@ install(TARGETS ${PROJECT_NAME}
+ )
+ 
+ # Install libtommath.pc for pkg-config if we build a shared library
+-if(BUILD_SHARED_LIBS)
+-    # 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")
++# 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")
+ 
+-    configure_file(
+-        ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in
+-        ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
+-        @ONLY
+-    )
++configure_file(
++    ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in
++    ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
++    @ONLY
++)
+ 
+-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
+-        DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
+-    )
+-endif()
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
++    DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
++)
+ 
+ # generate package version file
+ write_basic_package_version_file(
+@@ -262,18 +267,11 @@ endif()
+     list(APPEND CPACK_GENERATOR FREEBSD)
+ endif()
+ 
+-set(LTM_DEBIAN_SHARED_PACKAGE_NAME "${PROJECT_NAME}${PACKAGE_NAME_SUFFIX}${PROJECT_VERSION_MAJOR}")
+-
+ # general CPack config
+ set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}/packages/${DISTRO_PACK_PATH})
+ message(STATUS "CPack: packages will be generated under ${CPACK_PACKAGE_DIRECTORY}")
+-if(BUILD_SHARED_LIBS)
+-    set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}")
+-    set(CPACK_DEBIAN_PACKAGE_NAME "${LTM_DEBIAN_SHARED_PACKAGE_NAME}")
+-else()
+-    set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-devel")
+-    set(CPACK_DEBIAN_LIBRARIES_PACKAGE_NAME "${PROJECT_NAME}${PACKAGE_NAME_SUFFIX}-dev")
+-endif()
++set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}")
++set(CPACK_DEBIAN_PACKAGE_NAME "${PROJECT_NAME}${PACKAGE_NAME_SUFFIX}${PROJECT_VERSION_MAJOR}")
+ set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
+ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LibTomMath")
+ set(CPACK_PACKAGE_VENDOR "libtom projects")
+@@ -287,15 +285,7 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+ set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
+ set(CPACK_DEBIAN_PACKAGE_RELEASE ${PACKAGE_RELEASE_VERSION})
+ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+-if(BUILD_SHARED_LIBS)
+-    set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
+-else()
+-    set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
+-    set(CPACK_DEBIAN_PACKAGE_DEPENDS ${LTM_DEBIAN_SHARED_PACKAGE_NAME})
+-    set(CPACK_DEB_COMPONENT_INSTALL ON)
+-    set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
+-    set(CPACK_COMPONENTS_ALL Libraries)
+-endif()
++set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
+ 
+ # rpm specific CPack config
+ set(CPACK_RPM_PACKAGE_RELEASE ${PACKAGE_RELEASE_VERSION})