Friday, 3 December 2010


mkdir /sources/ooo
cd /sources/ooo

JUnit is not, as you may be forgiven for assuming, a boy band. It is, instead, a small Java application that allows various tests to be run on other Java applications (such as the one we are about to install).

unzip /sources/ooo/
cd junit4.8.1
install -v -m755 -d /usr/share/{,doc/}junit-4.8.1 &&
chown -R root:root . &&
cp -v -R junit* org  /usr/share/junit-4.8.1 &&
cp -v -R *.html *doc /usr/share/doc/junit-4.8.1
export CLASSPATH=$CLASSPATH:/usr/share/junit-4.8.1/junit-4.8.1.jar:/usr/share/junit-4.8.1
cd ..
rm -rvf junit4.8.1

Apache Ant is a Java based alternative to [make] and is going to use it to compile.

tar -jxvf /sources/ooo/apache-ant-1.8.0-src.tar.bz2
cd apache-ant-1.8.0
sed -i 's|${dist.dir}/etc|/etc/ant|'        build.xml &&
sed -i 's|/etc/ant.conf|/etc/ant/ant.conf|' src/script/ant &&
cp -v /usr/share/junit-4.8.1/junit-4.8.1.jar lib/optional/junit.jar
./ -Ddist.dir=/opt/ant-1.8.0 dist &&
ln -v -sf /etc/ant /opt/ant-1.8.0/etc &&
ln -v -sf ant-1.8.0 /opt/ant
cd ..
rm -rvf apache-ant-1.8.0

Next we come to one of my favourite ways BLFS has of fucking me off. If you look at the prerequisites for 3.2.1 in BLFS here you see Apache Ant, (good just installed that), GTK+2 (installed that ages ago), the Perl module XML::Parser (installed for Xorg), another one called Archive::Zip (right, need that), which (installed it to get lspci working with PowerTop), Zip and Unzip (both installed AGES ago).

Looks easy dunnit? Only one tiny Perl Module to install. Ah. Welcome to the wonders of Perl Module dependencies. Archive::Zip needs Compress::Zlib, which in turn needs ... ohforfuckssake. Just have a look at this:

cd /sources/ooo

Incidentally I am using the Server Beach mirror for these files, because I have had problems in the past trying to find them. They are pretty tiny, so hopefully that's OK.

tar -xzvf /sources/ooo/IO-Compress-Base-2.005.tar.gz
cd  IO-Compress-Base-2.005
perl Makefile.PL &&
make &&
make test
make install
cd ..
rm -rvf  IO-Compress-Base-2.005

tar -xzvf /sources/ooo/Compress-Raw-Bzip2-2.005.tar.gz
cd  Compress-Raw-Bzip2-2.005
perl Makefile.PL &&
make &&
make test
make install
cd ..
rm -rvf  Compress-Raw-Bzip2-2.005

tar -xzvf /sources/ooo/IO-Compress-Bzip2-2.005.tar.gz
cd  IO-Compress-Bzip2-2.005
perl Makefile.PL &&
make &&
make test
make install
cd ..
rm -rvf  IO-Compress-Bzip2-2.005

tar -xzvf /sources/ooo/Compress-Raw-Zlib-2.005.tar.gz
cd  Compress-Raw-Zlib-2.005
sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|" -e "s|INCLUDE\s*= ./zlib-src|INCLUDE    = /usr/include|" -e "s|LIB\s*= ./zlib-src|LIB        = /usr/lib|"
perl Makefile.PL &&
make &&
make test
make install
cd ..
rm -rvf  Compress-Raw-Zlib-2.005

tar -xzvf /sources/ooo/IO-Compress-Zlib-2.005.tar.gz
cd  IO-Compress-Zlib-2.005
perl Makefile.PL &&
make &&
make test
make install
cd ..
rm -rvf  IO-Compress-Zlib-2.005

tar -xzvf /sources/ooo/Compress-Zlib-2.005.tar.gz
cd  Compress-Zlib-2.005
perl Makefile.PL &&
make &&
make test
make install
cd ..
rm -rvf  Compress-Zlib-2.005

tar -xzvf /sources/ooo/Archive-Zip-1.20.tar.gz
cd  Archive-Zip-1.20
perl Makefile.PL &&
make &&
make test
make install
cd ..
rm -rf  Archive-Zip-1.20

Buggeration, we also need gperf:

tar -xzvf gperf-3.0.4.tar.gz
cd gperf-3.0.4
./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.0.4 &&
make install &&
install -m644 -v doc/gperf.{dvi,ps,pdf,txt} /usr/share/doc/gperf-3.0.4 &&
pushd /usr/share/info &&
rm -v dir &&
for FILENAME in *; do
    install-info $FILENAME dir 2>/dev/null
done &&
cd ..
rm -rvf gperf-3.0.4

And now for which you just cannot install from a ramdisk on a 32bit machine.

cd /sources/ooo
tar -xjvf OOo_3.2.1_src_system.tar.bz2
tar -xjvf OOo_3.2.1_src_core.tar.bz2
tar -xjvf OOo_3.2.1_src_extensions.tar.bz2
tar -xjvf OOo_3.2.1_src_l10n.tar.bz2
cd OOO320_m19
cp ../seamonkey-1.1.14.source.tar.bz2 moz/download/

Don't follow the instructions in BLFS, it gets the seamonkey filename wrong. Apparently OOo shits itself if you have certain environment variables set, so unset them and fire on a patch. In a rapidly developing theme the patch file name is also wrong on BLFS.

umask 0022 &&
patch -Np1 -i ../OOo_3.2.1-build_with_db5-1.patch

Now, set the configuration. I originally tried to set this with:
--with-system-libxml           \
but the system complained that:

to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt
checking which libxslt to use... external
checking for LIBXSLT... configure: error: Package requirements (libxslt) were not met:

No package 'libxslt' found

So I just did not tell OOO that I already had libxml installed to force it to use the version that it ships with in the source package.

PKG_CONFIG=/usr/bin/pkg-config ./configure \
--enable-graphite              \
--disable-lockdown             \
--disable-binfilter            \
--disable-fontooo              \
--disable-cups                 \
--enable-fontconfig            \
--disable-symbols              \
--disable-gnome-vfs            \
--disable-systray              \
--disable-odk                  \
--disable-qadevooo             \
--enable-cairo                 \
--disable-dbus                 \
--disable-gconf                \
--enable-gio                   \
--disable-pam                  \
--without-afms                 \
--without-fonts                \
--without-ppds                 \
--without-pam                  \
--with-system-stdlibs          \
--with-system-cairo            \
--with-system-expat            \
--with-system-zlib             \
--with-system-jpeg             \
--with-system-openssl          \
--with-system-python           \
--with-system-curl             \
--with-jdk-home=/opt/jdk       \
--with-java                    \
--with-ant-home=/opt/ant       \
--with-perl-home=/usr          \
--with-x                       \
--with-lang="en-GB"            \
--with-dict="en-GB"            \
--with-package-format=native   \
--with-vendor="Your name here"     \

Now compile this all with:

source &&
./bootstrap &&

Oh, joy un-fucking-bound. I got this error message (buried in a pile of crap by the way):

/shlibsign: No such file or directory

I did a google search for that and it turned up this post (albeit for someone compiling OOo on Windows). Seems there is something wrong in the Seamonkey Makefile which means it can't define its source directory properly. I did a bit more searching and found this solution.

Now that looks like the contents of a patch file to me. The important lines for this problem are the following:

-SRCDIR = $(call core_abspath,.)
 +ifeq ($(OS_TARGET), Linux)
 + SRCDIR = .

Translated into english that means [-] remove the troublesome [SRCDIR] line, and [+] replace it [if] your [TARGET] [OS] [eq]uals [Linux] with [SRCDIR = .]. The patch is for a different version of the Seamonkey source though, and I am not sure how to download or apply it from where I found it even if it was for the version I have. So, best option is to just do the proposed changes by hand. You can do this in [nano] by running the following command:

nano /sources/ooo/OOO320_m19/nss/

You then find [CTRL + W] the core_abspath line and turn it into [SRCDIR = .]. Save the file, and rerun the [make] command. But, of course, that didn't fucking work either. It was still complaining that it couldn't find some file. So I went to a new command prompt and ran the [find] command to get the absolute path to the file. I then re-ran the [nano] command to edit the Makefile and I just pasted in the full absolute path (minus the /[filename] bit at the end). And then it correctly built in:

real    930m58.090s
user    806m18.691s
sys     57m40.225s

930 MINUTES! And, it ran for a good 30-40 minutes before it crashed the first time due to the stupid path problem. So that's 960 minutes at least - a whole 16 HOURS to compile this! The sources folder (with all the working directories for the build) ended up taking up 8.8Gb of space. So no chance to compile on a ramdrive using a 32bit machine then.

Hope I got the settings right. Time to install it.

pushd instsetoo_native/unxlng?*/buildroot/opt &&
cp -r -v openoffice.org3 /opt/openoffice-3.2.1 &&
cp -r -v* /opt/openoffice-3.2.1 &&
ln -sf basis3.2 /opt/openoffice-3.2.1/basis-link &&

Ok, those commands look a bit odd. The first one [pushd] basically says "Remember where we started and move to the following directory" The one at the end, popd, says, "OK, finished now - go back to where we started. The [&&} at the end of each line tells the system to run all of the commands or none of the commands. So if one fails, or there is a mistake, it doesn't run all of them. The other commands are the usual copy and link commands we have seen before. Next up is a brief linking loop:

for appl in sbase scalc sdraw simpress smath soffice spadmin swriter
    ln -v -sf /opt/openoffice-3.2.1/program/$appl /usr/bin

That basically gives the variable [$appl] the value [sbase] then runs the [l]i[n]k command in the next line, then changes the variable to [scalc] and runs the command again, and so on.

To install some shiny icons, we run:

pushd sysui/desktop/icons &&
install -v -m755 -d /usr/share/icons/{hicolor,locolor} &&
cp -r -v hicolor/* /usr/share/icons/hicolor &&
cp -r -v locolor/* /usr/share/icons/locolor &&

That just makes a couple of directories and then populates them. Lastly, if you happen to be using .desktop files to organise your menu systems (which may be possible with Openbox, I am not sure) then you want to install the .desktop files for OpenOffice:

install -v -d -m755 /usr/share/applications &&
pushd /opt/openoffice-3.2.1/share/xdg/ &&
for appl in *.desktop
    sed -i '/Exec/d' $appl &&
    echo "Exec=/usr/bin/s`echo $appl | sed 's/.desktop//'`" >> $appl &&
    sed -i '/Icon/d' $appl &&
    echo "Icon=`echo "ooo-${appl}3.2" | sed 's/\.desktop//'`" >> $appl
done &&
sed -i 's@bin/sprinteradmin@bin/spadmin@' printeradmin.desktop &&
cp -v *.desktop /usr/share/applications &&

That command is an amalgam of the ones we have just run. Firstly it creates a directory if it doesn't exist anyway. Then it uses pushd to save the current location and to move to another directory. In the directory it then runs a loop on every file in the new directory with a [.desktop] extension. The loop includes (aaaargh) sed commands. It looks like it is changing the default entries for [Exec] and [Icon] in the [.desktop] files. Must have a good reason for doing this. Oh! I see, the original .desktop files had an Exec line which tried to run [openoffice.org3 -writer %U] for instance. Sed replaces that with [/usr/bin/swriter] which is also the name of the link file we made above. It also tweaks the Icon line, but I know not why.

I do not get the final [sed] on the [printeradmin.desktop] file. It then just copies the files to the appropriate place. If you have installed the desktop-files-utils package (which I have not) then you can now run the following command to let it know to rebuild the menus:


We then need to install the dictionaries and any extensions we compiled (don't remember compiling any but hey ho):

cp -v dictionaries/*.oxt sdext/*.oxt reportbuilder/ swext/ /opt/openoffice-3.2.1/share/extension/install

When I ran this, it copied all the dictionaries, but could not find any other extensions. And we then need to install the extensions, which may need some manual input:

for ext in /opt/openoffice-3.2.1/share/extension/install/*.oxt
    /opt/openoffice-3.2.1/program/unopkg add --shared --verbose $ext

This gave me LOADS of dictionaries. I think I may have inadvertently installed ALL of them. I will have to look back at the [with-dict] option that I used - may have been wrong. Last step is to install a link so that you can view office documents from within Firefox:

ln -sv /opt/openoffice-3.2.1/program/ /opt/firefox4b7/lib/firefox-4.0b7/plugins

Obviously, choose the proper path for your current firefox installation.

Et, voila.

No comments:

Post a Comment