3 |
3 |
|
4 |
4 |
EAPI=7
|
5 |
5 |
|
6 |
|
inherit java-pkg-2 java-ant-2 java-osgi toolchain-funcs
|
|
6 |
inherit flag-o-matic java-pkg-2 java-ant-2 toolchain-funcs java-osgi
|
7 |
7 |
|
8 |
8 |
MY_PV="${PV/_rc/RC}"
|
9 |
|
MY_DMF="https://archive.eclipse.org/eclipse/downloads/drops/R-${MY_PV}-201202080800"
|
|
9 |
MY_DMF="https://archive.eclipse.org/eclipse/downloads/drops4/R-${MY_PV}-201812060815"
|
10 |
10 |
MY_P="${PN}-${MY_PV}"
|
11 |
11 |
|
12 |
12 |
DESCRIPTION="GTK based SWT Library"
|
13 |
13 |
HOMEPAGE="https://www.eclipse.org/"
|
14 |
14 |
SRC_URI="
|
15 |
15 |
amd64? ( ${MY_DMF}/${MY_P}-gtk-linux-x86_64.zip )
|
16 |
|
ppc? ( ${MY_DMF}/${MY_P}-gtk-linux-x86.zip )
|
17 |
|
ppc64? ( ${MY_DMF}/${MY_P}-gtk-linux-ppc64.zip )
|
18 |
|
x86? ( ${MY_DMF}/${MY_P}-gtk-linux-x86.zip )"
|
|
16 |
ppc64? ( ${MY_DMF}/${MY_P}-gtk-linux-ppc64le.zip )"
|
19 |
17 |
|
20 |
18 |
LICENSE="CPL-1.0 LGPL-2.1 MPL-1.1"
|
21 |
|
SLOT="3.7"
|
22 |
|
KEYWORDS="amd64 ppc64 x86"
|
23 |
|
IUSE="cairo opengl"
|
|
19 |
SLOT="4.10"
|
|
20 |
KEYWORDS="amd64 ppc64"
|
|
21 |
IUSE="cairo opengl webkit"
|
24 |
22 |
|
25 |
|
COMMON_DEPEND="
|
|
23 |
COMMON_DEP="
|
26 |
24 |
>=dev-libs/atk-1.10.2
|
27 |
|
>=dev-libs/glib-2.6
|
|
25 |
>=dev-libs/glib-2.32
|
28 |
26 |
>=x11-libs/gtk+-2.6.8:2
|
29 |
27 |
x11-libs/libXtst
|
30 |
28 |
cairo? ( >=x11-libs/cairo-1.4.14 )
|
31 |
|
opengl? (
|
|
29 |
opengl? (
|
32 |
30 |
virtual/glu
|
33 |
31 |
virtual/opengl
|
|
32 |
)
|
|
33 |
webkit? (
|
|
34 |
net-libs/webkit-gtk:4
|
34 |
35 |
)"
|
35 |
|
BDEPEND="
|
36 |
|
app-arch/unzip
|
37 |
|
virtual/pkgconfig
|
38 |
|
"
|
39 |
|
DEPEND="${COMMON_DEPEND}
|
40 |
|
virtual/jdk:1.8
|
|
36 |
DEPEND="${COMMON_DEP}
|
|
37 |
>=virtual/jdk-1.8:*[-headless-awt]
|
41 |
38 |
x11-base/xorg-proto
|
42 |
39 |
x11-libs/libX11
|
43 |
40 |
x11-libs/libXrender
|
44 |
41 |
x11-libs/libXt
|
45 |
42 |
>=x11-libs/libXtst-1.1.0"
|
46 |
|
RDEPEND="${COMMON_DEPEND}
|
47 |
|
>=virtual/jre-1.4"
|
|
43 |
RDEPEND="${COMMON_DEP}
|
|
44 |
>=virtual/jre-1.8:*"
|
|
45 |
BDEPEND="
|
|
46 |
app-arch/unzip
|
|
47 |
virtual/pkgconfig
|
|
48 |
"
|
48 |
49 |
|
49 |
50 |
S="${WORKDIR}"
|
50 |
51 |
|
51 |
52 |
# JNI libraries don't need SONAME, bug #253756
|
52 |
|
QA_SONAME="usr/lib.*/libswt-.*.so"
|
|
53 |
QA_SONAME='usr/lib[^/]*/libswt-[^/]+.so'
|
53 |
54 |
|
54 |
55 |
PATCHES=(
|
55 |
|
# Fix Makefiles to respect flags and work with --as-needed
|
56 |
|
"${FILESDIR}"/as-needed-and-flag-fixes-3.6.patch
|
|
56 |
"${FILESDIR}"/${P}-as-needed-and-flag-fixes.patch
|
57 |
57 |
)
|
58 |
58 |
|
59 |
59 |
src_unpack() {
|
60 |
60 |
local DISTFILE=${A}
|
61 |
|
unzip -jq "${DISTDIR}"/${DISTFILE} "*src.zip" || die "Unable to extract distfile"
|
|
61 |
unzip -jq "${DISTDIR}"/${DISTFILE} swt.jar src.zip || die "Unable to extract distfile"
|
62 |
62 |
unpack "./src.zip"
|
63 |
63 |
|
64 |
64 |
# Cleanup the redirtied directory structure
|
... | ... | |
70 |
70 |
cp "${FILESDIR}/build.xml" "${S}/build.xml" || die "Unable to update build.xml"
|
71 |
71 |
mkdir "${S}/src" && mv "${S}/org" "${S}/src" || die "Unable to restructure SWT sources"
|
72 |
72 |
|
73 |
|
case ${ARCH} in
|
74 |
|
ppc|x86) eapply "${FILESDIR}"/${P}-gio_launch-URI-x86.patch ;;
|
75 |
|
*) eapply "${FILESDIR}"/${P}-gio_launch-URI.patch ;;
|
76 |
|
esac
|
77 |
|
|
|
73 |
# Apply patches
|
78 |
74 |
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
|
79 |
82 |
}
|
80 |
83 |
|
81 |
84 |
src_compile() {
|
|
85 |
append-cflags -fcommon # https://bugs.gentoo.org/707838
|
|
86 |
|
82 |
87 |
# Drop jikes support as it seems to be unfriendly with SWT
|
83 |
88 |
java-pkg_filter-compiler jikes
|
84 |
89 |
|
85 |
|
local AWT_ARCH
|
86 |
90 |
local JAWTSO="libjawt.so"
|
87 |
|
if [[ $(tc-arch) == 'x86' ]] ; then
|
88 |
|
AWT_ARCH="i386"
|
89 |
|
elif [[ $(tc-arch) == 'ppc' ]] ; then
|
90 |
|
AWT_ARCH="ppc"
|
91 |
|
elif [[ $(tc-arch) == 'ppc64' ]] ; then
|
92 |
|
AWT_ARCH="ppc64"
|
93 |
|
else
|
94 |
|
AWT_ARCH="amd64"
|
95 |
|
fi
|
96 |
|
if [[ -f "${JAVA_HOME}/jre/lib/${AWT_ARCH}/${JAWTSO}" ]]; then
|
97 |
|
export AWT_LIB_PATH="${JAVA_HOME}/jre/lib/${AWT_ARCH}"
|
98 |
|
elif [[ -f "${JAVA_HOME}/jre/bin/${JAWTSO}" ]]; then
|
99 |
|
export AWT_LIB_PATH="${JAVA_HOME}/jre/bin"
|
100 |
|
elif [[ -f "${JAVA_HOME}/$(get_libdir)/${JAWTSO}" ]] ; then
|
101 |
|
export AWT_LIB_PATH="${JAVA_HOME}/$(get_libdir)"
|
102 |
|
else
|
|
91 |
IFS=":" read -r -a ldpaths <<< $(java-config -g LDPATH)
|
|
92 |
|
|
93 |
for libpath in "${ldpaths[@]}"; do
|
|
94 |
if [[ -f "${libpath}/${JAWTSO}" ]]; then
|
|
95 |
export AWT_LIB_PATH="${libpath}"
|
|
96 |
break
|
|
97 |
# this is a workaround for broken LDPATH in <=openjdk-8.292_p10 and <=dev-java/openjdk-bin-8.292_p10
|
|
98 |
elif [[ -f "${libpath}/$(tc-arch)/${JAWTSO}" ]]; then
|
|
99 |
export AWT_LIB_PATH="${libpath}/$(tc-arch)"
|
|
100 |
break
|
|
101 |
fi
|
|
102 |
done
|
|
103 |
|
|
104 |
if [[ -z "${AWT_LIB_PATH}" ]]; then
|
103 |
105 |
eerror "${JAWTSO} not found in the JDK being used for compilation!"
|
104 |
106 |
die "cannot build AWT library"
|
105 |
107 |
fi
|
106 |
108 |
|
107 |
109 |
# Fix the pointer size for AMD64
|
108 |
|
[[ ${ARCH} == "amd64" || ${ARCH} == "ppc64" ]] && export SWT_PTR_CFLAGS=-DJNI64
|
|
110 |
export SWT_PTR_CFLAGS=-DJNI64
|
|
111 |
|
|
112 |
# Bug #461784, g_thread_init is deprecated since glib-2.32.
|
|
113 |
append-cflags -DNO__1g_1thread_1init
|
109 |
114 |
|
110 |
115 |
local make="emake -f make_linux.mak NO_STRIP=y CC=$(tc-getCC) CXX=$(tc-getCXX)"
|
111 |
116 |
|
112 |
117 |
einfo "Building AWT library"
|
113 |
|
${make} make_awt
|
|
118 |
${make} make_awt AWT_LIBS="-L\$(AWT_LIB_PATH) -Wl,-rpath,\$(AWT_LIB_PATH) -ljawt \`pkg-config --libs x11\`"
|
114 |
119 |
|
115 |
120 |
einfo "Building SWT library"
|
116 |
121 |
${make} make_swt
|
... | ... | |
128 |
133 |
${make} make_glx
|
129 |
134 |
fi
|
130 |
135 |
|
|
136 |
if use webkit ; then
|
|
137 |
einfo "Building WebKit component"
|
|
138 |
${make} make_webkit make_webkit2extension
|
|
139 |
fi
|
|
140 |
|
131 |
141 |
einfo "Building JNI libraries"
|
132 |
142 |
eant compile
|
133 |
143 |
|
... | ... | |
135 |
145 |
cp -i "${S}/version.txt" "${S}/build/version.txt" || die
|
136 |
146 |
cp -i "${S}/src/org/eclipse/swt/internal/SWTMessages.properties" \
|
137 |
147 |
"${S}/build/org/eclipse/swt/internal/" || die
|
|
148 |
unzip swt.jar 'org/eclipse/swt/internal/gtk/*.css' -d build || die
|
138 |
149 |
|
139 |
150 |
einfo "Packing JNI libraries"
|
140 |
151 |
eant jar
|
141 |
152 |
}
|
142 |
153 |
|
143 |
154 |
src_install() {
|
144 |
|
swtArch=${ARCH}
|
|
155 |
local swtArch=${ARCH}
|
145 |
156 |
use amd64 && swtArch=x86_64
|
146 |
157 |
|
147 |
158 |
sed "s/SWT_ARCH/${swtArch}/" "${FILESDIR}/${PN}-${SLOT}-manifest" > "MANIFEST_TMP.MF" || die
|
148 |
|
use cairo || sed -i -e "/ org.eclipse.swt.internal.cairo; x-internal:=true,/d" "MANIFEST_TMP.MF"
|
149 |
|
sed -i -e "/ org.eclipse.swt.internal.gnome; x-internal:=true,/d" "MANIFEST_TMP.MF" || die
|
150 |
|
use opengl || sed -i -e "/ org.eclipse.swt.internal.opengl.glx; x-internal:=true,/d" "MANIFEST_TMP.MF"
|
151 |
|
sed -i -e "/ org.eclipse.swt.internal.webkit; x-internal:=true,/d" "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
|
152 |
166 |
java-osgi_newjar-fromfile "swt.jar" "MANIFEST_TMP.MF" "Standard Widget Toolkit for GTK 2.0"
|
153 |
167 |
|
154 |
|
java-pkg_sointo /usr/$(get_libdir)
|
|
168 |
java-pkg_sointo "/usr/$(get_libdir)/swt"
|
155 |
169 |
java-pkg_doso *.so
|
156 |
170 |
|
157 |
|
docinto html
|
158 |
171 |
dodoc about.html
|
159 |
172 |
}
|