From 9ddd48c66cd07ec36866fce174268fa562ad303e Mon Sep 17 00:00:00 2001 From: Zara Zlatanova Date: Thu, 4 Dec 2025 12:27:49 +0100 Subject: [PATCH 1/6] feat: create cmake/CPackConfig.cmake + fix: modify CMakeLists.txt --- CMakeLists.txt | 23 +++++++++++++++++++++++ cmake/CPackConfig.cmake | 17 +++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 cmake/CPackConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 94d6c2c..3083dc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,10 +13,33 @@ 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 VERSION 0.1.0 SOVERSION 1 PUBLIC_HEADER "filesystem/filesystem.hpp;fem/fem.hpp;flatset/flatset.hpp;yamlParser/yamlParser.hpp") + +target_include_directories(cpackexamplelib + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC + $ + $ +) + add_executable("${PROJECT_NAME}" main.cpp) target_link_libraries("${PROJECT_NAME}" cpackexamplelib) target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES}) +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(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(CPackConfig) + DEAL_II_SETUP_TARGET("${PROJECT_NAME}") DEAL_II_SETUP_TARGET(cpackexamplelib) diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake new file mode 100644 index 0000000..ab4177f --- /dev/null +++ b/cmake/CPackConfig.cmake @@ -0,0 +1,17 @@ +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This file configures the cpack packaging process." + CACHE STRING "Extended summary.") + +set(CPACK_PACKAGE_VENDOR "Zara Zlatanova") +set(CPACK_PACKAGE_CONTACT "zara.zlatanova@protonmail.com") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Zara Zlatanova <${CPACK_PACKAGE_CONTACT}>") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/zezl7/cpack-exercise-wt2526") +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS YES) +set(CPACK_STRIP_FILES TRUE) + +set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Once unpacked, the binary cpackexample prints the SSE course work.") + +include(CPack) From d8dd03700ddde890b1c4154f24a80aa2fe23db5e Mon Sep 17 00:00:00 2001 From: Zara Zlatanova Date: Thu, 4 Dec 2025 12:29:48 +0100 Subject: [PATCH 2/6] feat: add output of lintian before and after changes --- lintian_final_output.sh | 10 ++++++++++ lintian_initial_output.sh | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 lintian_final_output.sh create mode 100644 lintian_initial_output.sh diff --git a/lintian_final_output.sh b/lintian_final_output.sh new file mode 100644 index 0000000..f1bf8d3 --- /dev/null +++ b/lintian_final_output.sh @@ -0,0 +1,10 @@ +$ lintian ./cpackexample_0.1.0_amd64.deb +running with root privileges is not recommended! +E: cpackexample: lacks-ldconfig-trigger usr/lib/libcpackexamplelib.so.0.1.0 +E: cpackexample: no-changelog usr/share/doc/cpackexample/changelog.gz (native package) +E: cpackexample: no-copyright-file +W: cpackexample: link-to-shared-library-in-wrong-package usr/lib/libcpackexamplelib.so.0.1.0 [usr/lib/libcpackexamplelib.so] +W: cpackexample: maintscript-calls-ldconfig [postinst] +W: cpackexample: maintscript-calls-ldconfig [postrm] +W: cpackexample: no-manual-page [usr/bin/cpackexample] +W: cpackexample: package-name-doesnt-match-sonames libcpackexamplelib1 diff --git a/lintian_initial_output.sh b/lintian_initial_output.sh new file mode 100644 index 0000000..a78bc6e --- /dev/null +++ b/lintian_initial_output.sh @@ -0,0 +1,12 @@ +$ lintian ./cpackexample_0.1.0_amd64.deb +running with root privileges is not recommended! +E: cpackexample: extended-description-is-empty +E: cpackexample: lacks-ldconfig-trigger usr/lib/libcpackexamplelib.so +E: cpackexample: no-changelog usr/share/doc/cpackexample/changelog.gz (native package) +E: cpackexample: no-copyright-file +E: cpackexample: no-phrase Maintainer zara.zlatanova@protonmail.com +W: cpackexample: no-manual-page [usr/bin/cpackexample] +W: cpackexample: package-name-doesnt-match-sonames libcpackexamplelib +W: cpackexample: shared-library-lacks-version usr/lib/libcpackexamplelib.so libcpackexamplelib.so +W: cpackexample: undeclared-elf-prerequisites (libboost_filesystem.so.1.83.0 libc.so.6 libdeal.ii.so.9.5.1 libgcc_s.so.1 libm.so.6 libmpi.so.40 libmpi_cxx.so.40 libstdc++.so.6 libtbb.so.12 libyaml-cpp.so.0.6) [usr/lib/libcpackexamplelib.so] +W: cpackexample: undeclared-elf-prerequisites (libc.so.6 libcpackexamplelib.so libdeal.ii.so.9.5.1 libgcc_s.so.1 libmpi.so.40 libmpi_cxx.so.40 libstdc++.so.6 libtbb.so.12) [usr/bin/cpackexample] \ No newline at end of file From b11fa68f8a3a0cbce0326ad6190348be6104a59d Mon Sep 17 00:00:00 2001 From: Zara Zlatanova Date: Thu, 4 Dec 2025 12:52:40 +0100 Subject: [PATCH 3/6] feat: add build and installation steps --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 8e950e4..b1b4112 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # Packaging with CPack Repository for the [CPack exercise](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/03_building_and_packaging/cpack_exercise.md). The code is a slightly modified version of the [code used in the CMake exercise](https://github.com/Simulation-Software-Engineering/cmake-exercise). + +## Buildind the package + +```bash +cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release .. +make -j && make install +cpack -G "TGZ;DEB" +``` + +## Installing the package + +```bash +apt install ./cpackexample_0.1.0_amd64.deb +``` \ No newline at end of file From 62f63a6cea652532dfb447ae8a1de128ed775901 Mon Sep 17 00:00:00 2001 From: Zara Zlatanova Date: Thu, 4 Dec 2025 12:53:47 +0100 Subject: [PATCH 4/6] fix: add missing build directory creation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b1b4112..00e1cae 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Repository for the [CPack exercise](https://github.com/Simulation-Software-Engin ## Buildind the package ```bash +mkdir build && cd build cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release .. make -j && make install cpack -G "TGZ;DEB" From 5815fb66f6e10171490e1a9c7eacc3a2ae17052a Mon Sep 17 00:00:00 2001 From: Zara Zlatanova Date: Thu, 4 Dec 2025 13:06:01 +0100 Subject: [PATCH 5/6] feat: add run instructions --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 00e1cae..53a22a0 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,11 @@ cpack -G "TGZ;DEB" ```bash apt install ./cpackexample_0.1.0_amd64.deb +``` + +## Unpacking the package and running the binary + +```bash +dpkg-deb -R cpackexample_0.1.0_amd64.deb /cpackexample-debian +cd /cpackexample-debian/usr/bin && ./cpackexample ``` \ No newline at end of file From 1bc9d9e0d1fc00f9ffd38462972da5f8ddbc39b5 Mon Sep 17 00:00:00 2001 From: zara <93386493+zezl7@users.noreply.github.com> Date: Thu, 4 Dec 2025 14:03:27 +0100 Subject: [PATCH 6/6] Fix typo in 'Building the package' section --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53a22a0..26e58b3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Repository for the [CPack exercise](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/03_building_and_packaging/cpack_exercise.md). The code is a slightly modified version of the [code used in the CMake exercise](https://github.com/Simulation-Software-Engineering/cmake-exercise). -## Buildind the package +## Building the package ```bash mkdir build && cd build @@ -22,4 +22,4 @@ apt install ./cpackexample_0.1.0_amd64.deb ```bash dpkg-deb -R cpackexample_0.1.0_amd64.deb /cpackexample-debian cd /cpackexample-debian/usr/bin && ./cpackexample -``` \ No newline at end of file +```