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