From 82eda3504be58b74f6483f71ed0a8b0b9485cda2 Mon Sep 17 00:00:00 2001 From: Marcel Graf Date: Sat, 6 Dec 2025 16:41:17 +0100 Subject: [PATCH 1/4] Added CPackConfig, changelog, and .gitignore file. Removed yaml-cpp from Dockerfile --- .gitignore | 1 + CMakeLists.txt | 18 ++++++++++++++++++ Dockerfile | 11 ++++++----- cmake/CPackConfig.cmake | 24 ++++++++++++++++++++++++ debian/changelog | 5 +++++ 5 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 cmake/CPackConfig.cmake create mode 100644 debian/changelog diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 94d6c2c..edbf7cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,12 @@ find_package(Boost 1.83 COMPONENTS filesystem REQUIRED) find_package(yaml-cpp 0.6 REQUIRED) add_library(cpackexamplelib filesystem/filesystem.cpp fem/fem.cpp flatset/flatset.cpp yamlParser/yamlParser.cpp) + + +set_target_properties(cpackexamplelib PROPERTIES + PUBLIC_HEADER "fem/fem.hpp;filesystem/filesystem.hpp;flatset/flatset.hpp;yamlParser/yamlParser.hpp" +) + add_executable("${PROJECT_NAME}" main.cpp) target_link_libraries("${PROJECT_NAME}" cpackexamplelib) @@ -20,3 +26,15 @@ target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES}) DEAL_II_SETUP_TARGET("${PROJECT_NAME}") DEAL_II_SETUP_TARGET(cpackexamplelib) + + +include(GNUInstallDirs) +install(TARGETS cpackexample cpackexamplelib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib + ) + +include(cmake/CPackConfig.cmake) \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bd5207d..c4a5e1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,13 +12,14 @@ RUN apt-get -qq update && \ vim \ tree \ lintian \ - unzip + unzip \ + libyaml-cpp # Get, unpack, build, and install yaml-cpp -RUN mkdir software && cd software && \ - wget https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.zip && unzip yaml-cpp-0.6.3.zip && \ - cd yaml-cpp-yaml-cpp-0.6.3 && mkdir build && cd build && \ - cmake -DYAML_BUILD_SHARED_LIBS=ON .. && make -j4 && make install +# RUN mkdir software && cd software && \ +# wget https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.zip && unzip yaml-cpp-0.6.3.zip && \ +# cd yaml-cpp-yaml-cpp-0.6.3 && mkdir build && cd build && \ +# cmake -DYAML_BUILD_SHARED_LIBS=ON .. && make -j4 && make install # This is some strange Docker feature. Normally, you don't need to add /usr/local to these ENV LIBRARY_PATH $LIBRARY_PATH:/usr/local/lib/ diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake new file mode 100644 index 0000000..644b455 --- /dev/null +++ b/cmake/CPackConfig.cmake @@ -0,0 +1,24 @@ +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CPack packaging exercise") +set(CPACK_PACKAGE_DESCRIPTION "This is the elaboration for the CPACK packaging exercise by Marcel Graf") + +set(CPACK_PACKAGE_VENDOR "Marcel Graf") +set(CPACK_PACKAGE_CONTACT "st172528@stud.uni-stuttgart.de") +set(CPACK_PACKAGE_MAINTAINERS ${CPACK_PACKAGE_VENDOR}) + +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/MarcelGraf0710/cpack-exercise-wt2526") + +set(CPACK_STRIP_FILES "TRUE") + +set(CPACK_BINARY_DEB "ON") +set(CPACK_BINARY_TGZ "ON") +set(CPACK_BINARY_TZ "OFF") +set(CPACK_BINARY_STGZ "OFF") + +set(CPACK_DEB_COMPONENT_INSTALL "ON") + +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +set(CPACK_DEBIAN_PACKAGE_SECTION "devel") +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) + +include(CPack) \ No newline at end of file diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..887a63b --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +cpackexample (0.1.0) unstable; urgency=medium + + * Initial release. + + -- Marcel Graf Wed, Dec 03 2025 17:15:00 +0100 \ No newline at end of file From 23f3c6dcb67281115258b89fe46cadc2ceda978e Mon Sep 17 00:00:00 2001 From: Marcel Graf Date: Sun, 7 Dec 2025 02:02:53 +0100 Subject: [PATCH 2/4] Implemented split into runtime and dev package; adapted files such that lintian is happy; adaptions to CPackConfig.cmake; adapted Dockerfile such that packages are automatically setup when entering container --- CMakeLists.txt | 32 ++++++++++++-------- Dockerfile | 10 ++----- changelog.gz | Bin 0 -> 157 bytes cmake/CPackConfig.cmake | 57 ++++++++++++++++++++++++++++-------- copyright | 7 +++++ debian/changelog | 5 ---- docker-entry.sh | 21 +++++++++++++ man/cpackexample.3.gz | Bin 0 -> 129 bytes uncompressed/changelog | 5 ++++ uncompressed/cpackexample.3 | 5 ++++ 10 files changed, 103 insertions(+), 39 deletions(-) create mode 100644 changelog.gz create mode 100644 copyright delete mode 100644 debian/changelog create mode 100755 docker-entry.sh create mode 100644 man/cpackexample.3.gz create mode 100644 uncompressed/changelog create mode 100644 uncompressed/cpackexample.3 diff --git a/CMakeLists.txt b/CMakeLists.txt index edbf7cd..f1ed8bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,15 +10,10 @@ DEAL_II_INITIALIZE_CACHED_VARIABLES() # Uses the FindBoost module of CMake find_package(Boost 1.83 COMPONENTS filesystem REQUIRED) -find_package(yaml-cpp 0.6 REQUIRED) +find_package(yaml-cpp 0.8 REQUIRED) add_library(cpackexamplelib filesystem/filesystem.cpp fem/fem.cpp flatset/flatset.cpp yamlParser/yamlParser.cpp) - -set_target_properties(cpackexamplelib PROPERTIES - PUBLIC_HEADER "fem/fem.hpp;filesystem/filesystem.hpp;flatset/flatset.hpp;yamlParser/yamlParser.hpp" -) - add_executable("${PROJECT_NAME}" main.cpp) target_link_libraries("${PROJECT_NAME}" cpackexamplelib) @@ -29,12 +24,23 @@ DEAL_II_SETUP_TARGET(cpackexamplelib) include(GNUInstallDirs) -install(TARGETS cpackexample cpackexamplelib - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib - ) + +set_target_properties(cpackexamplelib PROPERTIES + PUBLIC_HEADER "fem/fem.hpp;filesystem/filesystem.hpp;flatset/flatset.hpp;yamlParser/yamlParser.hpp" + VERSION 0.1.0 + SOVERSION 1 +) + +install(TARGETS cpackexamplelib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime + NAMELINK_ONLY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib COMPONENT dev +) + +install(TARGETS cpackexample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime +) include(cmake/CPackConfig.cmake) \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c4a5e1b..b1da370 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,17 +13,11 @@ RUN apt-get -qq update && \ tree \ lintian \ unzip \ - libyaml-cpp - -# Get, unpack, build, and install yaml-cpp -# RUN mkdir software && cd software && \ -# wget https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.zip && unzip yaml-cpp-0.6.3.zip && \ -# cd yaml-cpp-yaml-cpp-0.6.3 && mkdir build && cd build && \ -# cmake -DYAML_BUILD_SHARED_LIBS=ON .. && make -j4 && make install + libyaml-cpp-dev # This is some strange Docker feature. Normally, you don't need to add /usr/local to these ENV LIBRARY_PATH $LIBRARY_PATH:/usr/local/lib/ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib/ ENV PATH $PATH:/usr/local/bin/ -CMD ["/bin/bash"] +ENTRYPOINT ["/usr/local/bin/docker-entry.sh"] diff --git a/changelog.gz b/changelog.gz new file mode 100644 index 0000000000000000000000000000000000000000..c31799786cee6b100eacdaa0e78fc98d962f2162 GIT binary patch literal 157 zcmV;O0Al|iiwFP!000020~L$Q3c@fH1^4}mv-Fj46R3(WR1^`^P4xppaxKBOlr$0j zdn?Rh7#Q0c`{IwO+lqzbHwGk?q#+)+;=bEoj!UFaa$~>inw?K|mH{K28y~%?@V`yT zeG~#$6D(Ia1@pwJi)yBGJ>PaQIhh(SdWo?#Axg&^pfGU)n&Q9~nsg4O7eqZ6lOoD~ L{%{7+ng9R*7>+^x literal 0 HcmV?d00001 diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake index 644b455..de47ff8 100644 --- a/cmake/CPackConfig.cmake +++ b/cmake/CPackConfig.cmake @@ -1,24 +1,55 @@ -set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +### CPackConfig.cmake ### + +# General information +set(CPACK_PACKAGE_NAME "lib${PROJECT_NAME}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CPack packaging exercise") set(CPACK_PACKAGE_DESCRIPTION "This is the elaboration for the CPACK packaging exercise by Marcel Graf") - set(CPACK_PACKAGE_VENDOR "Marcel Graf") set(CPACK_PACKAGE_CONTACT "st172528@stud.uni-stuttgart.de") -set(CPACK_PACKAGE_MAINTAINERS ${CPACK_PACKAGE_VENDOR}) - +set(CPACK_PACKAGE_MAINTAINERS "Marcel Graf ") set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/MarcelGraf0710/cpack-exercise-wt2526") +set(CPACK_PACKAGE_COPYRIGHT "Copyright (c) 2025 Marcel Graf") -set(CPACK_STRIP_FILES "TRUE") +# Generators and general properties +set(CPACK_STRIP_FILES ON) +set(CPACK_GENERATOR "TGZ;DEB") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +set(CPACK_PACKAGE_CHANGELOG_FILE "${CMAKE_SOURCE_DIR}/changelog") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") -set(CPACK_BINARY_DEB "ON") -set(CPACK_BINARY_TGZ "ON") -set(CPACK_BINARY_TZ "OFF") -set(CPACK_BINARY_STGZ "OFF") - -set(CPACK_DEB_COMPONENT_INSTALL "ON") +# Debian package properties +## General information again such that lintian stops complaining +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Marcel Graf ") +set(CPACK_DEBIAN_PACKAGE_CHANGELOG "${CMAKE_SOURCE_DIR}/changelog") +set(CPACK_DEBIAN_PACKAGE_COPYRIGHT "${CMAKE_SOURCE_DIR}/copyright") +set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) -set(CPACK_DEBIAN_PACKAGE_SECTION "devel") -set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Marcel Graf ") + +## Runtime package +set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "libcpackexample1") + +## Dev package +set(CPACK_DEBIAN_DEV_PACKAGE_NAME "libcpackexample-dev") +set(CPACK_COMPONENT_DEV_DEPENDS "libcpackexample1") +set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "libcpackexample1") + +install(FILES ${CMAKE_SOURCE_DIR}/changelog.gz + DESTINATION "/usr/share/doc/libcpackexample-dev" + COMPONENT dev) + +install(FILES ${CMAKE_SOURCE_DIR}/copyright + DESTINATION "/usr/share/doc/libcpackexample-dev" + COMPONENT dev) + +install(FILES "${CMAKE_SOURCE_DIR}/man/cpackexample.3.gz" + DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 + COMPONENT dev) + +# Shared library management +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) +# CPack include(CPack) \ No newline at end of file diff --git a/copyright b/copyright new file mode 100644 index 0000000..2215163 --- /dev/null +++ b/copyright @@ -0,0 +1,7 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: cpackexample +Source: https://github.com/MarcelGraf0710/cpack-exercise-wt2526 + +Files: * +Copyright: 2025 Marcel Graf +License: MIT diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 887a63b..0000000 --- a/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -cpackexample (0.1.0) unstable; urgency=medium - - * Initial release. - - -- Marcel Graf Wed, Dec 03 2025 17:15:00 +0100 \ No newline at end of file diff --git a/docker-entry.sh b/docker-entry.sh new file mode 100755 index 0000000..c886f2b --- /dev/null +++ b/docker-entry.sh @@ -0,0 +1,21 @@ +SRC_DIR="/src" +OUT_DIR="/out" +BUILD_DIR="/tmp/build" + +mkdir "$BUILD_DIR" +mkdir "$OUT_DIR" + +cmake -S "$SRC_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCPACK_PACKAGE_DIRECTORY="$BUILD_DIR" + +make -C "$BUILD_DIR" -j package + +results=( + "$BUILD_DIR"/*.tar.gz + "$BUILD_DIR"/*.deb +) + +for f in "${results[@]}"; do + cp -f "$f" "$OUT_DIR/" +done + +ls -l "$OUT_DIR" \ No newline at end of file diff --git a/man/cpackexample.3.gz b/man/cpackexample.3.gz new file mode 100644 index 0000000000000000000000000000000000000000..00d3dd4a9f380c8eb1bf3eaab02dffcd3adceda6 GIT binary patch literal 129 zcmb2|=3oE;Cg#iB9|H>b3QE3}^%i{L{ZJTc@az)zw}21DUrL{P>3R5^^IPk2M)!ng zXvf9S21D+yPnWxeibXGd>K1YE61r^s`O?8#F)__^n{Ak#Z2tb;;bdggE!v85odXo25?i7Q=C&OExZiec{Eg4rEFivj#HH?sf$ literal 0 HcmV?d00001 diff --git a/uncompressed/changelog b/uncompressed/changelog new file mode 100644 index 0000000..59a46eb --- /dev/null +++ b/uncompressed/changelog @@ -0,0 +1,5 @@ +cpackexample-dev (0.1.0) UNSTABLE; urgency=medium + + * Initial package + + -- Marcel Graf Sat, 06 Dec 2025 12:00:00 +0100 diff --git a/uncompressed/cpackexample.3 b/uncompressed/cpackexample.3 new file mode 100644 index 0000000..0b60ba8 --- /dev/null +++ b/uncompressed/cpackexample.3 @@ -0,0 +1,5 @@ +.TH CPACKEXAMPLE 3 +.SH NAME +cpackexample \- example program for packaging +.SH DESCRIPTION +This is a demo program for the CPack exercise. \ No newline at end of file From 6a6bcf2ec1a722c75ba8a44fe2590a603cd9b381 Mon Sep 17 00:00:00 2001 From: Marcel Graf Date: Sun, 7 Dec 2025 02:33:53 +0100 Subject: [PATCH 3/4] Updated Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index b1da370..301bc0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,5 @@ ENV LIBRARY_PATH $LIBRARY_PATH:/usr/local/lib/ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib/ ENV PATH $PATH:/usr/local/bin/ +COPY docker-entry.sh /usr/local/bin/docker-entry.sh ENTRYPOINT ["/usr/local/bin/docker-entry.sh"] From b3e94a1596e07cdc00ef65828b19d72ba4fc13c6 Mon Sep 17 00:00:00 2001 From: Marcel Graf Date: Sun, 7 Dec 2025 03:16:32 +0100 Subject: [PATCH 4/4] Minor correction to docker-entry.sh --- Dockerfile | 3 ++- docker-entry.sh | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 301bc0f..5febf8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -From ubuntu:24.04 +FROM ubuntu:24.04 # Install a few dependencies RUN apt-get -qq update && \ @@ -22,3 +22,4 @@ ENV PATH $PATH:/usr/local/bin/ COPY docker-entry.sh /usr/local/bin/docker-entry.sh ENTRYPOINT ["/usr/local/bin/docker-entry.sh"] +CMD ["/bin/bash"] diff --git a/docker-entry.sh b/docker-entry.sh index c886f2b..8765671 100755 --- a/docker-entry.sh +++ b/docker-entry.sh @@ -1,9 +1,13 @@ -SRC_DIR="/src" +#!/usr/bin/env bash + +SRC_DIR="/mnt/cpack-exercise" OUT_DIR="/out" BUILD_DIR="/tmp/build" -mkdir "$BUILD_DIR" -mkdir "$OUT_DIR" +pwd +mkdir $BUILD_DIR +mkdir $OUT_DIR +ls cmake -S "$SRC_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCPACK_PACKAGE_DIRECTORY="$BUILD_DIR"