| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
inherit autotools flag-o-matic toolchain-funcs
|
|
6 |
inherit autotools toolchain-funcs
|
| 7 |
7 |
|
| 8 |
8 |
MY_PN="${PN/-/_}"
|
| 9 |
9 |
MY_P="${MY_PN}-${PV}"
|
| 10 |
10 |
|
| 11 |
11 |
DESCRIPTION="Similar to dd but can copy from source with errors"
|
| 12 |
|
HOMEPAGE="http://www.garloff.de/kurt/linux/ddrescue/"
|
| 13 |
|
SRC_URI="http://www.garloff.de/kurt/linux/ddrescue/${MY_P}.tar.bz2"
|
| 14 |
|
S="${WORKDIR}/${MY_P}"
|
|
12 |
HOMEPAGE="https://www.garloff.de/kurt/linux/ddrescue/"
|
|
13 |
|
|
14 |
if [[ ${PV} == 9999 ]] ; then
|
|
15 |
EGIT_REPO_URI="https://git.code.sf.net/p/ddrescue/code"
|
|
16 |
EGIT_BRANCH=DD_RESCUE_1_99_BRANCH
|
|
17 |
inherit git-r3
|
|
18 |
else
|
|
19 |
SRC_URI="https://www.garloff.de/kurt/linux/ddrescue/${MY_P}.tar.bz2"
|
|
20 |
S="${WORKDIR}/${MY_P}"
|
|
21 |
KEYWORDS="amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~sparc x86"
|
|
22 |
fi
|
| 15 |
23 |
|
| 16 |
24 |
LICENSE="|| ( GPL-2 GPL-3 )"
|
| 17 |
25 |
SLOT="0"
|
| 18 |
|
KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~sparc ~x86"
|
| 19 |
|
IUSE="cpu_flags_x86_avx2 lzo lzma cpu_flags_x86_sse4_2 static test xattr"
|
|
26 |
IUSE="cpu_flags_x86_avx2 cpu_flags_x86_sse4_2 lzo lzma static test xattr"
|
| 20 |
27 |
RESTRICT="!test? ( test )"
|
| 21 |
28 |
|
| 22 |
29 |
RDEPEND="
|
| 23 |
|
lzo? ( dev-libs/lzo )
|
| 24 |
|
xattr? ( sys-apps/attr )
|
|
30 |
!static? (
|
|
31 |
lzma? ( app-arch/xz-utils )
|
|
32 |
lzo? ( dev-libs/lzo:2 )
|
|
33 |
)
|
| 25 |
34 |
"
|
| 26 |
35 |
DEPEND="${RDEPEND}"
|
| 27 |
36 |
BDEPEND="
|
| 28 |
37 |
test? (
|
| 29 |
|
lzo? (
|
| 30 |
|
app-arch/lzop
|
| 31 |
|
)
|
|
38 |
lzo? ( app-arch/lzop )
|
| 32 |
39 |
)
|
| 33 |
40 |
"
|
| 34 |
41 |
|
|
42 |
PATCHES=(
|
|
43 |
# see https://sourceforge.net/p/ddrescue/tickets/10/
|
|
44 |
"${FILESDIR}"/${PN}-1.99.22-fix_static.patch
|
|
45 |
)
|
|
46 |
|
| 35 |
47 |
src_prepare() {
|
| 36 |
48 |
default
|
| 37 |
49 |
|
| ... | ... | |
| 56 |
68 |
}
|
| 57 |
69 |
|
| 58 |
70 |
src_configure() {
|
| 59 |
|
use static && append-ldflags -static
|
| 60 |
|
|
| 61 |
71 |
# OpenSSL is only used by a random helper tool we don't install.
|
| 62 |
|
export ac_cv_header_attr_xattr_h=$(usex xattr)
|
|
72 |
# sys_xattr is preferred over attr_xattr, disable attr_xattr assuming glibc/musl
|
|
73 |
export ac_cv_header_attr_xattr_h=no
|
|
74 |
export ac_cv_header_sys_xattr_h=$(usex xattr)
|
| 63 |
75 |
export ac_cv_header_openssl_evp_h=no
|
| 64 |
76 |
export ac_cv_lib_crypto_EVP_aes_192_ctr=no
|
| 65 |
77 |
export ac_cv_lib_lzo2_lzo1x_1_compress=$(usex lzo)
|
| ... | ... | |
| 83 |
95 |
# HAVE_LZO is special as it's checked for emptiness in test_crypt.sh.
|
| 84 |
96 |
# We could try make RDRND and friends controlled via USE but it's too brittle,
|
| 85 |
97 |
# see bug #947105.
|
| 86 |
|
emake \
|
| 87 |
|
MACH="${arch}" \
|
| 88 |
|
OS="${os}" \
|
| 89 |
|
HAVE_SSE42=$(usex cpu_flags_x86_sse4_2 1 0) \
|
| 90 |
|
HAVE_AVX2=$(usex cpu_flags_x86_avx2 1 0) \
|
| 91 |
|
HAVE_LZMA=$(usex lzma 1 0) \
|
| 92 |
|
HAVE_LZO=$(usev lzo 1) \
|
| 93 |
|
HAVE_OPENSSL=0 \
|
| 94 |
|
RPM_OPT_FLAGS="${CFLAGS} ${CPPFLAGS}" \
|
| 95 |
|
CFLAGS_OPT='$(CFLAGS)' \
|
| 96 |
|
LDFLAGS="${LDFLAGS} -Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/${PN}" \
|
| 97 |
|
CC="$(tc-getCC)" \
|
| 98 |
|
"$@"
|
|
98 |
local myemakeargs=(
|
|
99 |
MACH="${arch}"
|
|
100 |
OS="${os}"
|
|
101 |
HAVE_SSE42=$(usex cpu_flags_x86_sse4_2 1 0)
|
|
102 |
HAVE_AVX2=$(usex cpu_flags_x86_avx2 1 0)
|
|
103 |
HAVE_LZMA=$(usex lzma 1 0)
|
|
104 |
HAVE_LZO=$(usev lzo 1)
|
|
105 |
HAVE_OPENSSL=0
|
|
106 |
RPM_OPT_FLAGS="${CFLAGS} ${CPPFLAGS}"
|
|
107 |
CFLAGS_OPT='$(CFLAGS)'
|
|
108 |
LDFLAGS="${LDFLAGS} -Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/${PN}"
|
|
109 |
CC="$(tc-getCC)"
|
|
110 |
)
|
|
111 |
emake "${myemakeargs[@]}" "$@"
|
| 99 |
112 |
}
|
| 100 |
113 |
|
| 101 |
114 |
src_compile() {
|
| 102 |
|
_emake
|
|
115 |
_emake $(usev static)
|
| 103 |
116 |
}
|
| 104 |
117 |
|
| 105 |
118 |
src_test() {
|
| ... | ... | |
| 110 |
123 |
test_lzo.sh || die
|
| 111 |
124 |
fi
|
| 112 |
125 |
|
| 113 |
|
_emake check
|
|
126 |
# make only basic tests for static
|
|
127 |
_emake $(usex static check_fault check)
|
| 114 |
128 |
}
|
| 115 |
129 |
|
| 116 |
130 |
src_install() {
|
| 117 |
131 |
# easier to install by hand than trying to make sense of the Makefile.
|
| 118 |
132 |
dobin dd_rescue
|
| 119 |
|
dodir /usr/$(get_libdir)/${PN}
|
| 120 |
|
cp -pPR libddr_*.so "${ED}"/usr/$(get_libdir)/${PN}/ || die
|
|
133 |
if ! use static; then
|
|
134 |
insinto /usr/$(get_libdir)/${PN}
|
|
135 |
insopts -m 0755
|
|
136 |
doins libddr_*.so
|
|
137 |
fi
|
| 121 |
138 |
dodoc README.dd_rescue
|
| 122 |
139 |
doman dd_rescue.1
|
| 123 |
140 |
use lzo && doman ddr_lzo.1
|