summaryrefslogtreecommitdiff
blob: 9c2f973e212d6941fc0e440de0bc99505edcc678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="5"
JAVA_PKG_IUSE="doc source"

inherit java-pkg-2 java-ant-2

MY_P="xmlbeans-${PV}"

DESCRIPTION="An XML-Java binding tool"
HOMEPAGE="https://xmlbeans.apache.org/"
SRC_URI="https://archive.apache.org/dist/xmlbeans/source/${MY_P}-src.zip"

LICENSE="Apache-2.0"
SLOT="2"
KEYWORDS="~amd64 ~ppc64 ~x86"

CDEPEND="
	dev-java/saxon:9
	dev-java/jsr173:0
	dev-java/annogen:0
	dev-java/piccolo:0
	dev-java/ant-core:0
	dev-java/xml-commons-resolver:0"

RDEPEND="
	${CDEPEND}
	>=virtual/jre-1.6"

DEPEND="
	${CDEPEND}
	app-arch/unzip
	>=virtual/jdk-1.6"

S="${WORKDIR}/${MY_P}"

PATCHES=(
	"${FILESDIR}"/${P}-remove-jamsupport.patch
	"${FILESDIR}"/${P}-piccolo.patch
	"${FILESDIR}"/${P}-jam.patch
	"${FILESDIR}"/${P}-SchemaCompiler.java.patch
)

java_prepare() {
	epatch "${PATCHES[@]}"

	# Preserve the old xbean jar, which is required for bootstrapping schemas.
	mv external/lib/oldxbean.jar "${T}"/ || die

	# Remove bundled binary files.
	find . -name '*.jar' -exec rm -v {} + || die

	pushd external/lib > /dev/null || die

	find . -iname '*.zip' -exec rm -v {} + || die

	# Symlink the dependencies.
	java-pkg_jar-from jsr173{,.jar,_1.0_api_bundle.jar}
	java-pkg_jar-from jsr173{,.jar,_1.0_api.jar}

	mkdir xml-commons-resolver-1.1 || die
	java-pkg_jar-from xml-commons-resolver{,.jar} xcresolver.zip
	java-pkg_jar-from xml-commons-resolver{,.jar,-1.1/resolver.jar}

	# Put back the preserved old xbean jar.
	mv "${T}"/oldxbean.jar . || die

	popd > /dev/null || die

	# Create empty directories to let the build pass.
	mkdir -p build/classes/{jam,piccolo} || die
}

JAVA_ANT_REWRITE_CLASSPATH="true"

EANT_GENTOO_CLASSPATH="
	annogen
	piccolo
	ant-core
	saxon-9
"

EANT_BUILD_TARGET="deploy"
EANT_DOC_TARGET="docs"

EANT_EXTRA_ARGS="-Dpiccolo.classes.notRequired=true"
EANT_EXTRA_ARGS+=" -Djam.classes.notRequired=true"
EANT_EXTRA_ARGS+=" -Dsaxon9.jar.exists=true"

src_install() {
	java-pkg_dojar build/lib/xbean*.jar

	dodoc NOTICE.txt README.txt
	if use doc; then
		java-pkg_dojavadoc build/docs/reference
		java-pkg_dohtml -r docs
	fi

	use source && java-pkg_dosrc src/*
}

pkg_postinst() {
	ewarn "This package uses an old binary xbean to bootstrap its schemas."
	ewarn "If you do not trust the binary part of this build, please unmerge."
}