1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 JAVA_PKG_BSFIX_NAME="build.xml build-unix.xml"
7 inherit autotools java-pkg-opt-2 java-ant-2
9 DESCRIPTION="A collection of file system and media management forensic analysis tools"
10 HOMEPAGE="https://www.sleuthkit.org/sleuthkit/"
11 # TODO: sqlite-jdbc does not exist in the tree, we bundle it for now
12 SRC_URI="https://github.com/${PN}/${PN}/releases/download/${P}/${P}.tar.gz
13 java? ( http://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/3.8.11/sqlite-jdbc-3.8.11.jar )"
15 LICENSE="BSD CPL-1.0 GPL-2+ IBM java? ( Apache-2.0 )"
16 SLOT="0/13" # subslot = major soname version
17 KEYWORDS="amd64 hppa ppc x86"
18 IUSE="aff doc ewf java static-libs test +threads zlib"
19 RESTRICT="!test? ( test )"
24 aff? ( app-forensics/afflib )
25 ewf? ( app-forensics/libewf:= )
28 >=dev-java/c3p0-0.9.5:0
29 >=dev-java/jdbc-postgresql-9.4:0
31 zlib? ( sys-libs/zlib )
34 java? ( >=virtual/jre-1.8:= )
37 doc? ( app-doc/doxygen )
38 test? ( >=dev-util/cppunit-1.2.1 )
42 "${FILESDIR}"/${PN}-4.1.0-tools-shared-libs.patch
45 TSK_JAR_DIR="${S}/bindings/java/lib"
52 # Copy the jar files that don't exist in the tree yet
54 mkdir "${TSK_JAR_DIR}" || die
56 if [[ ${f} =~ .jar$ ]]; then
57 cp "${DISTDIR}"/"${f}" "${TSK_JAR_DIR}" || die
65 pushd "${S}"/bindings/java &>/dev/null || die
67 # Prevent "make install" from installing
68 # jar files under /usr/share/java
69 # We'll use the java eclasses for this
70 sed -e '/^jar_DATA/ d;' -i Makefile.am || die
72 # Disable dependency retrieval using ivy
73 # We will handle it ourselves
74 sed -e '/name="compile"/ s/, retrieve-deps//' \
75 -e '/name="dist-/ s/, init-ivy//g' \
78 java-pkg-opt-2_src_prepare
80 popd &>/dev/null || die
83 # Override the doxygen output directories
85 sed -e "/^OUTPUT_DIRECTORY/ s|=.*$|= ${T}/doc|" \
86 -i tsk/docs/Doxyfile \
87 -i bindings/java/doxygen/Doxyfile || die
90 # It's safe to call this even after java-pkg-opt-2_src_prepare
91 # because future calls to eapply_user do nothing and return 0
100 $(use_enable static-libs static)
101 $(use_enable threads multithreading)
102 $(use_with aff afflib)
103 $(use_with ewf libewf)
108 pushd "${S}"/bindings/java &>/dev/null || die
109 java-ant-2_src_configure
110 popd &>/dev/null || die
113 econf "${myeconfargs[@]}"
117 # Create symlinks of jars for the required dependencies
119 pushd "${S}"/bindings/java &>/dev/null || die
121 java-pkg_jar-from --into "${TSK_JAR_DIR}" c3p0
122 java-pkg_jar-from --into "${TSK_JAR_DIR}" jdbc-postgresql
124 popd &>/dev/null || die
127 # Create the doc output dirs if requested
129 mkdir -p "${T}"/doc/{api-docs,jni-docs} || die
132 emake all $(usex doc api-docs "")
139 pushd "${S}"/bindings/java &>/dev/null || die
141 java-pkg_dojar dist/Tsk_DataModel.jar
143 # Install the bundled jar files
144 pushd "${TSK_JAR_DIR}" &>/dev/null || die
146 # Skip the symlinks java-pkg_jar-from created
147 [[ -f ${f} ]] || continue
149 # Strip the version numbers as per eclass recommendation
150 [[ ${f} =~ -([0-9].)+.jar$ ]] || continue
152 java-pkg_newjar "${f}" "${f/${BASH_REMATCH[0]}/.jar}"
154 popd &>/dev/null || die
156 popd &>/dev/null || die
161 # It unconditionally builds both api and jni docs
162 # We install conditionally based on the provided use flags
164 dodoc -r "${T}"/doc/api-docs
165 use java && dodoc -r "${T}"/doc/jni-docs
168 find "${D}" -name '*.la' -delete || die