Friday 31 December 2010

eBook Management on Ubuntu

sudo apt-get install calibre

Should deal with dependencies, but will install an OOD version. So then:

sudo python -c "import urllib2; exec urllib2.urlopen('http://status.calibre-ebook.com/linux_installer').read(); main()"

To update to the latest.

Sigil for ePub editing:

wget http://sigil.googlecode.com/files/Sigil-0.3.1-Linux-x86-Setup.bin
chmod +x Sigil-0.3.1-Linux-x86-Setup.bin
sudo ./Sigil-0.3.1-Linux-x86-Setup.bin

Open the ePub file in Sigil. If it doesn't open or has an error, convert the epub to itself, which will over write the existing epub - so back up first.

Then open the folder "Styles" under the Book Browser, and open the Stylesheet.css

In the style sheet, change all margin{left,right} to 0.

Control S to save. Then exit Sigil.

Friday 24 December 2010

LFS - Openbox Configuration

I originally wrote the following before I put together the far more sensible popular dependencies post, which cut down the shit significantly. I leave this here therefore, as an example of the joys of dependency hell.

I decide I want to install the obconf program which lets me configure openbox from a gui, and obmenu which lets me configure openbox's menu from, drum roll, a gui. Shocker. So, lets start by having a look at the README in the latest version of obmenu:

REQUERIMENTS:

  python >= 2.3, pygtk, python-glade

OK, so we installed Python 2.6.4 for Firefox, so we just need the other two. Now, what about obconf. Great, there is nothing in the README file for obconf. However, if you go to the website for obconf here, you get this:

Compiling ObConf requires the following packages:

    GTK+ 2.x library and headers (development package)
    Glade 2.x library and headers (development package)
    Openbox 3.4 or above (the libraries development package if it is separate)

So, we have GTK and Openbox (it take a special kind of mind to decide to point out that the configuration software for openbox needs openbox to be installed). Not sure what this Glade thing is, but it echos the python-glade package needed for obconf. A ha! It is an interface designer. Interestingly, wikipedia has in in the same category of tools as MUI for the Amiga. The glade 2.x library is presumably the libglade package referred to in BLFS. Good news is we have previously installed both of its dependencies, libxml2 and GTK+2. Now, as far as I and Google can gather there is no such fucking thing as python-glade, so I am operating on the presumption that python-glade = Glade 2.x library = libglade.

wget http://ftp.gnome.org/pub/gnome/sources/libglade/2.6/libglade-2.6.4.tar.bz2
tar -jxvf libglade-2.6.4.tar.bz2
cd libglade-2.6.4
./configure --prefix=/usr &&
make
make check

Error, error, error and then I check the page and discover that one of the tests is supposed to fail. OK, hands up that was my fault.

make install
cd ..
rm -rvf libglade-2.6.4

So that should be all the dependencies sorted out for obconf. Next is obmenu. Let's start with pygtk. Its README file says this about dependencies:

Requirements
============
  * C compiler (GCC and MSVC supported)
  * Python 2.3.5 or higher
  * PyGObject 2.12.1 or higher
  * Glib 2.8.0 or higher
  * GTK+ 2.8.0 or higher (optional) or
    GTK+ 2.10.0 or higher for 2.10 API
    GTK+ 2.12.0 or higher for 2.12 API
    GTK+ 2.14.0 or higher for 2.14 API
    GTK+ 2.16.0 or higher for 2.16 API
  * libglade 2.5.0 or higher (optional)
  * pycairo 1.0.2 or higher (optional)
  * numpy (optional)

So, we obviously have GCC, we also have Python. We also have GTK+2 higher than all version listed there, as well as GLib (remember this is G(nome)Lib not G(nu)Libc). We have just installed libglade, so we are good to go. Not going to bother with the optional stuff. Lets just do this PyGObject thingy. In turn, it requires gobject-introspection, although it doesn't tell you that in its README. gobject-introspection in turn requires libiffi, according to BLFS.

wget ftp://sourceware.org/pub/libffi/libffi-3.0.8.tar.gz
tar -xzvf libffi-3.0.8.tar.gz
cd libffi-3.0.8
./configure --prefix=/usr &&
make
make install
cd ..
rm -rvf libffi-3.0.8

Actually installing gobject-introspection was a right pain in the arse. The one with instructions in BLFS at the time of writing (0.6.14) doesn't fucking work with pygobject 2.26.0 (which is the latest available at the time of writing), so I downloaded the latest version of this. Which doesn't fucking work with my version of Glib. Ah fuck. So it turns into a guessing game to find a version of gobject-introspection which works with my glib AND pygobject. Bastard. 0.9.5 works. Oh, hang on:

subprocess.CalledProcessError: Command '['/bin/sh', '../../libtool', '--mode=link', '--tag=CC', '--silent', 'gcc', '-o', '/dev/shm/gobject-introspection-0.9.5/tests/scanner/tmp-introspect696b_W/Regress-1.0', '-L.', 'libregress.la', '../../girepository/libgirepository-1.0.la', '-pthread', '-lgio-2.0', '-lgobject-2.0', '-lgmodule-2.0', '-lgthread-2.0', '-lrt', '-lglib-2.0', '/dev/shm/gobject-introspection-0.9.5/tests/scanner/tmp-introspect696b_W/Regress-1.0.o']' returned non-zero exit status 1

No it fucking doesn't. Right. Lets try to solve this from the other direction and find the version of pygobject that will fucking work with gobject-introspection 0.6.14. By the way, what the fuck is gobject-introspection. It sounds suspiciously like an arts student's 'kooky' first album.

wget http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/0.6/gobject-introspection-0.6.14.tar.bz2
tar -xjvf gobject-introspection-0.6.14.tar.bz2
cd gobject-introspection-0.6.14
./configure --prefix=/usr --disable-tests &&
make
make check

make install
cd ..
rm -rvf gobject-introspection-0.6.14

It turns out that if you look at the publish date of 0.6.14 it is 3rd June 2010. If you then look at 2.21 of pygobject that was published on 12th July 2010. Hmmm. Probably too late. 2.20 was September 2009 so that will definitely work with 0.6.14. Good. Progress. I install 2.20.

Well it installed, but then when I came to the next step (pygtk), oh, holy fucking shitting bastard. When I then downloaded 2.22 of pygtk, its README file states, and I quote:

PyGObject 2.12.1 or higher

What do I have? I have 2.20 - look its right up there! But when ./configuring I got:

checking for PYGOBJECT... configure: error: Package requirements (pygobject-2.0 >= 2.21.3) were not met:

Cocksucker. So when it SAYS 2.12.1 or higher it actually means 2.21.3 or higher. Looks like some lazy bastard hasn't updated the README file doesn't it? After checking file dates ... if I drop back to 2.17 of pygtk that should sync with 2.20 of PyGObject that I have installed.

checking for PYGOBJECT... configure: error: Package requirements (pygobject-2.0 >= 2.16.1) were not met:

No package 'pygobject-2.0' found

Oh, jesus fuck give me strength. YES IT FUCKING IS. I try 2.21 of pygtk and I get exactly the same fucking, manifestly false, bullshit statement. Right. Lets try 2.21.3 of pygobject since pygtk seems to desire that above all other things.

checking for GLIB - version >= 2.22.4... yes (version 2.22.4)

Man, that is cutting things pretty god damned fine. And does it fucking work? Does it fuck. Right, lets try exactly 2.16.1 of pygobject.

wget http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.16/pygobject-2.16.1.tar.bz2
tar -xjvf pygobject-2.16.1.tar.bz2
cd pygobject-2.16.1
./configure --prefix=/usr
make
make install
cd ..
rm -rvf pygobject-2.16.1

Now for pygtk 2.17 again ...

checking for PYCAIRO... no
no
not checking for gtk due to missing pycairo
checking for GDK target... x11
configure: WARNING: Could not find a valid numpy installation, disabling.
checking whether gcc understands -Wall... yes
checking whether gcc understands -fno-strict-aliasing... yes
checking whether gcc understands -std=c9x... yes
configure: error: conditional "HAVE_GTK_2_16" was never defined.
Usually this means the macro was only invoked conditionally.

God fucking damn cunting it. PYCAIRO is supposed to be a fucking optional package.
* pycairo 1.0.2 or higher (optional)
See - OPTIONAL. Right.

wget http://cairographics.org/releases/py2cairo-1.8.10.tar.gz
tar -xzvf py2cairo-1.8.10.tar.gz
cd pycairo-1.8.10
./configure --prefix=/usr
make
make install
cd ..
rm -rvf pycairo-1.8.10

wget http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.17/pygtk-2.17.0.tar.bz2
tar -xjvf pygtk-2.17.0.tar.bz2
cd pygtk-2.17.0
./configure --prefix=/usr
make
make install
cd ..
rm -rvf pygtk-2.17.0

Well, at fucking last. Lesson? PYCairo is NOT FUCKING OPTIONAL. Probably all the other versions of pygtk were stalling on this as well, so my install is now completely unnecessarily retarded. Bastard.

wget http://prdownloads.sourceforge.net/obmenu/obmenu-1.0.tar.gz?download
tar -xzvf obmenu-1.0.tar.gz
cd obmenu-1.0
python setup.py install
cd ..
rm -rvf obmenu-1.0

Amazingly obmenu installed and is functional after all that shite. On the other hand obconf does not fucking work because Startup Notification has not been installed - boo fucking hoo. Bastard arseholes. This wasn't mentioned anywhere in its README of course.

wget http://ftp.gnome.org/pub/gnome/sources/startup-notification/0.9/startup-notification-0.9.tar.bz2
tar -xjvf startup-notification-0.9.tar.bz2
cd startup-notification-0.9
./configure --prefix=/usr &&
make
make install &&
install -v -m644 -D doc/startup-notification.txt /usr/share/doc/startup-notification-0.9/startup-notification.txt
cd ..
rm -rvf startup-notification-0.9

wget http://openbox.org/dist/obconf/obconf-2.0.3.tar.gz
tar -xzvf obconf-2.0.3.tar.gz
cd obconf-2.0.3
./configure --prefix=/usr
make
make install
cd ..
rm -rvf obconf-2.0.3

And, fucking hell, they both now work. That was not fun.

By way of summary, the follow packages turned out to be needed:

(GTK+2, Python, libxml2)

obmenu <-- libglade
       <-- pygtk <-- pygobject <-- gobject-introspection <-- libffi
                 <-- pycairo
obconf <-- libglade
       <-- startup-notification

Friday 17 December 2010

Copy USB Install to HDD

mke2fs -jv -L lfs /dev/sda?
mkdir /media/lfs
mount /dev/sda7 /media/lfs
cd /media/amiga
sudo cp -axv . /media/lfs

sudo chroot "/media/lfs" /usr/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin CORES_TO_USE=-j2 /bin/bash --login

grub --batch < /etc/grub.conf

OR

sudo mkdir /media/root
sudo mount -t ext3 /dev/sda? /media/root
sudo mount -t proc none /media/root/proc
sudo mount -o bind /dev /media/root/dev
sudo chroot /media/root /bin/bash
sudo grub
find /boot/grub/stage1
root (hd0,Y)
setup (hd0)

Friday 10 December 2010

Updated BLFS Packages - OpenOffice.org

mkdir /sources/ooo
cd /sources/ooo
wget http://ftp.gnu.org/gnu/gperf/gperf-3.0.4.tar.gz
wget http://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_core.tar.bz2
wget http://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_system.tar.bz2
wget http://www.linuxfromscratch.org/patches/blfs/svn/OOo_3.2.1-build_with_db5-1.patch
wget ftp://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/1.1.14/seamonkey-1.1.14.source.tar.bz2
wget ftp://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_l10n.tar.bz2
wget ftp://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_extensions.tar.bz2

We need to install one dependency 'gperf':

tar -xzvf /sources/ooo/gperf-3.0.4.tar.gz
cd gperf-3.0.4
./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.0.4 &&
make
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 &&
popd
cd ..
rm -rvf gperf-3.0.4

And now for OpenOffice.org 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 &&
unset LANG LC_ALL
patch -Np1 -i ../OOo_3.2.1-build_with_db5-1.patch
autoreconf

Now, set the configuration.

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-libxml           \
--with-system-libxslt          \
--with-system-cairo            \
--with-system-expat            \
--with-system-zlib             \
--with-system-jpeg             \
--with-system-openssl          \
--with-system-python           \
--with-system-curl             \
--with-system-freetype         \
--with-jdk-home=/opt/jdk       \
--with-java                    \
--with-ant-home=/opt/ant       \
--with-perl-home=/usr          \
--with-x                       \
--with-lang="en-GB"             \
--with-dict=ENGB               \
--with-package-format=native   \
--with-vendor="Your name here"     \
--with-use-shell=bash

Now compile this all with:

source LinuxX86Env.Set.sh &&
./bootstrap &&
make $CORES_TO_USE

Then to install (several hours later):

pushd instsetoo_native/unxlng?6.pro/OpenOffice/native/install/en-US/linux-2.6-*/buildroot/opt &&
cp -r -v openoffice.org3 /opt/openoffice-3.2.1 &&
cp -r -v openoffice.org/* /opt/openoffice-3.2.1 &&
ln -sf basis3.2 /opt/openoffice-3.2.1/basis-link &&
popd

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

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 &&
popd

install -v -d -m755 /usr/share/applications &&
pushd /opt/openoffice-3.2.1/share/xdg/ &&
for appl in *.desktop
do
    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 &&
popd

update-desktop-database

cp -v dictionaries/unxlngi6.pro/bin/dict-*.oxt sdext/unxlngi6.pro/bin/*.oxt reportbuilder/unxlngi6.pro/bin/report-builder.oxt swext/unxlngi6.pro/bin/wiki-publisher.oxt /opt/openoffice-3.2.1/share/extension/install

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

ln -sv /opt/openoffice-3.2.1/program/libnpsoplugin.so ${FFPATH}/plugins

Thursday 9 December 2010

Updated BLFS Packages - Firefox

First the stand alone Firefox dependency Yasm:

cd /sources/extras
wget http://www.tortall.net/projects/yasm/releases/yasm-0.8.0.tar.gz
cd /dev/shm
tar -xzvf /sources/extras/yasm-0.8.0.tar.gz
cd yasm-0.8.0
CC="gcc -fPIC" ./configure --prefix=/usr
time make $CORES_TO_USE
make install
cd ..
rm -rvf yasm-0.8.0

Now Firefox:

cd /sources/extras
wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/4.0b7/source/firefox-4.0b7.source.tar.bz2
cd /dev/shm
tar -xjvf /sources/extras/firefox-4.0b7.source.tar.bz2
cd moz*
cat > .mozconfig << "EOF"
ac_add_options --enable-application=browser
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../firefox-build
mk_add_options MOZ_MAKE_FLAGS="-j2"
#Or -j4 or -j8 or comment the whole thing out for single core.
ac_add_options --prefix=/opt/firefox
ac_add_options --enable-optimize
ac_add_options --enable-system-cairo
ac_add_options --enable-system-sqlite
ac_add_options --enable-pango
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-jpeg
#ac_add_options --with-system-png
ac_add_options --with-pthreads
ac_add_options --with-system-zlib
ac_add_options --disable-accessibility
ac_add_options --disable-crashreporter
ac_add_options --disable-dbus
ac_add_options --disable-gnomevfs
ac_add_options --disable-necko-wifi
ac_add_options --disable-installer
ac_add_options --disable-javaxpcom
ac_add_options --disable-tests
ac_add_options --disable-updater
ac_add_options --disable-libnotify
ac_add_options --enable-official-branding
ac_add_options --enable-safe-browsing
ac_add_options --enable-strip
EOF

time make -f client.mk build
make -f client.mk install
cd ..
rm -rvf moz*

Be sure to check your install path and then change the text in the following command if needs be:

cat >> /etc/profile.d/custom_variables.sh << "EOF"
FFPATH=/opt/firefox/lib/firefox-4.0b7
EOF

source /etc/profile

cat >> /etc/ld.so.conf << "EOF"
# Extra Path so Firefox's libraries can be used by Flash10
/opt/firefox/lib/firefox-4.0b7
# End of Extra Path.
EOF

And now download and install the essential plugin flashplayer, and link the Java plugin.

wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.tar.gz
tar -xzvf install_flash_player_10_linux.tar.gz
mkdir -v ${FFPATH}/plugins
cp -v libflashplayer.so ${FFPATH}/plugins
ln -sv /opt/jdk/jre/lib/i386/libnpjp2.so ${FFPATH}/plugins

Wednesday 8 December 2010

Updated BLFS Packages - Desktop

We are using a slightly different install procedure this time. We are starting with GTK, then installing the Dependencies, and then moving on to applications. I put Openbox and Slim under that category, so here we go with the streamlined install now that the dependencies are taken care of:

cd /sources/desktop
wget http://download.berlios.de/slim/slim-1.3.2.tar.gz
wget http://openbox.org/dist/openbox/openbox-3.4.11.1.tar.gz
wget http://prdownloads.sourceforge.net/obmenu/obmenu-1.0.tar.gz
wget http://openbox.org/dist/obconf/obconf-2.0.3.tar.gz

cd /dev/shm

tar -xzvf /sources/desktop/slim-1.3.2.tar.gz 
cd slim-1.3.2 
sed -i -e "s:^MANDIR=.*:MANDIR=/usr/share/man:" -e "s:/usr/X11R6:/usr:" Makefile 
sed -i -e 's#X11R6/##g' -e 's#/usr/bin:##' -e 's/# daemon/daemon/' slim.conf
make $CORES_TO_USE 
make install 
cat >> /etc/inittab << "EOF"
x:5:respawn:/usr/bin/slim >& /dev/null 
EOF
cd .. 
rm -rf slim-1.3.2

tar -xzvf /sources/desktop/openbox-3.4.11.1.tar.gz
cd openbox-3.4.11.1
./configure --prefix=/usr --sysconfdir=/etc --disable-session-management
make $CORES_TO_USE
make install
cat > /root/.xinitrc << "EOF"
# Begin .xinitrc file
#xterm  -g 80x20+0+0   &
#xclock -g 100x100-0+0 &
exec openbox-session
EOF
cd ..
rm -rvf openbox-3.4.11.1

mkdir -p ~/.config/openbox
cp /etc/xdg/openbox/*.* ~/.config/openbox
cat > ~/.config/openbox/menu.xml << "EOF"
<?xml version="1.0" encoding="UTF-8"?>

<openbox_menu xmlns="http://openbox.org/3.4/menu">

<menu id="apps-editors-menu" label="Editors">
<item label="nano">
<action name="Execute">
<command>xterm -e /usr/bin/nano</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
</menu>

<menu id="apps-term-menu" label="Terminals">
<item label="Xterm">
<action name="Execute"><command>xterm</command></action>
</item>
</menu>

<menu id="apps-net-menu" label="Internet">
<item label="lynx">
<action name="Execute">
<command>xterm -e /usr/bin/lynx</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
</menu>

<menu id="apps-multimedia-menu" label="Multimedia">
<item label="alsamixer">
<action name="Execute">
<command>xterm -e /usr/bin/alsamixer</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
</menu>

<menu id="system-menu" label="System">
<item label="Openbox Configuration Manager">
<action name="Execute">
<command>obconf</command>
<startupnotify><enabled>yes</enabled></startupnotify>
</action>
</item>
<item label="Openbox Menu Editor">
<action name="Execute">
<execute>obmenu</execute>
</action>
</item>
<separator />
<item label="Reconfigure Openbox">
<action name="Reconfigure" />
</item>
</menu>

<menu id="root-menu" label="Openbox 3">
<separator label="Applications" />
<menu id="apps-editors-menu"/>
<menu id="apps-net-menu"/>
<menu id="apps-multimedia-menu"/>
<menu id="apps-term-menu"/>
<separator label="System" />
<menu id="system-menu"/>
<separator />
<item label="Log Out">
<action name="Exit">
<prompt>yes</prompt>
</action>
</item>
</menu>

</openbox_menu>
EOF


tar -xzvf /sources/desktop/obmenu-1.0.tar.gz
cd obmenu-1.0
python setup.py install
cd ..
rm -rvf obmenu-1.0

tar -xzvf /sources/desktop/obconf-2.0.3.tar.gz
cd obconf-2.0.3
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf obconf-2.0.3

Remember to nano both /etc/slim.conf and /etc/inittab, and to change the settings therein confirm to the instructions here.

Tuesday 7 December 2010

LFS - Popular Dependencies

I have installed a number of bits of software onto my bare LFS/X/GTK system now, and I have noticed that I have come across the same dependencies time and again. I have installed Firefox, OpenOffice and a number of smaller applications, all of which shared to an extent background software. So, for the next build, I thought it would be a good idea to stick all of that software into a blogpost so I have a record of the shared stuff, so I can install it all in a one-er and then get on with the applications themselves.

First of all, there are a few packages which crop up and I keep having to double check that I have installed them. I have, because they form part of the core system. They are:

Installed with LFS
zlib
libuuid

Installed Basics
zip
unzip
lzma
openssl

Installed with Xorg:
XML::Parser
Intltool
libpng (and yes I applied the patch to allow it to be used with Firefox)
Fontconfig
Pixman

Installed with GTK:
Cairo
Pango
PCRE
tiff
jpeg

I do not need to worry about those again, they are already installed. So what is not, and what is the best order to install these extras in? I think first of all we will install some programs that do not depend on any of the other packages we are about to dump into the system. SQLite is a database program and startup-notification makes the pointer do the hourglass thing while another program is starting up. For some programs, unbelievably this is actually a prerequisite.

I am going to stick all of these source files in a separate folder in sources - this is just to show that they are not part of the structure of LFS, and neither are they the Applications that I will end up running.

mkdir /sources/dependencies
cd /sources/dependencies
wget http://ftp.gnome.org/pub/gnome/sources/startup-notification/0.9/startup-notification-0.9.tar.bz2
wget http://sqlite.org/sqlite-amalgamation-3.7.3.tar.gz

cd /dev/shm
tar -xjvf /sources/dependencies/startup-notification-0.9.tar.bz2
cd startup-notification-0.9
./configure --prefix=/usr &&
make $CORES_TO_USE
make install &&
install -v -m644 -D doc/startup-notification.txt /usr/share/doc/startup-notification-0.9/startup-notification.txt
cd ..
rm -rvf startup-notification-0.9

tar -xzvf /sources/dependencies/sqlite-amalgamation-3.7.3.tar.gz
cd sqlite-3.7.3
CFLAGS="-g -O2 -DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_UNLOCK_NOTIFY=1" ./configure --prefix=/usr --enable-threadsafe --enable-readline --enable-dynamic-extensions &&
make $CORES_TO_USE
make install
cd ..
rm -rvf sqlite-3.7.3

Lets move on to a biggie which is the Python language. A number of applications use this, as do some of the intermediate libraries.

cd /sources/dependencies
wget http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tar.bz2
wget http://www.linuxfromscratch.org/patches/blfs/svn/Python-2.6.4-bdb_4.8-1.patch
wget http://docs.python.org/ftp/python/doc/2.6/python-2.6-docs-html.tar.bz2

cd /dev/shm
tar -xjvf /sources/dependencies/Python-2.6.4.tar.bz2
cd Python-2.6.4
sed -i "s/ndbm_libs = \[\]/ndbm_libs = ['gdbm', 'gdbm_compat']/" setup.py
patch -Np1 -i /sources/dependencies/Python-2.6.4-bdb_4.8-1.patch
./configure --prefix=/usr --enable-shared
make $CORES_TO_USE
make install
chmod -v 755 /usr/lib/libpython2.6.so.1.0
install -v -m755 -d /usr/share/doc/Python-2.6.4/html
tar --strip-components=1 --no-same-owner --no-same-permissions -C /usr/share/doc/Python-2.6.4/html -xvf /sources/dependencies/python-2.6-docs-html.tar.bz2
cat >> /etc/profile.d/35-python.sh << "EOF"
export PYTHONDOCS=/usr/share/doc/Python-2.6.4/html
EOF
cd ..
rm -rvf Python-2.6.4

Right, now it is time for some hot library action:

cd /sources/dependencies
wget http://ftp.gnome.org/pub/gnome/sources/libIDL/0.8/libIDL-0.8.14.tar.bz2
wget http://xmlsoft.org/sources/libxml2-2.7.6.tar.gz
wget http://xmlsoft.org/sources/libxslt-1.1.26.tar.gz
wget ftp://sourceware.org/pub/libffi/libffi-3.0.8.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/libglade/2.6/libglade-2.6.4.tar.bz2

cd /dev/shm
tar -xjvf /sources/dependencies/libIDL-0.8.14.tar.bz2
cd libIDL-0.8.14
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libIDL-0.8.14

tar -xzvf /sources/dependencies/libxml2-2.7.6.tar.gz
cd libxml2-2.7.6
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf libxml2-2.7.6

tar -xzvf /sources/dependencies/libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libxslt-1.1.26

tar -xzvf /sources/dependencies/libffi-3.0.8.tar.gz
cd libffi-3.0.8
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libffi-3.0.8

tar -jxvf /sources/dependencies/libglade-2.6.4.tar.bz2
cd libglade-2.6.4
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libglade-2.6.4

Still on the libraries front, we installed Glib, Cairo, Pango and GTK. Some applications need GTK to be able to speak C++ so we need to install the following crossover libraries (the libsigc++ is needed for glibmm). Note that this project has taken so long that I am now out of date with my version of glib. I had to update it before I could install glibmm. I also had to update gtk+2 and ATK, but not cairo or pango. I will write up a new GTK+2 installation post to bring the installation up to date.

cd /sources/dependencies
wget http://cairographics.org/releases/cairomm-1.6.2.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/libsigc++/2.2/libsigc++-2.2.8.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/glibmm/2.24/glibmm-2.24.2.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pangomm/2.26/pangomm-2.26.2.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/gtkmm/2.20/gtkmm-2.20.3.tar.bz2

cd /dev/shm
tar -xzvf /sources/dependencies/cairomm-1.6.2.tar.gz
cd cairomm-1.6.2
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf cairomm-1.6.2

tar -xjvf /sources/dependencies/libsigc++-2.2.8.tar.bz2
cd libsigc++-2.2.8
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libsigc++-2.2.8

tar -xjvf /sources/dependencies/glibmm-2.24.2.tar.bz2
cd glibmm-2.24.2
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf glibmm-2.24.2

tar -xjvf /sources/dependencies/pangomm-2.26.2.tar.bz2
cd pangomm-2.26.2
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf pangomm-2.26.2

tar -xjvf /sources/dependencies/gtkmm-2.20.3.tar.bz2
cd gtkmm-2.20.3
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf gtkmm-2.20.3

The next set are modules which plug in to the Python and give it access to GTK.

cd /sources/dependencies
wget http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/0.6/gobject-introspection-0.6.14.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pygobject/2.21/pygobject-2.21.3.tar.bz2
wget http://cairographics.org/releases/pycairo-1.8.8.tar.gz
wget http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.17/pygtk-2.17.0.tar.bz2
wget http://downloads.sourceforge.net/pyxml/PyXML-0.8.4.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/gtksourceview/2.10/gtksourceview-2.10.4.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pygtksourceview/2.10/pygtksourceview-2.10.1.tar.bz2

cd /dev/shm
tar -xjvf /sources/dependencies/gobject-introspection-0.6.14.tar.bz2
cd gobject-introspection-0.6.14
./configure --prefix=/usr --disable-tests &&
make $CORES_TO_USE
make install
cd ..
rm -rvf gobject-introspection-0.6.14

tar -xjvf /sources/dependencies/pygobject-2.21.3.tar.bz2
cd pygobject-2.21.3
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pygobject-2.21.3

tar -xzvf /sources/dependencies/pycairo-1.8.8.tar.gz
cd pycairo-1.8.8
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pycairo-1.8.8

tar -xjvf /sources/dependencies/pygtk-2.17.0.tar.bz2
cd pygtk-2.17.0
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pygtk-2.17.0

tar -xzvf /sources/dependencies/PyXML-0.8.4.tar.gz
cd PyXML-0.8.4
python setup.py build
python setup.py install &&
install -v -m644 doc/man/xmlproc_*.1 /usr/share/man/man1 &&
install -v -m755 -d /usr/share/doc/PyXML-0.8.4 &&
cp -v -R doc demo test /usr/share/doc/PyXML-0.8.4 &&
install -v -m644 README* /usr/share/doc/PyXML-0.8.4
cd ..
rm -rvf PyXML-0.8.4

tar -xjvf /sources/dependencies/gtksourceview-2.10.4.tar.bz2
cd gtksourceview-2.10.4
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf gtksourceview-2.10.4

tar -xjvf /sources/dependencies/pygtksourceview-2.10.1.tar.bz2
cd pygtksourceview-2.10.1
./configure --prefix=/usr --disable-docs &&
make $CORES_TO_USE
make install
cd ..
rm -rvf pygtksourceview-2.10.1

Sticking with the previous theme, we also need to install some modules for Perl:

cd /sources/dependencies
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Archive-Zip-1.20.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Base-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Raw-Bzip2-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Bzip2-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Raw-Zlib-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Zlib-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Zlib-2.005.tar.gz

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

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

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

tar -xzvf /sources/dependencies/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|" config.in
perl Makefile.PL &&
make &&
make install
cd ..
rm -rvf  Compress-Raw-Zlib-2.005

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

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

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

Now we need some applications which are regularly relied on:

cd /sources/dependencies
wget ftp://ftp.gnu.org/gnu/which/which-2.20.tar.gz
wget http://curl.haxx.se/download/curl-7.20.0.tar.bz2

cd /dev/shm
tar -xzvf /sources/dependencies/which-2.20.tar.gz
cd which-2.20
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf which-2.20

tar -xjvf /sources/dependencies/curl-7.20.0.tar.bz2
cd curl-7.20.0
./configure --prefix=/usr
make $CORES_TO_USE
make install
find docs -name "Makefile*" -o -name "*.1" -o -name "*.3" | xargs rm
install -v -d -m755 /usr/share/doc/curl-7.20.0
cp -v -R docs/* /usr/share/doc/curl-7.20.0
cd ..
rm -rvf curl-7.20.0

And some C++ stuff which I am a little in the dark about.

cd /sources/dependencies
wget http://downloads.sourceforge.net/boost/boost-jam-3.1.17.tgz
wget http://downloads.sourceforge.net/boost/boost_1_37_0.tar.bz2
cd /dev/shm
tar -xzvf /sources/dependencies/boost-jam-3.1.17.tgz
cd boost-jam-3.1.17
./build.sh
cd bin.linux* &&
cp -v bjam /usr/bin
cd ..
rm -rvf boost-jam-3.1.17

tar -xjvf /sources/dependencies/boost_1_37_0.tar.bz2
cd boost_1_37_0
./configure --prefix=/usr --with-toolset=gcc --with-bjam=/usr/bin/bjam &&
make $CORES_TO_USE
make install &&
ln -sfnv boost-1_37/boost /usr/include/boost
cd ..
rm -rvf boost_1_37_0

Some security libraries (and a stand alone SQLite database to support them:

cd /sources/dependencies
wget http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.6/src/nspr-4.8.6.tar.gz
wget http://www.linuxfromscratch.org/patches/blfs/svn/nspr-4.8.6-pkgconfig-1.patch
wget http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_4_RTM/src/nss-3.12.4.tar.gz
wget http://svn.cross-lfs.org/svn/repos/patches/nss/nss-3.12.4-fixes-1.patch
wget http://cross-lfs.org/~jciccone/nss-3.12-r5-config.in

cd /dev/shm

tar -xzvf /sources/dependencies/nspr-4.8.6.tar.gz
cd nspr-4.8.6
patch -Np1 -i /sources/dependencies/nspr-4.8.6-pkgconfig-1.patch &&
cd mozilla/nsprpub &&
./configure --prefix=/usr --with-mozilla --with-pthreads &&
make $CORES_TO_USE
make install &&
cp -v -LR dist/include/nspr /usr/include &&
rm -v -f /usr/bin/{prerr.properties,compile-et.pl}
cd ../../..
rm -rvf nspr-4.8.6

tar -xzvf /sources/dependencies/nss-3.12.4.tar.gz
cd nss-3.12.4
patch -Np0 -i /sources/dependencies/nss-3.12.4-fixes-1.patch &&
sed -i 's@\$(MKSHLIB) -o@\$(MKSHLIB) \$(LDFLAGS) -o@g' mozilla/security/coreconf/rules.mk &&
for dir in mozilla/security/{coreconf,dbm,nss}; do
  make -C $dir  BUILD_OPT=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 NSPR_INCLUDE_DIR=$(pkg-config --variable=includedir nspr) NSPR_LIB_DIR=$(pkg-config --variable=libdir nspr) FREEBL_NO_DEPEND=1 || break
done
for file in libsoftokn3.so libfreebl3.so libnss3.so libnssutil3.so libssl3.so libsmime3.so libnssckbi.so libnssdbm3.so; do
  install -m755 mozilla/dist/*.OBJ/lib/${file} /usr/lib
done
for file in libcrmf.a libnssb.a libnssckfw.a; do
  install -m644 mozilla/dist/*.OBJ/lib/${file} /usr/lib
done
for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap; do
  install -m755 mozilla/dist/*.OBJ/bin/${file} /usr/bin
done
install -m755 -d /usr/include/nss3
install -m644 mozilla/dist/public/nss/*.h /usr/include/nss3 &&
ln -sfv nss3 /usr/include/nss
cat > /usr/lib/pkgconfig/nss.pc << "EOF"
prefix=/usr
exec_prefix=/usr/bin
libdir=/usr/lib
includedir=/usr/include/nss3

Name: NSS
Description: Network Security Services
Version: 3.12.4
Requires: sqlite3 nspr >= 4.8
Libs: -L${libdir} -lssl3 -lsmime3 -lnss3 -lnssutil3
Cflags: -I${includedir}
EOF

chmod 644 /usr/lib/pkgconfig/nss.pc
ln -sfv nss.pc /usr/lib/pkgconfig/mozilla-nss.pc

install -v -m755 /sources/dependencies/nss-3.12-r5-config.in /usr/bin/nss-config &&
sed -i -e "s/@MOD_MAJOR_VERSION@/3/" -e "s/@MOD_MINOR_VERSION@/12/" -e "s/@MOD_PATCH_VERSION@/3/" -e "s/@prefix@/\/usr/" /usr/bin/nss-config

cd ..
rm -rvf nss-3.12.4

Lastly I am going to install some Java software including, stunningly, Java. Download the Java source from this link into the /sources/extras folder. Then run these commands:

cd /dev/shm
chmod +x /sources/extras/jdk-6u21-linux-i586.bin
/sources/extras/jdk-6u21-linux-i586.bin
cd jdk1.6.0_21
install -v -m755 -d /opt/jdk-6u21
mv -v * /opt/jdk-6u21
chown -v -R root:root /opt/jdk-6u21
ln -v -sf xawt/libmawt.so /opt/jdk-6u21/jre/lib/i386/
cd ..
sed -i 's@XINERAMA@FAKEEXTN@g' /opt/jdk-6u21/jre/lib/i386/xawt/libmawt.so
ln -v -nsf jdk-6u21 /opt/jdk

cat >> /etc/profile.d/30-jdk.sh << "EOF"
# Begin /etc/profile.d/30-jdk.sh

# Set JAVA_HOME directory
JAVA_HOME=/opt/jdk

# Adjust PATH
pathappend ${JAVA_HOME}/bin PATH

# Auto Java CLASSPATH
# Copy jar files to, or create symlinks in this directory
AUTO_CLASSPATH_DIR=/usr/lib/classpath
pathprepend . CLASSPATH
for dir in `find ${AUTO_CLASSPATH_DIR} -type d 2>/dev/null`; do
pathappend $dir CLASSPATH
done

export JAVA_HOME CLASSPATH
unset AUTO_CLASSPATH_DIR
unset dir

# End /etc/profile.d/30-jdk.sh
EOF

source /etc/profile

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 Apache Ant which is a Java based alternative to [make] and OpenOffice.org, amongst others, is going to use it to compile.

cd /sources/dependencies
wget http://downloads.sourceforge.net/junit/junit4.8.1.zip
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/a/apache-ant-1.8.1-src.tar.bz2

cd /dev/shm
unzip /sources/dependencies/junit4.8.1.zip
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

tar -jxvf /sources/dependencies/apache-ant-1.8.1-src.tar.bz2
cd apache-ant-1.8.1
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
./build.sh -Ddist.dir=/opt/ant-1.8.1 dist &&
ln -v -sf /etc/ant /opt/ant-1.8.1/etc &&
ln -v -sf ant-1.8.1 /opt/ant
cd ..
rm -rvf apache-ant-1.8.1

Monday 6 December 2010

Updated BLFS Packages - GTK

The reason for this update is two fold. Firstly I have nearly finished a stand alone post incorporating all the libraries, languages and programs that I found the applications I wanted to install (Firefox, OpenOffice et al) had as dependencies. If these are all installed in a one-er it makes it easier to go on and install the applications AND it makes it easier to update one post when there are version changes. Secondly, so much time had passed between my original post on GTK that that version was out of date. So, I need to bring GTK up to date. I will just be updating the All In One post, all the explanations set out in full in the main post still apply, but do not need to be rehearsed here.

So, the current installation idea is: Configuration, Toolchain, Actual Build, Hardware, Xorg, GTK, Shared Prerequisites, Desktop, and finally applications. Here is the new GTK. I had to go beyond BLFS and upgrade Glib and GTK+2 because they just did not work. In addition, Firefox in particular wanted the latest version of Cairo available, so I had to upgrade it, which meant that the Pixman version installed with Xorg was no longer good enough, so that needed updated as well. The latest version of GTK+2 wanted an updated pixbuf package, which I think used to be incorporated in GTK+2.

mkdir /sources/desktop
cd /sources/desktop
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
wget http://download.osgeo.org/libtiff/tiff-3.9.4.tar.gz
wget http://downloads.sourceforge.net/pcre/pcre-8.10.tar.bz2
wget http://cairographics.org/releases/pixman-0.21.2.tar.gz
wget http://cairographics.org/releases/cairo-1.10.0.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/glib/2.27/glib-2.27.3.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pango/1.28/pango-1.28.1.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/atk/1.30/atk-1.30.0.tar.bz2
wget http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.22/gdk-pixbuf-2.22.1.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/gtk+/2.22/gtk+-2.22.1.tar.bz2

cd /dev/shm

tar -xzvf /sources/desktop/jpegsrc.v7.tar.gz
cd jpeg-7
./configure --prefix=/usr --enable-static --enable-shared
make
make install
cd ..
rm -rf jpeg-7
ldconfig

tar -xzvf /sources/desktop/tiff-3.9.4.tar.gz
cd tiff-3.9.4
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf tiff-3.9.4

tar -xjvf /sources/desktop/pcre-8.10.tar.bz2
cd pcre-8.10
./configure --prefix=/usr --docdir=/usr/share/doc/pcre-8.10 --enable-utf8 --enable-unicode-properties --enable-pcregrep-libz --enable-pcregrep-libbz2
make $CORES_TO_USE
make install
mv -v /usr/lib/libpcre.so.* /lib/
ln -v -sf ../../lib/libpcre.so.0 /usr/lib/libpcre.so
cd ..
rm -rvf pcre-8.10

tar -xzvf /sources/desktop/pixman-0.21.2.tar.gz
cd pixman-0.21.2
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pixman-0.21.2

tar -xzvf /sources/desktop/cairo-1.10.0.tar.gz
cd cairo-1.10.0
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf cairo-1.10.0

tar -xjvf /sources/desktop/glib-2.27.3.tar.bz2
cd glib-2.27.3
./configure --prefix=/usr --with-pcre=system
make $CORES_TO_USE
make $CORES_TO_USE install
cat > /etc/profile.d/glib2-locale.sh << "EOF"
# Use the current locale charset for filenames
# in applications using GLib
export G_FILENAME_ENCODING=@locale
EOF
cd ..
rm -rvf glib-2.27.3

tar -xjvf /sources/desktop/pango-1.28.1.tar.bz2
cd pango-1.28.1
./configure --prefix=/usr --sysconfdir=/etc
make $CORES_TO_USE
make install
cd ..
rm -rvf pango-1.28.1

tar -xjvf /sources/desktop/atk-1.30.0.tar.bz2
cd atk-1.30.0
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf atk-1.30.0

tar -xjvf /sources/desktop/gdk-pixbuf-2.22.1.tar.bz2
cd gdk-pixbuf-2.22.1
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf gdk-pixbuf-2.22.1

tar -xjvf /sources/desktop/gtk+-2.22.1.tar.bz2
cd gtk+-2.22.1
./configure --prefix=/usr --sysconfdir=/etc &&
make $CORES_TO_USE
make install &&
install -v -m755 -d /usr/share/doc/gtk+-2.22.1/{faq,tutorial} &&
cp -v -R docs/faq/html/* /usr/share/doc/gtk+-2.22.1/faq &&
cp -v -R docs/tutorial/html/* /usr/share/doc/gtk+-2.22.1/tutorial &&
install -v -m644 docs/*.txt /usr/share/doc/gtk+-2.22.1
cd ..
rm -rvf gtk+-2.22.1

Version 2.22 of gtk+2 has problems with icons. In particular you need to install some icons to fill in some blanks. The easiest way to sort this is to install the gnome icon theme. We first of all need a program to make the theme names backwards compatible. Don't really know what this is about, but it also needs another XML::Type of Thing.

cd /sources/dependencies
wget http://cpan.org/authors/id/G/GR/GRANTM/XML-Simple-2.18.tar.gz
wget http://tango.freedesktop.org/releases/icon-naming-utils-0.8.90.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/gnome-icon-theme/2.30/gnome-icon-theme-2.30.3.tar.bz2

cd /dev/shm

tar -xzvf /sources/dependencies/XML-Simple-2.18.tar.gz
cd XML-Simple-2.18
perl Makefile.PL
make $CORES_TO_USE
make install
cd ..
rm -rvf XML-Simple-2.18

tar -xjvf /sources/dependencies/icon-naming-utils-0.8.90.tar.bz2
cd icon-naming-utils-0.8.90
./configure --prefix=/usr --libexecdir=/usr/lib/icon-naming-utils &&
make $CORES_TO_USE
make install
cd ..
rm -rvf icon-naming-utils-0.8.90

tar -xjvf /sources/dependencies/gnome-icon-theme-2.30.3.tar.bz2
cd gnome-icon-theme-2.30.3
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf gnome-icon-theme-2.30.3

You then need to create a configuration file for gtk to point it to the new icons we just installed.

cat > ~/.gtkrc-2.0 << "EOF"
gtk-icon-theme-name="gnome"
EOF

Friday 3 December 2010

LFS - OpenOffice.org

mkdir /sources/ooo
cd /sources/ooo
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/a/apache-ant-1.8.0-src.tar.bz2
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Archive-Zip-1.20.tar.gz
wget http://downloads.sourceforge.net/junit/junit4.8.1.zip
wget http://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_core.tar.bz2
wget http://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_system.tar.bz2
wget http://www.linuxfromscratch.org/patches/blfs/svn/OOo_3.2.1-build_with_db5-1.patch
wget ftp://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/1.1.14/seamonkey-1.1.14.source.tar.bz2
wget ftp://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_l10n.tar.bz2
wget ftp://ftp.osuosl.org/pub/openoffice/stable/3.2.1/OOo_3.2.1_src_extensions.tar.bz2

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/junit4.8.1.zip
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 OpenOffice.org 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
./build.sh -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 OpenOffice.org 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
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Base-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Raw-Bzip2-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Bzip2-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Raw-Zlib-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Zlib-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Zlib-2.005.tar.gz

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|" config.in
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:

wget http://ftp.gnu.org/gnu/gperf/gperf-3.0.4.tar.gz
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
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 &&
popd
cd ..
rm -rvf gperf-3.0.4

And now for OpenOffice.org 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 &&
unset LANG LC_ALL
patch -Np1 -i ../OOo_3.2.1-build_with_db5-1.patch
autoreconf

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"     \
--with-use-shell=bash

Now compile this all with:

source LinuxX86Env.Set.sh &&
./bootstrap &&
make $CORES_TO_USE

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/unxlngi6.pro/misc/build/mozilla/security/nss/cmd/shlibsign/Makefile

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?6.pro/OpenOffice/native/install/en-US/linux-2.6-*/buildroot/opt &&
cp -r -v openoffice.org3 /opt/openoffice-3.2.1 &&
cp -r -v openoffice.org/* /opt/openoffice-3.2.1 &&
ln -sf basis3.2 /opt/openoffice-3.2.1/basis-link &&
popd

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
do
    ln -v -sf /opt/openoffice-3.2.1/program/$appl /usr/bin
done

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 &&
popd

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
do
    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 &&
popd

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:

update-desktop-database

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

cp -v dictionaries/unxlngi6.pro/bin/dict-*.oxt sdext/unxlngi6.pro/bin/*.oxt reportbuilder/unxlngi6.pro/bin/report-builder.oxt swext/unxlngi6.pro/bin/wiki-publisher.oxt /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
do
    /opt/openoffice-3.2.1/program/unopkg add --shared --verbose $ext
done

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/libnpsoplugin.so /opt/firefox4b7/lib/firefox-4.0b7/plugins

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

Et, voila.

Wednesday 1 December 2010

AMD/ATI drivers for Radeon HD 6870 on Maverick Meertcat Live CD

That's a painful bloody title for a blog post I can tell you.
Download the installer from here to your Live USB key root directory. And make it executable:

chmod +x ati-driver-installer-10-11-x86.x86_64.run

Then reboot into the Live CD. Hit [CTRL+ALT+F1] and type the commands:


sudo /etc/init.d/gdm stop
cd /dev/shm
sudo /cdrom/ati-driver-installer-10-11-x86.x86_64.run

Answer yes to all the questions. Then run:


sudo cat > /etc/X11/xorg.conf << "EOF"
Section "Files"
 ModulePath   "/usr/lib/xorg/modules"
 ModulePath   "/usr/lib/X11/modules"
EndSection
Section "Device"
 Identifier  "ATI radeon 6870"
 Driver      "fglrx"
EndSection
EOF
To remove the "Unsupported Hardware" logo run this useful script from the Arch Wiki:
sudo cat > ./remove_logo.sh << "EOF"
DRIVER=/usr/lib/xorg/modules/drivers/fglrx_drv.so
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
 sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER
done
EOF
sudo chmod +x ./remove_logo.sh
sudo ./remove_logo.sh
and then just:
start x

Linux from Scratch - Radeon HD 6870

If one has recently purchased an AMD/ATI Radeon HD 6870, one will be pretty fucking pissed off with the lack of linux drivers for the same. However, one can do a bodge job as follows:

cd ~
wget https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/ati-driver-installer-10-11-x86.x86_64.run
chmod +x ati-driver-installer-10-11-x86.x86_64.run
cd /dev/shm
~/ati-driver-installer-10-11-x86.x86_64.run

Choose to install the driver, not build a package, and don't bother with the expert settings. Now, the problem is that the modules are installed to /usr/lib/xorg/modules and not the LFS default of /usr/lib/X11/modules. I considered farting around with symbolic links to sort everything out, but it turns out that Xorg has a brighter idea. You just add ANOTHER Modules Path to the xorg.conf that you are working with so the files section has:

ModulePath   "/usr/lib/X11/modules"
ModulePath   "/usr/lib/xorg/modules"

You then change the driver from 'intel' or 'vesa' or whatever, to 'fglrx':

Driver      "fglrx"

and bob's your proverbial mother's brother.