d3e493e3ecb9ac9b61fe7578d05432d7a31f1d38
[gentoo.git] / sys-fs / cryfs / cryfs-0.9.9-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 CMAKE_MAKEFILE_GENERATOR=emake
6 PYTHON_COMPAT=( python{2_7,3_{5,6}} )
7
8 inherit cmake-utils python-any-r1 flag-o-matic
9
10 DESCRIPTION="Encrypted FUSE filesystem that conceals metadata"
11 HOMEPAGE="https://www.cryfs.org/"
12
13 SLOT=0
14 IUSE="custom-optimization libressl test update-check"
15
16 LICENSE="LGPL-3 BSD-2 MIT"
17 # cryfs - LGPL-3
18 # scrypt - BSD-2
19 # spdlog - MIT
20
21 if [[ "${PV}" == 9999 ]] ; then
22         inherit git-r3
23         EGIT_REPO_URI="https://github.com/cryfs/cryfs"
24 else
25         SRC_URI="https://github.com/cryfs/cryfs/releases/download/${PV}/${P}.tar.xz"
26         KEYWORDS="amd64 ~arm arm64 x86"
27         S="${WORKDIR}"
28 fi
29
30 RDEPEND=">=dev-libs/boost-1.56:=
31         >=dev-libs/crypto++-5.6.3:=
32         net-misc/curl:=
33         >=sys-fs/fuse-2.8.6:0
34         !libressl? ( dev-libs/openssl:0= )
35         libressl? ( dev-libs/libressl:= )"
36 DEPEND="${RDEPEND}
37         ${PYTHON_DEPS}"
38
39 src_prepare() {
40         cmake-utils_src_prepare
41
42         # remove tests that require internet access to comply with Gentoo policy
43         sed -i -e '/CurlHttpClientTest.cpp/d' -e '/FakeHttpClientTest.cpp/d' test/cpp-utils/CMakeLists.txt || die
44
45         # remove non-applicable warning
46         sed -i -e '/WARNING! This is a debug build. Performance might be slow./d' src/cryfs-cli/Cli.cpp || die
47 }
48
49 src_configure() {
50         # upstream restricts installing files to Release configuration
51         # (CMAKE_BUILD_TYPE does not affect anything else)
52         local CMAKE_BUILD_TYPE
53         local -a mycmakeargs
54         CMAKE_BUILD_TYPE=Release
55         mycmakeargs=(
56                 "-DBoost_USE_STATIC_LIBS=off"
57                 "-DCRYFS_UPDATE_CHECKS=$(usex update-check)"
58                 "-DBUILD_TESTING=$(usex test)"
59         )
60         use custom-optimization || append-flags -O3
61
62         cmake-utils_src_configure
63 }
64
65 src_test() {
66         local TMPDIR
67         TMPDIR="${T}"
68         addread /dev/fuse
69         addwrite /dev/fuse
70         local -a tests_failed
71         tests_failed=()
72
73         for i in gitversion cpp-utils parallelaccessstore blockstore blobstore fspp cryfs cryfs-cli ; do
74                 "${BUILD_DIR}"/test/${i}/${i}-test || tests_failed+=( "${i}" )
75         done
76
77         adddeny /dev/fuse
78
79         if [[ -n ${tests_failed[@]} ]] ; then
80                 eerror "The following tests failed:"
81                 eerror "${tests_failed[@]}"
82                 die "At least one test failed"
83         fi
84 }
85
86 src_install() {
87         # work around upstream issue with cmake not creating install target
88         # in Makefile if we enable BUILD_TESTING
89         dobin "${BUILD_DIR}/src/cryfs-cli/cryfs"
90         gzip -cd "${BUILD_DIR}/doc/cryfs.1.gz" > "${T}/cryfs.1" || die
91         doman "${T}/cryfs.1"
92         einstalldocs
93 }