Showing posts with label openbox. Show all posts
Showing posts with label openbox. Show all posts

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, 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>

Tuesday, 24 August 2010

LAP - Openbox

This, I should point out, is another entirely optional step.  Feel free to skip over it if the shitieness of twm does not irritate you.

twm, which is the window manager that BLFS installs with X, is crap. It generates the crappy green title bars and the left click menu. At least it is small and works, after a fashion. There is an alternative. Actually, there are many, many alternatives, but we are just going to use one of them. Openbox looks much better, and it adds stuff like virtual desktops (CTRL + ALT + left/right arrows to switch desktops). The emulator, and anything else you want to run, will still work fine without Openbox, it will just look greener and crappier. The main requirement for Openbox is GTK, and we have just installed that, so Openbox itself should be a doddle.

The only dependency that we are going to install is libxml2 which is a library for accessing (or parsing) xml files.  I think, although I am far from certain, that Openbox stores its configuration settings in .xml files, whic essentially means that it needs to be able to read xml files to be able to work.

umount -v /media/amiga 
sudo mkdir /media/lfs 
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs 
cd /media/lfs/sources
mkdir desktop
chmod -v a+wt desktop
cd desktop 
wget http://xmlsoft.org/sources/libxml2-2.7.6.tar.gz 
wget http://openbox.org/dist/openbox/openbox-3.4.11.1.tar.gz 

Then from the Amiga Key:

cd /sources/desktop
tar -xzvf libxml2-2.7.6.tar.gz
cd libxml2-2.7.6
./configure --prefix=/usr
make $CORES_TO_USE
make $CORES_TO_USE check

Screeds and screeds of crap followed by:

Ran 0 tests, no errors 
Total 0 tests, no errors

Makes no sense whatsoever. It also complains about a missing part:

xmlconf/xmlconf.xml is missing
you need to fetch and extract the
latest XML Conformance Test Suites
http://www.w3.org/XML/Test/xmlts20080205.tar.gz
see http://www.w3.org/XML/Test/ for informations
I am ignoring that.
make install
cd ..
rm -rvf libxml2-2.7.6

Now for Openbox itself:
tar -xzvf openbox-3.4.11.1.tar.gz
cd openbox-3.4.11.1
./configure --prefix=/usr --sysconfdir=/etc --disable-startup-notification \
--disable-session-management
make $CORES_TO_USE
make install

I then replaced the existing ~/.xinitrc file with this one. Openbox's menu is accessed on a blank part of the desktop using the right mouse button.
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

A quick reboot confirmed it is working. Looks MUCH better. Now lets configure openbox so that it fits our system. First of all, Openbox had installed some default configuration files in [/etc/xdg/openbox/]. These are menu.xml which sets up the right click menu, rc.xml which sets up the actual display and operation of the windows themselves, and finally autostart.sh which runs various setup commands prior to Openbox starting. We will just leave autostart.sh and rc.xml alone, as they are doing their jobs fine.

The default menu for Openbox looks bizarre for our system. We have no GUI programs apart from E-UAE and xterm, so what's the point? We'll need to replace the menu.xml with our own version. To do that, first of all make a hidden folder in our home drive, and then copy all the default configuration files into it:

mkdir -p ~/.config/openbox
cp /etc/xdg/openbox/*.* ~/.config/openbox

Then replace the menu.xml with this one:

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>
<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"/>
<item label="E-UAE Emulator">
<action name="execute"><execute>/usr/bin/uae</execute></action>
</item>
<separator label="System" />
<menu id="system-menu"/>
<separator />
<item label="Log Out">
<action name="Exit">
<prompt>yes</prompt>
</action>
</item>
</menu>

</openbox_menu>
EOF
That all looks quite complicated, but it really isn't. It is split into two sections. The first defines the various submenus, and then the second section actually sets out the menu structure.

Because we have no GUI programs other than xterm and e-uae (which we will install shortly) we need to configure the other programs to be run through xterm. So for instance the [command] to run [alsamixer] is:

xterm -e /usr/bin/alsamixer

That tells the system to run [xterm] and [e]xecute the program [/usr/bin/alsamixer].

Now, if you log out and then back in, you should get a sensible right click menu which will load the applications that we have - either directly or through an xterm window.