summaryrefslogtreecommitdiff
blob: 7f1630a41b5a09b9868e5a87930b08d1e373a431 (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

MY_PV="${PV/./}"
URI_AMD64="https://www.rarlab.com/rar/rarlinux-x64-${MY_PV}.tar.gz"
URI_X86="https://www.rarlab.com/rar/rarlinux-x32-${MY_PV}.tar.gz"
URI_WIN64="https://www.rarlab.com/rar/winrar-x64-${MY_PV}.exe"

inherit unpacker

DESCRIPTION="RAR compressor/uncompressor"
HOMEPAGE="https://www.rarlab.com/"
SRC_URI="
	all-sfx? (
		${URI_AMD64}
		${URI_X86}
		${URI_WIN64}
	)
	amd64? ( ${URI_AMD64} )
	x86? ( ${URI_X86} )
"
S="${WORKDIR}/${PN}"

LICENSE="BSD BSD-2 RAR"
SLOT="0"
KEYWORDS="-* amd64 ~x86"
IUSE="all-sfx"
RESTRICT="bindist mirror"

RDEPEND="sys-libs/glibc"
BDEPEND="all-sfx? ( app-arch/unrar )"

DOCS=( "acknow.txt" "rar.txt" "readme.txt" "whatsnew.txt" )

QA_PREBUILT="
	opt/rar/default.sfx
	opt/rar/default-elf32.sfx
	opt/rar/default-elf64.sfx
	opt/rar/default-win32.sfx
	opt/rar/default-win64.sfx
	opt/rar/unrar
	opt/rar/rar
	opt/rar/WinCon.SFX
	opt/rar/WinCon64.SFX
	opt/rar/Zip.SFX
	opt/rar/Zip64.SFX
"

src_unpack() {
	local _file

	for _file in ${A}; do
		if [[ "${_file}" == rarli* ]]; then
			if [[ "${_file}" =~ x64 ]]; then
				if ! use amd64; then
					continue
				fi

				unpack "${_file}"
			elif [[ ! "${_file}" =~ x64 ]]; then
				if ! use x86; then
					continue
				fi

				unpack "${_file}"
			else
				die "Unknown SRC file '${_file}'!"
			fi
		fi
	done

	if use all-sfx ; then
		mkdir sfx
		cd sfx
		for _file in ${A}; do
			if [[ "${_file}" == rarli* ]]; then
				unpack "${_file}"
				if [[ "${_file}" =~ x64 ]]; then
					mv rar/default.sfx default-elf64.sfx || die
				else
					mv rar/default.sfx default-elf32.sfx || die
				fi
			elif [[ "${_file}" == winrar* ]]; then
				ln -s "${DISTDIR}"/${_file} w64.rar || die
				unpack_rar ./w64.rar
				mv Default.SFX default-win32.sfx || die
				mv Default64.SFX default-win64.sfx || die
			else
				die "Unknown SFX file '${_file}'!"
			fi
		done
	fi
}

src_compile() { :; }

src_install() {
	exeinto /opt/rar
	doexe rar unrar

	insinto /opt/rar
	doins rarfiles.lst

	if use all-sfx; then
		doins "${WORKDIR}"/sfx/*.{sfx,SFX}
	else
		doins default.sfx
	fi

	dodir /opt/bin
	dosym ../rar/rar /opt/bin/rar
	dosym ../rar/unrar /opt/bin/unrar

	docinto html
	dodoc order.htm

	einstalldocs
}