Gentoo Archives: gentoo-commits

From: "Miroslav Šulc" <fordfrog@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-forensics/sleuthkit/
Date: Wed, 23 Jun 2021 08:13:15
Message-Id: 1624435980.1f182a6955605f0ef6cdab76e682bdc9a2056077.fordfrog@gentoo
1 commit: 1f182a6955605f0ef6cdab76e682bdc9a2056077
2 Author: Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
3 AuthorDate: Tue Jun 15 07:24:24 2021 +0000
4 Commit: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 23 08:13:00 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f182a69
7
8 app-forensics/sleuthkit: v 4.9.0-r1 switch
9
10 Bug: https://bugs.gentoo.org/784026
11
12 Package-Manager: Portage-3.0.18, Repoman-3.0.2
13 Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
14 Closes: https://github.com/gentoo/gentoo/pull/21245/commits/6f2b8416d60df1f5ba4c4503f2936afc01e812f3
15 Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>
16
17 app-forensics/sleuthkit/sleuthkit-4.9.0-r1.ebuild | 303 ++++++++++++++++++++++
18 1 file changed, 303 insertions(+)
19
20 diff --git a/app-forensics/sleuthkit/sleuthkit-4.9.0-r1.ebuild b/app-forensics/sleuthkit/sleuthkit-4.9.0-r1.ebuild
21 new file mode 100644
22 index 00000000000..376076bbef9
23 --- /dev/null
24 +++ b/app-forensics/sleuthkit/sleuthkit-4.9.0-r1.ebuild
25 @@ -0,0 +1,303 @@
26 +# Copyright 1999-2020 Gentoo Authors
27 +# Distributed under the terms of the GNU General Public License v2
28 +
29 +EAPI=6
30 +
31 +JAVA_PKG_BSFIX_NAME="build.xml build-unix.xml"
32 +inherit autotools java-pkg-opt-2 java-ant-2
33 +
34 +DESCRIPTION="A collection of file system and media management forensic analysis tools"
35 +HOMEPAGE="https://www.sleuthkit.org/sleuthkit/"
36 +# TODO: sqlite-jdbc does not exist in the tree, we bundle it for now
37 +# See: https://bugs.gentoo.org/690010
38 +# TODO: SparseBitSet does not exist in the tree, we bundle it for now
39 +# See: https://bugs.gentoo.org/690012
40 +# TODO: Upstream uses a very specific version of libewf which is not in
41 +# the tree anymore. So we statically compile and link to sleuthkit.
42 +# Hopefully upstream will figure something out in the future.
43 +# See: https://bugs.gentoo.org/689752
44 +# TODO: gson-2.8.5 does not exist in the tree. Building it seems to
45 +# require Java 9. We have Java 11 in the tree but I don't see a
46 +# way to use it as a gentoo-vm in order to build gson. Sleuthkit
47 +# upstream still uses Java 8.
48 +# See: https://bugs.gentoo.org/706274
49 +# TODO: commons-validator-1.6 does not exist in the tree. The latest version
50 +# as of writing this ebuild is 1.4.1, for which the build fails. As
51 +# per #711930, this is a security sensitive bump. We're gonna fetch
52 +# the jar file here and file a bug request for a bump as well:
53 +# https://bugs.gentoo.org/721020
54 +SRC_URI="https://github.com/${PN}/${PN}/releases/download/${P}/${P}.tar.gz
55 + java? (
56 + https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar
57 + http://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/3.25.2/sqlite-jdbc-3.25.2.jar
58 + http://repo1.maven.org/maven2/com/zaxxer/SparseBitSet/1.1/SparseBitSet-1.1.jar
59 + https://repo1.maven.org/maven2/commons-validator/commons-validator/1.6/commons-validator-1.6.jar
60 + )
61 + ewf? ( https://github.com/sleuthkit/libewf_64bit/archive/VisualStudio_2010.tar.gz -> sleuthkit-libewf_64bit-20130416.tar.gz )"
62 +
63 +LICENSE="BSD CPL-1.0 GPL-2+ IBM java? ( Apache-2.0 )"
64 +SLOT="0/13" # subslot = major soname version
65 +KEYWORDS="~amd64 ~hppa ~ppc ~x86"
66 +IUSE="aff doc ewf java postgres static-libs test +threads zlib"
67 +RESTRICT="!test? ( test )"
68 +
69 +#
70 +# Note: It is not possible to move the dep on dev-java/jdbc-postgresql
71 +# inside a conditional postgres? block because java sources import
72 +# org.postgres unconditionally as of writing this (version 4.6.4). The
73 +# postgres USE flag will be used for the TSK postgresql support however.
74 +#
75 +DEPEND="
76 + dev-db/sqlite:3
77 + dev-lang/perl:*
78 + aff? ( app-forensics/afflib )
79 + ewf? ( sys-libs/zlib )
80 + java? (
81 + >=dev-java/c3p0-0.9.5:0
82 + dev-java/commons-lang:3.6
83 + dev-java/guava:20
84 + >=dev-java/jdbc-postgresql-9.4:0
85 + >=dev-java/joda-time-2.4:0
86 + )
87 + postgres? ( dev-db/postgresql:= )
88 + zlib? ( sys-libs/zlib )
89 +"
90 +# TODO: add support for not-in-tree libraries libvhdi and libvmdk
91 +# libvhdi: https://github.com/libyal/libvhdi
92 +# libvmdk: https://github.com/libyal/libvmdk
93 +# DEPEND="${DEPEND}
94 +# vhdi? ( dev-libs/libvhdi )
95 +# vmdk? ( dev-libs/libvmdk )
96 +# "
97 +
98 +RDEPEND="${DEPEND}
99 + java? (
100 + || (
101 + virtual/jre:1.8
102 + virtual/jdk:1.8
103 + )
104 + )
105 +"
106 +DEPEND="${DEPEND}
107 + java? ( virtual/jdk:1.8 )
108 + doc? ( app-doc/doxygen )
109 + test? ( >=dev-util/cppunit-1.2.1 )
110 +"
111 +
112 +PATCHES=(
113 + "${FILESDIR}"/${PN}-4.1.0-tools-shared-libs.patch
114 + "${FILESDIR}"/${PN}-4.6.4-default-jar-location-fix.patch
115 +)
116 +
117 +src_unpack() {
118 + local f
119 +
120 + unpack ${P}.tar.gz
121 +
122 + if use ewf; then
123 + pushd "${T}" &>/dev/null || die
124 + unpack sleuthkit-libewf_64bit-20130416.tar.gz
125 + export TSK_LIBEWF_SRCDIR="${T}"/libewf_64bit-VisualStudio_2010
126 + popd &>/dev/null || die
127 + fi
128 +
129 + # Copy the jar files that don't exist in the tree yet
130 + if use java; then
131 + TSK_JAR_DIR="${T}/lib"
132 + mkdir "${TSK_JAR_DIR}" || die
133 + for f in ${A}; do
134 + if [[ ${f} =~ .jar$ ]]; then
135 + cp "${DISTDIR}"/"${f}" "${TSK_JAR_DIR}" || die
136 + fi
137 + done
138 + export TSK_JAR_DIR
139 + fi
140 +}
141 +
142 +tsk_prepare_libewf() {
143 + # Inlining breaks the compilation, disable it
144 + sed -e 's/LIBUNA_INLINE inline/LIBUNA_INLINE/' \
145 + -i "${TSK_LIBEWF_SRCDIR}"/libuna/libuna_inline.h || die
146 +}
147 +
148 +src_prepare() {
149 + use ewf && tsk_prepare_libewf
150 +
151 + # Do not pass '-Werror'. This is overkill for user builds.
152 + sed -e '/AM_CXXFLAGS/ s/-Werror//g' \
153 + -i tsk/util/Makefile.am \
154 + -i tsk/pool/Makefile.am || die
155 +
156 + if use java; then
157 + pushd "${S}"/bindings/java &>/dev/null || die
158 +
159 + # Prevent "make install" from installing
160 + # jar files under /usr/share/java
161 + # We'll use the java eclasses for this
162 + # See: https://github.com/sleuthkit/sleuthkit/pull/1379
163 + sed -e '/^jar_DATA/ d;' -i Makefile.am || die
164 +
165 + java-pkg-opt-2_src_prepare
166 +
167 + popd &>/dev/null || die
168 + fi
169 +
170 + # Override the doxygen output directories
171 + if use doc; then
172 + sed -e "/^OUTPUT_DIRECTORY/ s|=.*$|= ${T}/doc|" \
173 + -i tsk/docs/Doxyfile \
174 + -i bindings/java/doxygen/Doxyfile || die
175 + fi
176 +
177 + # It's safe to call this even after java-pkg-opt-2_src_prepare
178 + # because future calls to eapply_user do nothing and return 0
179 + default
180 +
181 + eautoreconf
182 +}
183 +
184 +tsk_compile_libewf() {
185 + local myeconfargs=(
186 + --prefix=/
187 + --libdir=/lib
188 + --enable-static
189 + --disable-shared
190 + --disable-winapi
191 + --without-libbfio
192 + --with-zlib
193 + --without-bzip2
194 + --without-libhmac
195 + --without-openssl
196 + --without-libuuid
197 + --without-libfuse
198 +
199 + --with-libcstring=no
200 + --with-libcerror=no
201 + --with-libcdata=no
202 + --with-libclocale=no
203 + --with-libcnotify=no
204 + --with-libcsplit=no
205 + --with-libuna=no
206 + --with-libcfile=no
207 + --with-libcpath=no
208 + --with-libbfio=no
209 + --with-libfcache=no
210 + --with-libfvalue=no
211 +
212 + )
213 + # We want to contain our build flags
214 + local CFLAGS="${CFLAGS}"
215 + local LDFLAGS="${LDFLAGS}"
216 +
217 + pushd "${TSK_LIBEWF_SRCDIR}" &>/dev/null || die
218 +
219 + # Produce relocatable code
220 + CFLAGS+=" -fPIC"
221 + LDFLAGS+=" -fPIC"
222 + econf "${myeconfargs[@]}"
223 +
224 + # Do not waste CPU cycles on building ewftools
225 + sed -e '/ewftools/ d' -i Makefile || die
226 + emake
227 +
228 + # Only install the headers and the library
229 + emake -C libewf DESTDIR="${T}"/image install
230 + emake -C include DESTDIR="${T}"/image install
231 + find "${T}"/image -name '*.la' -delete || die
232 +
233 + popd &>/dev/null || die
234 +}
235 +
236 +src_configure() {
237 + local myeconfargs=(
238 + --enable-offline="${TSK_JAR_DIR}"
239 + $(use_enable java)
240 + $(use_enable static-libs static)
241 + $(use_enable threads multithreading)
242 + $(use_with aff afflib)
243 + $(use_with zlib)
244 + )
245 + # Workaround the automagic detection of postgresql
246 + local -x ac_cv_lib_pq_PQlibVersion="$(usex postgres)"
247 + # TODO: add support for non-existing libraries libvhdi and libvmdk
248 + # myeconfargs+=(
249 + # $(use_with vhdi libvhdi)
250 + # $(use_with vmdk libvmdk)
251 + # )
252 + myeconfargs+=(
253 + --without-libvhdi
254 + --without-libvmdk
255 + )
256 +
257 + use ewf && tsk_compile_libewf
258 + myeconfargs+=( $(use_with ewf libewf "${T}"/image) )
259 +
260 + if use java; then
261 + pushd "${S}"/bindings/java &>/dev/null || die
262 + java-ant-2_src_configure
263 + popd &>/dev/null || die
264 + fi
265 +
266 + econf "${myeconfargs[@]}"
267 +}
268 +
269 +src_compile() {
270 + # Give it an existing bogus ivy home #672220
271 + local -x IVY_HOME="${T}"
272 +
273 + # Create symlinks of jars for the required dependencies
274 + if use java; then
275 + pushd "${S}"/bindings/java &>/dev/null || die
276 +
277 + java-pkg_jar-from --into "${TSK_JAR_DIR}" c3p0
278 + java-pkg_jar-from --into "${TSK_JAR_DIR}" commons-lang:3.6
279 + java-pkg_jar-from --into "${TSK_JAR_DIR}" guava:20
280 + java-pkg_jar-from --into "${TSK_JAR_DIR}" jdbc-postgresql
281 + java-pkg_jar-from --into "${TSK_JAR_DIR}" joda-time
282 +
283 + popd &>/dev/null || die
284 + fi
285 +
286 + # Create the doc output dirs if requested
287 + if use doc; then
288 + mkdir -p "${T}"/doc/{api-docs,jni-docs} || die
289 + fi
290 +
291 + emake all $(usex doc api-docs "")
292 +}
293 +
294 +src_install() {
295 + local f
296 +
297 + if use java; then
298 + pushd "${S}"/bindings/java &>/dev/null || die
299 +
300 + java-pkg_newjar "dist/${P}.jar" "${PN}.jar"
301 +
302 + # Install the bundled jar files
303 + pushd "${TSK_JAR_DIR}" &>/dev/null || die
304 + for f in *; do
305 + # Skip the symlinks java-pkg_jar-from created
306 + [[ -f ${f} ]] || continue
307 +
308 + # Strip the version numbers as per eclass recommendation
309 + [[ ${f} =~ -([0-9]+\.)+jar$ ]] || continue
310 +
311 + java-pkg_newjar "${f}" "${f/${BASH_REMATCH[0]}/.jar}"
312 + done
313 + popd &>/dev/null || die
314 +
315 + popd &>/dev/null || die
316 + fi
317 +
318 + default
319 +
320 + # It unconditionally builds both api and jni docs
321 + # We install conditionally based on the provided use flags
322 + if use doc; then
323 + dodoc -r "${T}"/doc/api-docs
324 + use java && dodoc -r "${T}"/doc/jni-docs
325 + fi
326 +
327 + find "${D}" -name '*.la' -delete || die
328 +}