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