Log in

tachikoma valentines

Paludis crossbuilding

Gentoo has this terrific tool named crossdev.
dtlin@burnup:~$ su -c 'emerge crossdev'
… … …
dtlin@burnup:~$ crossdev
Usage: crossdev [options] --target TARGET

    --b, --binutils ver   Specify version of binutils to use
    --g, --gcc ver        Specify version of gcc to use
    --k, --kernel ver     Specify version of kernel headers to use
    --l, --libc ver       Specify version of libc to use
    -S, --stable          Use latest stable versions as default
    -C, --clean target    Uninstall specified target
    -P, --portage opts    Options to pass to emerge (see emerge(1))
    --with[out]-headers   Build C library headers before C compiler?
Stage Options:
    -s0, --stage0         Build just binutils
    -s1, --stage1         Also build a C compiler (no libc/C++)
    -s2, --stage2         Also build kernel headers
    -s3, --stage3         Also build the C library (no C++)
    -s4, --stage4         Also build a C++ compiler [default]
Extra Fun (must be run after above stages):
    --ex-only             Skip the stage steps above
    --ex-gcc              Build extra gcc targets (gcj/ada/etc...)
    --ex-gdb              Build a cross gdb
    --ex-insight          Build a cross insight
Target (-t) takes a tuple ARCH-VENDOR-OS-LIBC; see 'crossdev -t help'
(Yes, Gentoo can be a bit too… happy with colored terminals sometimes.)

If I want a cross-compiler targeting Windows, all I have to do is ensure a valid $PORTDIR_OVERLAY in /etc/make.conf, which all developers will have already, and run crossdev -t i586-mingw32msvc. Et voilà, a i586-mingw32msvc-gcc appears!

Except it only works with Gentoo’s default package manager, Portage.  On my system, it’s been replaced by Paludis, “the other package mangler”.  And there doesn’t seem to be documentation on how to manually take advantage of the ebuilds’ cross-building features manually.  Well, I think I can remedy that.

First, set up the Paludis equivalent of $PORTDIR_OVERLAY and fill it.
dtlin@burnup:~$ su -
burnup ~ # cat >/etc/paludis/repositories/local.conf
location = /var/paludis/repositories/local
master_repository = gentoo
format = ebuild
burnup ~ # mkdir -p /var/paludis/repositories/local/profiles
burnup ~ # cd /var/paludis/repositories/local
burnup local # mkdir cross-i586-mingw32msvc
burnup local # ls -d *-* >profiles/categories
burnup local # ln -fns ../../gentoo-portage/{sys-devel/{binutils,gcc,gdb},dev-util/{mingw-runtime,w32api}} cross-i586-mingwmsvc/
Next, build the stages in order.
burnup local # echo 'cross-i586-mingw32msvc/* crosscompile_opts: headers-only' >>/etc/paludis/use.conf
burnup local # echo 'cross-i586-mingw32msvc/* -* nocxx' >>/etc/paludis/use.conf
burnup local # paludis -i cross-i586-mingw32msvc/{w32api,mingw-runtime,gcc}
burnup local # sed -i '$d' /etc/paludis/use.conf
burnup local # sed -i '$d' /etc/paludis/use.conf
burnup local # paludis -i cross-i586-mingw32msvc/{w32api,mingw-runtime,gcc}
Most targets will use linux-headers instead of w32api and glibc/dietlibc/uclibc/klibc instead of mingw-runtime, but that’s the general idea.

Ah, I forgot…
burnup local # cat >>/etc/paludis/bashrc
case "${CATEGORY}/${PN}" in
    # cross-build
        CBUILD="${CHOST}" CTARGET="${CATEGORY#cross-}"
        CBUILD="${CHOST}" CTARGET="${CATEGORY#cross-}"
        CC="${CTARGET}-gcc" CXX="${CTARGET}-g++" LD="${CTARGET}-ld"
This may be necessary after stage 2 (but will probably fail before).


http cache cleaner question

Hmm, sorry in advance (not the right place for this post).

You remarked yesterday on my blog about nicing the 'http cache cleaner' service. A few questions, if you don't mind.

When you say copy the desktop to ~/.kde[4]/share/kde4/services/http_cache_cleaner.desktop , do you mean move? If you have a local http_cache_cleaner.desktop and a system one, won’t they both be used? Or am I wrong on this asssumption?

Then you said to make modifications there and I'm not sure what this implies. The .desktop file look pretty basic, not sure just what changes I could do there.

Then you recommend nicing the service. Would I nice the .desktop file itself? I don't see the service running. Also wouldn't nicing only be good for the session? That is, wouldn't rebooting cause the effects to be lost?

Sorry for so many questions, but I agree with you that this is a much better way to do this than deleting a file.
tachikoma valentines

November 2009

Powered by LiveJournal.com