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