Skip to content

Commit

Permalink
Fix open-quantum-safe#338 and open-quantum-safe#339: output a valid a…
Browse files Browse the repository at this point in the history
…arch64 debian package with a valid directory layout. (open-quantum-safe#377)

This commit aims to fix open-quantum-safe#338 and open-quantum-safe#339.

It fixes open-quantum-safe#338 by setting [`CPACK_DEBIAN_PACKAGE_ARCHITECTURE`] to the architecture
used by CMake. To do so, we inspect the value of [`CMAKE_SYSTEM_PROCESSOR`], which
tells us the target architecture.

A test has been added to ensure that the target architecture of the output .deb
is `arm64`.


This commit also fixes open-quantum-safe#339 by creating a configuration called `DebPack` which
sets the right file paths for `cpack`.

When `cpack` is invoked with `-C DebPack`, `lib/ossl-modules`, `lib` and `include/oqs-provider`
are being used as destination directories.

[`CPACK_DEBIAN_PACKAGE_ARCHITECTURE`]: https://cmake.org/cmake/help/latest/cpack_gen/deb.html#variable:CPACK_DEBIAN_PACKAGE_ARCHITECTURE
[`CMAKE_SYSTEM_PROCESSOR`]: https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_PROCESSOR.html#variable:CMAKE_SYSTEM_PROCESSOR

Signed-off-by: thb-sb <[email protected]>
  • Loading branch information
thomas authored Mar 19, 2024
1 parent 298a53f commit 37769c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,17 @@ jobs:
ctest --test-dir build/
- name: Build .deb install package
run: cpack
run: |
cpack \
--toolchain "${CMAKE_TOOLCHAIN_FILE}" \
-C DebPack \
-DCMAKE_INSTALL_PREFIX=/usr
working-directory: build

- name: Verify the .deb file target architecture.
working-directory: build
run: dpkg -I oqs-provider-*.deb | grep -q "Architecture: arm64"

- name: Retain .deb installer
uses: actions/upload-artifact@v3
with:
Expand Down
15 changes: 15 additions & 0 deletions oqsprov/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,23 @@ if (USE_ENCODING_LIB)
target_include_directories(oqsprovider PRIVATE ${encoder_LIBRARY_INCLUDE})
endif()
install(TARGETS oqsprovider
CONFIGURATIONS Debug Release
LIBRARY DESTINATION "${OPENSSL_MODULES_PATH}"
RUNTIME DESTINATION "${OPENSSL_MODULES_PATH}")

if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
endif()

install(TARGETS oqsprovider
CONFIGURATIONS DebPack
DESTINATION .
LIBRARY DESTINATION lib/ossl-modules
ARCHIVE DESTINATION lib/
PUBLIC_HEADER DESTINATION include/oqs-provider/
)
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_VENDOR "www.openquantumsafe.org")
set(CPACK_PACKAGE_VERSION ${OQSPROVIDER_VERSION_TEXT})
Expand Down

0 comments on commit 37769c9

Please sign in to comment.