Diff swt-4.10-r2 with a swt-4.28-r1

/usr/portage/dev-java/swt/swt-4.28-r1.ebuild 2023-10-09 14:52:29.448368349 +0300
1
# Copyright 1999-2022 Gentoo Authors
1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6
inherit flag-o-matic java-pkg-2 java-ant-2 toolchain-funcs java-osgi
6
JAVA_PKG_IUSE="doc source"
7

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

  
8 10
MY_PV="${PV/_rc/RC}"
9
MY_DMF="https://archive.eclipse.org/eclipse/downloads/drops4/R-${MY_PV}-201812060815"
11
MY_DMF="https://download.eclipse.org/eclipse/downloads/drops4/R-${MY_PV}-202306050440"
10 12
MY_P="${PN}-${MY_PV}"
11 13

  
12 14
DESCRIPTION="GTK based SWT Library"
13
HOMEPAGE="https://www.eclipse.org/"
15
HOMEPAGE="https://www.eclipse.org/swt/"
14 16
SRC_URI="
15 17
	amd64? ( ${MY_DMF}/${MY_P}-gtk-linux-x86_64.zip )
18
	arm64? ( ${MY_DMF}/${MY_P}-gtk-linux-aarch64.zip )
16 19
	ppc64? ( ${MY_DMF}/${MY_P}-gtk-linux-ppc64le.zip )"
17 20

  
18 21
LICENSE="CPL-1.0 LGPL-2.1 MPL-1.1"
19
SLOT="4.10"
20
KEYWORDS="amd64 ppc64"
22
SLOT="4.27"
23
KEYWORDS="amd64 arm64 ppc64"
21 24
IUSE="cairo opengl webkit"
22 25

  
23 26
COMMON_DEP="
24
	>=dev-libs/atk-1.10.2
25
	>=dev-libs/glib-2.32
26
	>=x11-libs/gtk+-2.6.8:2
27
	app-accessibility/at-spi2-core:2
28
	dev-libs/glib
29
	x11-libs/gtk+:3
27 30
	x11-libs/libXtst
28
	cairo? ( >=x11-libs/cairo-1.4.14 )
31
	cairo? ( x11-libs/cairo )
29 32
	opengl?	(
30 33
		virtual/glu
31 34
		virtual/opengl
32 35
	)
33 36
	webkit? (
34
		net-libs/webkit-gtk:4
37
		net-libs/webkit-gtk:4.1
35 38
	)"
36 39
DEPEND="${COMMON_DEP}
37
	>=virtual/jdk-1.8:*[-headless-awt]
40
	>=virtual/jdk-11:*[-headless-awt]
38 41
	x11-base/xorg-proto
39 42
	x11-libs/libX11
40 43
	x11-libs/libXrender
41 44
	x11-libs/libXt
42
	>=x11-libs/libXtst-1.1.0"
45
	x11-libs/libXtst"
43 46
RDEPEND="${COMMON_DEP}
44 47
	>=virtual/jre-1.8:*"
45 48
BDEPEND="
......
47 50
	virtual/pkgconfig
48 51
"
49 52

  
50
S="${WORKDIR}"
53
HTML_DOCS=( about.html )
51 54

  
52
# JNI libraries don't need SONAME, bug #253756
53
QA_SONAME='usr/lib[^/]*/libswt-[^/]+.so'
55
JAVA_RESOURCE_DIRS="resources"
56
JAVA_SRC_DIR="src"
54 57

  
55 58
PATCHES=(
56
	"${FILESDIR}"/${P}-as-needed-and-flag-fixes.patch
59
	"${FILESDIR}/swt-4.27-as-needed-and-flag-fixes.patch"
57 60
)
58 61

  
59 62
src_unpack() {
60
	local DISTFILE=${A}
61
	unzip -jq "${DISTDIR}"/${DISTFILE} swt.jar src.zip || die "Unable to extract distfile"
63
	default
62 64
	unpack "./src.zip"
63

  
64
	# Cleanup the redirtied directory structure
65
	rm -rf about_files/ || die
66 65
}
67 66

  
68 67
src_prepare() {
69
	# Replace the build.xml to allow compilation without Eclipse tasks
70
	cp "${FILESDIR}/build.xml" "${S}/build.xml" || die "Unable to update build.xml"
71
	mkdir "${S}/src" && mv "${S}/org" "${S}/src" || die "Unable to restructure SWT sources"
72

  
73
	# Apply patches
74 68
	default
75

  
76
	# Define missing g_thread_supported() to be already started.
77
	sed -i '1s/^/#define g_thread_supported() 1\n\n/' "${S}"/os_custom.h || die
78

  
79
	# Webext is also in the library directory
80
	sed -i 's|findResource([^,]\+|findResource("swt"|' \
81
		"${S}"/src/org/eclipse/swt/browser/WebKit.java || die
69
	java-pkg-2_src_prepare
70
	# .css stuff is essential at least for running net-p2p/biglybt
71
	unzip swt.jar 'org/eclipse/swt/internal/gtk/*.css' -d resources || die
72
	java-pkg_clean
73
	mkdir src || die "mkdir failed"
74
	mv org src || die "moving java sources failed"
75
	find src -type f ! -name '*.java' | xargs \
76
		cp  --parent -t resources -v || die "copying resources failed"
77
	cp version.txt resources || die "adding version.txt failed"
82 78
}
83 79

  
84 80
src_compile() {
85 81
	append-cflags -fcommon # https://bugs.gentoo.org/707838
86 82

  
87
	# Drop jikes support as it seems to be unfriendly with SWT
88
	java-pkg_filter-compiler jikes
89

  
90 83
	local JAWTSO="libjawt.so"
91 84
	IFS=":" read -r -a ldpaths <<< $(java-config -g LDPATH)
92 85

  
......
115 108
	local make="emake -f make_linux.mak NO_STRIP=y CC=$(tc-getCC) CXX=$(tc-getCXX)"
116 109

  
117 110
	einfo "Building AWT library"
111
	export SWT_JAVA_HOME="$(java-config -g JAVA_HOME)"
118 112
	${make} make_awt AWT_LIBS="-L\$(AWT_LIB_PATH) -Wl,-rpath,\$(AWT_LIB_PATH) -ljawt \`pkg-config --libs x11\`"
119 113

  
120 114
	einfo "Building SWT library"
......
135 129

  
136 130
	if use webkit ; then
137 131
		einfo "Building WebKit component"
138
		${make} make_webkit make_webkit2extension
132
		${make} make_webkit
139 133
	fi
140 134

  
141
	einfo "Building JNI libraries"
142
	eant compile
143

  
144
	einfo "Copying missing files"
145
	cp -i "${S}/version.txt" "${S}/build/version.txt" || die
146
	cp -i "${S}/src/org/eclipse/swt/internal/SWTMessages.properties" \
147
		"${S}/build/org/eclipse/swt/internal/" || die
148
	unzip swt.jar 'org/eclipse/swt/internal/gtk/*.css' -d build || die
149

  
150
	einfo "Packing JNI libraries"
151
	eant jar
135
	java-pkg-simple_src_compile
152 136
}
153 137

  
154 138
src_install() {
155
	local swtArch=${ARCH}
156
	use amd64 && swtArch=x86_64
157

  
158
	sed "s/SWT_ARCH/${swtArch}/" "${FILESDIR}/${PN}-${SLOT}-manifest" > "MANIFEST_TMP.MF" || die
159
	remove_from_manifest() {
160
		local subpkg=$1
161
		sed -i -e "/ org.eclipse.swt.internal.$subpkg; x-internal:=true,/d" "MANIFEST_TMP.MF" || die
162
	}
163
	use cairo || remove_from_manifest cairo
164
	use opengl || remove_from_manifest opengl.glx
165
	use webkit || remove_from_manifest webkit
166
	java-osgi_newjar-fromfile "swt.jar" "MANIFEST_TMP.MF" "Standard Widget Toolkit for GTK 2.0"
139
	java-pkg-simple_src_install
167 140

  
168 141
	java-pkg_sointo "/usr/$(get_libdir)/swt"
169 142
	java-pkg_doso *.so
170

  
171
	dodoc about.html
172 143
}
Thank you!