Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,37 @@ 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)
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)
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From ubuntu:24.04
FROM ubuntu:24.04

# Install a few dependencies
RUN apt-get -qq update && \
Expand All @@ -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"]
Binary file added changelog.gz
Binary file not shown.
55 changes: 55 additions & 0 deletions cmake/CPackConfig.cmake
Original file line number Diff line number Diff line change
@@ -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 <st172528@stud.uni-stuttgart.de>")
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 <st172528@stud.uni-stuttgart.de>")
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 <st172528@stud.uni-stuttgart.de>")

## 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)
7 changes: 7 additions & 0 deletions copyright
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions docker-entry.sh
Original file line number Diff line number Diff line change
@@ -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"
Binary file added man/cpackexample.3.gz
Binary file not shown.
5 changes: 5 additions & 0 deletions uncompressed/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpackexample-dev (0.1.0) UNSTABLE; urgency=medium

* Initial package

-- Marcel Graf <st172528@stud.uni-stuttgart.de> Sat, 06 Dec 2025 12:00:00 +0100
5 changes: 5 additions & 0 deletions uncompressed/cpackexample.3
Original file line number Diff line number Diff line change
@@ -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.