app-metrics/prometheus: add 3.1.0
[gentoo/gentoo.git] / app-crypt / veracrypt / veracrypt-1.26.15.ebuild
bloba1276336ac41cf8caa3f40d2c30c13e2f5e201de
1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 WX_GTK_VER="3.2-gtk3"
7 inherit desktop flag-o-matic linux-info pax-utils toolchain-funcs wxwidgets
9 DESCRIPTION="Disk encryption with strong security based on TrueCrypt"
10 HOMEPAGE="https://www.veracrypt.fr/en/Home.html"
11 SRC_URI="https://github.com/${PN}/VeraCrypt/archive/VeraCrypt_${PV}.tar.gz -> ${P}.tar.gz"
12 S="${WORKDIR}/VeraCrypt-VeraCrypt_${PV}/src"
14 # The modules not linked against in Linux include (but not limited to):
15 #   libzip, chacha-xmm, chacha256, chachaRng, rdrand, t1ha2
16 # Tested by actually removing the source files and performing a build
17 # For this reason, we don't have to worry about their licenses
18 LICENSE="Apache-2.0 BSD RSA truecrypt-3.0"
19 SLOT="0"
20 KEYWORDS="~amd64"
21 IUSE="+asm cpu_flags_x86_sse2 cpu_flags_x86_sse4_1 cpu_flags_x86_ssse3 doc X"
22 RESTRICT="bindist mirror"
24 RDEPEND="
25         app-admin/sudo
26         sys-apps/pcsc-lite
27         sys-fs/fuse:0
28         sys-fs/lvm2
29         x11-libs/wxGTK:${WX_GTK_VER}[X?]"
30 DEPEND="${RDEPEND}"
31 BDEPEND="
32         asm? ( dev-lang/yasm )
33         virtual/pkgconfig"
35 CONFIG_CHECK="~BLK_DEV_DM ~CRYPTO ~CRYPTO_XTS ~DM_CRYPT ~FUSE_FS"
37 src_configure() {
38         setup-wxwidgets
40         # https://bugs.gentoo.org/786741
41         # std::byte clashes with src/Common/Tcdefs.h typedef
42         append-cxxflags -std=c++14
45 src_compile() {
46         local myemakeargs=(
47                 NOSTRIP=1
48                 NOTEST=1
49                 VERBOSE=1
50                 CC="$(tc-getCC)"
51                 CXX="$(tc-getCXX)"
52                 AR="$(tc-getAR)"
53                 RANLIB="$(tc-getRANLIB)"
54                 TC_EXTRA_CFLAGS="${CFLAGS}"
55                 TC_EXTRA_CXXFLAGS="${CXXFLAGS}"
56                 TC_EXTRA_LFLAGS="${LDFLAGS}"
57                 WX_CONFIG="${WX_CONFIG}"
58                 $(usex X "" "NOGUI=1")
59                 $(usex asm "" "NOASM=1")
60                 $(usex cpu_flags_x86_sse2 "" "NOSSE2=1")
61                 $(usex cpu_flags_x86_sse4_1 "SSE41=1" "")
62                 $(usex cpu_flags_x86_ssse3 "SSSE3=1" "")
63         )
65         emake "${myemakeargs[@]}"
68 src_test() {
69         ./Main/veracrypt --text --test || die "tests failed"
72 src_install() {
73         local DOCS=( Readme.txt )
75         dobin Main/veracrypt
76         if use doc; then
77                 DOCS+=( "${S}"/../doc/EFI-DCS )
78                 docompress -x /usr/share/doc/${PF}/EFI-DCS
79                 HTML_DOCS=( "${S}"/../doc/html/. )
80         fi
81         einstalldocs
83         newinitd "${FILESDIR}"/veracrypt.init veracrypt
85         if use X; then
86                 local s
87                 for s in 16 48 128 256; do
88                         newicon -s ${s} Resources/Icons/VeraCrypt-${s}x${s}.xpm veracrypt.xpm
89                 done
90                 make_desktop_entry veracrypt "VeraCrypt" veracrypt "Utility;Security"
91         fi
93         pax-mark -m "${ED}"/usr/bin/veracrypt
96 pkg_postinst() {
97         local version
99         ewarn "VeraCrypt has a very restrictive license. Please be explicitly aware"
100         ewarn "of the limitations on redistribution of binaries or modified source."
102         # Remove this when we remove veracrypt-1.25.9.ebuild from the tree.
103         for version in ${REPLACING_VERSIONS}; do
104                 if ver_test "${version}" -lt "1.26.7"; then
105                         ewarn "Starting with 1.26.7, TrueCrypt volumes are no longer supported."
106                         ewarn "Please explore alternatives such as dm-crypt to mount truecrypt volumes."
107                         ewarn "Moreover, support for RIPEMD160 and GOST89 is dropped."
108                         ewarn "Volumes using these algoritms will no longer mount."
109                 fi
110         done