Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.3.0 #574

Merged
merged 5 commits into from
Mar 27, 2024
Merged

Release 1.3.0 #574

merged 5 commits into from
Mar 27, 2024

Conversation

sjaeckel
Copy link
Member

@sjaeckel sjaeckel commented Mar 19, 2024

@dod38fr
@mrc0mmand
@gahr
@DimStar77 (or maybe @ana ?)
@dfandrich
@antonio-rojas
@Millak

Can you please check whether this release would be fine? I've created a tag v1.3.0-rc1

Please use #575 for general questions and this PR for problems with the build.

Signed-off-by: Steffen Jaeckel <[email protected]>
(cherry picked from commit 8314bde)
@sjaeckel sjaeckel changed the base branch from develop to master March 19, 2024 14:43
@sjaeckel sjaeckel closed this Mar 19, 2024
@sjaeckel sjaeckel reopened this Mar 19, 2024
Signed-off-by: Steffen Jaeckel <[email protected]>
@mrc0mmand
Copy link

Just pushed this to Fedora Rawhide (https://bodhi.fedoraproject.org/updates/FEDORA-2024-37b74bed11), let's see what's going to break :)

@dod38fr
Copy link

dod38fr commented Mar 24, 2024

I've built rakudo 2022.12 on top of libtommath 1.30.0-rc1 without problem, so it looks good.

Signed-off-by: Steffen Jaeckel <[email protected]>
@gahr
Copy link

gahr commented Mar 27, 2024

Hi, I am trying this out using CMake (previously we were using makefile.shared on FreeBSD). I have two issues:

  1. the manpage is not there anymore
  2. it doesn't seem to be possible to build both static and shared libs in one go

@sjaeckel
Copy link
Member Author

sjaeckel commented Mar 27, 2024

Hi, I am trying this out using CMake (previously we were using makefile.shared on FreeBSD). I have two issues:

Oh, that comment was right in time, I was just finishing the release ;)

Indeed! Are you fine with me simply removing that step of trying to install the manpage? The manpage is also written for the current develop branch, so it doesn't really make sense to install it.

  1. it doesn't seem to be possible to build both static and shared libs in one go

That's true, you have to build it twice, once with -DBUILD_SHARED_LIBS=Off for the static library and once with -DBUILD_SHARED_LIBS=On for the shared one ... I've been told "that's the way how CMake do"^TM ... also I've seen proposals that enable the old behavior, but I didn't like them since they seem too convoluted and I can live with the two separate build steps. Is that a problem for you?

@gahr
Copy link

gahr commented Mar 27, 2024

Hi, I am trying this out using CMake (previously we were using makefile.shared on FreeBSD). I have two issues:

Oh, that comment was right in time, I was just finishing the release ;)

Yup - so sorry, it took me a while to get to this!

Indeed! Are you fine with me simply removing the manpage?

Sure, that's fine.

  1. it doesn't seem to be possible to build both static and shared libs in one go

That's true, you have to build it twice, once with -DBUILD_SHARED_LIBS=Off for the static library and once with -DBUILD_SHARED_LIBS=On for the shared one ... I've been told "that's the way how CMake do"^TM ... also I've seen proposals that enable that behavior, but I didn't like them since they seem too convoluted and I can live with the two separate build steps. Is that a problem for you?

CMake supports "object" libraries, where the objects are compiled and can later be used to generate both static and shared libraries. Here's a patch that does that. I would suggest to remove the option to build shared libraries and always produce both flavours :)

--- CMakeLists.txt.orig 2024-03-27 08:40:34.650661000 +0000
+++ CMakeLists.txt      2024-03-27 08:41:25.371702000 +0000
@@ -103,9 +103,14 @@
 # library target
 #-----------------------------------------------------------------------------
 add_library(${PROJECT_NAME}
+    OBJECT
     ${SOURCES}
     ${HEADERS}
 )
+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}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
+set_target_properties(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
 
 target_include_directories(${PROJECT_NAME} PUBLIC
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@@ -130,6 +135,7 @@
     VERSION ${PROJECT_VERSION}
     SOVERSION ${PROJECT_VERSION_MAJOR}
     PUBLIC_HEADER "${PUBLIC_HEADERS}"
+    POSITION_INDEPENDENT_CODE True
 )
 
 option(COMPILE_LTO "Build with LTO enabled")
@@ -159,7 +165,7 @@
 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

@gahr
Copy link

gahr commented Mar 27, 2024

Alright, let me do it better: the SOVERSION needs to be a property of the shared lib, and the PUBLIC_HEADER needs to be on libraries proper:

--- CMakeLists.txt.orig 2024-03-27 09:23:29 UTC                                                                                                                                                 [23/1822]
+++ CMakeLists.txt
@@ -103,9 +103,14 @@ add_library(${PROJECT_NAME}
 # library target                                                                                   
 #-----------------------------------------------------------------------------
 add_library(${PROJECT_NAME}                                                                        
+    OBJECT
     ${SOURCES}                 
     ${HEADERS}                                                                                     
 )                                
+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}_shared PROPERTIES OUTPUT_NAME tommath) 
+set_target_properties(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME tommath)
  
 target_include_directories(${PROJECT_NAME} PUBLIC                  
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@@ -126,9 +131,16 @@ set_target_properties(${PROJECT_NAME} PROPERTIES                                                                                                                                    
 endif()                                                                                                                                                                                                 
                                                                                                                                                                                                         
 set_target_properties(${PROJECT_NAME} PROPERTIES                                                                                                                                                        
-    OUTPUT_NAME tommath
     VERSION ${PROJECT_VERSION}
+    POSITION_INDEPENDENT_CODE True                                                                 
+)                                                                                                  
+             
+set_target_properties(${PROJECT_NAME}_shared PROPERTIES
+    PUBLIC_HEADER "${PUBLIC_HEADERS}"
     SOVERSION ${PROJECT_VERSION_MAJOR}                                                             
+)                                                                                                  
+         
+set_target_properties(${PROJECT_NAME}_static PROPERTIES
     PUBLIC_HEADER "${PUBLIC_HEADERS}"
 )                                                                                                  
                                                                                                    
@@ -159,7 +171,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

@sjaeckel
Copy link
Member Author

What were the reasons again why some people don't want PIE code in static libraries?

It can't be size, since the PIE version of the static library is slightly smaller ... runtime cost?

... there's no manpage on master

Fixup of aeebd86

Signed-off-by: Steffen Jaeckel <[email protected]>
@gahr
Copy link

gahr commented Mar 27, 2024

As discussed offline, let's postpone the changes to CMake after 1.3.0 is out.

All looks good on FreeBSD :)

For this release we will still dump our header to `<prefix>/include`.

Signed-off-by: Steffen Jaeckel <[email protected]>
@sjaeckel sjaeckel merged commit 36131ff into master Mar 27, 2024
76 checks passed
@sjaeckel sjaeckel deleted the release/1.3.0 branch March 27, 2024 13:43
@sjaeckel sjaeckel added this to the v1.3.0 milestone Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants