]> Pileus Git - ~andy/sunrise/blob - app-office/openoffice-infra/openoffice-infra-3.0.1.ebuild
app-office/openoffice-infra: Change app-text/poppler to virtual/poppler at deps.
[~andy/sunrise] / app-office / openoffice-infra / openoffice-infra-3.0.1.ebuild
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 WANT_AUTOMAKE="1.9"
6 EAPI="2"
7
8 inherit autotools check-reqs db-use eutils fdo-mime flag-o-matic java-pkg-opt-2 kde-functions mono multilib toolchain-funcs
9
10 IUSE="binfilter cups dbus debug eds gnome gstreamer gtk kde ldap mono nsplugin odk oodict opengl pam postgres"
11
12 PATCHLEVEL="OOO300"
13 MILESTONE="15"
14 OOOTAG=${PATCHLEVEL}_m${MILESTONE}
15 OOOBUILDTAG=ooo300-m${MILESTONE}
16
17 SRC=OOo_${PV}_src
18 S=${WORKDIR}/infra-ooo-files_${PV}
19 WORKSRC=${WORKDIR}/${OOOTAG}
20
21 DESCRIPTION="OpenOffice-Infra, office suite with enhanced Russian support from Infra-Resource"
22
23 SRC_URI="binfilter? ( mirror://openoffice/stable/${PV}/${SRC}_binfilter.tar.bz2 )
24         mirror://openoffice/stable/${PV}/${SRC}_core.tar.bz2
25         mirror://openoffice/stable/${PV}/${SRC}_l10n.tar.bz2
26         mirror://openoffice/stable/${PV}/${SRC}_extensions.tar.bz2
27         mirror://openoffice/stable/${PV}/${SRC}_system.tar.bz2
28         odk? ( java? ( http://tools.openoffice.org/unowinreg_prebuild/680/unowinreg.dll ) )
29         http://download.i-rs.ru/pub/openoffice/${PV}/ru/infra-ooo-files_${PV}.tar.gz"
30
31 LANGS1="ru uk"
32 LANGS="${LANGS1} en en_US"
33
34 # proprt linguas handling
35 for X in ${LANGS} ; do
36         IUSE="${IUSE} linguas_${X}"
37 done
38
39 HOMEPAGE="http://www.i-rs.ru/ http://www.go-oo.org/"
40
41 LICENSE="LGPL-2"
42 SLOT="0"
43 KEYWORDS="~amd64 ~x86"
44
45 COMMON_DEPEND="!app-office/openoffice-infra-bin
46         !app-office/openoffice
47         !app-office/openoffice-bin
48         x11-libs/libXaw
49         x11-libs/libXinerama
50         >=dev-lang/perl-5.0
51         dbus? ( >=dev-libs/dbus-glib-0.71 )
52         gnome? ( >=x11-libs/gtk+-2.10
53                 >=gnome-base/gnome-vfs-2.6
54                 >=gnome-base/gconf-2.0
55                 >=x11-libs/cairo-1.0.2 )
56         gtk? ( >=x11-libs/gtk+-2.10
57                 >=x11-libs/cairo-1.0.2 )
58         eds? ( >=gnome-extra/evolution-data-server-1.2 )
59         gstreamer? ( >=media-libs/gstreamer-0.10
60                         >=media-libs/gst-plugins-base-0.10 )
61         kde? ( kde-base/kdelibs:3.5 )
62         java? ( >=dev-java/bsh-2.0_beta4
63                 >=dev-db/hsqldb-1.8.0.9 )
64         mono? ( >=dev-lang/mono-1.2.3.1 )
65         nsplugin? ( || ( net-libs/xulrunner:1.8 net-libs/xulrunner:1.9 =www-client/seamonkey-1* )
66                 >=dev-libs/nspr-4.6.6
67                 >=dev-libs/nss-3.11-r1 )
68         opengl? ( virtual/opengl
69                 virtual/glu )
70         >=net-misc/neon-0.24.7
71         >=dev-libs/openssl-0.9.8g
72         >=x11-libs/startup-notification-0.5
73         >=media-libs/freetype-2.1.10-r2
74         >=media-libs/fontconfig-2.3.0
75         cups? ( net-print/cups )
76         media-libs/jpeg
77         media-libs/libpng
78         app-arch/zip
79         app-arch/unzip
80         >=app-text/hunspell-1.1.4-r1
81         dev-libs/expat
82         >=dev-libs/icu-3.8
83         >=sys-libs/db-4.3
84         >=app-text/libwpd-0.8.8
85         >=media-libs/vigra-1.4
86         >=virtual/poppler-0.8.0"
87
88 RDEPEND="java? ( >=virtual/jre-1.5 )
89         ${COMMON_DEPEND}"
90
91 DEPEND="${COMMON_DEPEND}
92         x11-libs/libXrender
93         x11-libs/libXtst
94         x11-proto/printproto
95         x11-proto/xextproto
96         x11-proto/xproto
97         x11-proto/xineramaproto
98         >=sys-apps/findutils-4.1.20-r1
99         dev-perl/Archive-Zip
100         virtual/perl-Compress-Zlib
101         >=virtual/perl-Compress-Raw-Zlib-2.002
102         virtual/perl-IO-Compress-Base
103         dev-util/pkgconfig
104         dev-util/intltool
105         >=dev-libs/boost-1.33.1
106         sys-devel/flex
107         sys-devel/bison
108         dev-libs/libxslt
109         >=dev-libs/libxml2-2.0
110         >=dev-util/gperf-3
111         >=net-misc/curl-7.12
112         sys-libs/zlib
113         sys-apps/coreutils
114         pam? ( sys-libs/pam
115                 sys-apps/shadow[pam] )
116         !dev-util/dmake
117         >=dev-lang/python-2.3.4[threads]
118         java? ( || ( =virtual/jdk-1.6* =virtual/jdk-1.5* )
119                 >=dev-java/ant-core-1.7 )
120         ldap? ( net-nds/openldap )
121         postgres? ( virtual/postgresql-base )"
122
123 PROVIDE="virtual/ooo"
124 RESTRICT="strip" # the openoffice.org from infra-resource is already stripped
125
126 pkg_setup() {
127
128         ewarn
129         ewarn " It is important to note that OpenOffice-Infra is a very fragile  "
130         ewarn " build when it comes to CFLAGS.  A number of flags have already "
131         ewarn " been filtered out.  If you experience difficulty merging this  "
132         ewarn " package and use agressive CFLAGS, lower the CFLAGS and try to  "
133         ewarn " merge again. Also note that building OOo takes a lot of time and "
134         ewarn " hardware ressources: 4-6 GB free diskspace and 256 MB RAM are "
135         ewarn " the minimum requirements. If you have less, use openoffice-infra-bin "
136         ewarn
137         ewarn " Also if you experience a build break, please make sure to retry "
138         ewarn " with MAKEOPTS="-j1" before filing a bug. "
139         ewarn
140
141         # Check if we have enough RAM and free diskspace to build this beast
142         CHECKREQS_MEMORY="512"
143         use debug && CHECKREQS_DISK_BUILD="8192" || CHECKREQS_DISK_BUILD="5120"
144         check_reqs
145
146         strip-linguas ${LANGS}
147
148         if [[ -z "${LINGUAS}" ]]; then
149                 export LINGUAS_OOO="en-US"
150                 ewarn
151                 ewarn " To get a localized build, set the according "
152                 ewarn " LINGUAS variable(s). LINGUAS=ru for example. "
153                 ewarn
154         else
155                 export LINGUAS_OOO=$(echo ${LINGUAS} | sed -e 's/\ben\b/en_US/g;s/_/-/g')
156         fi
157
158         if use !java; then
159                 ewarn
160                 ewarn " You are building with java-support disabled, this results in some "
161                 ewarn " of the OpenOffice.org functionality (i.e. help) being disabled. "
162                 ewarn " If something you need does not work for you, rebuild with "
163                 ewarn " java in your USE-flags. "
164                 ewarn
165         fi
166
167         if use !gtk && use !gnome; then
168                 ewarn
169                 ewarn " If you want the OpenOffice-Infra systray quickstarter to work "
170                 ewarn " activate the 'gtk' and 'gnome' use flags. "
171                 ewarn
172         fi
173
174         if is-flagq -ffast-math ; then
175                 eerror
176                 eerror " You are using -ffast-math, which is known to cause problems. "
177                 eerror " Please remove it from your CFLAGS, using this globally causes "
178                 eerror " all sorts of problems. "
179                 eerror " After that you will also have to - at least - rebuild python otherwise "
180                 eerror " the openoffice build will break. "
181                 die
182         fi
183
184         if use nsplugin; then
185                 if pkg-config --exists libxul; then
186                         BRWS="libxul"
187                 elif pkg-config --exists xulrunner-xpcom; then
188                         BRWS="xulrunner"
189                 elif pkg-config --exists seamonkey-xpcom; then
190                         BRWS="seamonkey"
191                 else
192                         die "USE flag [nsplugin] set but no installed xulrunner or seamonkey found!"
193                 fi
194         fi
195
196         java-pkg-opt-2_pkg_setup
197
198         # sys-libs/db version used
199         local db_ver=$(db_findver '>=sys-libs/db-4.3')
200
201 }
202
203 src_unpack() {
204
205         unpack infra-ooo-files_${PV}.tar.gz
206         use binfilter && unpack ${SRC}_binfilter.tar.bz2
207         unpack ${SRC}_core.tar.bz2
208         unpack ${SRC}_l10n.tar.bz2
209         unpack ${SRC}_extensions.tar.bz2
210         unpack ${SRC}_system.tar.bz2
211
212 }
213
214 src_prepare() {
215
216         if use odk && use java; then
217             cp -f "${DISTDIR}"/unowinreg.dll "${WORKSRC}"/external/unowinreg/
218         fi
219
220         # Some fixes for our patchset
221         cd "${S}"
222         epatch "${FILESDIR}/${PV}/gentoo-scripts.diff"
223         # Patch for using Gentoo specific goo team patches and InfraGentoo/InfraGentooPG distro targets
224         epatch "${FILESDIR}/${PV}/gentoo-infragentoo.diff"
225
226         # Patches from go-oo mainstream
227         cp -f "${FILESDIR}/${PV}/gentoo-nojavanostax.diff" "${WORKDIR}/infra-ooo-files_${PV}/patches/dev300/nojavanostax.diff" || die
228         cp -f "${FILESDIR}/${PV}/gentoo-hunspell.diff" "${WORKDIR}/infra-ooo-files_${PV}/patches/dev300/hunspell-one-dir-nocrash.diff" || die
229         cp -f "${FILESDIR}/${PV}/gentoo-buildfix-mono-2-2.diff" "${WORKDIR}/infra-ooo-files_${PV}/patches/dev300/buildfix-mono-2-2.diff" || die
230
231         cd "${WORKSRC}"; tar xjf "${WORKDIR}/infra-ooo-files_${PV}/files/extras-templates.tar.bz2"
232         cd "${WORKSRC}"; rm -rf "extras/source/autotext/lang/ru/*" ; tar xjf "${WORKDIR}/infra-ooo-files_${PV}/files/extras_ru.tar.bz2"
233         "${WORKDIR}"/infra-ooo-files_${PV}/bin/enable-dict ru_RU "${WORKDIR}"/infra-ooo-files_${PV}/files/dict_ru_RU.tar.bz2 "${WORKSRC}"
234         "${WORKDIR}"/infra-ooo-files_${PV}/bin/enable-dict uk_UA "${WORKDIR}"/infra-ooo-files_${PV}/files/dict_uk_UA.tar.bz2 "${WORKSRC}"
235
236         # Infra branding
237         mkdir -p "${WORKSRC}"/{libwps,libwpg,libwpd,libsvg}/download/
238         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/files/libwps*.tar.gz   "${WORKSRC}"/libwps/download/
239         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/files/libwpg*.tar.gz   "${WORKSRC}"/libwpg/download/
240         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/files/libwpd*.tar.gz   "${WORKSRC}"/libwpd/download/
241         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/files/libsvg*.tar.gz   "${WORKSRC}"/libsvg/download/
242         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/files/infra-logo-team.png   "${WORKSRC}"/default_images/sw/res/
243         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/files/go-oo-team.png   "${WORKSRC}"/default_images/sw/res/
244         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/res/infra/intro.bmp    "${WORKSRC}"/ooo_custom_images/nologo/introabout/
245         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/res/infra/about.bmp    "${WORKSRC}"/default_images/introabout/
246         cp -f "${WORKDIR}"/infra-ooo-files_${PV}/res/infra/backing*.png    "${WORKSRC}"/default_images/framework/res/
247
248         local patchconf
249         local distro
250         if use postgres; then
251             distro=InfraGentooPG
252         else
253             distro=InfraGentoo
254         fi
255         patchconf="--tag=${OOOBUILDTAG} --distro=${distro} --distro=Localize"
256         if use binfilter; then
257             patchconf="${patchconf} --distro=Binfilter"
258         fi
259
260         "${WORKDIR}"/infra-ooo-files_${PV}/bin/apply.pl "${WORKDIR}"/infra-ooo-files_${PV}/patches/dev300 "${WORKSRC}" ${patchconf}
261         "${WORKDIR}"/infra-ooo-files_${PV}/bin/transform --apply "${WORKDIR}"/infra-ooo-files_${PV} "${WORKSRC}"
262
263         if use postgres; then
264             # fix using of pg lib
265             epatch "${FILESDIR}/${PV}/gentoo-configure-pg.diff"
266         fi
267         # enable/disable-gstreamer, disable scanning for rpm/dpkg and etc
268         epatch "${FILESDIR}/${PV}/gentoo-configure.diff"
269         # disable mkdepend warning
270         epatch "${FILESDIR}/${PV}/gentoo-mkdepend.diff"
271         # completion_matches -> rl_completion_matches
272         epatch "${FILESDIR}/${PV}/gentoo-completion_matches.diff"
273         # disable rpm
274         epatch "${FILESDIR}/gentoo-epm-3.7.patch.diff"
275         if use postgres; then
276             # fix handling of system libs for postgresql-base
277             epatch "${FILESDIR}/gentoo-system_pgsql.diff"
278         fi
279         # more stabillity on multiprocessing build
280         epatch "${FILESDIR}/${PV}/gentoo-vba_incl.diff"
281         cp -f "${FILESDIR}/${PV}/gentoo-ReturnInteger.hdl" "${WORKSRC}/scripting/source/vbaevents/ReturnInteger.hdl" || die
282         cp -f "${FILESDIR}/${PV}/gentoo-ReturnInteger.hpp" "${WORKSRC}/scripting/source/vbaevents/ReturnInteger.hpp" || die
283         cp -f "${FILESDIR}/${PV}/gentoo-XVBAToOOEventDescGen.hdl" "${WORKSRC}/scripting/source/vbaevents/XVBAToOOEventDescGen.hdl" || die
284         cp -f "${FILESDIR}/${PV}/gentoo-XVBAToOOEventDescGen.hpp" "${WORKSRC}/scripting/source/vbaevents/XVBAToOOEventDescGen.hpp" || die
285         # fix ru dict
286         epatch "${FILESDIR}/${PV}/gentoo-ru_dict.diff"
287
288         cd "${WORKSRC}/config_office"
289
290         eautoreconf
291
292 }
293
294 src_configure() {
295
296         # Use flag checks
297         if use java; then
298                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-ant-home=${ANT_HOME}"
299                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-jdk-home=$(java-config --jdk-home 2>/dev/null)"
300                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-java-target-version=$(java-pkg_get-target)"
301                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-system-beanshell"
302                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-system-hsqldb"
303                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-beanshell-jar=$(java-pkg_getjar bsh bsh.jar)"
304                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-hsqldb-jar=$(java-pkg_getjar hsqldb hsqldb.jar)"
305         fi
306
307         if use nsplugin ; then
308                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-mozilla"
309                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-system-mozilla=${BRWS}"
310         else
311                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-mozilla"
312                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --without-system-mozilla"
313         fi
314
315         # Handle new dicts system
316         if use oodict ; then
317             CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-myspell-dicts"
318             local tempdicts=ENUS
319             local tempdict
320             for i in ${LINGUAS_OOO}; do
321                 if [[ "${i}" != "en-US" ]]; then
322                     tempdict=$(ls ${WORKSRC}/dictionaries/ | grep ${i} | sed -e 's/_//g;s/\///g' | tr '[a-z]' '[A-Z]')
323                     tempdicts="${tempdicts},${tempdict}"
324                 fi
325             done
326             CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-dict=${tempdicts}"
327         else
328             CONFIGURE_ARGS="${CONFIGURE_ARGS} --without-myspell-dicts"
329             CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-system-dicts"
330             CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-external-dict-dir=/usr/share/myspell"
331             CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-external-hyph-dir=/usr/share/myspell"
332             CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-external-thes-dir=/usr/share/myspell"
333         fi
334
335         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable binfilter)"
336         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable cups)"
337         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable dbus)"
338         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable eds evolution2)"
339         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable gnome gnome-vfs)"
340         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable gnome lockdown)"
341         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable gstreamer)"
342         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable gtk systray)"
343         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable ldap)"
344         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable opengl)"
345         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_with ldap openldap)"
346         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable debug crashdump)"
347         CONFIGURE_ARGS="${CONFIGURE_ARGS} $(use_enable debug strip-solver)"
348
349         # Extension stuff
350         CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-extension-integration"
351         CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-minimizer"
352         CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-pdfimport"
353         CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-presenter-console"
354         CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-wiki-publisher"
355         CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-report-builder"
356
357         # Fix kdefilepicker crash on exit
358         CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-alloc=system"
359
360         # Original branding results in black splash screens for some, so forcing ours
361         CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-intro-bitmaps=\\\"${WORKSRC}/ooo_custom_images/nologo/introabout/intro.bmp\\\""
362
363         # Use multiprocessing by default now, it gets tested by upstream
364         export JOBS=$(echo "${MAKEOPTS}" | sed -e "s/.*-j\([0-9]\+\).*/\1/")
365
366         # Compile problems with these ...
367         filter-flags "-funroll-loops"
368         filter-flags "-fprefetch-loop-arrays"
369         filter-flags "-fno-default-inline"
370         filter-flags "-fstack-protector"
371         filter-flags "-fstack-protector-all"
372         filter-flags "-ftracer"
373         filter-flags "-fforce-addr"
374         replace-flags "-O?" "-O2"
375         # not very clever to disable warning, but ... users afraid it
376         append-flags "-Wno-implicit"
377         append-flags "-fno-strict-aliasing"
378
379         if [[ $(gcc-major-version) -lt 4 ]]; then
380                 replace-flags "-fomit-frame-pointer" "-momit-leaf-frame-pointer"
381         fi
382
383         # Build with NVidia cards breaks otherwise
384         use opengl && append-flags "-DGL_GLEXT_PROTOTYPES"
385
386         # Now for our optimization flags ...
387         export ARCH_FLAGS="${CXXFLAGS}"
388         use debug || export LINKFLAGSOPTIMIZE="${LDFLAGS}"
389
390         # Make sure gnome-users get gtk-support
391         local GTKFLAG="--disable-gtk --disable-cairo --without-system-cairo"
392         { use gtk || use gnome; } && GTKFLAG="--enable-gtk --enable-cairo --with-system-cairo"
393
394         use kde && set-kdedir 3
395
396         # workaround for --with-system-*
397         export PKG_CONFIG=pkg-config
398
399         cd "${WORKSRC}/config_office"
400
401         # distro-configs are not hooked in infra build, passing configure options as commandline arguments
402         ./configure \
403                 --srcdir="${DISTDIR}" \
404                 --with-lang="${LINGUAS_OOO}" \
405                 --with-build-version="${OOOTAG}" \
406                 ${GTKFLAG} \
407                 $(use_enable mono) \
408                 $(use_enable kde) \
409                 $(use_enable debug symbols) \
410                 $(use_enable odk) \
411                 $(use_enable pam) \
412                 $(use_with java) \
413                 --with-system-jpeg \
414                 --with-system-libxml \
415                 --with-system-libwpd \
416                 --with-system-hunspell \
417                 --disable-fontooo \
418                 --disable-qadevooo \
419                 --with-system-boost \
420                 --with-system-curl \
421                 --with-system-db \
422                 --with-system-expat \
423                 --with-system-icu \
424                 --with-system-libxslt \
425                 --with-system-vigra \
426                 --without-stlport \
427                 --with-system-zlib \
428                 --with-system-stdlibs \
429                 --enable-neon \
430                 --with-system-neon \
431                 --enable-xrender-link \
432                 --with-system-xrender \
433                 --with-system-openssl \
434                 --with-system-python \
435                 --with-vba-package-format=builtin \
436                 --without-gpc \
437                 --without-agg \
438                 --mandir=/usr/share/man \
439                 --libdir=/usr/$(get_libdir) \
440                 --with-use-shell=bash \
441                 --with-epm=internal \
442                 --with-linker-hash-style=both \
443                 --with-package-format=native \
444                 --with-vendor="Infra-Resource" \
445                 ${CONFIGURE_ARGS} \
446                 || die "Configuration failed!"
447
448 }
449
450 src_compile() {
451
452         cd "${WORKSRC}"
453
454         local gentoo_env_set
455         if [[ "${ARCH}" == "amd64" ]]; then
456             gentoo_env_set="${WORKSRC}/LinuxX86-64Env.Set.sh"
457         else
458             gentoo_env_set="${WORKSRC}/LinuxX86Env.Set.sh"
459         fi
460
461         source "${gentoo_env_set}"
462
463         ./bootstrap
464
465         cd transex3; build.pl --checkmodules ; build.pl -P${JOBS} --all --html --dontgraboutput -- -P${JOBS} && deliver.pl
466
467         cd "${WORKSRC}"
468
469         for i in ${LINGUAS_OOO}; do
470             if [[ "${i}" == "ru" || "${i}" == "uk" ]]; then
471                 [ -f "${WORKDIR}"/infra-ooo-files_${PV}/sdf/${i}/${i}-vendor.sdf ] && "${WORKSRC}"/transex3/scripts/localize -m -l ${i} -f "${WORKDIR}"/infra-ooo-files_${PV}/sdf/${i}/${i}-vendor.sdf
472             fi
473             if [[ "${i}" == "ru" ]]; then
474                 [ -f "${WORKDIR}"/infra-ooo-files_${PV}/sdf/${i}/${i}.sdf ] && "${WORKSRC}"/transex3/scripts/localize -m -l ${i} -f "${WORKDIR}"/infra-ooo-files_${PV}/sdf/${i}/${i}.sdf
475                 [ -f "${WORKDIR}"/infra-ooo-files_${PV}/sdf/${i}/${i}-patched.sdf ] && "${WORKSRC}"/transex3/scripts/localize -m -l ${i} -f "${WORKDIR}"/infra-ooo-files_${PV}/sdf/${i}/${i}-patched.sdf
476             fi
477         done
478
479         if [[ "${JOBS}" != "1" ]]; then
480             cd instsetoo_native ;  build.pl --checkmodules ; build.pl -P${JOBS} --all --html --dontgraboutput -- -P${JOBS} || die "Build failed"
481         else
482             dmake || die "Build failed"
483         fi
484
485 }
486
487 src_install() {
488
489         einfo "Preparing Installation ..."
490
491         local instdir="/usr/$(get_libdir)/openoffice"
492         local basecomponents="base calc draw impress math writer"
493         local allcomponents
494         local arch_var
495         local gentoo_env_set_dst
496
497         if [[ "${ARCH}" == "amd64" ]]; then
498             arch_var="x"
499             gentoo_env_set_dst="linux-2.6-x86_64"
500         else
501             arch_var="i"
502             gentoo_env_set_dst="linux-2.6-intel"
503         fi
504
505         allcomponents="${basecomponents}"
506         use cups && allcomponents="${allcomponents} printeradmin"
507         { use gtk || use gnome; } && allcomponents="${allcomponents} qstart"
508
509         dodir "${instdir}"
510
511         cp -af "${WORKSRC}"/instsetoo_native/unxlng"${arch_var}"6.pro/OpenOffice/native/install/en-US/"${gentoo_env_set_dst}"/buildroot/opt/* \
512             "${D}"${instdir}
513
514         for i in ${LINGUAS_OOO}; do
515             if [[ "${i}" != "en-US" ]]; then
516                 cp -af "${WORKSRC}"/instsetoo_native/unxlng"${arch_var}"6.pro/OpenOffice_languagepack/native/install/"${i}"/"${gentoo_env_set_dst}"/buildroot/opt/* \
517                     "${D}"${instdir}
518             fi
519         done
520
521         # dict extensions
522         if use oodict; then
523             rm -f "${D}"${instdir}/share/extension/install/dict-*.oxt
524             insinto ${instdir}/share/extension/install
525             local dictlang
526             for i in ${LINGUAS_OOO}; do
527                 if [[ "${i}" == "en-US" ]]; then
528                     dictlang=en
529                 else
530                     dictlang=${i}
531                 fi
532                 doins "${WORKSRC}"/dictionaries/unxlng"${arch_var}"6.pro/bin/dict-"${dictlang}".oxt
533             done
534         fi
535
536         # Menu entries
537         cd "${D}"${instdir}/share/xdg/
538
539         for i in ${allcomponents}; do
540                 if [[ "${i}" == "printeradmin" ]]; then
541                     sed -i -e s/openoffice.org3-/oo/g "${i}".desktop || die "Sed failed"
542                 else
543                     sed -i -e s/openoffice.org3/ooffice/g "${i}".desktop || die "Sed failed"
544                 fi
545                 domenu "${i}".desktop
546         done
547
548         # Icons
549         insinto /usr/share/icons
550         doins -r "${WORKSRC}"/sysui/desktop/icons/{hicolor,locolor}
551         ecvs_clean "${D}/usr/share/icons"
552         for color in {hicolor,locolor}; do
553             for sizes in "${D}"usr/share/icons/${color}/* ; do
554                 for i in ${allcomponents}; do
555                     [[ -f "${sizes}"/apps/"${i}".png ]] && mv "${sizes}"/apps/"${i}".png "${sizes}"/apps/openofficeorg3-"${i}".png
556                 done
557             done
558         done
559
560         # Gnome icons
561         if use gnome; then
562             mkdir -p "${D}"/usr/share/icons/gnome
563             for size in {16x16,32x32,48x48}; do
564                 if ! [[ -d "${D}"/usr/share/icons/gnome/"${size}" ]]; then
565                     mkdir -p "${D}"/usr/share/icons/gnome/"${size}"
566                     mkdir -p "${D}"/usr/share/icons/gnome/"${size}/apps"
567                 fi
568                 for i in ${allcomponents}; do
569                     dosym /usr/share/icons/hicolor/"${size}"/apps/openofficeorg3-"${i}".png /usr/share/icons/gnome/"${size}"/apps/openofficeorg3-"${i}".png
570                 done
571             done
572         fi
573
574         for i in ${allcomponents}; do
575             dosym /usr/share/icons/hicolor/48x48/apps/openofficeorg3-"${i}".png /usr/share/pixmaps/openofficeorg3-"${i}".png
576         done
577
578         # Mime types
579         insinto /usr/share/mime/packages
580         doins "${WORKSRC}"/sysui/unxlng"${arch_var}"6.pro/misc/openoffice.org/openoffice.org.xml
581
582         # Install wrapper script
583         newbin "${FILESDIR}"/wrapper.in ooffice || die
584         sed -i -e s/LIBDIR/$(get_libdir)/g "${D}"/usr/bin/ooffice || die "Wrapper script failed"
585
586         # Install PostgreSQL SDBC extension
587         if use postgres; then
588             insinto /usr/$(get_libdir)/openoffice/share/extension/install
589             doins "${WORKSRC}"/connectivity/unxlng"${arch_var}"6.pro/lib/postgresql-sdbc-0.7.6.zip
590             fperms 444 /usr/$(get_libdir)/openoffice/share/extension/install/postgresql-sdbc-0.7.6.zip
591         fi
592
593         # Component symlinks
594         for i in ${basecomponents}; do
595             dosym "${instdir}"/program/s"${i}" /usr/bin/oo"${i}"
596         done
597
598         if use cups; then
599             dosym "${instdir}"/program/spadmin /usr/bin/ooprinteradmin
600         fi
601         dosym "${instdir}"/program/soffice /usr/bin/soffice
602         dosym "${instdir}"/basis3.0/program/setofficelang /usr/bin/setofficelang
603         dosym "${instdir}"/program/unopkg  /usr/bin/unopkg
604
605         # Fix the permissions for security reasons
606 #       chown -R root:0 "${D}"
607
608         # Non-java weirdness see bug #99366
609         use !java && rm -f "${D}"${instdir}/ure/bin/javaldx
610
611         # record java libraries
612         use java && java-pkg_regjar "${D}"/usr/$(get_libdir)/openoffice/basis3.0/program/classes/*.jar
613
614         # install java-set-classpath
615         if use java; then
616             insinto /usr/$(get_libdir)/openoffice/basis3.0/program
617             newins "${FILESDIR}/java-set-classpath.in" java-set-classpath
618             fperms 755 /usr/$(get_libdir)/openoffice/basis3.0/program/java-set-classpath
619         fi
620
621 }
622
623 pkg_postinst() {
624
625         fdo-mime_desktop_database_update
626         fdo-mime_mime_database_update
627
628         [[ -x /sbin/chpax ]] && [[ -e /usr/$(get_libdir)/openoffice/program/soffice.bin ]] && chpax -zm /usr/$(get_libdir)/openoffice/program/soffice.bin
629
630         # Add available & useful jars to openoffice classpath
631         use java && /usr/$(get_libdir)/openoffice/basis3.0/program/java-set-classpath $(java-config --classpath=jdbc-mysql 2>/dev/null) >/dev/null
632
633         elog " To start OpenOffice-Infra, run:"
634         elog
635         elog " $ ooffice"
636         elog
637         elog " Also, for individual components, you can use any of:"
638         elog
639         elog " oobase, oocalc, oodraw, ooimpress, oomath or oowriter"
640         elog
641         if use !oodict; then
642             elog " Spell checking is now provided through your own myspell-ebuilds, "
643             elog " if you want to use it, please install the correct myspell package "
644             elog " according to your language needs. "
645             elog " For example, for myspell and the russian language You should do "
646             elog
647             elog " emerge -av myspell-ru "
648             elog
649             elog " If You want to use internal openoffice extensions dicts re-emerge the package with "
650             elog " USE=\"oodict\" "
651         else
652             elog " Spell checking is now provided through OO own dicts extensions, "
653             elog " please install the correct extension from /usr/$(get_libdir)/openoffice/share/extension/install/ "
654             elog " via Extension Manager according to your language needs. "
655         fi
656         elog
657         elog " Some aditional functionality can be installed via Extension Manager: "
658         elog " *) PDF Import "
659         elog " *) Presentation Console "
660         elog " *) Presentation Minimizer "
661         elog " *) Wiki Publisher "
662         elog " *) Report Builder "
663         elog
664         elog " Please use the packages provided in "
665         elog " /usr/$(get_libdir)/openoffice/share/extension/install/ "
666         elog " instead of those from the SUN extension site. "
667         if use postgres; then
668             elog
669             elog " PostgreSQL SDBC extension provided in "
670             elog " /usr/$(get_libdir)/openoffice/share/extension/install/ "
671         fi
672         elog
673
674 }
675
676 pkg_postrm() {
677
678         fdo-mime_desktop_database_update
679         fdo-mime_mime_database_update
680
681 }