Lines 1-62
Link Here
|
1 |
# Copyright 1999-2023 Gentoo Authors |
1 |
# Copyright 1999-2023 Gentoo Authors |
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
3 |
|
4 |
EAPI=8 |
4 |
EAPI=8 |
5 |
|
5 |
|
6 |
inherit multilib toolchain-funcs |
6 |
inherit multilib toolchain-funcs |
7 |
|
7 |
|
8 |
MY_PN="${PN}src" |
8 |
MY_PN="${PN}src" |
9 |
|
9 |
|
10 |
DESCRIPTION="Uncompress rar files" |
10 |
DESCRIPTION="Uncompress rar files" |
11 |
HOMEPAGE="https://www.rarlab.com/rar_add.htm" |
11 |
HOMEPAGE="https://www.rarlab.com/rar_add.htm" |
12 |
SRC_URI="https://www.rarlab.com/rar/${MY_PN}-${PV}.tar.gz -> ${P}.tar.gz" |
12 |
SRC_URI="https://www.rarlab.com/rar/${MY_PN}-${PV}.tar.gz -> ${P}.tar.gz" |
13 |
S="${WORKDIR}/unrar" |
13 |
S="${WORKDIR}/unrar" |
14 |
|
14 |
|
15 |
LICENSE="unRAR" |
15 |
LICENSE="unRAR" |
16 |
SLOT="0/6" # subslot = soname version |
16 |
SLOT="0/6" # subslot = soname version |
17 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" |
17 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" |
18 |
|
18 |
|
19 |
PATCHES=( "${FILESDIR}/${PN}-6.2.6-honor-flags.patch" ) |
19 |
PATCHES=( "${FILESDIR}/${PN}-6.2.6-honor-flags.patch" ) |
20 |
|
20 |
|
21 |
src_prepare() { |
21 |
src_prepare() { |
22 |
default |
22 |
default |
23 |
|
23 |
|
24 |
local sed_args=( -e "/libunrar/s:.so:$(get_libname ${PV%.*.*}):" ) |
24 |
local sed_args=( -e "/libunrar/s:.so:$(get_libname ${PV%.*.*}):" ) |
25 |
if [[ ${CHOST} == *-darwin* ]] ; then |
25 |
if [[ ${CHOST} == *-darwin* ]] ; then |
26 |
sed_args+=( -e "s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/$(get_libdir)/libunrar$(get_libname ${PV%.*.*}):" ) |
26 |
sed_args+=( -e "s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/$(get_libdir)/libunrar$(get_libname ${PV%.*.*}):" ) |
27 |
else |
27 |
else |
28 |
sed_args+=( -e "s:-shared:& -Wl,-soname -Wl,libunrar$(get_libname ${PV%.*.*}):" ) |
28 |
sed_args+=( -e "s:-shared:& -Wl,-soname -Wl,libunrar$(get_libname ${PV%.*.*}):" ) |
29 |
fi |
29 |
fi |
30 |
sed -i "${sed_args[@]}" makefile || die |
30 |
sed -i "${sed_args[@]}" makefile || die |
31 |
} |
31 |
} |
32 |
|
32 |
|
33 |
src_configure() { |
33 |
src_configure() { |
34 |
mkdir -p build-{lib,bin} || die |
34 |
mkdir -p build-{lib,bin} || die |
35 |
printf 'VPATH = ..\ninclude ../makefile' > build-lib/Makefile || die |
35 |
printf 'VPATH = ..\ninclude ../makefile' > build-lib/Makefile || die |
36 |
cp build-{lib,bin}/Makefile || die |
36 |
cp build-{lib,bin}/Makefile || die |
37 |
} |
37 |
} |
38 |
|
38 |
|
39 |
src_compile() { |
39 |
src_compile() { |
40 |
unrar_make() { |
40 |
unrar_make() { |
41 |
emake AR="$(tc-getAR)" CXX="$(tc-getCXX)" CXXFLAGS="${CXXFLAGS}" STRIP=true "$@" |
41 |
emake AR="$(tc-getAR)" CXX="$(tc-getCXX)" CXXFLAGS="${CXXFLAGS}" STRIP=true "$@" |
42 |
} |
42 |
} |
43 |
|
43 |
|
44 |
unrar_make CXXFLAGS+=" -fPIC" -C build-lib lib |
44 |
unrar_make CXXFLAGS+=" -fPIC" -C build-lib lib |
45 |
ln -s libunrar$(get_libname ${PV%.*.*}) build-lib/libunrar$(get_libname) || die |
45 |
ln -s libunrar$(get_libname ${PV%.*.*}) build-lib/libunrar$(get_libname) || die |
46 |
ln -s libunrar$(get_libname ${PV%.*.*}) build-lib/libunrar$(get_libname ${PV}) || die |
46 |
ln -s libunrar$(get_libname ${PV%.*.*}) build-lib/libunrar$(get_libname ${PV}) || die |
47 |
|
47 |
|
48 |
unrar_make -C build-bin |
48 |
unrar_make -C build-bin |
49 |
} |
49 |
} |
50 |
|
50 |
|
51 |
src_install() { |
51 |
src_install() { |
52 |
dobin build-bin/unrar |
52 |
dobin build-bin/unrar |
53 |
dodoc readme.txt |
53 |
dodoc readme.txt |
54 |
|
54 |
|
55 |
dolib.so build-lib/libunrar* |
55 |
dolib.so build-lib/libunrar* |
56 |
|
56 |
|
57 |
insinto /usr/include/libunrar${PV%.*.*} |
57 |
# unrar doesn't officially install headers, but unofficially, software |
|
|
58 |
# depends on it anyway. There is no standard for where to install them, |
59 |
# but the most common location (shared by nearly all vendors) is "unrar". |
60 |
# FreeBSD alone uses "libunrar". Gentoo formerly used "libunrar6" and |
61 |
# had a compat symlink for FreeBSD, then passed the compat location in |
62 |
# ./configure scripts e.g. for sys-fs/rar2fs. Software in the wild |
63 |
# seems to expect either "unrar" or "libunrar". |
64 |
# See: https://bugs.gentoo.org/916036 |
65 |
# |
66 |
# We now use the "standard" (hah) location, and keep the compat symlink but |
67 |
# change the destination. The version-suffixed location lacks utility, but |
68 |
# we would keep it if we could, just in case -- unfortunately portage is |
69 |
# buggy: https://bugs.gentoo.org/834600 |
70 |
# |
71 |
# Hopefully, no one has ever actually used it and therefore this does not |
72 |
# matter. The odds are on our side, since it periodically changed location |
73 |
# arbitrarily. |
74 |
insinto /usr/include/unrar |
58 |
doins *.hpp |
75 |
doins *.hpp |
59 |
dosym libunrar${PV%.*.*} /usr/include/libunrar |
76 |
dosym unrar /usr/include/libunrar |
60 |
|
77 |
|
61 |
find "${ED}" -type f -name "*.a" -delete || die |
78 |
find "${ED}" -type f -name "*.a" -delete || die |
62 |
} |
79 |
} |
63 |
- |
|
|