summaryrefslogtreecommitdiff
blob: 9f44599c856e97ba9787ed8ec3e3e4b3c007d6a0 (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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# Copyright 1999-2020 Martin V\"ath
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DESCRIPTION="Wolfgang Friebel's preprocessor for sys-apps/less. Disable by appending colon"
HOMEPAGE="https://github.com/wofr06/lesspipe"
SRC_URI="https://www-zeuthen.desy.de/~friebel/unix/less/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~x64-cygwin ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"

case ${PV} in
9999*)
	EGIT_REPO_URI="https://github.com/wofr06/${PN}.git"
	#EGIT_BRANCH="master"
	EGIT_BRANCH="lesspipe"
	inherit git-r3
	SRC_URI=""
	KEYWORDS="";;
*alpha*)
	RESTRICT="mirror"
	EGIT_COMMIT="d13c24786e7af2eecb10ebaeec811acbac8553af"
	SRC_URI="https://github.com/vaeth/${PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}/${PN}-${EGIT_COMMIT}";;
esac
inherit required-use-warn
pkg_pretend() {
	required-use-warn
}

IUSE="antiword brotli cabextract catdoc +cpio +djvu dpkg +dvi2tty +elinks exiftool fastjar +ghostscript gpg +groff hdf5 +html2text id3v2 image isoinfo libplist libreoffice +links +lynx lz4 lzip mediainfo mp3info mp3info2 netcdf ooffice p7zip pandoc pdf pstotext rar rpm +rpm2targz unrar unrtf +unzip +w3m wv xlhtml zstd"

htmlmode="( || ( html2text links lynx elinks w3m ) )"
REQUIRED_USE="!rpm2targz? ( rpm? ( cpio ) )
	ooffice? ${htmlmode}
	xlhtml? ${htmlmode}"
REQUIRED_USE_WARN="
	alpha? ( !brotli !catdoc !exiftool !fastjar !id3v2 !libplist !libreoffice
		!mediainfo !mp3info !mp3info2 !netcdf !ooffice !pandoc !pstotext
		!rar !zstd )
	arm? ( !antiword !brotli !catdoc !exiftool !fastjar !html2text !id3v2
		!mediainfo !mp3info !ooffice !pandoc !pstotext !rar !xlhtml )
	arm64? ( !antiword !catdoc !dpkg !elinks !exiftool !fastjar !html2text
		!id3v2 !mediainfo !mp3info !mp3info2 !netcdf !ooffice !pandoc !pstotext
		!rar !unrtf !wv !xlhtml )
	hppa? ( !catdoc !brotli !exiftool !fastjar !hdf5 !libplist !libreoffice
		!mediainfo !mp3info2 !netcdf !ooffice !pandoc !rar !w3m !xlhtml !zstd )
	ia64? ( !antiword !brotli !catdoc !exiftool !fastjar !id3v2 !libplist
		!libreoffice !mp3info !mp3info2 !mediainfo !netcdf !ooffice
		!pandoc !pstotext !rar !xlhtml !zstd )
	ppc? ( !brotli !libreoffice !mediainfo !pandoc )
	ppc64? ( !brotli !catdoc !fastjar !mediainfo !ooffice !pandoc !xlhtml )
	sparc? ( !brotli !catdoc !exiftool !fastjar !id3v2 !libplist !libreoffice
		!mediainfo !mp3info2 !netcdf !ooffice !pandoc !pstotext !zstd )"

BOTH_DEPEND="sys-apps/file
	app-arch/xz-utils
	app-arch/bzip2
	dev-lang/perl
	brotli? ( !alpha? ( !arm? ( !hppa? ( !ia64? ( !ppc? ( !ppc64? ( !sparc?
		( >=app-arch/brotli-1 ) ) ) ) ) ) ) )
	lz4? ( app-arch/lz4 )
	zstd? ( !alpha? ( !hppa? ( !ia64? ( !sparc? ( app-arch/zstd ) ) ) ) )
	unzip? ( app-arch/unzip )
	fastjar? ( !alpha? ( !arm? ( !arm64? ( !hppa? ( !ia64? ( !ppc64? (
		!sparc? ( app-arch/fastjar ) ) ) ) ) ) ) )
	unrar? ( app-arch/unrar )
	!unrar? (
		rar? ( !alpha? ( !arm? ( !arm64? ( !hppa? ( !ia64?
			( app-text/o3read ) ) ) ) ) ) )
	lzip? ( app-arch/lzip )
	p7zip? ( app-arch/p7zip )
	cpio? ( app-arch/cpio )
	cabextract? ( app-arch/cabextract )
	exiftool? ( !alpha? ( !arm? ( !hppa? ( !ia64? ( !sparc?
		( media-libs/exiftool ) ) ) ) ) )
	html2text? ( !arm? ( !arm64? ( app-text/html2text ) ) )
	!html2text? (
		links? ( www-client/links )
		!links? (
			lynx? ( www-client/lynx )
			!lynx? (
				elinks? ( !arm64? ( www-client/elinks ) )
				!elinks? (
					w3m? ( !hppa? ( www-client/w3m ) ) ) ) ) )
	groff? ( sys-apps/groff )
	rpm2targz? ( app-arch/rpm2targz )
	!rpm2targz? ( rpm? ( app-arch/rpm ) )
	antiword? ( !arm? ( !arm64? ( !ia64? ( app-text/antiword ) ) ) )
	!antiword? (
		catdoc? ( !alpha? ( !arm? ( !arm64? ( !hppa? ( !ia64?
			( !ppc64? ( !sparc? ( app-text/catdoc ) ) ) ) ) ) ) ) )
	xlhtml? ( !arm? ( !arm64? ( !hppa? ( !ia64? ( !ppc64?
		( app-text/xlhtml ) ) ) ) ) )
	unrtf? ( !arm64? ( app-text/unrtf ) )
	ooffice? ( !alpha? ( !arm? ( !arm64? ( !hppa? ( !ia64? (
		!ppc64? ( !sparc? ( app-text/o3read ) ) ) ) ) ) ) )
	pandoc? ( !alpha? ( !arm? ( !arm64? ( !hppa? ( !ia64? ( !ppc? ( !ppc64? (
		!sparc? ( app-text/pandoc ) ) ) ) ) ) ) ) )
	libreoffice? ( !alpha? ( !hppa? ( !ia64? ( !ppc? ( !sparc?
		( app-office/libreoffice ) ) ) ) ) )
	djvu? ( app-text/djvu )
	dvi2tty? ( dev-tex/dvi2tty )
	pstotext? ( !alpha? ( !arm? ( !arm64? ( !ia64? ( !sparc?
		( app-text/pstotext ) ) ) ) ) )
	!pstotext? ( ghostscript? ( app-text/ghostscript-gpl ) )
	gpg? ( app-crypt/gnupg )
	pdf? ( app-text/poppler )
	id3v2? ( !alpha? ( !arm? ( !arm64? ( !ia64? ( !sparc?
		( media-sound/id3v2 ) ) ) ) ) )
	!id3v2? (
		mp3info2? ( !alpha? ( !arm64? ( !hppa? ( !ia64? ( !sparc?
			( dev-perl/MP3-Tag ) ) ) ) ) )
		!mp3info2? (
			mp3info? ( !alpha? ( !arm? ( !arm64? ( !ia64?
				( media-sound/mp3info ) ) ) ) ) ) )
	image? ( virtual/imagemagick-tools )
	isoinfo? ( || ( virtual/cdrtools app-cdr/dvd+rw-tools ) )
	libplist? ( !alpha? ( !hppa? ( !ia64? ( !sparc?
		( app-pda/libplist ) ) ) ) )
	dpkg? ( !arm64? ( app-arch/dpkg ) )
	hdf5? ( !hppa? ( sci-libs/hdf5 ) )
	netcdf? ( !alpha? ( !arm64?  ( !hppa? ( !ia64? ( !sparc?
		( sci-libs/netcdf ) ) ) ) ) )
	wv? ( !arm64? ( app-text/wv ) )
	mediainfo? ( !alpha? ( !arm? ( !arm64? ( !hppa? ( !ia64? ( !ppc? (
		!ppc64? ( !sparc? ( media-video/mediainfo ) ) ) ) ) ) ) ) )"
DEPEND="${BOTH_DEPEND}"
RDEPEND="${BOTH_DEPEND}
	sys-apps/less
	!<sys-apps/less-483-r1"

ModifyStart() {
	sedline=
}

Modify() {
	if [ -z "${sedline:++}" ]
	then	sedline='/^__END__$/,${'
	else	sedline=${sedline}';'
	fi
	sedline=${sedline}'s/^\('${1}'[[:space:]][[:space:]]*\)[nNyY]/\1'${2:-Y}'/'
}

ModifyEnd() {
	sedline=${sedline}'}'
	sed -i -e "${sedline}" "${S}/configure" || die
}

ModifyY() {
	local i
	for i
	do	Modify "${i}"
	done
}

ModifyN() {
	local i
	for i
	do	Modify "${i}" N
	done
}

ModifyX() {
	if [ ${?} -eq 0 ]
	then	ModifyY "${@}"
	else	ModifyN "${@}"
	fi
}

ModifyU() {
	local i
	for i
	do	use "${i}"; ModifyX "${i}"
	done
}

Modify1() {
	local i search
	search=:
	for i
	do	${search} && use "${i}" && search=false; ModifyX "${i}"
	done
}

src_prepare() {
	printf 'h5dump\t\tN\nncdump\t\tN\n' >>"${S}/configure"
	ModifyStart
	ModifyY 'HILITE'
	ModifyY 'LESS_ADVANCED_PREPROCESSOR'
	ModifyY 'nm'
	ModifyY 'iconv'
	ModifyY 'bzip2'
	ModifyY 'xz' 'lzma'
	ModifyY 'perldoc'
	ModifyU 'unzip' 'fastjar'
	Modify1 'unrar' 'rar'
	ModifyU 'brotli'
	ModifyU 'lz4'
	ModifyU 'lzip'
	ModifyU 'zstd'
	use p7zip; ModifyX '7za'
	ModifyU 'cpio' 'cabextract' 'groff'
	Modify1 'html2text' 'links' 'lynx' 'elinks' 'w3m'
	use rpm2targz; ModifyX 'rpmunpack'
	! use rpm2targz && use rpm; ModifyX 'rpm' 'rpm2cpio'
	Modify1 'antiword' 'catdoc'
	use xlhtml; ModifyX 'ppthtml' 'xlhtml'
	ModifyU 'unrtf'
	use ooffice; ModifyX 'o3tohtml'
	use djvu; ModifyX 'djvutxt'
	ModifyU 'dvi2tty'
	ModifyU 'pstotext'
	! use pstotext && use ghostscript; ModifyX 'ps2ascii'
	ModifyU 'gpg'
	use pdf; ModifyX 'pdftohtml' 'pdftotext' 'pdfinfo'
	Modify1 'id3v2' 'mp3info2' 'mp3info'
	use image; ModifyX 'identify'
	ModifyU 'isoinfo'
	ModifyU 'libreoffice'
	ModifyU 'pandoc'
	use wv; ModifyX 'wvText'
	Modify1 'exiftool' 'mediainfo'
	ModifyN 'dpkg'
	ModifyN 'lsbom'
	use libplist; ModifyX 'plutil'
	use hdf5; ModifyX 'h5dump'
	use netcdf; ModifyX 'ncdump'
	ModifyEnd
	printf '%s\n' 'LESS_ADVANCED_PREPROCESSOR=1' >70lesspipe || die
	default
}

src_configure() {
	./configure --fixed --prefix=/usr || die
}

src_compile() {
	:
}

src_install() {
	doenvd 70lesspipe
	dodir /usr/share/man/man1
	default
}