1 # Copyright 2019-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
10 inherit flag-o-matic java-pkg-2 multiprocessing
12 DESCRIPTION="Java OpenJFX client application platform"
13 HOMEPAGE="https://openjfx.io"
15 SRC_URI="https://hg.openjdk.java.net/${PN}/${SLOT}-dev/rt/archive/${MY_PV}.tar.bz2 -> ${P}.tar.bz2
16 https://downloads.gradle.org/distributions/gradle-${EGRADLE_VER}-bin.zip
17 https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-sandbox/7.1.0/lucene-sandbox-7.1.0.jar
18 https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-grouping/7.1.0/lucene-grouping-7.1.0.jar
19 https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-queryparser/7.1.0/lucene-queryparser-7.1.0.jar
20 https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-queries/7.1.0/lucene-queries-7.1.0.jar
21 https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-core/7.1.0/lucene-core-7.1.0.jar
22 https://repo.maven.apache.org/maven2/org/antlr/gunit/3.5.2/gunit-3.5.2.jar
23 https://repo1.maven.org/maven2/org/antlr/antlr4/4.7.2/antlr4-4.7.2-complete.jar
24 https://repo.maven.apache.org/maven2/org/antlr/ST4/4.0.8/ST4-4.0.8.jar
27 LICENSE="GPL-2-with-classpath-exception"
30 IUSE="cpu_flags_x86_sse2 debug doc source +media"
33 dev-java/swt:4.10[cairo,opengl]
39 media-libs/fontconfig:1.0
52 dev-java/openjdk-bin:${SLOT}[doc?]
53 dev-java/openjdk:${SLOT}[doc?]
60 >=dev-java/ant-core-1.10.7-r1:0
63 dev-java/hamcrest-core:0
64 dev-java/stringtemplate:0
69 REQUIRED_USE="cpu_flags_x86_sse2"
72 "${FILESDIR}"/11/disable-buildSrc-tests.patch
73 "${FILESDIR}"/11/glibc-compatibility.patch
74 "${FILESDIR}"/11/respect-user-cflags.patch
75 "${FILESDIR}"/11/use-system-swt-jar.patch
76 "${FILESDIR}"/11/wno-error.patch
79 S="${WORKDIR}/rt-${MY_PV}"
82 local GRADLE_HOME="${WORKDIR}/gradle-${EGRADLE_VER}"
83 local gradle="${GRADLE_HOME}/bin/gradle"
90 --gradle-user-home "${T}/gradle_user_home"
91 --project-cache-dir "${T}/gradle_project_cache"
96 # FIXME: build.gradle believes $ANT_HOME/bin/ant shoud exist
99 einfo "gradle "${gradle_args[@]}" ${@}"
100 "${gradle}" "${gradle_args[@]}" ${@} || die "gradle failed"
104 JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
105 JAVA_PKG_WANT_SOURCE="${SLOT}"
106 JAVA_PKG_WANT_TARGET="${SLOT}"
108 # The nastiness below is necessary while the gentoo-vm USE flag is
109 # masked. First we call java-pkg-2_pkg_setup if it looks like the
110 # flag was unmasked against one of the possible build VMs. If not,
111 # we try finding one of them in their expected locations. This would
112 # have been slightly less messy if openjdk-bin had been installed to
113 # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
114 # file but disable it so that it would not normally be selectable.
117 for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
118 if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then
124 if has_version --host-root dev-java/openjdk:${SLOT}; then
125 export JAVA_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT}
126 export JDK_HOME="${JAVA_HOME}"
127 export ANT_RESPECT_JAVA_HOME=ture
130 if [[ ${MERGE_TYPE} != "binary" ]]; then
131 JDK_HOME=$(best_version --host-root dev-java/openjdk-bin:${SLOT})
132 [[ -n ${JDK_HOME} ]] || die "Build VM not found!"
133 JDK_HOME=${JDK_HOME#*/}
134 JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*}
136 export JAVA_HOME="${JDK_HOME}"
137 export ANT_RESPECT_JAVA_HOME=ture
143 unpack "${P}.tar.bz2"
144 unpack "gradle-${EGRADLE_VER}-bin.zip"
146 mkdir "${T}/jars" || die
149 for line in ${SRC_URI}; do
150 if [[ ${line} =~ (http|https)://[a-zA-Z0-9.-_]*/(maven2|m2|eclipse)/(.*[.]jar)$ ]]; then
151 jar=$(basename "${BASH_REMATCH[-1]}")
152 cp -v "${DISTDIR}/${jar}" "${T}/jars/" || die
162 java-pkg_jar-from --build-only --with-dependencies --into "${d}" antlr
163 java-pkg_jar-from --build-only --with-dependencies --into "${d}" antlr-3.5
164 java-pkg_jar-from --build-only --with-dependencies --into "${d}" stringtemplate
165 java-pkg_jar-from --build-only --with-dependencies --into "${d}" hamcrest-core
167 sed -i "s#__gentoo_swt_jar__#$(java-pkg_getjars swt-4.10)#" "${S}"/build.gradle || die
171 append-flags -Wno-error
173 #FIXME: still calls gcc, pkg-config etc by name without chost prefix
174 #FIXME: should we enable webkit? doubt so
176 # build is very sensetive to doc presense, take extra steps
179 if has_version --host-root dev-java/openjdk:${SLOT}[doc]; then
180 jdk_doc="${EROOT%/}/usr/share/doc/openjdk-${SLOT}/html/api"
181 elif has_version --host-root dev-java/java-sdk-docs:${SLOT}; then
182 jdk_doc="${EROOT%/}/usr/share/doc/java-sdk-docs-${SLOT}/html/api"
184 [[ -r ${jdk_doc}/element-list ]] || die "JDK Docs not found, terminating build early"
187 cat <<- _EOF_ > "${S}"/gradle.properties
188 COMPILE_TARGETS = linux
189 COMPILE_WEBKIT = false
190 COMPILE_MEDIA = $(usex media true false)
191 JDK_DOCS = https://docs.oracle.com/en/java/javase/${SLOT}/docs/api
192 JDK_DOCS_LINK = $(usex doc "${jdk_doc}" "")
193 BUILD_LIBAV_STUBS = false
194 GRADLE_VERSION_CHECK = false
196 CONF = $(usex debug DebugNative Release)
197 NUM_COMPILE_THREADS = $(makeopts_jobs)
198 JFX_DEPS_URL = ${T}/jars
199 COMPANY_NAME = "Gentoo"
204 egradle zips $(usex doc "" "--exclude-task javadoc")
208 if ! use source ; then
209 rm -v build/sdk/lib/src.zip || die
212 insinto "/usr/$(get_libdir)/${PN}-${SLOT}"
214 doins build/javafx-exports.zip
218 dodoc -r build/javadoc/.
219 dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"