summaryrefslogtreecommitdiff
blob: 592676f940e4b38f0637b008357490765bacb26a (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

inherit gnat versionator

IUSE=""

Name="XmlAda"

DESCRIPTION="XML library for Ada"
HOMEPAGE="http://libre2.adacore.com/xmlada/"
SRC_URI="https://libre2.adacore.com/xmlada/${Name}-${PV}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"

DEPEND="virtual/gnat
	>=sys-apps/sed-4"
RDEPEND=""

src_unpack()
{
	unpack ${A}

	cd "${S}"
	#making .dvi docs is problemmatic. Skip that for now
	sed -i -e "s/all: obj test docs/all: obj test/" Makefile.in
	#increase stack size
	cd sax
	sed -i -e "s/Stack_Size : constant Natural := 64;/Stack_Size : constant Natural := 128;/" sax-readers.adb
}

lib_compile()
{
	# for some reason shared libs are assigned version numbers from some
	# pre-release (possibly when upstream stopped to care about them?)
	local MAJOR=$(get_major_version)
	local MINOR=$(get_version_component_range 2-)
	# force building shared libs and fix broken shared lib versioning
	sed -i -e "s:BUILD_SHARED=FALSE:BUILD_SHARED=TRUE:" \
		-e "s:libxmlada_\${@\:%_install=%}-\${MAJOR}.\${MINOR}.so:libxmlada_\${@\:%_inst=%}.so.${MAJOR}.${MINOR}:" \
		-e "s:libxmlada_\${@\:%_inst=%}-\${MAJOR}.\${MINOR}.so:libxmlada_\${@\:%_inst=%}.so.${MAJOR}.${MINOR}:" \
		-e "s:FPIC=:FPIC=-fPIC:" Makefile.in

	export CFLAGS=$ADACFLAGS
	./configure --prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-shared \
		--host=${CHOST} \
		--build=${CHOST} \
		--target=${CHOST} \
		--with-system-zlib || die

	export COMPILER=gnatmake
	make || die "make failed"
}

# here we need to use the $1 - passed gnat profile name
lib_install() {
	make PREFIX="${DL}" install || die "install failed"

	# fix xmlada-config hardsets locations
	sed -i -e "s:\${prefix}/include/xmlada:${AdalibSpecsDir}/${PN}:" \
		-e "s:\${prefix}/lib:${AdalibLibTop}/$1/${PN}:g" \
		"${DL}"/bin/xmlada-config

	# now move stuff to proper location and delete extras
	mv "${DL}"/bin/xmlada-config "${DL}"/lib/* "${DL}"/include/${PN}/*.ali "${DL}"
	rm -rf "${DL}"/bin "${DL}"/include "${DL}"/lib
}

src_install ()
{
	cd "${S}"
	dodir ${AdalibSpecsDir}/${PN}
	insinto ${AdalibSpecsDir}/${PN}
	doins dom/*.ad? input_sources/*.ad? sax/*.ad? unicode/*.ad?

	#set up environment
	echo "PATH=%DL%" > ${LibEnv}
	echo "LDPATH=%DL%" >> ${LibEnv}
	echo "ADA_OBJECTS_PATH=%DL%" >> ${LibEnv}
	echo "ADA_INCLUDE_PATH=/usr/include/ada/${PN}" >> ${LibEnv}

	gnat_src_install

	dodoc AUTHORS README docs/xml.ps
	dohtml docs/*.html
	doinfo docs/*.info
	#need to give a proper name to the info file
	cd "${D}"/usr/share/info
	mv xml.info.gz ${PN}.info.gz

}