mheily / libkqueue

kqueue(2) compatibility library
Other
236 stars 77 forks source link

submit a Debian package for 2.6.1+ #135

Open mheily opened 2 years ago

mheily commented 2 years ago

The official Debian package is several years old now, and it would be good to push a new version downstream.

I plan to make a few other improvements to support this:

  1. Update the README to describe the process for generating a new Debian package
  2. Tweak the CMakeFile to allow building a source archive that meets Debian naming requirements
  3. Consider how to make the build process more accessible, potentially moving the packaging files to a branch in the libkqueue repository.
mheily commented 2 years ago

There's a Debian patch to CMakelists.txt that does not apply cleanly to the new version. Perhaps we should incorporate this upstream, and drop the patch?

$ cat patches/cmake-debian-updates 
Description: Update CMake config for debian package
 A few updates to the CMakeLists.txt file to be more relevant for the
 Debian package.
Author: Matthew Newton <matthew-git@newtoncomputing.co.uk>
Last-Update: 2019-01-15

Index: libkqueue-2.3.1/CMakeLists.txt
===================================================================
--- libkqueue-2.3.1.orig/CMakeLists.txt
+++ libkqueue-2.3.1/CMakeLists.txt
@@ -120,22 +120,28 @@ else()
 endif()

 add_library(kqueue ${LIBRARY_TYPE} ${LIBKQUEUE_SOURCES} ${LIBKQUEUE_HEADERS})
-set_target_properties(kqueue PROPERTIES DEBUG_POSTFIX "d")
+set_target_properties(kqueue PROPERTIES DEBUG_POSTFIX "d" SOVERSION 0)
+
+add_library(kqueue_static STATIC ${LIBKQUEUE_SOURCES} ${LIBKQUEUE_HEADERS})
+set_target_properties(kqueue_static PROPERTIES DEBUG_POSTFIX "d" OUTPUT_NAME kqueue)

 if(WIN32)
   target_compile_definitions(kqueue PRIVATE _USRDLL;_WINDLL)
   target_compile_definitions(kqueue PRIVATE _CRT_SECURE_NO_WARNINGS)
 else()
   target_compile_definitions(kqueue PRIVATE _XOPEN_SOURCE=600)
+  target_compile_definitions(kqueue_static PRIVATE _XOPEN_SOURCE=600)
 endif()

 target_include_directories(kqueue PRIVATE include)
 if(NOT WIN32)
   target_include_directories(kqueue PRIVATE src/common)
+  target_include_directories(kqueue_static PRIVATE src/common include)
 endif()

 if(CMAKE_C_COMPILER_ID MATCHES GNU)
   target_compile_options(kqueue PRIVATE -Wall -Werror)
+  target_compile_options(kqueue_static PRIVATE -Wall -Werror)
 endif()
 if(MINGW AND CMAKE_C_COMPILER_ID MATCHES GNU)
   target_compile_options(kqueue PRIVATE -march=i486)
@@ -145,6 +151,7 @@ if(WIN32)
   target_link_libraries(kqueue PRIVATE Ws2_32)
 endif()
 target_link_libraries(kqueue PRIVATE Threads::Threads)
+target_link_libraries(kqueue_static PRIVATE Threads::Threads)

 if(ENABLE_TESTING)
   add_subdirectory(test)
@@ -164,10 +171,10 @@ set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
 install(FILES
           "include/sys/event.h"
         DESTINATION
-          "${CMAKE_INSTALL_FULL_INCLUDEDIR}/sys"
+          "${CMAKE_INSTALL_FULL_INCLUDEDIR}/kqueue/sys"
         COMPONENT headers)
 install(TARGETS
-          kqueue
+          kqueue kqueue_static
         DESTINATION
           "${CMAKE_INSTALL_FULL_LIBDIR}"
         COMPONENT libraries)
arr2036 commented 2 years ago

We now already set SOVERSION, so that's fine.

arr2036 commented 2 years ago

https://stackoverflow.com/questions/2152077/is-it-possible-to-get-cmake-to-build-both-a-static-and-shared-library-at-the-sam

The second answer here describes a way of building shared or static or both without duplicating library properties.

arr2036 commented 2 years ago

If we can get away with just using cpack I think that'd be ideal instead of needing to maintain separate packaging infrastructure.

mheily commented 2 years ago

Debian doesn't support the use of CPack to build their official packages. I've updated my packaging scripts in this repository to handle the new version: https://github.com/mheily/debian-packages

I've uploaded the package to mentors.debian.net and need to find someone with permission to upload the package to the archive.

shahn commented 3 months ago

Has there been any update so far, or would it be possible to support this packaging effort?