Sunday, May 18, 2014

Installing Apache OpenOffice in Arch Linux

After trying and failing to get Libreoffice to work with Danish spellcheck, I gave up and decidede to install Apache OpenOffice, which by all accounts, seem like a more solid piece of software. However, this was not available in the official repositories, and I could not find any up to date, Danish versions on AUR, so I decided to give it a shot.
The only reason I've not submitted a PKGBUILD to AUR is that I can not find a direct link to the openoffice tarball. Anyway, here's how to install it:

  1. Install rpmextract ( sudo pacman -S rpmextract )
  2. Download the RPM bundle of OpenOffice for your architecture and language and extract it (tar xf Apacheblabla.tar.gz)
  3. When the bundle is unpacked you get a directory like en_US or da_DK or whichever language you downloaded.
  4. I'll use en-US as an example in the commands below, substitute as needed.
  5. Then move the RPMS directory into a newly created oooarch/src dir as shown:
    $ mkdir -p oooarch/src/
    $ mv en-US/RPMS oooarch/src
  6. Now create a new file inside oooarch called PKGBUILD, and put the following text into it:
    pkgver=4.1.1 #or something
    pkgdesc="Danish openoffice from Apache"

    build() {
  7.  Then execute:
    $ cd oooarch/src/
    $ find *.rpm -exec echo {} \; >> ../PKGBUILD
  8. Now open the PKGBUILD file again, and add the following text:
    package() {
      mv opt ${pkgdir}
Done, build and install the package:
$ makepkg
$ sudo pacman -U apache-openoffice-blablabla.tar.xz

Done, this does not include .desktop files and such, you can add these if you want, I don't care for them.
One thing that might be convenient though, is to add a symlink  /usr/bin/soffice -> /opt/openoffice4/program/soffice so that office can be started with the "soffice" command and documents opened with the "soffice" binary, this will automatically open the writer, calc, draw, applications depending on the argument file.

$ ln -s /opt/openoffice4/program/soffice  /usr/bin/soffice

That's it.