All 8 entries tagged Linux

View all 60 entries tagged Linux on Warwick Blogs | View entries tagged Linux at Technorati | There are no images tagged Linux on this blog

November 16, 2009

Generating Freedesktop.org spec compliant thumbnails

A lot of Linux software that needs to generate thumbnails of an image uses the freedesktop.org thumbnail specification. This is good as it means if one application has already made a thumbnail of an image then another application can make use of it rather than generating it's own. I recently found myself looking for a way to generate such thumbnails.

The impetus for this was gnome-appearance-properties. This is the application which allows you to do stuff like change your wallpaper. Sadly as the number of wallpapers available increases it's usability decreases to some extent. The reason for this is that the user interface is frozen until all the wallpaper thumbnails are displayed. This in itself isn't too bad, unless you have thousands of wallpapers, but if it's combined with a lack of pre-generated thumbnails the user interface is frozen until all the thumbnails have been generated. This is annoying because if there are few hundred wallpapers available thumbnail generation can take over thirty seconds even on a decent spec machine. Thirty seconds during which the user is left looking at an unresponsive interface. There is long standing bug report regarding this, that I can't currently locate, which makes the very sensible suggestion that the thumbnails should be loaded asynchronously. Hopefully at some point someone will implement that, but in the mean time I found myself wondering whether it was possible to script the generation of thumbnails in advance.

My first thought was ImageMagick and a bash script because I'm already familiar with those. As it turns out ImageMagick comes very, very close to being able to generate such thumbnails using the -thumbnail option. I say close, because whilst it inserts both the MTime and URI information required by the freedesktop.org spec, it generates the URI incorrectly by inserting one too many slashes at the start. It creates

$ convert /usr/share/pixmaps/backgrounds/cosmos/earthrise.jpg -thumbnail 128x foo.png
$ identify -verbose foo.png | grep Thumb::URI
Thumb::URI: file:////usr/share/pixmaps/backgrounds/cosmos/earthrise.jpg

when it needs to be

 Thumb::URI: file:///usr/share/pixmaps/backgrounds/cosmos/earthrise.jpg

At time of writing this is actually fixed, but only in the svn version. If you have 6.5.7-8 or later then you should find it generates the URI properly. If you have an older version you can create the thumbnails like this:

#!/bin/bash
# makethumb - script to generate thumbnails to freedesktop.org spec
# *** Assumes GNU coreutils. ***
file=$1
saveto=~/.thumbnails/normal
tagfile=/tmp/$(basename $0)_tags
mkdir -p $saveto
thumbname=$(echo -n file://$file | md5sum| cut -d " " -f 1);
mtime=$(date +%s -r "$file")
echo "Thumb::URI={file://${file}}" >$tagfile
echo "Thumb::MTime={${mtime}}" >>$tagfile
convert -resize 128x -strip +profile "*" $file MIFF:- | cat $tagfile - | convert MIFF:- "PNG:${saveto}/${thumbname}.png"
rm -f $tagfile
$ makethumb /usr/share/pixmaps/backgrounds/cosmos/earthrise.jpg

Generating thumbnails this way is quite slow though. Using

$ find  /usr/share/pixmaps/backgrounds/ -type f -exec ~/makethumb {} \;

332 thumbnails took around 1:15 in my tests, though obviously this will vary depending on the spec of the machine. I tried using a variant of the script which generated thumbnails for all the files in a given directory, so only invoking the script once instead of multiple times. There was no significant difference in speed between the two methods though.

So I started looking for some way to use GNOME's thumbnail generation capabilities. The only example I could find of doing this used Python GTK bindings and was incomplete. I've only ever cobbled together one python script before, (that was also to use GTK bindings), but I managed to put together this

#!/usr/bin/python
# makethumb.py - script to generate thumbnails using GTK bindings

import gnome.ui
import gnomevfs
import time
import sys
import os

file=sys.argv[1]

uri=gnomevfs.get_uri_from_local_path(file)
mime=gnomevfs.get_mime_type(file)
mtime=int(time.strftime("%s",time.localtime(os.path.getmtime(file))))
thumbFactory = gnome.ui.ThumbnailFactory(gnome.ui.THUMBNAIL_SIZE_NORMAL)
if thumbFactory.can_thumbnail(uri ,mime, 0):
thumbnail=thumbFactory.generate_thumbnail(uri, mime)
if thumbnail != None:
thumbFactory.save_thumbnail(thumbnail, uri, mtime)

Using that to generate thumbnails in the same manner shown above for the bash script was about ten seconds faster. However after some experimentation I put together this (updated 15/8/11 to include suggestions from comment 2):

#!/usr/bin/python
# makethumbs.py - generates thumbnails for all files in a directory

import gnome.ui
import gnomevfs
import time
import os

dir="/usr/share/pixmaps/backgrounds/"

thumbFactory = gnome.ui.ThumbnailFactory(gnome.ui.THUMBNAIL_SIZE_NORMAL)

for subdir, dirs, files in os.walk(dir):
for file in files:
path = os.path.join(subdir, file)
uri = gnomevfs.get_uri_from_local_path(path)
mime=gnomevfs.get_mime_type(subdir+"/"+file)
mtime = int(os.path.getmtime(path))
print uri
print mtime
if thumbFactory.can_thumbnail(uri ,mime, 0):
thumbnail=thumbFactory.generate_thumbnail(uri, mime)
if thumbnail is not None:
thumbFactory.save_thumbnail(thumbnail, uri, mtime)

I found that generates 332 thumbnails in around 9 seconds. A massive difference to repeatedly invoking the makethumb.py script. I expect there are people who could provide a detailed explanation of why it's so much faster. I am not one of them.

It's also interesting to note that I've found this script generates thumbnails around three times faster than the gnome-appearance-properties creates them. Why that is I have no idea. The thumbs that result are not identical. The thumbnails generated by the Python script have the width and height of the original image embedded in them whilst the ones generated by gnome-appearance-properties do not. The ones generated by gnome-appearance-properties have a very lightly larger file size and the Channel Statistics embedded in the thumbnails are different too. However both sets of thumbnails say they were generated by GNOME::ThumbnailFactory.

Interesting as all this is, (to me anyway if it's not to you then why did you read this far?), it's all about generating thumbnails on a per-user basis. What if it was possible to have a system wide cache of per-generated thumbnails. E.g. you install a bunch of wallpapers and along with them you can install thumbnails that will be used rather than each user generating their own. The freedesktop.org thumbnail spec does cover this. So I tried creating such thumbnails. gnome-appearance-properties ignored them. When I say ignored them, I don't mean it looked at them and didn't use them, the output of strace indicates that it doesn't even look to see they exist. Which is a shame.


February 02, 2009

zypper equivalent of yum —downloadonly

Looking at moving from yum to zypper I found myself unable to work out how to get zypper to download packages but not install them. Yum can do this with the downloadonly plugin:

yum -y update --downloadonly

According to this bug report, zypper should be able to do it but I couldn't find any explanation as to how. In the end I emailed the guy who marked that bug report as fixed and he was kind enough to reply and point me in the direction of the keep-packages option. This is a per-repo setting which means download packages are kept in cache. Knowing this a Google search took me here where it is mentioned along with the --dry-run option. So to get zypper to download updates but not install them, enable caching of packages on all repos with

zypper mr -k -all

and then use

zypper -l -y  update --dry-run




January 20, 2009

Hotspot VPN vs Asus Eee PC

Writing about web page http://go.warwick.ac.uk/wireless

I've recently got my hands on an Asus Eee PC 901. I got the version which ships with Linux (Xandros heavily modified by Asus) on it since I'm that way inclined. I found that whilst it is possible to use the pre-loaded software to connect to the University's Hotspot VPN, doing so doesn't result in connection that is actually usable.

The reason for this turns out to be because the default behaviour of the included VPN client is to re-use the IP address that the Hotspot network has assigned to the machine's wireless connection for the VPN connection. The VPN server doesn't like that.

The solution is to tweak the configuration file for the VPN connection so that it uses the IP address assigned by the VPN server. Assuming there's only one VPN connection set up on the machine then the config file is /etc/ppp/peers/vpn1 and the option noipdefault needs to be added as an extra line at the end.

There's various ways to edit the file, arguable the fastest being to tap Ctrl-Alt-T which brings up an xterm window in which you can run

$ sudo kwrite /etc/ppp/peers/vpn1

After which the last few lines of the file should look like:

/home/user> tail -5 /etc/ppp/peers/vpn1
lock
noauth
nobsdcomp
nodeflate
noipdefault

Full connection guide with screenshots and such like can be found here.


January 11, 2009

Adding wallpapers in KDE 4, the metadata.desktop file and X–KDE–PluginInfo–Name attribute

Google bait-ish title as this is something I worked out through trial and error when I couldn't find any information about it.

Whilst poking around in KDE 4 I noticed that some wallpapers are supplied in multiple resolutions. E.g.

mike@continuity:~$ rpm -ql kdebase4-wallpapers | grep Fresh
/usr/share/wallpapers/Fresh_Morning
/usr/share/wallpapers/Fresh_Morning/contents
/usr/share/wallpapers/Fresh_Morning/contents/images
/usr/share/wallpapers/Fresh_Morning/contents/images/1024x768.jpg
/usr/share/wallpapers/Fresh_Morning/contents/images/1280x1024.jpg
/usr/share/wallpapers/Fresh_Morning/contents/images/1280x800.jpg
/usr/share/wallpapers/Fresh_Morning/contents/images/1440x900.jpg
/usr/share/wallpapers/Fresh_Morning/contents/images/1600x1200.jpg
/usr/share/wallpapers/Fresh_Morning/contents/images/1920x1200.jpg
/usr/share/wallpapers/Fresh_Morning/contents/screenshot.png
/usr/share/wallpapers/Fresh_Morning/metadata.desktop

Presumably KDE 4 picks the one that's most suitable for your screen resolution.

When I put my own multiple resolution wallpaper in to /usr/share/wallpapers I found that KDE 4 did not list it in the drop down list of available wallpapers. Eventually I worked out that it wasn't showing up because the value of the X-KDE-PluginInfo-Name attribute in the metadata.desktop file has to match the name of the directory the wallpaper is in. E.g.

mike@continuity:~$ grep X-KDE-PluginInfo-Name /usr/share/wallpapers/Fresh_Morning/metadata.desktop
X-KDE-PluginInfo-Name=Fresh_Morning

Once I made them match my wallpaper appeared in the list.


November 06, 2008

The joy of shell

Writing about web page http://ask.slashdot.org/askslashdot/08/11/05/2027234.shtml

There's a discussion going on Slashdot entitled "(Useful) Stupid Unix Tricks?".  (Clicking the 'Get more comments'  button at the bottom of the page a few times makes more of the discussion visible.) I love discussions like that because I nearly always pick up something useful.

A useful trick that occured to me this morning was to combine && with a kdialog yes/no prompt:

kdialog --yesno "are you sure?" && do_stuff


Of course stuff which is really useful on one Unix-like OS is sometimes useless on another. I work on Linux, but sometimes need to do something the multi user Solaris boxes such as mimosa or primrose etc and occcasionally get tripped up by differences. Though I've found changing my shell on Solaris to bash instead of the default tcsh and adding /usr/local/gnu/bin/ to the start of my $PATH helps!


November 05, 2008

Altering AutoYaST profiles on the fly…

...or: How to have one or more variants of an AutoYaST profile without having to actually maintain them.

Say you maintain a bunch of machines running some SUSE variant, you install them using AutoYaST so they're all identical but you find that sometimes you want to install a machine in a way which is slightly different to normal. For example, you want to be able to re-install a machine whilst preserving the contents of a particular partition. This presents a problem because it means you need more than one AutoYaST profile, the one you usually use and the variant. If you change the main profile you have to make the same changes to the variant. Maintaining a variant is going to be prone to human error, forgetfulness and possibly problems could be caused by trying to use a variant which you don't realise hasn't been maintained.

Faced with such a situation myself a neat solution occurred to me. My AutoYaST profile is accessed from a web sever at time of installation, so a script on the web server can be used to manipulate the XML on the fly and serve the modified version. This way only one AutoYaST profile has to be maintained but you can can have as many variants of it as you like provided you write a script to produce that variant. E.g. This PHP:

<?php
# reads the autoinst.xml file, alters the partition config data so that
# partitions are re-used rather than created, and /local is not formatted
# then outputs the new xml.

$sourcexmlfile="autoyast.xml";

$data=simplexml_load_file($sourcexmlfile);

foreach ($data->partitioning->drive->partitions->partition as $partition) {
$partition->create="false";
if ($partition->mount=="/local") $partition->format="false";
}

header('Content-Type: text/xml');
print $data->asXML();
?>

saved as a suitably named file on the web server and it's url provided as the source of the AutoYaST profile at install time allows machines to be re-installed whilst preserving the contents of the partition that gets mounted at /local.


October 10, 2008

Viglen MPC

This is a Viglen MPC

Viglen MPC (smaller)

Take 3 CD jewel cases, put them on top of each other and it's a little bigger than that. The Viglen page doesn't mention all the specs, but it contains a 40GB 4200rpm harddisk, 512MB DDR ram and a 400Mhz AMD Geode processor. I'm not certain but I think it's this one. The info in the lshw output says "version GX2" and the Mhz and cache size match that processor. Visible on the outside there's a 10/100 Ethernet port, VGA out, headphone and mic sockets, four USB 2 ports on the front and two USB 1.1 ports on the back. There's no optical drive, no wireless and no bluetooth. All in all not impressive specs but then they sell for £99 (or maybe £80 if you listen to a podcast) and Viglen's marketing blurb claims it's power usage is so low that it costs only around £1 a year to run. I've seen these machines mentioned on a few websites recently and recalled that my team leader purchased one at some point in the not too distant past. So I tracked it down to see what it was like.

Construction and taking it apart.

Photos here.

Well there's not much too it. The case is nice and solid, metal (aluminum?), around 5mm thick, rather than plastic. This gets noticeably warm to the touch during operation, but no more than many power adapters and the like. The warmness is due at least in part to the fact that there are no fans and only one very small vent above the VGA port. The only moving part is the harddisk which means the machine is pretty much silent. You can just about hear the disk if there's no background noise and you're sitting right next to it. There's a couple of screws at one end which when undone allow you to slide the innards out. Everything is on the one board with the only two non-integrated components being the harddisk and the memory. The passively cooled processor is tucked underneath the harddisk. The ram sits in one slot on the underside of the board which is nice as it means it can be easily upgraded. (Though it's DDR which is rather expensive these days compared with the newer and faster DDR2.) There's two leds on the front, a blue one for power and a red one for the harddisk activity. These are don't-look-directly-in-to-them bright. As with Apple's Mac Mini, the small size has been partly achieved by using a separate power adaptor which is about a quarter of the size of the machine itself.

BIOS

The BIOS contains very few options. You can change the date/time and the boot device order. Network booting isn't listed as an option. There are no options regarding power management. For example it is not possible to specify what the machine does when power is restored after it's lost. If the machine loses power and then power is restored it stays turned off. Which is unfortunate because something a small machine stashed away somewhere and left unattended really needs to do is turn itself on automatically after a power cut.

Update 5/11/09: I noticed today that the machine does in fact have a network boot option, it's just disabled by default and you have to press Shift-F10 during boot, (rather than F1 which gets you in to the BIOS), to get at the configuration options to enable it. Unfortunately my joy at finding this was short lived as once enabled it completely fails to work. All I can get out of it is "PXE-E32: TFTP open timeout" whilst other machines on the same vlan happily PXE boot. The chipset is Realtek RTL8139 and Google throws up hits for other people who've also found that NICs with this chipset fail to do PXE boot whilst other machines on their network work fine. I've found references to flashing the NIC's firmware but that looks like far more effort than I'm willing to go in to right now.

Installing an OS.

The Viglen site says the machines ship with "special preinstalled version of Xubuntu Linux" but the one I have shipped with Windows XP on it. Shipping such a machine with Windows XP on it strikes me as absurd but maybe that's just me. How well XP runs on it I have no idea as the person who had the machine before me had wiped it and put Ubuntu on. They had also forgotten the password and after my first couple of attempts to reset the password were foiled by technical difficulties I won't bore you with I lost patience and decided to just wipe it. I ran in to some difficulties here as I at first went with the current version of Xubuntu, 8.04. It turns out that there is an issue with the video driver for the Geode graphics chip in the version of xorg that ships with 8.04 which is also present in the version that ships with the pre-release versions of 8.10. So I gave up on trying to get sensible video settings and went with 7.10 which I found a forum post saying worked fine with the Geode chips. 7.10 is supported until April 2009 so hopefully the video drivers will be sorted by then.

Assuming PXE boot won't work for you either, you have two choices for installing an OS: Attach a USB optical drive or use a bootable USB flash drive. Whichever you chose installation is going to be slow because the USB 2.0 ports on the front of the machine cannot be used for booting from so you're stuck using the USB 1.1 ports on the back. I chose to install from a USB flash drive because I've never done it before. I started off trying to make a bootable USB flash drive the 'manual' way with running various commands but after a few failed attempts at this I gave in and used the UNetbootin method described here to make a bootable flash drive from the Xubuntu 7.10 desktop CD. I knew I'd need to pass some options to the kernel at boot so I did the steps described to get the original Live CD boot menu. It's necessary to pass some options to the kernel when booting the Live CD else you just get a kernel panic. The magic options are acpi=pff and pnpbios=off, so at the boot: prompt you need to type live acpi=off pnpbios=off. (You need to plug the keyboard in to the other USB 1.1 port to be able to type that.) It's then just a matter of waiting for the live environment to start up and then running the graphical installer as usual. Installation took around a couple of hours so it's one of those things you need to set going then go do something else and look in on it occasionally.

The kernel options specified when booting to the Live CD environment are automatically added to the default grub entry but you'll need to manually add them for the others.

Once I'd rebooted to the installed system there were a hundred plus updates to install which took around another couple of hours (of which only a very small percentage was the download time).

Everything 'just worked' apart from some minor issues with the video. My monitor wasn't automatically detected and the correct resolution set, but I was able to specify the relevant settings using the GUI tool Xubuntu provides. The video driver was set to vesa when it should be amd so I manually edited the xorg.conf to change that. (The driver was renamed at some point so in more recent versions of xorg it's not called amd, I think it's called geode instead.)

Usage.

Well there's no getting away from it, this machine is slow. From power on to the login screen takes over two and a half minutes. Once you're logged in then performance is, well, slow. It's usable, but you do have to be patient. Web browsing with Firefox is adequate, but rendering of  pages tends to be a little reminiscent of using a 56k dial up modem in that you can watch the page be rendered a bit at a time. It struggles with pages that are Javascript heavy or which contain a lot of Flash elements. For example after entering my username and password on Google Mail it takes nearly thirty seconds to get to my inbox. I was wondering if the machine could be used to run a web browser kiosk set up but the performance is not really good enough, unless maybe you have it accessing a restricted set of pages with very little or no Javascript and no Flash elements.

When it comes to media play back it could just about cope with Weebl and Bob though with frames being dropped from the video. I tried iPlayer but it was predictably hopeless, at least for watching anything. I did manage to get it to play a TV show after dismissing multiple warnings about scripts running very slowly. Whilst the audio was OK, the video was a series of still images that changed every few seconds. It can handle the radio shows though. My one attempt at playing back a DivX encoded AVI file resulted in X restarting so I decided not to explore that futher. I have all my music CDs ripped by iTunes as 192Kbps AAC and mplayer plays these fine. So multimedia wise it's no good for video but fine for audio.

If you tell the machine to shutdown then it doesn't turn off. You have to actually press the power button to turn it off, 80s style. I'm guessing this is due to the lack of ACPI.

hddtemp reports the harddisk temperature as anywhere between 40oC and 47oC depending on whether it's been working hard and ambient room temperature.

I installed lm-sensors but it couldn't find any sensors. A few minutes on Google suggests that it might find some with some patches applied or a newer kernel (Xubuntu 7.10 uses 2.6.22) but I didn't bother to try.

Power consumption.

Viglen's marketing blurb claims it costs "around £1 a year to run". I'm assuming this figure was based on a combination of a calculation done prior to the recent double figure percentage electricity price hikes and having it turned off most of the time. If you're a member of staff or a student the University will loan you one of those nifty energy monitoring devices so you can go round your house seeing how much power everything uses. (See here for details.) I borrowed one and got readings of 3w when it's turned off, 9w when idling and 11w if I gave it a work out by chucking lots of pointless awk loops at it and some disk activity. For the sake of convenience I used a figure of 10w and after looking at my most recent electricity bill 10p per kWh. (Units over the first X per billing period were charged at ~9p each.) So, to run the box continuously for one year would cost roughly:

(10/1000)*(24*365)*0.1=£8.76

Which is not a lot, but rather a lot more than £1.

The 3w usage when it's turned off is rather surprising since I got lower readings with regular sized PCs.

Final thoughts.

If you think about this machine in terms of the amount of raw power you get for your money then it looks pretty bad. Asus have just launched their Intel Atom powered EEE Box (I've linked to a review of the box since the only product page I can find on Asus' site won't load) which has an RRP of £250 and 30 seconds on Google finds it for sale as low as £210. Now that's more than twice the cost of the Viglen, but it's way more than twice the machine. The EEE Box is arguably in a different market segment than the Viglen MPC, but I can't name anything else that is comparable to the Viglen MPC. The one thing that did come to mind is Chris May's review earlier this year of a Linksys network storage appliance which can be made to run Linux and currently sells for ~£73 on Amazon. The sort of uses Chris was talking about for that are much the same as I thought about for the Viglen. Compared to the Linksys box the Viglen looks very good, but then they are very different products. The Viglen is sold as a 'proper' computer, the Linksys is sold as a box you can plug a harddisk in to and share it on the network and making it run Linux, and not a distro you've actually heard of at that, is a hack.

If you look at the Viglen as a very small machine that uses very little power and can be tucked away and left to do tasks which don't require much in the way of processing power then it looks fairly good. You could attach a big harddisk via one of the USB 2 ports, or just swap the internal harddisk for something larger, and use it as a fileserver. A fileserver that could simultaneously run a bit torrent client or DNS server, print server or whatever such services you feel the need for on your home LAN. Or it would probably be perfectly good for hooking up to a large screen to display information in a public area.


June 17, 2008

Firefox 3, GTK and a downside of Enterprise Linux distros.

N.B. On 6/8/09 Novell updated Firefox in SLED 10 to version 3.0.12. They packaged up newer versions of GTK etc and supplied them as packages with names like firefox3-gtk2. I guess they got tired of backporting security fixes in to Firefox 2, or it became too difficult or just impossible to do anymore.


So Firefox 3 is released today. This is a Good Thing but also highlights a downside of using an 'Enterprise' Linux distro. The Linux version of Firefox has a dependency on the GTK toolkit and Firefox 3 requires GTK 2.10 or higher. If you're using a Linux distro that has an older version of GTK then Firefox pops up a message about how it needs GTK 2.10+ then exits. Given that part of the point of Enterprise distros is that they don't change things like library versions for years at a time, (thus providing a stability lacking in distros that release a new version every 6 months or so), this leaves anyone using a version of an Enterprise distro that has GTK older than 2.10 with something of a problem if they want Firefox 3. I am one such person as my main work machine runs Novell's SUSE Linux Enterprise Desktop 10, which has GTK 2.8.

There is of course a solution. (Aside from hoping that someone will release Firefox 3 packages for the version of your distro you're using, which for an Enterprise distro seems unlikley.) Get a new version of GTK and point Firefox 3 at it. Except it may not be that simple since GTK depends on various other libraries, possibly newer versions of those libraries than a distro with a version of GTK older than 2.10 includes. Anyway, this is how I got Firefox 3 running on SLED 10. It should be useful as a guide for other distros though some adaption may be required.

Install some packages

You'll need the following packages installed: openssl-devel, libjpeg-devel, libtiff-devel, libpng-devel. The versions that are included with your distro should do. The names may be slightly different if you're not using SLED 10. Debian and Ubuntu tend to use -dev rather than -devel in package names for example. There's probably other -devel packages you'll need apart from those I've listed and which I already had installed, but you'll find out if that's the case when you try and build stuff.

Download source code for GTK and dependencies.

These are the versions I used.:

Glib - http://ftp.gnome.org/pub/gnome/sources/glib/2.16/glib-2.16.3.tar.bz2
Cairo - http://www.cairographics.org/releases/cairo-1.2.6.tar.gz
Pango - http://ftp.gnome.org/pub/GNOME/sources/pango/1.20/pango-1.20.3.tar.bz2
ATK - http://ftp.gnome.org/pub/gnome/sources/atk/1.22/atk-1.22.0.tar.bz2
GTK - http://ftp.gnome.org/pub/gnome/sources/gtk+/2.12/gtk+-2.12.10.tar.bz2

I used Cairo 1.2.6 because it's new enough that Pango 1.20.3 will use it and old enough that it didn't require me to also build pixman.

Set some environment variables

I found I had to set the following environment variables to get the build to work. Note that the paths reflect where I installed the libraries so change to where ever you decide to install stuff.

$ export PKG_CONFIG_PATH=/local/opt/lib/pkgconfig:$PKG_CONFIG_PATH
$ export LD_LIBRARY_PATH=/local/opt/lib:$LD_LIBRARY_PATH
$ export PATH=/local/opt/bin:$PATH
$ export CPPFLAGS="-I/local/opt/gtk/include"
$ export LDFLAGS="-L/local/opt/gtk/lib"

Build and install

In the order they're listed above, unpack the source code, build and install. The build command is the same for all:

$ ./configure --prefix=/local/opt && make && make install

I installed the packages in to /local/opt since obviously I want to keep it all separate to the libraries that come with SLED 10, that's somewhere non-root users can write to on my machine and not doing this as root eliminates the chance of a typo overwritting already installed libaries. You may of course find some libraries don't build because you don't have some package or other installed so you may find you have to install a -devel package and try again. Edit: If something fails to configure or build then read the errors. Look at what libraries are mentioned then see if you have the -devel packages for those libraries installed. If not install them then try again. If you get an error about cups-config not being present then install the cups-devel package. Also read the comments and see if someone else had the same problem and a solution is suggested.

Make a wrapper script to run Firefox

You'll need to run Firefox via a wrapper script. This is what I use. If you're not using SLED 10 remove or alter the MOZ_PLUGIN_DIR value as appropriate. Replace /path-to-firefox/ with where you unpacked Firefox 3 and /local/opt with where ever you installed stuff.

#!/bin/bash
export LD_LIBRARY_PATH=/local/opt/lib
export MOZ_PLUGIN_PATH=/path-to-firefox/plugins:/usr/lib/browser-plugins
/path-to-firefox/firefox

Edit: I've just realised the MOZ_PLUGIN_DIR doesn't have any effect. I could have sworn that it did. Will have to look in to that.

Edit: Sorted out how to make Firefox 3 uses plugins in /usr/lib/browser-plugins and updated wrapper script.


Search this blog

Tags

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXXI