From e05f330532c2235acc75c3a79bc832e535c4c4d0 Mon Sep 17 00:00:00 2001 From: GF Date: Sun, 7 Dec 2025 15:12:11 +0100 Subject: [PATCH 1/3] Add install and packaging targets --- CMakeLists.txt | 39 +++++++++++++++++++++++++++++++++++++ cmake/CPackConfig.cmake | 22 +++++++++++++++++++++ debian/changelog.Debian | 7 +++++++ debian/changelog.Debian.gz | Bin 0 -> 268 bytes docs/cpackexample.1 | 32 ++++++++++++++++++++++++++++++ docs/cpackexample.1.gz | Bin 0 -> 616 bytes 6 files changed, 100 insertions(+) create mode 100644 cmake/CPackConfig.cmake create mode 100644 debian/changelog.Debian create mode 100644 debian/changelog.Debian.gz create mode 100644 docs/cpackexample.1 create mode 100644 docs/cpackexample.1.gz diff --git a/CMakeLists.txt b/CMakeLists.txt index 94d6c2c..14743ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION "3.28") project("cpackexample" VERSION 0.1.0) +include(GNUInstallDirs) + FIND_PACKAGE(deal.II 9.5 REQUIRED HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} ) @@ -18,5 +20,42 @@ add_executable("${PROJECT_NAME}" main.cpp) target_link_libraries("${PROJECT_NAME}" cpackexamplelib) target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES}) +target_include_directories(cpackexamplelib + PUBLIC + $ + $ + ) + +install(TARGETS "${PROJECT_NAME}" cpackexamplelib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + +install(DIRECTORY fem filesystem flatset yamlParser + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib + FILES_MATCHING PATTERN "*.hpp" + ) + +install(FILES README.md + DESTINATION ${CMAKE_INSTALL_DOCDIR} + ) + +install(FILES LICENSE + DESTINATION ${CMAKE_INSTALL_DOCDIR} + RENAME copyright + ) + +install(FILES debian/changelog.Debian.gz + DESTINATION ${CMAKE_INSTALL_DOCDIR} + RENAME changelog.Debian.gz + ) + +install(FILES docs/cpackexample.1.gz + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 + ) + DEAL_II_SETUP_TARGET("${PROJECT_NAME}") DEAL_II_SETUP_TARGET(cpackexamplelib) + +include(cmake/CPackConfig.cmake) diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake new file mode 100644 index 0000000..88035eb --- /dev/null +++ b/cmake/CPackConfig.cmake @@ -0,0 +1,22 @@ +set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +set(CPACK_PACKAGE_VENDOR "gufarui") +set(CPACK_PACKAGE_CONTACT "gufarui ") +set(CPACK_PACKAGE_MAINTAINER "gufarui ") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Example FEM/Boost/yaml-cpp project packaged for the SSE exercise") +set(CPACK_PACKAGE_DESCRIPTION "Exercises the deal.II FEM solver, Boost containers/filesystem, and yaml-cpp parser.") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/gufarui/cpack-exercise-wt2526") +set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") + +set(CPACK_GENERATOR "TGZ;DEB") +set(CPACK_STRIP_FILES TRUE) +set(CPACK_DEBIAN_PACKAGE_RELEASE 1) + +set(CPACK_DEBIAN_PACKAGE_SECTION "science") +set(CPACK_DEBIAN_PACKAGE_DESCRIPTION + "Example code for the Simulation Software Engineering course.") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "gufarui ") +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_PACKAGE_HOMEPAGE_URL}") + +include(CPack) diff --git a/debian/changelog.Debian b/debian/changelog.Debian new file mode 100644 index 0000000..b3a25c9 --- /dev/null +++ b/debian/changelog.Debian @@ -0,0 +1,7 @@ +cpackexample (0.1.0) unstable; urgency=medium + + * Initial binary package for the Packaging with CPack exercise. Provides + the sample FEM/Boost/yaml-cpp playground from the Simulation Software + Engineering course material. + + -- gufarui Sun, 07 Dec 2025 15:00:00 +0100 diff --git a/debian/changelog.Debian.gz b/debian/changelog.Debian.gz new file mode 100644 index 0000000000000000000000000000000000000000..097d307ad323d551c2aa309a3fe06bfb7fde7f49 GIT binary patch literal 268 zcmV+n0rUPJiwFn+00002|6^!jZf9j|Z)YwG^u*TRM^c~XkhdqLXM36+KnG@GIGTG(!pnr+9a;9kKxyJoMsf( zefoEQ?!Gr~Atc#MGPh#~t9eGG10x5i~lVuD8-dO1<#m9+D-k~uD39db+z zM>2P^)% for the Packaging with +CPack exercise at the University of Stuttgart. diff --git a/docs/cpackexample.1.gz b/docs/cpackexample.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..fd10de180ee9e8a028d4e0a4da0abce6a8886bca GIT binary patch literal 616 zcmV-u0+;XklSC|z8^?ZwST9TmTyz?ynz1AAoSER@EgKS1iihHBV558M(I zrjOm!Qn)=oqbJzd##kb6Yyn6{1z^{ZF!c~f3fMuIB=)Y3 zoz!CxImW90QB%3-18K+@LhGI@43v;_XF`xW!F36{l+U%2b4}RkEPE#{Uz`gJdl@b~ z7={iHjd#)3e-w?-IRvI&F7{3ewgyxO?7Nd{7zEtzO%q=O8Bmybt#qENhnB2#>TI@9 zp>JYOmXkGucTc7!fl32k_ylz5rW^R59-3EbPX3c>IJ+#ZT~kopCAd%5u}1ONbH C5-L#u literal 0 HcmV?d00001 From 025bb8b28623507938b0bb00d0242e1cc0d0c3f3 Mon Sep 17 00:00:00 2001 From: GF Date: Sun, 7 Dec 2025 15:31:15 +0100 Subject: [PATCH 2/3] Add PR description --- PR_DESCRIPTION.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 PR_DESCRIPTION.md diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md new file mode 100644 index 0000000..780aeda --- /dev/null +++ b/PR_DESCRIPTION.md @@ -0,0 +1,19 @@ +## Summary + +- Add full install rules so `cpackexample`, `libcpackexamplelib`, and headers land in `${CMAKE_INSTALL_PREFIX}/bin|lib|include/cpackexamplelib`, and install README, MIT license (as `copyright`), a compressed Debian changelog, and a compressed man page. +- Introduce `cmake/CPackConfig.cmake` with maintainer/contact/vendor/description/homepage metadata, enable only `TGZ` and `DEB` generators, make the package stripped, and let `CPACK_DEBIAN_PACKAGE_SHLIBDEPS` derive dependencies. +- Provide Debian-specific docs (`debian/changelog.Debian(.gz)` and `docs/cpackexample.1(.gz)`) that satisfy lintian’s changelog/man checks so the `.deb` passes lintian (except the usual root warning). + +## Testing + +1. `docker run --rm --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpackexercise /bin/bash -lc "set -euo pipefail && cd /mnt/cpack-exercise && rm -rf build && cmake -S . -B build && cmake --build build && cmake --build build --target package"` +2. `tar -tzf build/cpackexample-0.1.0-Linux.tar.gz` +3. `dpkg-deb -c build/cpackexample_0.1.0-1_arm64.deb` +4. `docker run --rm --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpackexercise /bin/bash -lc "cd /mnt/cpack-exercise/build && apt-get -qq update && apt-get -y install ./cpackexample_0.1.0-1_arm64.deb && which cpackexample && cpackexample > /tmp/cpackexample.log && head -n 10 /tmp/cpackexample.log"` +5. `docker run --rm --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpackexercise /bin/bash -lc "cd /mnt/cpack-exercise/build && lintian ./cpackexample_0.1.0-1_arm64.deb"` + +`lintian` output: + +``` +running with root privileges is not recommended! +``` From 8f3da016132b38c3d0af6c25fa657ed4c47fbcac Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 7 Dec 2025 15:38:49 +0100 Subject: [PATCH 3/3] Delete PR_DESCRIPTION.md --- PR_DESCRIPTION.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 PR_DESCRIPTION.md diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md deleted file mode 100644 index 780aeda..0000000 --- a/PR_DESCRIPTION.md +++ /dev/null @@ -1,19 +0,0 @@ -## Summary - -- Add full install rules so `cpackexample`, `libcpackexamplelib`, and headers land in `${CMAKE_INSTALL_PREFIX}/bin|lib|include/cpackexamplelib`, and install README, MIT license (as `copyright`), a compressed Debian changelog, and a compressed man page. -- Introduce `cmake/CPackConfig.cmake` with maintainer/contact/vendor/description/homepage metadata, enable only `TGZ` and `DEB` generators, make the package stripped, and let `CPACK_DEBIAN_PACKAGE_SHLIBDEPS` derive dependencies. -- Provide Debian-specific docs (`debian/changelog.Debian(.gz)` and `docs/cpackexample.1(.gz)`) that satisfy lintian’s changelog/man checks so the `.deb` passes lintian (except the usual root warning). - -## Testing - -1. `docker run --rm --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpackexercise /bin/bash -lc "set -euo pipefail && cd /mnt/cpack-exercise && rm -rf build && cmake -S . -B build && cmake --build build && cmake --build build --target package"` -2. `tar -tzf build/cpackexample-0.1.0-Linux.tar.gz` -3. `dpkg-deb -c build/cpackexample_0.1.0-1_arm64.deb` -4. `docker run --rm --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpackexercise /bin/bash -lc "cd /mnt/cpack-exercise/build && apt-get -qq update && apt-get -y install ./cpackexample_0.1.0-1_arm64.deb && which cpackexample && cpackexample > /tmp/cpackexample.log && head -n 10 /tmp/cpackexample.log"` -5. `docker run --rm --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpackexercise /bin/bash -lc "cd /mnt/cpack-exercise/build && lintian ./cpackexample_0.1.0-1_arm64.deb"` - -`lintian` output: - -``` -running with root privileges is not recommended! -```