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