summaryrefslogtreecommitdiff
path: root/app-misc/far2l/far2l-9999.ebuild
blob: d1417db7b340bd0d97afcb7c3b47515a0950b4c6 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )

WX_GTK_VER="3.2-gtk3"

inherit cmake optfeature python-single-r1 wxwidgets xdg

DESCRIPTION="Linux port of FAR Manager v2"
HOMEPAGE="https://github.com/elfmz/far2l"

if [[ "${PV}" == "9999" ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/elfmz/far2l"
	EGIT_BRANCH="master"
else
	MY_PV="v_${PV/_beta/}"
	MY_P="${PN}-${MY_PV}"
	S="${WORKDIR}/${MY_P}"
	SRC_URI="https://github.com/elfmz/far2l/archive/${MY_PV}.tar.gz"
	KEYWORDS="~amd64"
fi

LICENSE="GPL-2"
SLOT="0"
IUSE="+archive aws +chardet +colorer mtp nfs python rar samba sdl sftp +ssl webdav wxwidgets X"
REQUIRED_USE="
	python? ( ${PYTHON_REQUIRED_USE} )
"
RESTRICT="mirror"

# media-libs/libmtp provides udev rules and plugdev access for MTP devices.
# far2l itself uses the bundled libmtp with mtp enabled.
RDEPEND="
	archive? ( app-arch/libarchive )
	aws? (
		dev-libs/openssl:0=
		net-libs/neon[ssl]
	)
	chardet? ( app-i18n/uchardet )
	colorer? ( dev-libs/libxml2 )
	mtp? (
		media-libs/libmtp
		dev-libs/libusb:1
	)
	nfs? ( net-fs/libnfs )
	python? (
		${PYTHON_DEPS}
		$(python_gen_cond_dep '
			dev-python/cffi[${PYTHON_USEDEP}]
		')
	)
	rar? ( app-arch/unrar )
	samba? ( net-fs/samba[client] )
	sdl? (
		media-libs/libsdl2
		media-libs/freetype:2
		media-libs/harfbuzz
		media-libs/fontconfig
	)
	sftp? ( net-libs/libssh[sftp] )
	ssl? ( dev-libs/openssl:0= )
	webdav? ( net-libs/neon )
	wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER} )
	X? (
		x11-libs/libX11
		x11-libs/libXi
	)"

DEPEND="${RDEPEND}"

BDEPEND="
	virtual/pkgconfig
	python? ( ${PYTHON_DEPS} )"

DOCS=( README.md )

pkg_setup() {
	if use wxwidgets; then
		setup-wxwidgets
	fi
	if use python; then
		python-single-r1_pkg_setup
	fi
}

src_prepare() {
	sed -e 's|\${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/|\\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/|g' \
		-i CMakeLists.txt || die
	sed -e 's:cmake_minimum_required (VERSION 3\.5\.0):cmake_minimum_required (VERSION 3.10.0):' \
		-i CMakeLists.txt || die
	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DMULTIARC="$(usex archive)"
		-DNR_AWS="$(usex aws)"
		-DUSEUCD="$(usex chardet)"
		-DCOLORER="$(usex colorer)"
		-DMTP="$(usex mtp)"
		-DNR_NFS="$(usex nfs)"
		-DPYTHON="$(usex python)"
		-DUNRAR="$(usex rar lib NO)"
		-DNR_SMB="$(usex samba)"
		-DUSESDL="$(usex sdl)"
		-DNR_SFTP="$(usex sftp)"
		-DNR_OPENSSL="$(usex ssl)"
		-DNR_WEBDAV="$(usex webdav)"
		-DUSEWX="$(usex wxwidgets)"
		-DTTYX="$(usex X)"

		-DMUSL="$(usex elibc_musl)"
		-DBUILD_SHARED_LIBS=OFF
	)

	if use mtp; then
		mycmakeargs+=(
			-DMTP_SYSTEM_LIBUSB=ON
			-DMTP_SYSTEM_LIBMTP=OFF
		)
	fi

	if use X; then
		mycmakeargs+=(
			-DTTYXI=YES
		)
	fi

	cmake_src_configure
}

pkg_postinst() {
	xdg_pkg_postinst
	optfeature "accessing Android devices through the ADB plugin" dev-util/android-tools
	optfeature "privileged file operations through far2l's sudo support" app-admin/sudo
}