Diff openjfx-8.1000-r1 with a openjfx-11.0.9_p0-r1

/usr/portage/dev-java/openjfx/openjfx-11.0.9_p0-r1.ebuild 2023-10-09 14:52:29.440368349 +0300
1
# Copyright 2020-2023 Gentoo Authors
1
# Copyright 2019-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6
JAVA_PKG_IUSE="doc source"
7

  
8
inherit flag-o-matic java-pkg-2 java-pkg-simple multiprocessing toolchain-funcs
9

  
6
MY_PV="${PV/_p/+}"
7
SLOT="${MY_PV%%[.+]*}"
10 8
EGRADLE_VER="4.10.3"
11
EHG_COMMIT="9f49e3b6147f"
12 9

  
13
DESCRIPTION="Java OpenJFX 8 client application platform"
10
inherit flag-o-matic java-pkg-2 multiprocessing
11

  
12
DESCRIPTION="Java OpenJFX client application platform"
14 13
HOMEPAGE="https://openjfx.io"
15
SRC_URI="
16
	https://hg.openjdk.java.net/${PN}/8u-dev/rt/archive/${EHG_COMMIT}.tar.bz2 -> ${P}.tar.bz2
17
	https://dev.gentoo.org/~gyakovlev/distfiles/${P}-backports.tar.bz2
14

  
15
SRC_URI="https://hg.openjdk.java.net/${PN}/${SLOT}-dev/rt/archive/${MY_PV}.tar.bz2 -> ${P}.tar.bz2
18 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
19 25
"
20
# eclass overrides it, set back to normal
21
S="${WORKDIR}/${P}"
26

  
27
S="${WORKDIR}/rt-${MY_PV}"
22 28

  
23 29
LICENSE="GPL-2-with-classpath-exception"
24
SLOT="$(ver_cut 1)"
25
KEYWORDS="~amd64 ~ppc64"
26
IUSE="debug doc media cpu_flags_x86_sse2"
30
KEYWORDS="-* ~amd64 ~ppc64"
31
IUSE="cpu_flags_x86_sse2 debug doc source +media"
27 32
REQUIRED_USE="amd64? ( cpu_flags_x86_sse2 )"
28
RESTRICT="test" # needs junit version we don't have, fragile
29

  
30
DEPEND="
31
	app-arch/unzip
32
	>=dev-java/ant-core-1.8.2:0
33
	>=dev-java/antlr-2.7.7-r7:0
34
	dev-java/antlr:3
35
	dev-java/openjdk:8
36
	dev-java/stringtemplate:0
37
	dev-java/swt:4.10[cairo,opengl]
38
	sys-devel/bison
39
	sys-devel/flex
40
	virtual/jdk:1.8
41
	virtual/pkgconfig
42
"
43 33

  
44 34
RDEPEND="
35
	app-accessibility/at-spi2-core
45 36
	dev-java/swt:4.10[cairo,opengl]
46
	virtual/jre:1.8
37
	dev-libs/glib:2
38
	dev-libs/libxml2:2
39
	dev-libs/libxslt
40
	media-libs/freetype:2
41
	media-libs/fontconfig:1.0
42
	media-libs/libjpeg-turbo
43
	x11-libs/gdk-pixbuf
44
	x11-libs/gtk+:2
45
	x11-libs/gtk+:3
46
	x11-libs/cairo[glib]
47
	x11-libs/libX11
48
	x11-libs/libXtst
49
	x11-libs/libXxf86vm
50
	x11-libs/pango
51
	virtual/opengl
52
	doc? ( dev-java/openjdk:${SLOT}[doc] )
53
	!doc? (
54
		|| (
55
			dev-java/openjdk-bin:${SLOT}
56
			dev-java/openjdk:${SLOT}
57
		)
58
	)
47 59
"
48 60

  
49
# FIXME: majority of flags are honored, needs a bit more patching
50
QA_FLAGS_IGNORED=".*"
51

  
52
JAVA_PKG_WANT_BUILD_VM="openjdk-8"
53
JAVA_PKG_WANT_SOURCE="1.8"
54
JAVA_PKG_WANT_TARGET="1.8"
61
DEPEND="${RDEPEND}
62
	app-arch/unzip
63
	app-arch/zip
64
	>=dev-java/ant-core-1.10.7-r1:0
65
	dev-java/antlr:0
66
	dev-java/antlr:3.5
67
	dev-java/hamcrest-core:0
68
	dev-java/stringtemplate:0
69
	virtual/ttf-fonts
70
	virtual/pkgconfig
71
"
55 72

  
56 73
PATCHES=(
57
	"${FILESDIR}"/8/99-sysdeps.patch
58
	"${FILESDIR}"/8/disable-online-repos.patch
59
	"${FILESDIR}"/8/respect_flags.patch
60
	"${FILESDIR}"/8/0000-Fix-wait-call-in-PosixPlatform.patch
61
	"${FILESDIR}"/8/0001-Change-Lucene.patch
62
	"${FILESDIR}"/8/0003-fix-cast-between-incompatible-function-types.patch
63
	"${FILESDIR}"/8/0004-Fix-Compilation-Flags.patch
64
	"${FILESDIR}"/8/0005-don-t-include-xlocale.h.patch
65
	"${FILESDIR}"/8/06-disable-architecture-verification.patch
66
	"${FILESDIR}"/8/10-javadoc-locale.patch
67
	"${FILESDIR}"/8/Wno-error.patch
68
	"${FILESDIR}"/8/don-t-force-msse.patch
69
	"${FILESDIR}"/8/fxpackager-don-t-include-obsolete-sys-sysctl.h.patch
74
	"${FILESDIR}"/11/disable-buildSrc-tests.patch
75
	"${FILESDIR}"/11/glibc-compatibility.patch
76
	"${FILESDIR}"/11/respect-user-cflags.patch
77
	"${FILESDIR}"/11/use-system-swt-jar.patch
78
	"${FILESDIR}"/11/wno-error.patch
79
	"${FILESDIR}"/11/don-t-force-msse.patch
80
	"${FILESDIR}"/11/disable-architecture-verification.patch
81
	"${FILESDIR}"/11/ffmpeg5.patch
82
	"${FILESDIR}/11/${PV}-version.patch"
70 83
)
71 84

  
72 85
egradle() {
......
78 91
		--no-build-cache
79 92
		--no-daemon
80 93
		--offline
81
		--gradle-user-home	"${T}/gradle_user_home"
94
		--gradle-user-home "${T}/gradle_user_home"
82 95
		--project-cache-dir "${T}/gradle_project_cache"
83 96
	)
84 97

  
......
92 105
	TERM="xterm" "${gradle}" "${gradle_args[@]}" ${@} || die "gradle failed"
93 106
}
94 107

  
108
pkg_setup() {
109
	JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
110
	JAVA_PKG_WANT_SOURCE="${SLOT}"
111
	JAVA_PKG_WANT_TARGET="${SLOT}"
112

  
113
	# The nastiness below is necessary while the gentoo-vm USE flag is
114
	# masked. First we call java-pkg-2_pkg_setup if it looks like the
115
	# flag was unmasked against one of the possible build VMs. If not,
116
	# we try finding one of them in their expected locations. This would
117
	# have been slightly less messy if openjdk-bin had been installed to
118
	# /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
119
	# file but disable it so that it would not normally be selectable.
120

  
121
	local vm
122
	for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
123
		if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then
124
			java-pkg-2_pkg_setup
125
			return
126
		fi
127
	done
128

  
129
	if has_version -b dev-java/openjdk:${SLOT}; then
130
		export JAVA_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT}
131
		export JDK_HOME="${JAVA_HOME}"
132
		export ANT_RESPECT_JAVA_HOME=true
133
	else
134
		if [[ ${MERGE_TYPE} != "binary" ]]; then
135
			JDK_HOME=$(best_version -b dev-java/openjdk-bin:${SLOT})
136
			[[ -n ${JDK_HOME} ]] || die "Build VM not found!"
137
			JDK_HOME=${JDK_HOME#*/}
138
			JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*}
139
			export JDK_HOME
140
			export JAVA_HOME="${JDK_HOME}"
141
			export ANT_RESPECT_JAVA_HOME=true
142
		fi
143
	fi
144
}
145

  
95 146
src_unpack() {
96
	default
97
	mv -v "rt-${EHG_COMMIT}" "${P}" || die
147
	unpack "${P}.tar.bz2"
148
	unpack "gradle-${EGRADLE_VER}-bin.zip"
149

  
150
	mkdir "${T}/jars" || die
151

  
152
	local line jar
153
	for line in ${SRC_URI}; do
154
		if [[ ${line} =~ (http|https)://[a-zA-Z0-9.-_]*/(maven2|m2|eclipse)/(.*[.]jar)$ ]]; then
155
			jar=$(basename "${BASH_REMATCH[-1]}")
156
			cp -v "${DISTDIR}/${jar}" "${T}/jars/" || die
157
		fi
158
	done
98 159
}
99 160

  
100 161
src_prepare() {
101
	eapply "${WORKDIR}/${P}-backports"
102 162
	default
103 163

  
104
	# this will create local jar storage to be used as ivy repo
105 164
	local d="${T}/jars"
106
	mkdir "${d}" || die
107 165

  
108
	# we need jars subdir in every prokect so gradle can find them
109
	# only system jars, no bundling
110
	local target targets
111
	targets=(
112
		jars
113
		buildSrc/jars
114
		modules/{base,builders,controls,extensions,fxml}/jars
115
		modules/{graphics,jmx,media,swing,swt,web,fxpackager}/jars
116
	)
117
	einfo "Copying system jars"
118
	for target in ${targets[@]}; do
119
		ln -vs "${T}/jars" "${target}" || die
120
	done
166
	java-pkg_jar-from --build-only --with-dependencies --into "${d}" antlr
167
	java-pkg_jar-from --build-only --with-dependencies --into "${d}" antlr-3.5
168
	java-pkg_jar-from --build-only --with-dependencies --into "${d}" stringtemplate
169
	java-pkg_jar-from --build-only --with-dependencies --into "${d}" hamcrest-core
121 170

  
122
	local swt_file_name="$(java-pkg_getjars swt-4.10)"
123
	java-pkg_jar-from --build-only --into "${d}" ant-core ant.jar ant-1.8.2.jar
124
	java-pkg_jar-from --build-only --into "${d}" ant-core ant-launcher.jar ant-launcher-1.8.2.jar
125
	java-pkg_jar-from --build-only --into "${d}" antlr antlr.jar antlr-2.7.7.jar
126
	java-pkg_jar-from --build-only --into "${d}" antlr-3 antlr-tool.jar antlr-3.1.3.jar
127
	java-pkg_jar-from --build-only --into "${d}" antlr-3 antlr-runtime.jar antlr-runtime-3.1.3.jar
128
	java-pkg_jar-from --build-only --into "${d}" stringtemplate  stringtemplate.jar stringtemplate-3.2.jar
129
	sed -i "s#compile name: SWT_FILE_NAME#compile files(\"${swt_file_name}\")#" "${S}"/build.gradle || die
130

  
131
	sed -i 's/-rpath/-rpath-link/g' modules/media/src/main/native/jfxmedia/projects/linux/Makefile || die
171
	sed -i "s#__gentoo_swt_jar__#$(java-pkg_getjars swt-4.10)#" "${S}"/build.gradle || die
132 172
}
133 173

  
134 174
src_configure() {
135
	# see gradle.properties.template in ${S}
175
	append-flags -Wno-error -fcommon
176

  
177
	#FIXME: still calls gcc, pkg-config etc by name without chost prefix
178
	#FIXME: should we enable webkit? doubt so
179

  
180
	# build is very sensetive to doc presense, take extra steps
181
	if use doc; then
182
		local jdk_doc
183
		if has_version -b dev-java/openjdk:${SLOT}[doc]; then
184
			jdk_doc="${EPREFIX}/usr/share/doc/openjdk-${SLOT}/html/api"
185
		fi
186
		[[ -r ${jdk_doc}/element-list ]] || die "JDK Docs not found, terminating build early"
187
	fi
188

  
136 189
	cat <<- _EOF_ > "${S}"/gradle.properties
137 190
		COMPILE_TARGETS = linux
138
		GRADLE_VERSION_CHECK = false
139
		COMPILE_AVPLUGIN = $(usex media true false)
140
		COMPILE_MEDIA = $(usex media true false)
141 191
		COMPILE_WEBKIT = false
142
		BUILD_JAVADOC = $(usex doc true false)
143
		BUILD_SRC_ZIP = $(usex source true false)
144
		FULL_TEST = false
192
		COMPILE_MEDIA = $(usex media true false)
193
		JDK_DOCS = https://docs.oracle.com/en/java/javase/${SLOT}/docs/api
194
		JDK_DOCS_LINK = $(usex doc "${jdk_doc}" "")
195
		BUILD_LIBAV_STUBS = false
196
		GRADLE_VERSION_CHECK = false
197
		LINT = none
145 198
		CONF = $(usex debug DebugNative Release)
146 199
		NUM_COMPILE_THREADS = $(makeopts_jobs)
200
		JFX_DEPS_URL = ${T}/jars
201
		COMPANY_NAME = "Gentoo"
147 202
	_EOF_
148

  
149
	local repostring='
150
		repositories {
151
		ivy {
152
			url file("${projectDir}/jars")
153
			layout "pattern", {
154
				artifact "[artifact]-[revision].[ext]"
155
				artifact "[artifact].[ext]"
156
			}
157
		}
158
		mavenLocal()
159
	}'
160

  
161
	cat <<- _EOF_ > "${S}"/buildSrc/gentoo.gradle
162
		${repostring}
163
	_EOF_
164

  
165
	cat <<- _EOF_ > "${S}"/gentoo.gradle
166
		${repostring}
167
		allprojects {
168
			${repostring}
169
		}
170
	_EOF_
171

  
172
	echo "apply from: 'gentoo.gradle'" >> build.gradle || die
173
	echo "apply from: 'gentoo.gradle'" >> buildSrc/build.gradle || die
174
	sed -i 's/mavenCentral/mavenLocal/g' build.gradle || die
175
	sed -i 's/mavenCentral/mavenLocal/g' buildSrc/build.gradle || die
176
	einfo "Configured with the following settings:"
177
	cat gradle.properties || die
178

  
179 203
}
180 204

  
181 205
src_compile() {
182
	append-cflags '-fcommon'
183
	tc-export_build_env CC CXX PKG_CONFIG
184
	rm -r tests buildSrc/src/test || die
185
	egradle openExportLinux
206
	egradle zips $(usex doc "" "--exclude-task javadoc")
186 207
}
187 208

  
188 209
src_install() {
189
	local dest="/usr/$(get_libdir)/openjdk-${SLOT}"
190
	local ddest="${ED}${dest}"
191
	dodir "${dest}"
192
	pushd build/export/sdk > /dev/null || die
193
	cp -pPRv * "${ddest}" || die
194
	popd > /dev/null || die
210
	if ! use source ; then
211
		rm -v build/sdk/lib/src.zip || die
212
	fi
213

  
214
	insinto "/usr/$(get_libdir)/${PN}-${SLOT}"
215
	doins -r build/sdk/.
216
	doins build/javafx-exports.zip
217

  
218
	if use doc; then
219
		docinto html
220
		dodoc -r build/javadoc/.
221
		dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
222
	fi
195 223
}
Thank you!