sabato 30 ottobre 2010

Gentoo on a macbook air 2gen + wmii on X11

Well, here we are... this is supposed to be my attempt to write down a few notes about my open-source adventures... coding stuff and much more...

I use gentoo and/or debian since 8 years ago and I'm definitely an open-source fan.

But these days I'm approaching a new problem.. bring open source into a macbook.

Since I'm not finding to much documentation about this I just want to write up a few things on how's going this experience:


Use case:
As every good g33k know mac user interface sucks 'cause we need a tiled window manager to be l33t!

Jokes apart the fact is that wmii used to be my window manager of choice for quite a while, I love, like a few others, to have a tiled window manager for doing my everyday work.

But having bought a macbook I didn't want to loose the power of OSX optimization on apple hardware, and I do also want to try how a mac user feels like..

Hence the need to install my usual developing environment into a OSX enabled mac.

Specifically I own a brand new macbook air with OSX 10.6 snow leopard

The distro:
Looking around into the www it seems that there are 3 solutions to install open-source software on osx:
  1. macports
  2. fink
  3. gentoo prefix
Since as said I'm a gentoo fan gentoo-prefix became my first choice

To install gentoo-prefix on osx you can just follow the (as-usual) great handbook


Installation is pretty straightforward and after some compilations you should have your brand new gentoo environment!

The hard part - wmii compile

As gentoo prefix is an unstable tree included wmii version is enough recent.. specifically version 3.9.2

$emerge wmii works good for dependency resolution but hangs up on the most important part... compiling wmii!

lurking around again I've found this:
wmii bugs

and the final solution seems to be alter the config.mk file
adding

SHARED = -dynamiclib
SOEXT = dylib
CFLAGS = -D_DARWIN_C_SOURCE -std=c99 -DHOST_NAME_MAX=22
INCX11 = -I/usr/X11/include -I/usr/X11/include/freetype2
LIBS += -L/usr/X11/lib -lX11 -lXrender -lxinerama -lXrandr

at the end of it..

and removing option -soname from the SHARED variable


Unfortunately I do not know how to patch the ebuild file to do it... so
my "ugly" solution is to halt the compilation with a CTRL+Z after the unpacking
and than edit the file and restore it with the old good "fg"

compiled ebuild would not install but if you take compiled files they are almost-working...

Setup Xinitrc:
Now you can just put the compiled files somewhere in your PATH and create
a .xinitrc file in your home

here's mine

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11/lib/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then

if [ -x /usr/bin/cpp ] ; then
xrdb -merge $sysresources
else
xrdb -nocpp -merge $sysresources
fi



fi

if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then

if [ -x /usr/bin/cpp ] ; then
xrdb -merge "$userresources"
else
xrdb -nocpp -merge "$userresources"
fi

fi

if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi

exec quartz-wm --only-proxy &
exec /Users/tha/Gentoo/usr/local/bin/wmii



You can find info's about how to setup a X11 window manager on OSX here:
http://www.cs.ucla.edu/~eoster/osxx11/


The end?
So here's the first part of my ugly-almost working setup...

It's not perfect. it's not elegant but it's a first step...
I wrote this just hoping to be useful to somebody as all the post I've linked here have been useful for me :)

bye

Ghedamat

UPDATE:
to make client labels work you have to set the WMII_ADDRESS variable according to current X session

example:
export WMII_ADDRESS='unix!/tmp/ns.USER.:DISPLAY/wmii'

and than launch X11.app
open /Application/Utilities/X11.app

unfortunately I still don't know how get the DISPLAY number 'cause it varies... :(

Nessun commento:

Posta un commento