forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sleuthkit-4.4.2.ebuild
175 lines (138 loc) · 4.13 KB
/
sleuthkit-4.4.2.ebuild
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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
JAVA_PKG_BSFIX_NAME="build.xml build-unix.xml"
inherit autotools java-pkg-opt-2 java-ant-2
DESCRIPTION="A collection of file system and media management forensic analysis tools"
HOMEPAGE="https://www.sleuthkit.org/sleuthkit/"
# TODO: sqlite-jdbc does not exist in the tree, we bundle it for now
SRC_URI="https://github.com/${PN}/${PN}/releases/download/${P}/${P}.tar.gz
java? ( http://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/3.8.11/sqlite-jdbc-3.8.11.jar )"
LICENSE="CPL-1.0 GPL-2+ IBM java? ( Apache-2.0 )"
SLOT="0/13" # subslot = major soname version
KEYWORDS="~amd64 ~hppa ~ppc ~x86"
IUSE="aff doc ewf java static-libs test +threads zlib"
DEPEND="
dev-db/sqlite:3
dev-lang/perl:*
aff? ( app-forensics/afflib )
ewf? ( app-forensics/libewf:= )
java? (
>=virtual/jdk-1.8:*
>=dev-java/c3p0-0.9.5:0
>=dev-java/jdbc-postgresql-9.4:0
)
zlib? ( sys-libs/zlib )
"
RDEPEND="${DEPEND}
java? ( >=virtual/jre-1.8:= )
"
DEPEND="${DEPEND}
doc? ( app-doc/doxygen )
test? ( >=dev-util/cppunit-1.2.1 )
"
PATCHES=(
"${FILESDIR}"/${PN}-4.1.0-tools-shared-libs.patch
"${FILESDIR}"/${PN}-4.4.2-c89-fix.patch
)
TSK_JAR_DIR="${S}/bindings/java/lib"
src_unpack() {
local f
unpack ${P}.tar.gz
# Copy the jar files that don't exist in the tree yet
if use java; then
mkdir "${TSK_JAR_DIR}" || die
for f in ${A}; do
if [[ ${f} =~ .jar$ ]]; then
cp "${DISTDIR}"/"${f}" "${TSK_JAR_DIR}" || die
fi
done
fi
}
src_prepare() {
if use java; then
pushd "${S}"/bindings/java &>/dev/null || die
# Prevent "make install" from installing
# jar files under /usr/share/java
# We'll use the java eclasses for this
sed -e '/^jar_DATA/ d;' -i Makefile.am || die
# Disable dependency retrieval using ivy
# We will handle it ourselves
sed -e '/name="compile"/ s/, retrieve-deps//' \
-e '/name="dist-/ s/, init-ivy//g' \
-i build.xml || die
# Even if static libs are disabled, the build system looks for
# the static library and fails if not present
# Disable that check
use static-libs || sed -e '/<fail unless="present" message="JNI/ d;' \
-i build-unix.xml || die
java-pkg-opt-2_src_prepare
popd &>/dev/null || die
fi
# Override the doxygen output directories
if use doc; then
sed -e "/^OUTPUT_DIRECTORY/ s|=.*$|= ${T}/doc|" \
-i tsk/docs/Doxyfile \
-i bindings/java/doxygen/Doxyfile || die
fi
# It's safe to call this even after java-pkg-opt-2_src_prepare
# because future calls to eapply_user do nothing and return 0
default
eautoreconf
}
src_configure() {
local myeconfargs=(
$(use_enable java)
$(use_enable static-libs static)
$(use_enable threads multithreading)
$(use_with aff afflib)
$(use_with ewf libewf)
$(use_with zlib)
)
if use java; then
pushd "${S}"/bindings/java &>/dev/null || die
java-ant-2_src_configure
popd &>/dev/null || die
fi
econf "${myeconfargs[@]}"
}
src_compile() {
# Create symlinks of jars for the required dependencies
if use java; then
pushd "${S}"/bindings/java &>/dev/null || die
java-pkg_jar-from --into "${TSK_JAR_DIR}" c3p0
java-pkg_jar-from --into "${TSK_JAR_DIR}" jdbc-postgresql
popd &>/dev/null || die
fi
# Create the doc output dirs if requested
if use doc; then
mkdir -p "${T}"/doc/{api-docs,jni-docs} || die
fi
emake all $(usex doc api-docs "")
}
src_install() {
local f
if use java; then
pushd "${S}"/bindings/java &>/dev/null || die
java-pkg_dojar dist/Tsk_DataModel.jar
# Install the bundled jar files
pushd "${TSK_JAR_DIR}" &>/dev/null || die
for f in *; do
# Skip the symlinks java-pkg_jar-from created
[[ -f ${f} ]] || continue
# Strip the version numbers as per eclass recommendation
[[ ${f} =~ -([0-9].)+.jar$ ]] || continue
java-pkg_newjar "${f}" "${f/${BASH_REMATCH[0]}/.jar}"
done
popd &>/dev/null || die
popd &>/dev/null || die
fi
default
# It unconditionally builds both api and jni docs
# We install conditionally based on the provided use flags
if use doc; then
dodoc -r "${T}"/doc/api-docs
use java && dodoc -r "${T}"/doc/jni-docs
fi
find "${D}" -name '*.la' -delete || die
}