app-crypt/veracrypt: bump to 1.24-Hotfix1
[gentoo.git] / app-crypt / veracrypt / veracrypt-1.24_p1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit eutils linux-info pax-utils toolchain-funcs wxwidgets
6
7 DESCRIPTION="Disk encryption with strong security based on TrueCrypt"
8 HOMEPAGE="https://www.veracrypt.fr/en/Home.html"
9 SRC_URI="https://github.com/${PN}/VeraCrypt/archive/VeraCrypt_1.24-Hotfix1.tar.gz -> ${P}.tar.gz"
10
11 # The modules not linked against in Linux include (but not limited to):
12 #   libzip, chacha-xmm, chacha256, chachaRng, jitterentropy, rdrand, t1ha2
13 # Tested by actually removing the source files and performing a build
14 # For this reason, We don't have to worry about their licenses
15 LICENSE="Apache-2.0 truecrypt-3.0"
16 SLOT="0"
17 KEYWORDS="~amd64"
18 IUSE="+asm cpu_flags_x86_sse2 cpu_flags_x86_sse4_1 cpu_flags_x86_ssse3 doc X"
19 RESTRICT="bindist mirror"
20
21 WX_GTK_VER="3.0-gtk3"
22
23 RDEPEND="
24         sys-fs/lvm2
25         sys-fs/fuse:0
26         x11-libs/wxGTK:${WX_GTK_VER}[X?]
27         app-admin/sudo
28         dev-libs/pkcs11-helper
29 "
30 DEPEND="
31         ${RDEPEND}
32         virtual/pkgconfig
33         asm? ( dev-lang/yasm )
34 "
35
36 S="${WORKDIR}/VeraCrypt-VeraCrypt_1.24-Hotfix1/src"
37
38 pkg_setup() {
39         local CONFIG_CHECK="~BLK_DEV_DM ~CRYPTO ~CRYPTO_XTS ~DM_CRYPT ~FUSE_FS"
40         linux-info_pkg_setup
41
42         setup-wxwidgets
43 }
44
45 src_prepare() {
46         eapply -p2 "${FILESDIR}"/${PN}-1.24-no-gui-fix.patch
47         default
48 }
49
50 src_compile() {
51         local TC_EXTRA_CFLAGS="${CFLAGS}"
52         local TC_EXTRA_CXXFLAGS="${CXXFLAGS}"
53         local myemakeargs=(
54                 NOSTRIP=1
55                 NOTEST=1
56                 VERBOSE=1
57                 CC="$(tc-getCC)"
58                 CXX="$(tc-getCXX)"
59                 AR="$(tc-getAR)"
60                 RANLIB="$(tc-getRANLIB)"
61                 TC_EXTRA_LFLAGS="${LDFLAGS}"
62                 WX_CONFIG="${WX_CONFIG}"
63                 $(usex X "" "NOGUI=1")
64                 $(usex asm "" "NOASM=1")
65                 $(usex cpu_flags_x86_sse2 "" "NOSSE2=1")
66                 $(usex cpu_flags_x86_sse4_1 "SSE41=1" "")
67                 $(usex cpu_flags_x86_ssse3 "SSSE3=1" "")
68         )
69
70         # We need to explicitly disable the GUI support when linking against
71         # wxwidgets, in case it was compiled with USE=X
72         if ! use X; then
73                 TC_EXTRA_CFLAGS="${TC_EXTRA_CFLAGS} -DwxUSE_GUI=0"
74                 TC_EXTRA_CXXFLAGS="${TC_EXTRA_CXXFLAGS} -DwxUSE_GUI=0"
75         fi
76
77         myemakeargs+=(
78                 TC_EXTRA_CFLAGS="${TC_EXTRA_CFLAGS}"
79                 TC_EXTRA_CXXFLAGS="${TC_EXTRA_CXXFLAGS}"
80         )
81
82         emake "${myemakeargs[@]}"
83 }
84
85 src_test() {
86         "${S}/Main/veracrypt" --text --test || die "tests failed"
87 }
88
89 src_install() {
90         local DOCS=( Readme.txt )
91         local HTML_DOCS=( )
92
93         dobin Main/veracrypt
94         if use doc; then
95                 DOCS+=( "${S}"/../doc/EFI-DCS )
96                 docompress -x "/usr/share/doc/${PF}/EFI-DCS"
97                 HTML_DOCS+=( "${S}"/../doc/html/. )
98         fi
99         einstalldocs
100
101         newinitd "${FILESDIR}/${PN}.init" ${PN}
102
103         if use X; then
104                 local s
105                 for s in 16 48 128 256; do
106                         newicon -s ${s} Resources/Icons/VeraCrypt-${s}x${s}.xpm veracrypt.xpm
107                 done
108                 make_desktop_entry ${PN} "VeraCrypt" ${PN} "Utility;Security"
109         fi
110
111         pax-mark -m "${D%/}/usr/bin/veracrypt"
112 }
113
114 pkg_postinst() {
115         ewarn "VeraCrypt has a very restrictive license. Please be explicitly aware"
116         ewarn "of the limitations on redistribution of binaries or modified source."
117 }