summaryrefslogtreecommitdiff
blob: da1d5ba42aa22fa1355460cc6fd850619517c801 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/app-office/abiword/abiword-0.99.3-r1.ebuild,v 1.2 2002/04/12 23:03:04 seemant Exp $

S=${WORKDIR}/${P}/abi
DESCRIPTION="Text processor"
SRC_URI="http://download.sourceforge.net/abiword/abiword-${PV}.tar.gz"
HOMEPAGE="http://www.abisource.com"
SLOT="0"
DEPEND="virtual/glibc
	>=sys-devel/gcc-2.95.2
	=media-libs/freetype-1.3.1-r3
	>=media-libs/libpng-1.2.1
	>=media-libs/jpeg-6b-r2
	>=x11-libs/gtk+-1.2.10-r4
	gnome? ( >=gnome-base/gnome-libs-1.4.1.2-r1
	>=dev-libs/libunicode-0.4-r1
	>=gnome-base/bonobo-1.0.9-r1
	>=gnome-extra/gal-0.13-r1 )
	>=sys-devel/automake-1.5d-r1
	perl?  ( >=sys-devel/perl-5.6 )
	spell? ( >=app-text/pspell-ispell-0.12-r1 )
	xml2?  ( >=dev-libs/libxml2-2.4.10 )
	virtual/x11"


fix_perl_env() {
	# new configure scripts is a bit broken
	export PERL_ARCHLIB="`(perl -V:installarchlib | sed -e "s/\(.*=\|'\|;\)//g\")`"
	export PERL_LIB="`(perl -V:installprivlib | sed -e "s/\(.*=\|'\|;\)//g\")`"
	export POD2MAN_EXE="`which pod2man`"
	export SITE_LIB="`(perl -V:sitelib | sed -e "s/\(.*=\|'\|;\)//g\")`"
	export SITE_ARCHLIB="`(perl -V:sitearch | sed -e "s/\(.*=\|'\|;\)//g\")`"
}

src_unpack() {

	unpack ${A}

	if [ "`use perl`" ] ; then
		fix_perl_env

		# Fix perl stuff install outside sandbox, as well as a bug in 
		# Abiword's build system (Abiword.3pm did not install, and
		# the '.packlist' was not generated properly) -- Azarah (25/02/2002).
		cd ${S}/src/bindings/perl
		cp GNUmakefile.am GNUmakefile.am.orig
		sed -e "s:PERL_ARCHLIB = @PERL_ARCHLIB@:PERL_ARCHLIB = ${PERL_ARCHLIB}:" \
			-e "s:PERL_LIB = @PERL_LIB@:PERL_LIB = ${PERL_LIB}:" \
			-e "s:POD2MAN_EXE = @POD2MAN_EXE@:POD2MAN_EXE = ${POD2MAN_EXE}:" \
			-e "s:SITE_LIB = @SITE_LIB@:SITE_LIB = ${SITE_LIB}:" \
			-e "s:SITE_ARCHLIB = @SITE_ARCHLIB@:SITE_ARCHLIB = ${SITE_ARCHLIB}:" \
			-e 's:write $(SITE_ARCHLIB)/auto:write $(PERLDEST)/$(SITE_ARCHLIB)/auto:g' \
			-e 's:blib/lib $(SITE_LIB):blib/lib $(PERLDEST)/$(SITE_LIB):g' \
			-e 's:blib/arch $(SITE_ARCHLIB):blib/arch $(PERLDEST)/$(SITE_ARCHLIB):g' \
			-e 's:blib/bin /usr/bin:blib/bin $(PERLDEST)/usr/bin:g' \
			-e 's:blib/script /usr/bin:blib/script $(PERLDEST)/usr/bin:g' \
			-e 's:blib/man1 /usr/share/man/man1:blib/man1 $(PERLDEST)/usr/share/man/man1:g' \
			-e 's:blib/man3 /usr/share/man/man3:blib/man3 $(PERLDEST)/usr/share/man/man3:g' \
			-e 's:mkpath $(PERL_ARCHLIB):mkpath $(PERLDEST)/$(PERL_ARCHLIB):g' \
			-e 's:$(PERL_ARCHLIB)/perllocal.pod:$(PERLDEST)/$(PERL_ARCHLIB)/perllocal.pod.new:' \
			GNUmakefile.am.orig >GNUmakefile.am || die
		mkdir -p blib/{arch,bin,lib,man1,man3,script}
		cd ${S}
	fi

	# clear invalid symlinks
	rm -f ac-helpers/{install-sh,mkinstalldirs,missing}
}

src_compile() {

	local myconf
	use gnome	\
		&& myconf="${myconf} --with-gnome --enable-gnome"	\
		&& export ABI_OPT_BONOBO=1

	use perl	\
		&& myconf="${myconf} --enable-scripting"
	
	use spell	\
		&& myconf="${myconf} --with-pspell"

	use xml2	\
		&& myconf="${myconf} --with-libxml2"

	./autogen.sh
	
	echo
	echo "*************************************************"
	echo "* Ignore above ERROR as it does not cause build *"
	echo "* to fail.                                      *"
	echo "*************************************************"
	echo

	CFLAGS="$CFLAGS `gdk-pixbuf-config --cflags`"

	./configure --host=${CHOST} \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--sysconfdir=/etc \
		--localstatedir=/var/lib \
		--with-libjpeg \
		--enable-extra-optimization \
		${myconf} || die

	# Doesn't work with -j 4 (hallski)
	make UNIX_CAN_BUILD_STATIC=0 \
		OPTIMIZER="${CFLAGS}" || die
}

src_install() {

	dodir /usr/{bin,lib}

	make prefix=${D}/usr \
		mandir=${D}/usr/share/man \
		infodir=${D}/usr/share/info \
		sysconfdir=${D}/etc \
		localstatedir=${D}/var/lib \
		PERLDEST=${D} \
		install || die
	
	dosed "s:${D}::g" /usr/bin/AbiWord
	
	rm -f ${D}/usr/bin/abiword
	dosym /usr/bin/AbiWord /usr/bin/abiword

	dodoc BUILD COPYING *.txt, *.TXT

	# Install icon and .desktop for menu entry
	if [ "`use gnome`" ] ; then
		insinto /usr/share/pixmaps
		newins ${WORKDIR}/${P}/abidistfiles/icons/abiword_48.png AbiWord.png
		insinto /usr/share/gnome/apps/Applications
		doins ${FILESDIR}/AbiWord.desktop
	fi
}

pkg_postinst() {

	# Appending installation info
	local perlver="`perl -v | grep -e "This is perl" | cut -d ' ' -f 4`"
	perlver=${perlver/v/}
	local perlarch="`perl -V | grep -e " archname" | cut -d '=' -f 4`"
	if [ -f /usr/lib/perl5/${perlver}/${perlarch}/perllocal.pod.new ] ; then
		sed -e "s:5.6.0:${perlver}:g" \
			/usr/lib/perl5/${perlver}/${perlarch}/perllocal.pod.new \
			>> /usr/lib/perl5/${perlver}/${perlarch}/perllocal.pod
		rm -rf /usr/lib/perl5/${perlver}/${perlarch}/perllocal.pod.new
	fi
}