summaryrefslogtreecommitdiff
blob: 51a5d8403d188edb8e766916972f991bee51532e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit toolchain-funcs flag-o-matic desktop xdg

DESCRIPTION="Advanced file encryption using AES"
HOMEPAGE="https://www.aescrypt.com/"
SRC_URI="https://www.aescrypt.com/download/v$(ver_cut 1)/linux/${P}.tgz"
LICENSE="BSD GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="static X"
RDEPEND="X? (
		|| ( gnome-extra/zenity kde-apps/kdialog )
		dev-lang/perl
	)
	"

PATCHES=(
	"${FILESDIR}/${P}-iconv.patch"
	"${FILESDIR}/${P}-ldflags.patch"
)

src_prepare() {
	xdg_src_prepare
	sed -i \
		-e 's:Icon=/usr/share/aescrypt/SmallLock.png:Icon=SmallLock:' \
		-e 's|Categories=Application;Utility;TextEditor;|Categories=Utility;TextEditor;|' \
		gui/AESCrypt.desktop || die
}

src_compile() {
	if use static; then
		append-cflags "-DDISABLE_ICONV"
		append-ldflags "-static"
	fi
	cd src || die
	emake \
		CFLAGS="${CFLAGS} -Wall -Wextra -pedantic -std=c99 -D_FILE_OFFSET_BITS=64" \
		LDFLAGS="${LDFLAGS}" \
		CC="$(tc-getCC)"
}

src_test() {
	cd src || die
	emake -j1 test \
		CFLAGS="${CFLAGS} -Wall -Wextra -pedantic -std=c99 -D_FILE_OFFSET_BITS=64" \
		LDFLAGS="${LDFLAGS}" \
		CC="$(tc-getCC)"
}

src_install() {
	dobin src/{aescrypt,aescrypt_keygen}
	doman man/*
	doicon gui/SmallLock.png
	domenu gui/AESCrypt.desktop
	dobin gui/aescrypt-gui
}

pkg_postinst() {
	xdg_pkg_postinst
	if use X; then
		einfo 'The .desktop file for aescrypt is only supposed to be used with "Open With"'
		einfo 'to encrypt and decrypt files.'
		einfo 'See:'
		einfo '	https://www.aescrypt.com/linux_aes_crypt.html'
		einfo 'for more information'
	fi
}