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..f1ed8bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +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) + add_executable("${PROJECT_NAME}" main.cpp) target_link_libraries("${PROJECT_NAME}" cpackexamplelib) @@ -20,3 +21,26 @@ target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES}) DEAL_II_SETUP_TARGET("${PROJECT_NAME}") DEAL_II_SETUP_TARGET(cpackexamplelib) + + +include(GNUInstallDirs) + +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 bd5207d..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 && \ @@ -12,17 +12,14 @@ RUN apt-get -qq update && \ vim \ tree \ lintian \ - unzip - -# 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 + unzip \ + 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/ +COPY docker-entry.sh /usr/local/bin/docker-entry.sh +ENTRYPOINT ["/usr/local/bin/docker-entry.sh"] CMD ["/bin/bash"] diff --git a/changelog.gz b/changelog.gz new file mode 100644 index 0000000..c317997 Binary files /dev/null and b/changelog.gz differ diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake new file mode 100644 index 0000000..de47ff8 --- /dev/null +++ b/cmake/CPackConfig.cmake @@ -0,0 +1,55 @@ +### 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 "Marcel Graf ") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/MarcelGraf0710/cpack-exercise-wt2526") +set(CPACK_PACKAGE_COPYRIGHT "Copyright (c) 2025 Marcel Graf") + +# 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") + +# 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_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/docker-entry.sh b/docker-entry.sh new file mode 100755 index 0000000..8765671 --- /dev/null +++ b/docker-entry.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +SRC_DIR="/mnt/cpack-exercise" +OUT_DIR="/out" +BUILD_DIR="/tmp/build" + +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" + +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 0000000..00d3dd4 Binary files /dev/null and b/man/cpackexample.3.gz differ 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