From 31eb3c7613d4f96d309d781e64929cfef366b07b Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Mon, 11 Apr 2016 15:10:17 +0200 Subject: [PATCH] Add package with examples. Change-Id: Idd9fee1bdc3588721fb74f1dca3ff570e827a757 --- CMakeLists.txt | 8 ++++++++ examples/CMakeLists.txt | 5 +++++ packaging/yaca.spec | 25 ++++++++++++++++++------- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a42b702..0c2f401 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,14 @@ IF(NOT DEFINED BIN_INSTALL_DIR) SET(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") ENDIF(NOT DEFINED BIN_INSTALL_DIR) +IF(NOT DEFINED SHARE_INSTALL_PREFIX) + SET(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share") +ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX) + +IF(NOT DEFINED EXAMPLES_DIR) + SET(EXAMPLES_DIR "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}/examples") +ENDIF(NOT DEFINED EXAMPLES_DIR) + ADD_SUBDIRECTORY(${SRC_FOLDER}) #ADD_SUBDIRECTORY(${TEST_FOLDER}) ADD_SUBDIRECTORY(${EXAMPLES_FOLDER}) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 160ec0e..6413bad 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -45,6 +45,8 @@ FUNCTION(BUILD_EXAMPLE EXAMPLE_NAME SOURCE_FILE) WORLD_READ WORLD_EXECUTE ) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} + DESTINATION ${EXAMPLES_DIR}) ENDFUNCTION(BUILD_EXAMPLE) BUILD_EXAMPLE("yaca-example-digest" digest.c) @@ -53,3 +55,6 @@ BUILD_EXAMPLE("yaca-example-encrypt-gcm" encrypt_aes_gcm.c) BUILD_EXAMPLE("yaca-example-sign" sign.c) BUILD_EXAMPLE("yaca-example-key-exchange" key_exchange.c) BUILD_EXAMPLE("yaca-example-test" test.c) + +INSTALL(FILES ${COMMON_SOURCES} + DESTINATION ${EXAMPLES_DIR}) diff --git a/packaging/yaca.spec b/packaging/yaca.spec index bfef0c7..126018c 100644 --- a/packaging/yaca.spec +++ b/packaging/yaca.spec @@ -13,10 +13,13 @@ Requires(postun): /sbin/ldconfig %description The package provides Yet Another Crypto API. +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + %files -%defattr(644,root,root,755) %{_libdir}/libyaca.so.0 -%attr(755,root,root) %{_libdir}/libyaca.so.%{version} +%{_libdir}/libyaca.so.%{version} %prep %setup -q @@ -33,10 +36,6 @@ make -k %{?jobs:-j%jobs} %clean rm -rf %{buildroot} -%post -n yaca -p /sbin/ldconfig - -%postun -n yaca -p /sbin/ldconfig - ## Devel Package ############################################################### %package devel Summary: Yet Another Crypto API development files @@ -47,7 +46,19 @@ Requires: yaca = %{version}-%{release} The package provides Yet Another Crypto API development files. %files devel -%defattr(644,root,root,755) %{_libdir}/libyaca.so %{_includedir}/yaca %{_libdir}/pkgconfig/yaca.pc + +## Examples Package ############################################################ +%package examples +Summary: Yet Another Crypto API example files +Group: Security/Other +Requires: yaca = %{version}-%{release} + +%description examples +The package provides Yet Another Crypto API example files. + +%files examples +%{_bindir}/yaca-example* +%{_datadir}/%{name}/examples -- 2.7.4