diff options
author | Remi Collet <remi@remirepo.net> | 2020-01-17 11:25:32 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-01-17 11:25:32 +0100 |
commit | fd700e084d7c9874c9d01deeed659956ac255420 (patch) | |
tree | bd127b77ee7e35a285dc74ca4863ddc3a926b23d |
new package
-rw-r--r-- | .gitignore | 9 | ||||
-rw-r--r-- | 0001-fix-installation-layout-e.g.-honors-GNUInstallDirs.patch | 99 | ||||
-rw-r--r-- | 0002-add-option-to-NOT-install-static-libraries.patch | 76 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | libmongocrypt.spec | 103 |
5 files changed, 291 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f69818 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.bz2 +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/0001-fix-installation-layout-e.g.-honors-GNUInstallDirs.patch b/0001-fix-installation-layout-e.g.-honors-GNUInstallDirs.patch new file mode 100644 index 0000000..e56c926 --- /dev/null +++ b/0001-fix-installation-layout-e.g.-honors-GNUInstallDirs.patch @@ -0,0 +1,99 @@ +From ef75913b08e709329df1f325ac05033efbbe3d3c Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 17 Jan 2020 09:49:38 +0100 +Subject: [PATCH 1/2] fix installation layout, e.g. honors GNUInstallDirs + +--- + CMakeLists.txt | 4 ++-- + kms-message/CMakeLists.txt | 20 ++++++++++---------- + 2 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2bef1a7..010c292 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -351,7 +351,7 @@ configure_file (cmake/mongocrypt-config.cmake + install (EXPORT mongocrypt_targets + NAMESPACE mongo:: + FILE mongocrypt_targets.cmake +- DESTINATION lib/cmake/mongocrypt ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mongocrypt + ) + + install ( +@@ -359,7 +359,7 @@ install ( + cmake/mongocrypt-config.cmake + "${CMAKE_CURRENT_BINARY_DIR}/mongocrypt/mongocrypt-config-version.cmake" + DESTINATION +- lib/cmake/mongocrypt ++ ${CMAKE_INSTALL_LIBDIR}/cmake/mongocrypt + COMPONENT + Devel + ) +diff --git a/kms-message/CMakeLists.txt b/kms-message/CMakeLists.txt +index fcfb07d..bfc1bd0 100644 +--- a/kms-message/CMakeLists.txt ++++ b/kms-message/CMakeLists.txt +@@ -124,10 +124,10 @@ set_property (TARGET kms_message_static APPEND PROPERTY + include (CMakePackageConfigHelpers) + install (TARGETS kms_message kms_message_static + EXPORT kms_message_targets +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib +- RUNTIME DESTINATION bin +- INCLUDES DESTINATION include ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + + install ( +@@ -141,7 +141,7 @@ install ( + src/kms_message/kms_request_opt.h + src/kms_message/kms_response.h + src/kms_message/kms_response_parser.h +- DESTINATION include/kms_message ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/kms_message + COMPONENT Devel + ) + +@@ -162,7 +162,7 @@ configure_file (cmake/kms_message-config.cmake + COPYONLY + ) + +-set (ConfigPackageLocation lib/cmake/kms_message) ++set (ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/kms_message) + install (EXPORT kms_message_targets + NAMESPACE mongo:: + FILE kms_message_targets.cmake +@@ -178,8 +178,8 @@ install ( + ) + + # pkg-config. +-set (PKG_CONFIG_LIBDIR "\${prefix}/lib") +-set (PKG_CONFIG_INCLUDEDIR "\${prefix}/include") ++set (PKG_CONFIG_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") ++set (PKG_CONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + set (PKG_CONFIG_LIBS "-L\${libdir} -lkms_message") + set (PKG_CONFIG_CFLAGS "-I\${includedir}") + configure_file ( +@@ -189,7 +189,7 @@ configure_file ( + + install ( + FILES "${CMAKE_CURRENT_BINARY_DIR}/libkms_message.pc" +- DESTINATION lib/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) + + # cannot run tests without crypto +@@ -211,4 +211,4 @@ if (NOT DISABLE_NATIVE_CRYPTO) + target_link_libraries(test_kms_request "${OPENSSL_LIBRARIES}") + target_include_directories(test_kms_request PRIVATE "${OPENSSL_INCLUDE_DIR}") + endif() +-endif () +\ No newline at end of file ++endif () +-- +2.24.1 + diff --git a/0002-add-option-to-NOT-install-static-libraries.patch b/0002-add-option-to-NOT-install-static-libraries.patch new file mode 100644 index 0000000..e2bd02a --- /dev/null +++ b/0002-add-option-to-NOT-install-static-libraries.patch @@ -0,0 +1,76 @@ +From 777fb32be7eb6082dbed88becd2e1ee573247e40 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 17 Jan 2020 11:09:21 +0100 +Subject: [PATCH 2/2] add option to NOT install static libraries + +--- + CMakeLists.txt | 19 ++++++++++++++----- + kms-message/CMakeLists.txt | 8 +++++++- + 2 files changed, 21 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 010c292..f97c18c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,6 +10,7 @@ endif() + set (CMAKE_C_STANDARD 99) + + option (ENABLE_SHARED_BSON "Dynamically link libbson (default is static)" OFF) ++option (ENABLE_STATIC "Install static libraries" ON) + + set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) + +@@ -262,7 +263,13 @@ if (NOT MONGOCRYPT_CRYPTO STREQUAL none) + target_include_directories (example-state-machine-static PRIVATE ./src) + endif () + +-install (TARGETS mongocrypt mongocrypt_static ++if (ENABLE_STATIC) ++ set (TARGETS_TO_INSTALL mongocrypt mongocrypt_static) ++else () ++ set (TARGETS_TO_INSTALL mongocrypt) ++endif () ++install ( ++ TARGETS ${TARGETS_TO_INSTALL} + EXPORT mongocrypt_targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +@@ -324,10 +331,12 @@ install ( + FILES "${CMAKE_BINARY_DIR}/libmongocrypt.pc" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +-install ( +- FILES "${CMAKE_BINARY_DIR}/libmongocrypt-static.pc" +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +-) ++if (ENABLE_STATIC) ++ install ( ++ FILES "${CMAKE_BINARY_DIR}/libmongocrypt-static.pc" ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ++ ) ++endif () + + include (CMakePackageConfigHelpers) + set (INCLUDE_INSTALL_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/mongocrypt") +diff --git a/kms-message/CMakeLists.txt b/kms-message/CMakeLists.txt +index bfc1bd0..fae39bd 100644 +--- a/kms-message/CMakeLists.txt ++++ b/kms-message/CMakeLists.txt +@@ -122,7 +122,13 @@ set_property (TARGET kms_message_static APPEND PROPERTY + ) + + include (CMakePackageConfigHelpers) +-install (TARGETS kms_message kms_message_static ++if (ENABLE_STATIC) ++ set (TARGETS_TO_INSTALL kms_message kms_message_static) ++else () ++ set (TARGETS_TO_INSTALL kms_message) ++endif () ++install ( ++ TARGETS ${TARGETS_TO_INSTALL} + EXPORT kms_message_targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +-- +2.24.1 + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..91b0fd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../common/Makefile + diff --git a/libmongocrypt.spec b/libmongocrypt.spec new file mode 100644 index 0000000..e6bef6e --- /dev/null +++ b/libmongocrypt.spec @@ -0,0 +1,103 @@ +# remirepo/fedora spec file for libmongocrypt +# +# Copyright (c) 2020 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%global gh_owner mongodb +%global gh_project libmongocrypt +%global libname %{gh_project} +%global libver 1.0 +%global soname 0 + +Name: %{libname} +Summary: The companion C library for client side encryption in drivers +Version: 1.0.1 +Release: 1%{?dist} + +# see kms-message/THIRD_PARTY_NOTICES +# kms-message/src/kms_b64.c is ISC +# everything else is ASL 2.0 +License: ASL 2.0 and ISC +URL: https://github.com/%{gh_owner}/%{gh_project} + +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{version}.tar.gz + +# Fix install layout, PR #87 +Patch0: 0001-fix-installation-layout-e.g.-honors-GNUInstallDirs.patch +Patch1: 0002-add-option-to-NOT-install-static-libraries.patch + +BuildRequires: cmake >= 3.5 +BuildRequires: gcc +BuildRequires: gcc-c++ +# pkg-config may pull compat-openssl10 +BuildRequires: openssl-devel +# should be libson-1.0 only available in 1.16 +BuildRequires: cmake(libbson-1.0) >= 1.11 + + +%description +%{summary}. + + +%package devel +Summary: Header files and development libraries for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: pkgconfig +Requires: cmake-filesystem + +%description devel +This package contains the header files and development libraries +for %{name}. + + +%prep +%setup -q -n %{gh_project}-%{version}%{?prever:-dev} +%patch0 -p1 +%patch1 -p1 +echo "%{version}" >VERSION_CURRENT + + +%build +%cmake \ + -DCMAKE_C_FLAGS="%{optflags} -fPIC" \ + -DENABLE_SHARED_BSON:BOOL=ON \ + -DENABLE_STATIC:BOOL=OFF \ + . + +make %{?_smp_mflags} + + +%install +make install DESTDIR=%{buildroot} + + +%check +make test + + +%files +%{!?_licensedir:%global license %%doc} +%license LICENSE +%{_libdir}/libkms_message.so.%{soname}* +%{_libdir}/libmongocrypt.so.%{soname}* + + +%files devel +%doc *.md +%{_includedir}/kms_message +%{_includedir}/mongocrypt +%{_libdir}/libkms_message.so +%{_libdir}/libmongocrypt.so +%{_libdir}/cmake/kms_message +%{_libdir}/cmake/mongocrypt +%{_libdir}/pkgconfig/*.pc + + +%changelog +* Fri Jan 17 2020 Remi Collet <remi@remirepo.net> - 1.0.1-1 +- initial package +- fix installation layout using patch from + https://github.com/mongodb/libmongocrypt/pull/87 |