From 7486ab2b882a7c5e03d0dc01f9460bf0b584fd11 Mon Sep 17 00:00:00 2001 From: Anton Bolshakov Date: Mon, 8 Dec 2025 22:47:41 +0800 Subject: [PATCH] sleuthkit-4.14.0.ebuild --- app-forensics/sleuthkit/Manifest | 3 + .../sleuthkit-4.1.0-tools-shared-libs.patch | 55 +++ .../sleuthkit-4.10.1-exclude-usr-local.patch | 28 ++ ...euthkit-4.12.0-configure-ac-test-fix.patch | 34 ++ .../files/sleuthkit-4.12.1-c23.patch | 30 ++ ...thkit-4.6.4-default-jar-location-fix.patch | 58 ++++ .../sleuthkit/files/sleuthkit-gcc_15.patch | 46 +++ app-forensics/sleuthkit/metadata.xml | 16 + .../sleuthkit/sleuthkit-4.14.0.ebuild | 328 ++++++++++++++++++ 9 files changed, 598 insertions(+) create mode 100644 app-forensics/sleuthkit/Manifest create mode 100644 app-forensics/sleuthkit/files/sleuthkit-4.1.0-tools-shared-libs.patch create mode 100644 app-forensics/sleuthkit/files/sleuthkit-4.10.1-exclude-usr-local.patch create mode 100644 app-forensics/sleuthkit/files/sleuthkit-4.12.0-configure-ac-test-fix.patch create mode 100644 app-forensics/sleuthkit/files/sleuthkit-4.12.1-c23.patch create mode 100644 app-forensics/sleuthkit/files/sleuthkit-4.6.4-default-jar-location-fix.patch create mode 100644 app-forensics/sleuthkit/files/sleuthkit-gcc_15.patch create mode 100644 app-forensics/sleuthkit/metadata.xml create mode 100644 app-forensics/sleuthkit/sleuthkit-4.14.0.ebuild diff --git a/app-forensics/sleuthkit/Manifest b/app-forensics/sleuthkit/Manifest new file mode 100644 index 000000000..1ea51a631 --- /dev/null +++ b/app-forensics/sleuthkit/Manifest @@ -0,0 +1,3 @@ +DIST sleuthkit-4.14.0.tar.gz 3831626 BLAKE2B 3bf3bb8c399f2597f1dc928e514185cb498dcd4f447815975ec7e6c8f56f5d6cf27c1a056e96b55de829ad205dbf27fab645d91f64995a7099bf8e02322169fb SHA512 cc486ced49595f830e473bf3831b0b02525305c29795e3e17f0292231a0c25c619463b02584c3266b61c33a77912b73eefc257ff9aa3c9af68102b49e3e99105 +DIST sleuthkit-libewf_64bit-20130416.tar.gz 23818247 BLAKE2B 23be933ed8a74e4834ee6571a28d81ba16e98e4e4e27b5b1b3b655d1d92a6eadcba35aadf96aa404e6e0a225b27f3f5daff2836879b87fe58440a3ad5645de44 SHA512 611cbb57de17600caee0330bbe9917c4481d7711a35dba8c072fd49cd3e1714e0a3ce30fd8fcac9981db848e80870bf5d215326c56808bb6f5b4c8dcc1e5a3c9 +DIST sqlite-jdbc-3.42.0.0.jar 13030515 BLAKE2B 02ffee9875fefd3f2ba4e9115d0b4fee53163bab994830b28033159ab08df264e5f86bbcfb7d1fae145c9aaafc6537fb9084594ce6b21c9715226a1cf644f174 SHA512 6d0491f7f2f542629f4e69d5891ded85e887f0d8dad8c4568ead07b1eda79e0b97f625374a635f12d419d2f42a4049976365e0a8265ee371172f330be9571616 diff --git a/app-forensics/sleuthkit/files/sleuthkit-4.1.0-tools-shared-libs.patch b/app-forensics/sleuthkit/files/sleuthkit-4.1.0-tools-shared-libs.patch new file mode 100644 index 000000000..efa335068 --- /dev/null +++ b/app-forensics/sleuthkit/files/sleuthkit-4.1.0-tools-shared-libs.patch @@ -0,0 +1,55 @@ +--- sleuthkit-4.1.0/tools/autotools/Makefile.am ++++ sleuthkit-4.1.0/tools/autotools/Makefile.am +@@ -1,6 +1,5 @@ + AM_CPPFLAGS = -I../.. -I$(srcdir)/../.. -Wall + LDADD = ../../tsk/libtsk.la +-LDFLAGS += -static + EXTRA_DIST = .indent.pro + + bin_PROGRAMS = tsk_recover tsk_loaddb tsk_comparedir tsk_gettimes +--- sleuthkit-4.1.0/tools/fstools/Makefile.am ++++ sleuthkit-4.1.0/tools/fstools/Makefile.am +@@ -1,6 +1,5 @@ + AM_CPPFLAGS = -I../.. -I$(srcdir)/../.. -Wall + LDADD = ../../tsk/libtsk.la +-LDFLAGS += -static + EXTRA_DIST = .indent.pro fscheck.cpp + + bin_PROGRAMS = blkcalc blkcat blkls blkstat ffind fls fcat fsstat icat ifind ils \ +--- sleuthkit-4.1.0/tools/hashtools/Makefile.am ++++ sleuthkit-4.1.0/tools/hashtools/Makefile.am +@@ -1,6 +1,5 @@ + AM_CPPFLAGS = -I../.. -I$(srcdir)/../.. -Wall + LDADD = ../../tsk/libtsk.la +-LDFLAGS += -static + EXTRA_DIST = .indent.pro md5.c sha1.c + + bin_PROGRAMS = hfind +--- sleuthkit-4.1.0/tools/imgtools/Makefile.am ++++ sleuthkit-4.1.0/tools/imgtools/Makefile.am +@@ -1,6 +1,5 @@ + AM_CPPFLAGS = -I../.. -I$(srcdir)/../.. -Wall + LDADD = ../../tsk/libtsk.la +-LDFLAGS += -static + EXTRA_DIST = .indent.pro + + bin_PROGRAMS = img_cat img_stat +--- sleuthkit-4.1.0/tools/srchtools/Makefile.am ++++ sleuthkit-4.1.0/tools/srchtools/Makefile.am +@@ -6,7 +6,6 @@ + + sigfind_SOURCES = sigfind.cpp + sigfind_LDADD = ../../tsk/libtsk.la +-sigfind_LDFLAGS = -static + + indent: + indent *.c *.cpp +--- sleuthkit-4.1.0/tools/vstools/Makefile.am ++++ sleuthkit-4.1.0/tools/vstools/Makefile.am +@@ -1,6 +1,5 @@ + AM_CPPFLAGS = -I../.. -I$(srcdir)/../.. -Wall + LDADD = ../../tsk/libtsk.la +-LDFLAGS += -static + EXTRA_DIST = .indent.pro + + bin_PROGRAMS = mmls mmstat mmcat diff --git a/app-forensics/sleuthkit/files/sleuthkit-4.10.1-exclude-usr-local.patch b/app-forensics/sleuthkit/files/sleuthkit-4.10.1-exclude-usr-local.patch new file mode 100644 index 000000000..256dc5454 --- /dev/null +++ b/app-forensics/sleuthkit/files/sleuthkit-4.10.1-exclude-usr-local.patch @@ -0,0 +1,28 @@ +From: Gokturk Yuksek + +Do not allow the build system to use libs from /usr/local. + +Bug: https://bugs.gentoo.org/774039 + +--- a/configure.ac ++++ b/configure.ac +@@ -92,19 +92,6 @@ + dnl Enable multithreading by default in the presence of pthread + AS_IF([test "x$ax_pthread_ok" = "xyes" && test "x$enable_multithreading" != "xno"], [ax_multithread=yes], [ax_multithread=no]) + +-case "$host" in +-*-*-mingw*) +- dnl Adding the native /usr/local is wrong for cross-compiling +- ;; +-*) +- dnl Not all compilers include /usr/local in the include and link path +- if test -d /usr/local/include; then +- CPPFLAGS="$CPPFLAGS -I/usr/local/include" +- LDFLAGS="$LDFLAGS -L/usr/local/lib" +- fi +- ;; +-esac +- + dnl Add enable/disable option + AC_ARG_ENABLE([java], + [AS_HELP_STRING([--disable-java], [Do not build the java bindings or jar file])]) diff --git a/app-forensics/sleuthkit/files/sleuthkit-4.12.0-configure-ac-test-fix.patch b/app-forensics/sleuthkit/files/sleuthkit-4.12.0-configure-ac-test-fix.patch new file mode 100644 index 000000000..2bb52435f --- /dev/null +++ b/app-forensics/sleuthkit/files/sleuthkit-4.12.0-configure-ac-test-fix.patch @@ -0,0 +1,34 @@ +https://github.com/sleuthkit/sleuthkit/pull/2835 + +From fd19051920849343631df1cbf8d4b86f1bf98b2c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=B6kt=C3=BCrk=20Y=C3=BCksek?= +Date: Mon, 26 Jun 2023 22:05:47 -0700 +Subject: [PATCH] configure.ac: use '=' for comparison instead of '==' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The operator '==' isn't POSIX compliant[0]. Use the standard '=', as it's +done everywhere else in configure.ac. + +[0] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html + +Bug: https://bugs.gentoo.org/870250 +Signed-off-by: Göktürk Yüksek +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index c4226f5be4..bec6ddbf62 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -252,7 +252,7 @@ AS_IF([test "x$enable_java" != "xno"], [ + dnl if we found everything we need, set ax_java_support for the + dnl status message and set X_JNI for use in Makefile + AS_IF([test "x$JNI_CPPFLAGS" != x && test "x$ANT_FOUND" != x && test "x$JAVA" != x], [ax_java_support=yes], [ax_java_support=no]) +-AM_CONDITIONAL([X_JNI],[test "x$ax_java_support" == "xyes"]) ++AM_CONDITIONAL([X_JNI],[test "x$ax_java_support" = "xyes"]) + + AC_CONFIG_COMMANDS([tsk/tsk_incs.h], + [echo "#ifndef _TSK_INCS_H" > tsk/tsk_incs.h diff --git a/app-forensics/sleuthkit/files/sleuthkit-4.12.1-c23.patch b/app-forensics/sleuthkit/files/sleuthkit-4.12.1-c23.patch new file mode 100644 index 000000000..59b8083c6 --- /dev/null +++ b/app-forensics/sleuthkit/files/sleuthkit-4.12.1-c23.patch @@ -0,0 +1,30 @@ +https://bugs.gentoo.org/943976 +https://github.com/sleuthkit/sleuthkit/commit/dc9b299ea2c4fd4d79305df1e62073aac14fdb2e + +From dc9b299ea2c4fd4d79305df1e62073aac14fdb2e Mon Sep 17 00:00:00 2001 +From: Joel Uckelman +Date: Fri, 1 Nov 2024 18:11:25 +0000 +Subject: [PATCH] Don't redefine bool. That causes collisions. + +--- a/tsk/base/crc.h ++++ b/tsk/base/crc.h +@@ -91,7 +91,6 @@ Status : Copyright (C) Ross Williams, 1993. However, permission is + #ifndef DONE_STYLE + + typedef unsigned long ulong; +-typedef unsigned bool; + typedef unsigned char * p_ubyte_; + + #ifndef TRUE +@@ -120,8 +119,8 @@ typedef struct + int cm_width; /* Parameter: Width in bits [8,32]. */ + ulong cm_poly; /* Parameter: The algorithm's polynomial. */ + ulong cm_init; /* Parameter: Initial register value. */ +- bool cm_refin; /* Parameter: Reflect input bytes? */ +- bool cm_refot; /* Parameter: Reflect output CRC? */ ++ unsigned cm_refin; /* Parameter: Reflect input bytes? */ ++ unsigned cm_refot; /* Parameter: Reflect output CRC? */ + ulong cm_xorot; /* Parameter: XOR this to output CRC. */ + + ulong cm_reg; /* Context: Context during execution. */ + diff --git a/app-forensics/sleuthkit/files/sleuthkit-4.6.4-default-jar-location-fix.patch b/app-forensics/sleuthkit/files/sleuthkit-4.6.4-default-jar-location-fix.patch new file mode 100644 index 000000000..126fce904 --- /dev/null +++ b/app-forensics/sleuthkit/files/sleuthkit-4.6.4-default-jar-location-fix.patch @@ -0,0 +1,58 @@ +From f8c1cada7f01826b15a82b20600b8df7562fa2ed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=B6kt=C3=BCrk=20Y=C3=BCksek?= +Date: Wed, 28 Nov 2018 21:33:46 -0500 +Subject: [PATCH v1] Allow --enable-offline to accept a directory argument for + jar libs + +Allow the hardcoded default_jar_location in build.xml to +/usr/share/java to be changed using the argument provided to +--enable-offline. Note that this changes the behavior of the switch +from "anything other than yes or no is incorrect" to "anything other +than no implies offline mode". +--- + bindings/java/Makefile.am | 4 ++++ + configure.ac | 10 +++++++++- + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/bindings/java/Makefile.am b/bindings/java/Makefile.am +index ad27526e..f0bb9f68 100644 +--- a/bindings/java/Makefile.am ++++ b/bindings/java/Makefile.am +@@ -7,6 +7,10 @@ jar_DATA = $(tsk_jar) + + if OFFLINE + ant_args=-Doffline=true ++if CUSTOM_DEFAULT_JAR_LOCATION ++ ant_args+= -Ddefault-jar-location="@DEFAULT_JAR_LOCATION@" ++else ++endif + else + + endif +diff --git a/configure.ac b/configure.ac +index dc9026ed..d3d41646 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -221,10 +221,18 @@ AC_ARG_ENABLE([offline], + [case "${enableval}" in + yes) offline=true ;; + no) offline=false ;; +- *) AC_MSG_ERROR([bad value ${enableval} for --enable-online]) ;; ++ *) ++ offline=true ++ default_jar_location="${enableval}" ++ ;; + esac],[offline=false]) + + AM_CONDITIONAL([OFFLINE], [test "x$offline" = xtrue]) ++AM_CONDITIONAL([CUSTOM_DEFAULT_JAR_LOCATION], [test "x$default_jar_location" != "x"]) ++AM_COND_IF([CUSTOM_DEFAULT_JAR_LOCATION], ++ [AC_SUBST([DEFAULT_JAR_LOCATION], [$default_jar_location])] ++) ++ + + + dnl Check if we should link libewf. +-- +2.19.1 + diff --git a/app-forensics/sleuthkit/files/sleuthkit-gcc_15.patch b/app-forensics/sleuthkit/files/sleuthkit-gcc_15.patch new file mode 100644 index 000000000..1b369b8c1 --- /dev/null +++ b/app-forensics/sleuthkit/files/sleuthkit-gcc_15.patch @@ -0,0 +1,46 @@ +From 8d710c36a947a2666bbef689155831d76fff56b9 Mon Sep 17 00:00:00 2001 +From: Hilko Bengen +Date: Tue, 18 Feb 2025 19:06:57 +0100 +Subject: [PATCH] Avoid defining bool datatype + +This avoids build failures with GCC 15, +see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1097897 +--- + tsk/base/crc.h | 3 ++- + tsk/img/aff.c | 2 -- + 2 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/tsk/base/crc.h b/tsk/base/crc.h +index f9f4617c3d..3b13aa92f3 100644 +--- a/tsk/base/crc.h ++++ b/tsk/base/crc.h +@@ -82,6 +82,8 @@ Status : Copyright (C) Ross Williams, 1993. However, permission is + #ifndef CM_DONE + #define CM_DONE + ++#include ++ + /******************************************************************************/ + + /* The following definitions are extracted from my style header file which */ +@@ -91,7 +93,6 @@ Status : Copyright (C) Ross Williams, 1993. However, permission is + #ifndef DONE_STYLE + + typedef unsigned long ulong; +-typedef unsigned bool; + typedef unsigned char * p_ubyte_; + + #ifndef TRUE +diff --git a/tsk/img/aff.c b/tsk/img/aff.c +index c53812e822..1604224c25 100755 +--- a/tsk/img/aff.c ++++ b/tsk/img/aff.c +@@ -14,8 +14,6 @@ + + #if HAVE_LIBAFFLIB + +-typedef int bool; +- + #include "aff.h" + + /* Note: The routine -assumes- we are under a lock on &(img_info->cache_lock)) */ diff --git a/app-forensics/sleuthkit/metadata.xml b/app-forensics/sleuthkit/metadata.xml new file mode 100644 index 000000000..9a98e4651 --- /dev/null +++ b/app-forensics/sleuthkit/metadata.xml @@ -0,0 +1,16 @@ + + + + + + Enable extra aff formats + Enable libewf support + + + Reflect ABI compatibility for libtsk.so + + + sleuthkit + sleuthkit/sleuthkit + + diff --git a/app-forensics/sleuthkit/sleuthkit-4.14.0.ebuild b/app-forensics/sleuthkit/sleuthkit-4.14.0.ebuild new file mode 100644 index 000000000..139ed65ab --- /dev/null +++ b/app-forensics/sleuthkit/sleuthkit-4.14.0.ebuild @@ -0,0 +1,328 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools java-pkg-opt-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 +# See: https://bugs.gentoo.org/690010 +# TODO: Upstream uses a very specific version of libewf which is not in +# the tree anymore. So we statically compile and link to sleuthkit. +# Hopefully upstream will figure something out in the future. +# See: https://bugs.gentoo.org/689752 +SRC_URI="https://github.com/${PN}/${PN}/releases/download/${P}/${P}.tar.gz + java? ( + https://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/3.42.0.0/sqlite-jdbc-3.42.0.0.jar + ) + ewf? ( https://github.com/sleuthkit/libewf_64bit/archive/VisualStudio_2010.tar.gz + -> sleuthkit-libewf_64bit-20130416.tar.gz )" + +LICENSE="BSD CPL-1.0 GPL-2+ IBM java? ( Apache-2.0 )" +SLOT="0/19" # subslot = major soname version +KEYWORDS="amd64 ~hppa ppc x86" +IUSE="aff doc ewf java static-libs test +threads zlib" +RESTRICT="!test? ( test )" + +DEPEND=" + dev-db/sqlite:3 + dev-lang/perl:* + aff? ( app-forensics/afflib ) + ewf? ( virtual/zlib:= ) + java? ( + >=dev-java/c3p0-0.9.5.5:0 + dev-java/commons-lang:3.6 + >=dev-java/commons-validator-1.6:0 + >=dev-java/gson-2.8.5:0 + dev-java/guava:0 + >=dev-java/jdbc-postgresql-9.4:0 + >=dev-java/joda-time-2.4:0 + >=dev-java/mchange-commons-0.2.20:0 + dev-java/sparsebitset:0 + ) + zlib? ( virtual/zlib:= ) +" +# TODO: add support for not-in-tree libraries: +# libvhdi: https://github.com/libyal/libvhdi +# libvmdk: https://github.com/libyal/libvmdk +# libvslvm: https://github.com/libyal/libvslvm +# Upstream also says "A stand-alone version of libbfio is needed +# to allow libvslvm to directly read from a TSK_IMAGE." Not sure +# what it means yet. +# +# DEPEND="${DEPEND} +# vhdi? ( dev-libs/libvhdi ) +# vmdk? ( dev-libs/libvmdk ) +# vslvm? ( dev-libs/libvslvm dev-libs/libbfio ) +# " + +RDEPEND="${DEPEND} + java? ( virtual/jre:1.8 ) +" +DEPEND="${DEPEND} + java? ( virtual/jdk:1.8 ) + test? ( + >=dev-util/cppunit-1.2.1 + ) +" +BDEPEND=" + virtual/pkgconfig + java? ( >=dev-java/ant-1.10.14-r3:0 ) + doc? ( app-text/doxygen ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-gcc_15.patch + "${FILESDIR}"/${PN}-4.1.0-tools-shared-libs.patch + "${FILESDIR}"/${PN}-4.6.4-default-jar-location-fix.patch + "${FILESDIR}"/${PN}-4.10.1-exclude-usr-local.patch + "${FILESDIR}"/${PN}-4.12.0-configure-ac-test-fix.patch +# "${FILESDIR}"/${PN}-4.12.1-c23.patch +) + +src_unpack() { + local f + + unpack ${P}.tar.gz + + if use ewf; then + pushd "${T}" &>/dev/null || die + unpack sleuthkit-libewf_64bit-20130416.tar.gz + export TSK_LIBEWF_SRCDIR="${T}"/libewf_64bit-VisualStudio_2010 + popd &>/dev/null || die + fi + + # Copy the jar files that don't exist in the tree yet + if use java; then + TSK_JAR_DIR="${T}/lib" + mkdir "${TSK_JAR_DIR}" || die + for f in ${A}; do + if [[ ${f} =~ .jar$ ]]; then + cp "${DISTDIR}"/"${f}" "${TSK_JAR_DIR}" || die + fi + done + export TSK_JAR_DIR + fi +} + +tsk_prepare_libewf() { + # Inlining breaks the compilation, disable it + sed -e 's/LIBUNA_INLINE inline/LIBUNA_INLINE/' \ + -i "${TSK_LIBEWF_SRCDIR}"/libuna/libuna_inline.h || die +} + +src_prepare() { + use ewf && tsk_prepare_libewf + + # Do not pass '-Werror'. This is overkill for user builds. + sed -e '/AM_CXXFLAGS/ s/-Werror//g' \ + -i tsk/util/Makefile.am \ + -i tsk/pool/Makefile.am || die + # Remove -static from LDFLAGS because it doesn't actually create + # a static binary. It confuses libtool, who then inserts rpath + sed -e '/LDFLAGS/ s/-static//' \ + -i tools/pooltools/Makefile.am || die + + 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 + # See: https://github.com/sleuthkit/sleuthkit/pull/1379 + sed -e '/^jar_DATA/ d;' -i Makefile.am || die + + java-pkg-opt-2_src_prepare + + popd &>/dev/null || die + + # Call ant with jar target for case-uco. + # The default invocation of ant tries to + # run junit tests, which there are none. + # It ends up failing with: + # junit.framework.AssertionFailedError: No tests found in org.sleuthkit.caseuco.TestSuite + sed -e '/\tant \$(ant_args)/ s|$| jar|' \ + -i "${S}"/case-uco/java/Makefile.am \ + || die + + export ANT_OPTS=" -Dant.build.javac.source=$(java-pkg_get-source)" + export ANT_OPTS+=" -Dant.build.javac.target=$(java-pkg_get-target)" + + java-pkg-opt-2_src_prepare + 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 +} + +tsk_compile_libewf() { + local myeconfargs=( + --prefix=/ + --libdir=/lib + --enable-static + --disable-shared + --disable-winapi + --without-libbfio + --with-zlib + --without-bzip2 + --without-libhmac + --without-openssl + --without-libuuid + --without-libfuse + + --with-libcstring=no + --with-libcerror=no + --with-libcdata=no + --with-libclocale=no + --with-libcnotify=no + --with-libcsplit=no + --with-libuna=no + --with-libcfile=no + --with-libcpath=no + --with-libbfio=no + --with-libfcache=no + --with-libfvalue=no + + ) + # We want to contain our build flags + local CFLAGS="${CFLAGS}" + local LDFLAGS="${LDFLAGS}" + + pushd "${TSK_LIBEWF_SRCDIR}" &>/dev/null || die + + # Produce relocatable code + CFLAGS+=" -fPIC" + LDFLAGS+=" -fPIC" + econf "${myeconfargs[@]}" + + # Do not waste CPU cycles on building ewftools + sed -e '/ewftools/ d' -i Makefile || die + emake + + # Only install the headers and the library + emake -C libewf DESTDIR="${T}"/image install + emake -C include DESTDIR="${T}"/image install + find "${T}"/image -name '*.la' -delete || die + + popd &>/dev/null || die +} + +src_configure() { + local myeconfargs=( + --enable-offline="${TSK_JAR_DIR}" + $(use_enable java) + $(use_enable static-libs static) + $(use_enable test cppunit) + $(use_enable threads multithreading) + $(use_with aff afflib) + $(use_with zlib) + ) + # TODO: add support for non-existing libraries: + # myeconfargs+=( + # $(use_with vhdi libvhdi) + # $(use_with vmdk libvmdk) + # $(use_with vslvm libvslvm) + # $(use_with vslvm libbfio) # not a typo + # ) + myeconfargs+=( + --without-libvhdi + --without-libvmdk + --without-libvslvm + --without-libbfio + ) + + use ewf && tsk_compile_libewf + myeconfargs+=( $(use_with ewf libewf "${T}"/image) ) + + econf "${myeconfargs[@]}" +} + +src_compile() { + # Give it an existing bogus ivy home #672220 + local -x IVY_HOME="${T}" + + # Create symlinks of jars for the required dependencies + if use java; then + java-pkg_jar-from --into "${TSK_JAR_DIR}" c3p0 + java-pkg_jar-from --into "${TSK_JAR_DIR}" commons-lang:3.6 + java-pkg_jar-from --into "${TSK_JAR_DIR}" commons-validator + java-pkg_jar-from --into "${TSK_JAR_DIR}" gson + java-pkg_jar-from --into "${TSK_JAR_DIR}" guava + java-pkg_jar-from --into "${TSK_JAR_DIR}" jdbc-postgresql + java-pkg_jar-from --into "${TSK_JAR_DIR}" joda-time + java-pkg_jar-from --into "${TSK_JAR_DIR}" mchange-commons + java-pkg_jar-from --into "${TSK_JAR_DIR}" sparsebitset + + # case-uco needs gson and expects it under case-uco/java/lib + # symlink it to the jar dir we create for java bindings + ln -s "${TSK_JAR_DIR}" "${S}"/case-uco/java/lib || die + ln -s ./gson.jar "${TSK_JAR_DIR}"/gson-2.8.5.jar || 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() { + # Give it an existing bogus ivy home #756766 + local -x IVY_HOME="${T}" + local f + + if use java; then + pushd "${S}"/bindings/java &>/dev/null || die + + # Install case-uco + pushd "${S}"/case-uco/java &>/dev/null || die + java-pkg_newjar "dist/${PN}-caseuco-${PV}".jar "${PN}-caseuco.jar" + popd || die + + # Install the bundled jar files as well as the + # sleuthkit jar installed here by case-uco + pushd "${TSK_JAR_DIR}" &>/dev/null || die + for f in *; do + # Skip the symlinks java-pkg_jar-from created + [[ -L ${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 + # Default install target for case-uco installs the jar in the wrong place + rm -r "${ED}"/usr/share/java + + # 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 +} + +src_test() { + emake -C "${S}"/unit_tests check +}