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