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.

Tuesday 30 November 2010

Backing up Entire Drives with [dd]

If you want to backup a partition use, [partimage]. It is excellent, and will happily achieve the task.

If, on the other hand, you want to backup the whole disk, there does not seem to me to be an OS alternative other than [dd].

To backup the [i]nput [f]ile (because in linux EVERYTHING is a file) [dev]ice [sda] in chunks with a [s]ize of 1 [M]ega[b]yte, [|] piping all data to the [bzip2] program set at the highest encryption setting [-9] to [>] the file [disk_image.301110.img.bz2] on the share [backup/reception] on the cifs server [readynasduo.local] from a live [ubuntu] user's account (having first browsed to the CIFS share, run this command:

sudo dd if=/dev/sda bs=1M | bzip2 -9 >'/home/ubuntu/.gvfs/backup on readynasduo.local/reception/disk_image.301110.img.bz2'

LFS - Powertop & acpi

Powertop is a system which is supposed to help you save battery life on a portable PC by identifying areas to optimise. Powertop requires lspci (optional) which in turn wants 'which', so:

wget ftp://ftp.gnu.org/gnu/which/which-2.20.tar.gz
tar -xzvf which-2.20.tar.gz
cd which-2.20
./configure --prefix=/usr &&
make
make install
cd ..
rm -rvf which-2.20

wget http://www.kernel.org/pub/software/utils/pciutils/pciutils-3.1.7.tar.bz2
tar -xjvf pciutils-3.1.7.tar.bz2
cd pciutils-3.1.7
make PREFIX=/usr ZLIB=no
make PREFIX=/usr install
make PREFIX=/usr install-lib
update-pciids
cd ..
rm -rvf pciutils-3.1.7

wget http://www.lesswatts.org/projects/powertop/download/powertop-1.13.tar.gz
tar -xzvf powertop-1.13.tar.gz
cd powertop-1.13
make
make install
cd ..
rm -rvf powertop-1.13.tar.gz

Just leave it running for 5+ minutes and you will get an estimate of usage.

Another useful power tool is acpi for getting battery information, and you install as follows:

wget http://sourceforge.net/projects/acpiclient/files/acpiclient/1.5/acpi-1.5.tar.gz/download
tar -xzvf acpi-1.5.tar.gz
cd acpi-1.5
./configure --prefix=/usr
make
make install
cd ..
rm -rvf acpi-1.5

Friday 26 November 2010

Extra Openbox Menu Items

Some items to add to the Openbox menu:

Here is an entry for Firefox 4 beta:

<item label="firefox"><action name="Execute"><execute>/opt/firefox4/bin/firefox</execute></action></item>

Here is an entry to Suspend the machine to RAM. I cannot get this actual command to run, so I have to pop the command in a script and then run the script. There has to be a better way of doing this.

<item label="Suspend to RAM"><action name="Execute"><command>~/str.sh</command></action></item>

cat > ~/str.sh << "EOF"
echo mem > /sys/power/state
EOF

The next two items would be good in the system section - Powertop for useful battery information, and top for system process information.

<item label="Powertop"><action name="Execute"><command>xterm -e /usr/bin/powertop</command></action></item>

<item label="Top"><action name="Execute"><command>xterm -e /usr/bin/top -i</command></action></item>

Friday 19 November 2010

LFS - Fonts

The standard font that X comes with is, bluntly, shit. So lets install some new fonts to brighten everything up.

Firstly, setup the directory to store the downloaded files in:

mkdir /sources/fonts
cd /sources/fonts

Next download a bog standard, and nice looking, free font, Dejavu. The commands basically 1. make a folder in /usr/share/fonts 2. copies all ttf files into that directory 3. runs the program fc-cache to load the ttf files.

wget http://sourceforge.net/projects/dejavu/files/dejavu/2.32/dejavu-fonts-ttf-2.32.tar.bz2/download
tar -jxvf dejavu-fonts-ttf-2.32.tar.bz2
cd dejavu-fonts-ttf-2.32/ttf
install -v -d -m755 /usr/share/fonts/dejavu &&
install -v -m644 *.ttf /usr/share/fonts/dejavu &&
fc-cache -v /usr/share/fonts/dejavu
cd ../../
rm -rf dejavu-fonts-ttf-2.32

Next we are going to install some Microsoft fonts - which are freely licensed. To do this we are going to need a bit of software to unpack the Microsoft archive:

wget http://www.cabextract.org.uk/cabextract-1.2.tar.gz
tar -xzvf cabextract-1.2.tar.gz
cd cabextract-1.2
./configure --prefix=/usr &&
make
make install
cd ..
rm -rf cabextract-1.2

Now we need to get the fonts:

wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/andale32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/arial32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/arialb32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/comic32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/courie32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/georgi32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/impact32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/times32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/trebuc32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/verdan32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/webdin32.exe/download

We then install the fonts using a bit of a script to automate the repetitive commands. Apart from the cabextract command basically we are doing the same as the Dejavu commands above.

for msfont in andale32 arial32 arialb32 comic32 courie32 georgi32 impact32 times32 trebuc32 verdan32 webdin32
do
mkdir $msfont
cabextract $msfont.exe -d $msfont
cd $msfont
install -v -d -m755 /usr/share/fonts/$msfont
install -v -m644 *.TTF /usr/share/fonts/$msfont
install -v -m644 *.ttf /usr/share/fonts/$msfont
fc-cache -v /usr/share/fonts/$msfont
cd ..
rm -rf $msfont
done

I am not entirely sure if this last step actually does anything, but it is supposed to make a config file which anti aliases the fonts.

cat > ~/.fonts.conf << "EOF"
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="font">
   <edit name="autohint" mode="assign">
     <bool>true</bool>
   </edit>
 </match>
</fontconfig>
EOF

Friday 12 November 2010

Command Line F1 Live Timing

Live Timing is pretty much essential for any self respecting F1 fan. It lets you follow what is going on for every car, so you are not restricted to what ever the (usually braindead) director chooses to show you from time to time.

Bad news. It needs Java to work. This is unfortunate if you want it to run on an inexpensive Netbook which struggles with Java. Also, it crashes from time to time, and restarting a browser and reloading a Java page is not much fun.

Helpfully some chap has written a command line client for live timing, and you can get it here:

wget http://launchpad.net/live-f1/0.2/0.2.10/+download/live-f1-0.2.10.tar.gz

You install it as follows:

tar -xzvf live-f1-0.2.10.tar.gz
cd live-f1_0.2.10
./configure
make

The software will now be available in the [./src] directory, and you can run it by typing:

./src/live-f1

You need to set up your user/password file in [~] as follows:

cat > ~/.f1rc << "EOF"
email YOUR_EMAIL_ADDRESS
password YOUR_PASSWORD
EOF

OBVIOUSLY you change the YOUR_X bits to match your log on details from the Live Timing's website.

Friday 5 November 2010

Wireless Networking on Maverick

Once I shifted to Maverick Meercat, I found that the drivers became obstinate. Helpfully the Broadcom folks have uploaded a couple of patches which sorts this out. These are then, updated instructions on how to get the fucking thing to work.

cd /media/2G
wget http://www.broadcom.com/docs/linux_sta/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz 
wget http://www.broadcom.com/docs/linux_sta/sta_5.60.48.36_2.6.33_kernel_patch.zip
wget http://www.broadcom.com/docs/linux_sta/sta_5.60.48.36_2.6.34_multicast_kernel_patch.zip

My USB Stick is called [2G] so Ubuntu automounts it into a directory with the same name in [/media]. The next command downloads the latest version of the hybrid driver. I am not sure what a hybrid driver is, but if I had to guess I would say it is a driver AND firmware contained in the same package. Incidentally, you could just use the same URL in windows and save the file to the USB Key. You then reboot to the USB Key and run the following commands (ideally from a script):

cd /tmp
cp /cdrom/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz .
mkdir hybrid_wl 
cd hybrid_wl 
tar -xzvf ../hybrid-portsrc-x86_32-v5.60.48.36.tar.gz
unzip /cdrom/sta_5.60.48.36_2.6.33_kernel_patch.zip
patch -p0 < patch
unzip /cdrom/linux_sta/sta_5.60.48.36_2.6.34_multicast_kernel_patch.zip
patch -p0 < patch_hybrid_multicast
make clean
make
sudo rmmod b43 
sudo rmmod b44 
sudo rmmod b43legacy
sudo rmmod wl
sudo rmmod ssb 
sudo rmmod ndiswrapper 
sudo rmmod lib80211
sudo modprobe lib80211
sudo insmod wl.ko

The [cp] commands [c]o[p]ys the file we downloaded into the current [.] directory, which is [/tmp] because we just moved into it. The patch commands change the source code files in terms of the instructions contained in the special patch files.

There are lots of [r]e[m]ove [mod]ules commands, because there are so many modules which potentially interfere with the [wl] driver. Again, once this script has finished, the interface should be up and running. This one will take a little longer to run because it is building the module from source code each time.

Friday 29 October 2010

Making a Maverick Live CD

This is a simple update of my live CD instructions, but this time updated for Maverick Meercat. This time I am going to leave the original CD image on removable media to cut down the space taken up by this operation.

First of all we are going to need some extra packages for our running system to manipulate the CD image. To install these, run this command from a terminal window.

sudo aptitude install squashfs-tools genisoimage

The CD image contains one large archive file which stores all of the disk environment for the LiveCD. The squashfs-tools handles this archive. Basically, we unpack everything, add our extra packages, and then repack everything. The genisoimage [gen]erates the final [iso] [image] which we put onto the USB Key in due course.

Now, make a working directory in [~] home, and copy the image file into it:

mkdir ~/live
cd ~/live

Next we are going to actually mount the CD image so we can use it as if we had burned it to a CD and inserted it. We need to create the mount point first of all:

mkdir mnt
sudo mount -o loop /media/[whatever]/ubuntu-10.10-desktop-i386.iso mnt

The [whatever] will differ depending on exactly where your system mounts the USB Key you just plugged in. The loop [o]ption allows us to mount the image file as a folder.

Now we need to copy all of the files off the mounted image APART from the large squashed file. Again we want a separate folder to store these files:

mkdir extract-cd
rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd

Next we need to extract the big archive file:

sudo unsquashfs mnt/casper/filesystem.squashfs

It uncompresses to a folder name we want to change by the typical linux method of [m]o[v]ing it.

sudo mv squashfs-root edit

We are going to be chrooting into the filesystem we just unpacked, and we want to use some of the files on our existing machine to point the way to the internet, and to give us access to our current hardware:

sudo cp /etc/resolv.conf edit/etc/
sudo cp /etc/hosts edit/etc/
sudo mount --bind /dev/ edit/dev

Now we chroot in and mount some virtual filesystems:

sudo chroot edit
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

We also need to set some system variables and create a symbolic link for some reason or another.

export HOME=/root
export LC_ALL=C
dbus-uuidgen > /var/lib/dbus/machine-id
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl

I think the dbus command generates a code for this specific machine that some installation stuff may need. No idea what the [initctl] stuff is all about.
Excellent. We are now at the point where we can start to install stuff. First of all, and this was fucking frustrating trying to work this out, we need to enable the universe and multiverse repositories if we want to install packages from them. We need to do this in command line:

sudo nano /etc/apt/sources.list

This next command adds an external repository to the list of places we can download stuff from. It's a biggie but it basically is just a series of commands that run in sequence.

sudo wget http://www.medibuntu.org/sources.list.d/`lsb_release -cs`.list --output-document=/etc/apt/sources.list.d/medibuntu.list; sudo apt-get -q update; sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring; sudo apt-get -q update

Before installing stuff, it might be a good idea to clean out some stuff we are not going to use. First of all have a look at all the installed packages in order of size:

dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less

The first on the list looks like a massive package, but what you have to understand is that this is showing you the UNCOMPRESSED sizes. Yeah, thanks for that. If you check on http://packages.ubuntu.com/lucid for the ubuntu-docs information, you find it is only taking up a few hundred Kb when squashed.
So what can you remove? Evolution is a prime candidate. Not much use on a LiveCD. You will be using webmail from a LiveCD.

dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | grep evolution

This will show you all packages which have evolution in the title. It should look like this:

9760 evolution-common
5160 libevolution
2916 evolution-exchange
1540 evolution-data-server
1152 evolution-webcal
1076 evolution
700 evolution-plugins
368 evolution-data-server-common
128 evolution-indicator
128 evolution-couchdb

You can remove all, apart from evolution-data-server-common which is needed by other applications, by running this command:

apt-get remove --purge evolution-common libevolution evolution-exchange evolution-data-server evolution-webcal evolution evolution-plugins evolution-indicator evolution-couchdb

The language packs also take up a lot of space, and I do not need anything but English. Find these by running:

dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | grep language-

and then remove the ones we do not want:

apt-get remove --purge language-pack-gnome-xh-base language-pack-xh-base language-pack-gnome-zh-hans-base language-pack-zh-hans-base language-pack-gnome-es-base language-pack-gnome-pt-base language-pack-gnome-de-base language-pack-pt-base language-pack-es-base language-pack-de-base language-pack-gnome-bn-base language-pack-bn-base

There are other language packs, but they are to small to worry about clearing up unless you are intent on getting this image as small as possible. The final obvious low hanging fruit are foreign font sets. Do a search for [t]rue[t]ype[f]ont packages:

dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | grep ttf

12584 ttf-unfonts-core - Korean
6200 ttf-takao-pgothic - Japanese
5456 ttf-thai-tlwg - Thai
5184 ttf-wqy-microhei - Don't know for sure, better keep
4204 ttf-freefont - Latin, keep
2632 ttf-indic-fonts-core - Indian
2564 ttf-dejavu-core - Latin, keep
1724 ttf-liberation - Latin, keep
1708 ttf-opensymbol - Symbols, needed for OpenOffice, keep
592 ttf-khmeros-core Cambodian
216 ttf-punjabi-fonts - Punjabi
144 ttf-lao - Lao, where ever Lao is
116 ttf-kacst-one - Arabic

apt-get remove --purge ttf-unfonts-core ttf-takao-pgothic ttf-thai-tlwg ttf-wqy-microhei ttf-indic-fonts-core ttf-khmeros-core ttf-punjabi-fonts ttf-lao ttf-kacst-one

I am not going to be printing from the LiveCD so I can remove the software and drivers as follows. Do not worry about the ubuntu-desktop meta file - it is just an easy way of ensuring that all the ubuntu basic stuff is installed. As soon as printing is removed, the installation no longer qualifies as an ubuntu desktop but it doesn't actually remove the rest of the stuff.

apt-get remove --purge cups hplip-data

I am also going to remove rhythmbox, because it does take up a lot of space, and like evolution it is really the type of application you need to set up on an installed machine rather than running from a LiveCD.

apt-get remove --purge rhythmbox

Even after all of those deletions, once I recompressed the image I found I had saved a paltry 90Mb or so. Ho hum. Once you have carried out all the removals, a good strategy is to upgrade all your remaining packages to the latest versions. You do NOT want to upgrade the Kernel or Grub because that causes bad things to happen and will stop the Live USB stick booting. So, create the following files to 'pin' those packages to their current versions:

sudo cat > hold_back_kernel << "EOF"
Package: linux-generic linux-headers-generic linux-image-generic linux-restricted-modules-generic
Pin: version 2.6.35.22.23
Pin-Priority: 1001
EOF
sudo mv hold_back_kernel /etc/apt/preferences.d/
sudo cat > hold_back_grub << "EOF"
Package: grub-common
Pin: version 1.98+20100804-5ubuntu3
Pin-Priority: 1001
EOF
sudo mv hold_back_grub /etc/apt/preferences.d/
sudo apt-get update

You can check that the version numbers are correct (they should be for the Live CD you have downloaded) and check the system knows about the new rules by running these commands:

sudo apt-cache policy
dpkg -l linux-generic
dpkg -l grub-common

The last few lines of all of that should look like this (you can see the version numbers match up):

Pinned packages:
     linux-headers-generic -> 2.6.35.22.23
     linux-image-generic -> 2.6.35.22.23
     grub-common -> 1.98+20100804-5ubuntu3
     linux-generic -> 2.6.35.22.23
root@compaq:/# dpkg -l linux-generic
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                      Version                   Description
+++-=========================-=========================-==================================================================
ii  linux-generic             2.6.35.22.23              Complete Generic Linux kernel
root@compaq:/# dpkg -l grub-common
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                      Version                   Description
+++-=========================-=========================-==================================================================
ii  grub-common               1.98+20100804-5ubuntu3    GRand Unified Bootloader, version 2 (common files)

You should now be able to run the upgrade excluding those troublesome packages.

sudo apt-get upgrade

We can now run a massive install command to add the extra packages that we want.

sudo apt-get install \
\
build-essential linux-headers-generic libgtk2.0-dev patch bison texinfo \
\
xul-ext-adblock-plus flashplugin-installer openjdk-6-jre icedtea6-plugin \
\
openoffice.org-writer openoffice.org-java-common openoffice.org-l10n-en-gb openoffice.org-help-en-gb openoffice.org-style-human myspell-en-gb openoffice.org-hyphenation-en-us openoffice.org-thesaurus-en-us openoffice.org-java-common \
\
ttf-mscorefonts-installer \
\
smplayer vlc avidemux audacity pitivi \
\
totem totem-plugins-extra gstreamer0.10-pitfdll gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse \
\
non-free-codecs libavcodec-unstripped-52 libdvdcss2 libdvdread4 libdvdnav4 \
\
lame mjpegtools twolame mpeg2dec liba52-0.7.4-dev ffmpeg ffmpeg2theora w32codecs \
\
keepassx \
\
xchm comix ghostscript ghostscript-x gqview \
\
wine \
\
transmission \
\
f-spot dcraw gimp gimp-data-extras gimp-help-en \
\
celestia celestia-common celestia-common-nonfree stellarium googleearth-package \
\
subversion yasm \
autoconf libtool zlib1g-dev libbz2-dev intltool libglib2.0-dev \
libdbus-glib-1-dev libgtk2.0-dev libgudev-1.0-dev \
libwebkit-dev libnotify-dev libgstreamer0.10-dev \
libgstreamer-plugins-base0.10-dev \
\
monodevelop

To install Google Earth from the package downloaded above, you run:

make-googleearth-package

I also want a couple of bits of software which are not available in the repositories. The first is Handbrake which is used to auto convert between video formats, and then Truecrypt which is a handy encryption system.

The lump of packages near the end of the long list above (subversion to libgstreamer) contains the dependencies for Handbrake. Handbrake itself is installed using the svn system:

cd /tmp
svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
cd hb-trunk
./configure --launch
cd build
make install

Truecrypt is a pain in the arse since they want you to accept their stupid licence instead of just releasing under the GPL.

cd /tmp
wget http://www.truecrypt.org/download/truecrypt-7.0a-linux-x86.tar.gz
tar -xzvf truecrypt-7.0a-linux-x86.tar.gz
./truecrypt-7.0a-setup-x86

Extract the package file - it automatically stores it in /tmp. We need to extract it to /, and it auto installs to the correct folders. So:

cd /
tar -xzvf /tmp/truecrypt_7.0a_i386.tar.gz

And that is that for Truecrypt.

If you were stupid enough to upgrade the kernel package, it is extremely likely that doing a upgrade of all the packages will change the kernel version. To ensure that the new kernel is actually used, you need to go into the ...
~/live/edit/boot
...folder and copy the latest versions of the vmlinuz compressed kernel and the initrd.img files to the ...
~/live/extract-cd/casper
...folder. You then need to delete the existing initrd.lz file, and rename the initrd.img file you just copied over to replace it. Do the same with the vmlinuz files. This has NEVER worked for me so I do not upgrade the kernel package.

If you want the clock in the LiveCD machine to show the proper time, take a moment and set your time zone and keyboard for UK use:

sudo setxkbmap gb
sudo cp -v --remove-destination /usr/share/zoneinfo/Europe/London /etc/localtime

Of course, the keyboard command does not fucking work. I now have no fucking idea how to change the keyboard map from the command line. Brilliant. I mean there must be a file somewhere, anywhere, that actually stores these settings. Where? No fucking clue. Moving on:

We now need to clean up some user account stuff incase any of the installed packages made changes:

awk -F: '$3 > 999' /etc/passwd
usermod -u 500 $hit #where hit is any user ID greater than 999

Right, and we are good to do a general clean up:

apt-get clean
rm -rf /tmp/* ~/.bash_history
rm /etc/resolv.conf
rm /var/lib/dbus/machine-id
rm /sbin/initctl
dpkg-divert --rename --remove /sbin/initctl
umount /proc
umount /sys
umount /dev/pts
exit
sudo umount edit/dev

The [rm] commands obviously [r]e[m]ove stuff, and the remaining commands undo the setup commands we used to get into the [chroot] environment. Virtually every time I do this I get a fucking annoying error telling me that it can't umount these things because they are in use. Well, you know what I say to that? Hello Mr. Reboot.

Once the system has come back on, fire up a terminal and:

cd ~/live

Now, update the .manifest file which is a list of installed packages:
chmod +w extract-cd/casper/filesystem.manifest
sudo chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest
sudo cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop
sudo sed -i '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop
sudo sed -i '/casper/d' extract-cd/casper/filesystem.manifest-desktop

Now delete the existing squashed archive and replace it. Don't worry if it cannot find one, there shouldn't be one the first time you run through these instructions.
sudo rm extract-cd/casper/filesystem.squashfs
sudo mksquashfs edit extract-cd/casper/filesystem.squashfs

That last command will take most time of anything here, as it (re)compressess all the packages we want. If you are feeling particularly narcisstic you can edit the disk details (change the image name) that pop up on boot:

sudo nano extract-cd/README.diskdefines

Now we need to rebuild the md5sum check file:
cd extract-cd
sudo rm md5sum.txt
find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt

That will probably take two [sudo] password requests - one for the straight [sudo] and one for the [| sudo] piped version. Do not know why. Irritating as fuck.

And finally we need to build a new iso image:

sudo mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-10.10-desktop-i386-custom.iso .

Once you have that image you use the unetbootin software (which comes in both windows and linux flavours) to load the image onto the USB Key. You need to use version 494 at least to get it to work with Maverick. Job done.

Tuesday 26 October 2010

Hardware Fuckup 2: The Return

The fucking fucker is fucking fucked a-fucking-gain.

Turned machine off in morning, fine.

Turned machine on this evening, same fucking bastard symptoms as March. Lights come on and the fan spins for half a second then off.

Cockmaster.

The difference this time was that the machine was doing NOTHING when it seems to have failed for no reason at all. It was OFF. The power supply, at least, is untouched, and works fine in another machine.

Bawbag.

Friday 22 October 2010

LFS - Firefox 4 Beta from Source

The new version of Firefox is nearly out, and I wanted to try it with my LFS system. I figured that it should not be too different to Firefox 3.6 which I have installed. I encountered two problems when installing FF4. Firstly, for some strange reason, it can't use the libpng that I have installed. I updated libpng to the latest version, but still nada. It also needed the yasm software which is some programming language stuff.

So:
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

And then:

cd /sources/extras
wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/4.0b6/source/firefox-4.0b6.source.tar.bz2
cd /dev/shm
tar -xjvf /sources/extras/firefox-4.0b6.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="-j4"
ac_add_options --prefix=/opt/firefox4
ac_add_options --enable-optimize
ac_add_options --enable-system-cairo
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
Note - the "-j4" line. Make this j2 for a dual core, or leave it out altogether for single core. I have commented out the libpng line, because I will want it back if I ever find out what is screwed up. I have also changed the install directory so I can install it alongside FF3. Now run:
time make -f client.mk build
make -f client.mk install
cd ..
rm -rvf moz*
I think I may have found the problem with Flash 10. My system is missing some dependencies. Running [ldd] on the library reports the following as missing:
libssl3.so => not found
libsmime3.so => not found
libnss3.so => not found
libplds4.so => not found
libplc4.so => not found
libnspr4.so => not found
All of these libraries are in the Firefox folder - but are NOT available to the system as a whole. So I need to somehow tell the system it can look in the firefox folders to get these things. They way to do this is by adding the firefox path to following file:
cat >> /etc/ld.so.conf << "EOF"
# Extra Path so Firefox's libraries can be used by Flash10
/opt/firefox4/lib/firefox-4.0b6
# End of Extra Path.
EOF
OK. We now get a fucking different problem. It can't find the cURL library. Which it DOESN'T FUCKING ASK FOR when you [ldd] the fucker. OK.
wget http://curl.haxx.se/download/curl-7.20.0.tar.bz2
tar -xjvf curl-7.20.0.tar.bz2
cd curl-7.20.0
./configure --prefix=/usr
make $CORES_TO_USE
Holy fuck the [make check] is the best I have ever seen! It gives you an actual ETA of how long the test is going to take to run! It is awesome. And then it ruins everything by not giving you a final report. Bastard.
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
And, finally, the fucker works. You just install Flashplayer 10 using the following instructions:
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 /opt/firefox4/lib/firefox-4.0b6/plugins
cp -v libflashplayer.so /opt/firefox4/lib/firefox-4.0b6/plugins
If you have already installed Java, just link it to the new plugins directory:
ln -sv /opt/jdk/jre/lib/i386/libnpjp2.so /opt/firefox4/lib/firefox-4.0b6/plugins

Friday 15 October 2010

LAP - WHDLoad

You need lha & installer

cd ~amiga/shared
wget http://www.whdload.de/whdload/WHDLoad_usr.lha
wget http://www.aminet.net/util/boot/skick346.lha
wget http://aminet.net/util/pack/xfdmaster.lha
cp ~/amiga/roms/1.3.rom ./kick34005.A500
cp ~/amiga/roms/3.1.rom ./kick40068.A1200

lha x shared:WHDLoad_usr.lha ram:
[install to c:]
lha x shared:skick346.lha devs:
copy shared:kick34005.A500 devs:Kickstarts
copy shared:kick40068.A1200 devs:Kickstarts
lha x shared:xfdmaster.lha ram:
copy ram:xfd_User/C/xfddecrunch c:

Friday 8 October 2010

System Info from the Command Line

Bizarrely it can be a frustrating experience to get sensible information about your system from a linux machine. Fortunately, this has been sorted out in the latest versions of Ubuntu which come with the [name of app] which seems to give one a full overview of the hardware installed in the system. Ubuntu's DIsk Usage Analyser is a very useful way of finding out what is taking up space in the system.

Those graphical applications are dependency heavy though, and require you to have the whole of Gnome installed before they are prepared to work. I therefore present herein a non-exhaustive list of commands which get you to the same kind of useful information:

df -h

This gives you the total [d]isk space used and [f]ree in [h]uman readable numbers.

df -hH

This gives you the same information in marketing megabytes, not actual megabytes.

du [dir] -h

Gives you the [d]isk [u]sage of a directory and all its subdirectories individually.

du [dir] -hs

Gives you the [d]isk [u]sage of the whole directory in one number.

top -i
...brings up a fullscreen updating display of the current active processes, and general memory/swap usage.

ps -auxf | sort -nr -k 4 | head -10
...should show you the top ten processes by memory usage.

free -m
...shows you memory usage only in [m]egabytes.

sudo du --max-depth=1 --exclude=*dev* --exclude=*tmp* --exclude=*proc* | sort -n -r

This is a useful command to run from the root directory as it lists the space used by all subfolders to that directory only. It does not go below the subfolder level ([max-depth=1]). It does not work with [-h] as the sort ([| sort -n -r]) gets confused and does not deal with the M or K distinction. In other words a 20000k file is treated as larger than a 20m file. The excludes are useful because proc and dev are virtual and do not take up any space on the disk. I had tmp mounted to a ramdisk when I was doing my Amiga project, so I also wanted to exclude that.

This following does seem to do the sort better (or at all):

du -ks --exclude=*dev* --exclude=*tmp* --exclude=*proc* * | sort -nr | cut -f2 | xargs -d '\n' du -sh

I have no idea what the [cut] or [args] bits do, but they seem to sort out (ha ha) the sorting problem.

To get Battery information from the command line, you use the following two commands:

cat /proc/acpi/battery/BAT1/state
cat /proc/acpi/battery/BAT1/info

The variable here is the [BAT1] bit. Yours may be BAT0 or something else. Just check the contents of the directory and you should find something. There is a useful perl script here which extracts and displays the information produced by the preceding commands.