user-avatar
Today is Saturday
February 4, 2012

Category: Gentoo

January 11, 2012

Compiling firefox-9.0 on linux PPC

by Thomas Capricelli — Categories: Admin, Gentoo — Tags: , Leave a comment

The good point is that yes!, it is possible to compile firefox 8.0 or 9.0 on linux-ppc.

General point of view

The mozilla foundation has stopped supporting the PPC platform for firefox starting with version 4.0. Gentoo ebuilds, quite understandably, followed upstream by removing ppc keywords for all firefox ebuilds >=4.0.

Though… I still have this nice ibook overthere. I’m not sure what it is (ibook G3 something ?) but what is for sure is that the processor is a 32-bit PPC. I use a very convenient lightweight desktop on this, based on razor-qt and such. My main usecase for this computer is … browsing. I don’t update it very often and I still had firefox 3.x on it. I thought it was time to get something more recent.

It happens that a friend of mine had similar problems updating firefox on several Mac mini, those old ones with ppc processors too (hello Olivier :-) .

The one thing to know is that some google-related stuff in the crashreporter will NOT compile under recent gcc (we tested 4.3 and 4.6 I believe). So you have to disable the crashrepoter in order to get firefox compiling. Despite this, it should be ok, even though unsupported.

Howto for Gentoo users

First thing you need to do is to force the ppc (or ~ppc) keyword for firefox. Add this line

www-client/firefox **

into /etc/portage/package.keywords (record this path can either be a file or a directory whose files will be concatenated).

Fortunately, there’s a gentoo USE flag for the crashreporter, so you just need to disable it, by adding “-crashreporter”, either to the USE variable in /etc/make.conf, or in /etc/portage/package.use

Then be patient. Of course, on such old beasts, it will need several hours of compiling.

December 2, 2011

Celery init scripts for Gentoo

by Thomas Capricelli — Categories: Admin, Django, Gentoo3 Comments

I’m using django-celery on a project. The only difficult part was that gentoo ebuilds would not provide init scripts. It might be that some ebuilds in some obscure overlay provides those, but this was far too far away from the mainstream portage tree for me.

Yes, the documentation about celery has some scripts using supervisord, but I still like the init.d kind of scripts, so here they are.

The first one is /etc/init.d/celeryd, used for every worker.

#!/sbin/runscript
# Copyright 2011 Sylphide Consulting / Thomas Capricelli

# this file should be installed as /etc/init.d/celeryd

# doc:
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4

# configuration is taken from /etc/conf.d/celeryd
# You NEED to configure CELERYD_APP_DIR
# You MAY configure CELERYD_USER, CELERYD_GROUP, CELERYD_CONCURRENCY

depend() {
    need net

}

checkconfig() {
    if [ -z "${CELERYD_APP_DIR}" ] ; then
        eerror "Please configure /etc/conf.d/celeryd"
        return 1
    fi
}

start() {
    concurrency=${CELERYD_CONCURRENCY:-1}
    options="--workdir=${CELERYD_APP_DIR} --pidfile=/var/run/celeryd.pid --logfile=/var/log/celeryd.log --concurrency=${concurrency} --events"
    if [ -n "${CELERYD_USER}" ] ; then
        options="${options} --uid=${CELERYD_USER}"
    fi
    if [ -n "${CELERYD_GROUP}" ] ; then
        options="${options} --gid=${CELERYD_GROUP}"
    fi
    ebegin "Starting celeryd"
    start-stop-daemon \
        --chdir ${CELERYD_APP_DIR} \
        --start \
        --pidfile /var/run/celeryd.pid \
        --exec ${CELERYD_APP_DIR}/manage.py -- \
        celeryd_detach ${options}
    eend $?
}

stop() {
    ebegin "Stopping celeryd"
    start-stop-daemon --stop --pidfile=/var/run/celeryd.pid
    eend $?
}

The second one is /etc/init.d/celerybeat, for the scheduler. I’m using redis, but if you dont, just comment out the after redis line.

#!/sbin/runscript
# Copyright 2011 Sylphide Consulting / Thomas Capricelli

# this file should be installed as /etc/init.d/celerybeat

# doc:
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4

# configuration is taken from /etc/conf.d/celerybeat
# You NEED to configure CELERYBEAT_APP_DIR
# You MAY configure CELERYBEAT_USER, CELERYBEAT_GROUP

depend() {
    need net
    after redis
}

checkconfig() {
    if [ -z "${CELERYBEAT_APP_DIR}" ] ; then
        eerror "Please configure /etc/conf.d/celerybeat"
        return 1
    fi
}

start() {
    options="--workdir=${CELERYBEAT_APP_DIR} --pidfile=/var/run/celerybeat.pid --logfile=/var/log/celerybeat.log --detach"
    if [ -n "${CELERYBEAT_USER}" ] ; then
        options="${options} --uid=${CELERYBEAT_USER}"
    fi
    if [ -n "${CELERYBEAT_GROUP}" ] ; then
        options="${options} --gid=${CELERYBEAT_GROUP}"
    fi
    ebegin "Starting celerybeat"
    start-stop-daemon \
        --chdir ${CELERYBEAT_APP_DIR} \
        --start \
        --pidfile /var/run/celerybeat.pid \
        --exec ${CELERYBEAT_APP_DIR}/manage.py -- \
        celerybeat ${options}
    eend $?
}   

stop() {
    ebegin "Stopping celerybeat"
    start-stop-daemon --stop --pidfile=/var/run/celerybeat.pid
    eend $?
}

November 14, 2011

New lightweight admin-oriented linux kernel mercurial mirror

by Thomas Capricelli — Categories: Admin, Gentoo, Linux kernel — Tags: Leave a comment

On most servers I’m responsible for, I use to compile my own kernels. Instead of downloading/applying patches, which is cumbersome, I was using the (now broken) mercurial mirror http://www.kernel.org/hg/linux-2.6
It was great as i just had to do something like “hg pull -u; hg up -r v2.6.xx” to update my tree.

Though, this has several drawbacks, and among them some very important:
* the minor versions are not there, such as 2.6.xx.y
* the repository cloning is worth 2.1G, not including the checkout
* you need to specify the tag to get a stable kernel
* the repository contains all intermediate versions, which slows down updating both from network and local checkout.

The first point is the one what bothers me the more. For example at some given date, say the 2.6.39 is not yet released, the last version available in the hg mirror is 2.6.38, although 2.6.38.6 is available. So I  still need to manually patch my checkout because I think 6 minor stable versions are worth having.

My solution to this is a script that I’ve called by the pretty name of eudyptula (this is a very small penguin..). Eudyptula automatically (using cron) updates a mercurial repository to the latest ‘stable’ version of the linux kernel, according to what is found on the official ftp server. The result is here:

https://bitbucket.org/orzel/linux-kernel-stable

The repository clone weights only 220M (excluding the checkout, on my ext4 partition), and contains only one changeset for each update from a stable version to the next. ‘hg pull -u’ is enough to get the latest stable source. Hence the name.

A typical history will look like

* 2.6.38

* 2.6.38.1

* 2.6.38.2

* 2.6.38.3

* 2.6.38.4

* 2.6.38.5

* 2.6.38.6

* 2.6.39

* 2.6.39.1

and will drop any 2.6.38.x release that could appear after 2.6.39 is released.

As a convenience, I’m also tagging versions the same way they are tagged in the official git/mercurial repositories (‘v2.6.38.4″ for example).

Of course, it does NOT makes sense to use this repository if you intend to do kernel development. It is supposed to be used  readonly.

This is a long term project. As of today (november 14th, 2011), I’ve been using this for updating ~10 servers for the last 9 months. I intend to maintain this clone for long, checking and fixing problems if they ever occur.

If there’s enough interest, I could do another mirror for the long-term support versions. Though those versions, officially created and maintained by kernel developers, are not as formally described, and this is more difficult to do from a cron job.

November 9, 2011

EmergeActivity gets a graphical interface: releasing 2.0

by Thomas Capricelli — Categories: Admin, Gentoo, KDE — Tags: , , , Leave a comment

I’m still using this small utility that displays the activity of ‘emerges’ on the misc gentoo boxes I’m admin for. I’ve wanted to add a graphical interface for very long, but did not have the time… until recently. So here it is.

It is available for download from the homepage and as a mercurial clone.

September 18, 2011

A small step forward for the mercurial activity plugin, releasing version 2.0

by Thomas Capricelli — Categories: Admin, Gentoo, KDE — Tags: , , Leave a comment

As time goes, my mercurial ‘activity’ plugin has got more and more options. Useful and requested options of course, but still it kinda clobber the –help output and it is more and more cumbersome to play with. This is why I have introduced a new frontend, based on Qt, to play/decide about those options.

First, let me issue a very strong statement: this is optional and it is still possible to use the extension in an desktop-less environment (aka a server). This is an important point as many people, including myself, use the extension to provide activity information on some html page, maybe even integrating with the mercurial web interface.

So how does it work ? The extension now has a new option –mode. There are currently three possible values:

  • file: this is the previous behaviour, and is the default value. A image file is created and it exits.
  • display: this opens a window with the activity graph, using matplotlib, you can not change anything.
  • gui: this opens a full-fledge window, where you can change options and see ‘in real time’ how the graph changes.

This looks like this:

You’ll notice that the bottom of the window contains the corresponding command line, that you can copy/paste.

Last thing: the extension is now a python module, and as such, the way you configure the extension in your ~/.hgrc has slightly changed. Instead of having

activity=/home/orzel/hg/hgactivity/activity.py

you should now have

activity=/home/orzel/hg/hgactivity/activity

May 13, 2011

How to detect Altivec availability on linux/ppc at runtime

by Thomas Capricelli — Categories: Gentoo, Linux kernel — Tags: , Leave a comment

It is easy to find information on how to detect the availability of the different SSE instructions sets on the x86 platform.. but this get trickier when you’re looking after AltiVec.

This page provide some code and a link explaining why methods based on try and catch exception are bad:

http://freevec.org/function/altivec_runtime_detection_linux

I did few modifications to this code, that I consider enhancements:

  • use /proc/self/ instead of /proc/%d/ based on getpid() to simplify the code, as suggested in comment
  • use of bool for the result variable and the return value
  • clean ugly use of goto when possible
  • do not cache the result in a static variable
#include <fcntl.h>
#include <linux/auxvec.h>
#include <asm/cputable.h>

// from http://freevec.org/function/altivec_runtime_detection_linux
static inline bool altivecAvailable(void)
{
    bool result = false;
    unsigned long buf[64];
    ssize_t count;
    int fd, i;

    fd = open("/proc/self/auxv", O_RDONLY);
    if (fd < 0) {
        return false;
    }
    // loop on reading
    do {
        count = read(fd, buf, sizeof(buf));
        if (count < 0){
            break;
        for (i=0; i < (count / sizeof(unsigned long)); i += 2) {
            if (buf[i] == AT_HWCAP) {
                result = !!(buf[i+1] & PPC_FEATURE_HAS_ALTIVEC);
                goto out_close;
            } else if (buf[i] == AT_NULL)
                goto out_close;
        }
    } while (count == sizeof(buf));
out_close:
    close(fd);
    return result;
}

October 4, 2010

announcing qxv

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: , 2 Comments

Well… you know how it is, you get used to a tool, and even if some brand new software is now available, you keep on using this old stuff. In his case, i’m speaking of xv, whose last release was in 1994. It’s still my default viewer for all image formats in my KDE/firefox/whatever settings.

So it’s old, it’s unmaintained, but there’s something even worse : it’s not Free Software. That’s probably the reason nobody took off maintainance, by the way.

Because of all those reasons, most distributions do not ship it anymore, and that’s a shame (my distribution of choice, Gentoo, does though, congrats!)

This project is about providing a key-to-key compatible image viewer, GPL, and maintained. Using a toolkit sush as Qt, it’s not very difficult. The two main features are “Free Software” and “maintained”. I use it everyday, trust me it will be maintained :-)

I’ll also probably provide binaries for MacOS and Windows, because we basically have this for free thanks to Qt portability.

qxv is a single binary, and does not depend on any other files (despite, of course, dynamically linked libraries, whatever they are).

The 0.1 release provide those features (all present in xv)

  • create list of images from comand line
  • those keys are handled the same way as xv : space(next image), backspace(previous image), enter(reload current image), “,”(shrink), “.”(grow), “<”(shrink a lot), “>”(grow a lot), “t”(rotate clockwise), “T”(rotate counterclockwise), q(quit), h(horizontal flip), v(vertical flip)
  • basic control window (available by a right click on the main window)

More information:

April 3, 2010

Announcing colibri 1.0 alpha1, a mailing list manager with a django based web interface

by Thomas Capricelli — Categories: Admin, Django, Gentoo — Tags: , 3 Comments

It has been more than one year now that I’m running my own mailing list software here at freehackers, and I think it is now time to release a first preview of it. Let me introduce Colibri 1.0 alpha1

Colibri is a free software (GPL), based on python and Django.

myaccount2

It’s not feature complete, but it actually forward mails. From the web interface, people can (un)subscribe and configure their accounts.

The webpage, with screenshots, download, bugtracker and some documentation is at http://labs.freehackers.org/projects/colibri/wiki

I use mercurial for source control, and the repository is available both for cloning and browsing at http://sources.freehackers.org/Colibri/

January 10, 2010

Playing with clang and Qt

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: , , 5 Comments

You might know that there’s a new kid in the C++ compilers list ; clang. Llvm has been around for quite some time, but until recently the only way to make use of it was through the somehow cumbersome llvm-gcc which binds the gcc C/C++ frontend to the llvm backend. People (mostly Apple) have been working since 2005 on a frontend dedicated to llvm, clang. It is already used ‘in production’ by Apple for the C and objective-c languages.

The C++ part is still very alpha, but i still wanted to play with it. Among other things I wanted to try compiling some Qt projects using qmake. So i hacked this quick&dirty linux-clang mkspec. To use it, uncompress the tgz in your $(QTDIR)/mkspecs/ , edit the clang.conf file to suite your own paths, and do something like:

qmake -recursive -spec linux-clang
make

I’m using it with Qt-4.6, and it works for me (c). As a last advice, I highly recommend the svn trunk instead of the last release for clang. The website has clear information about how to do this.

* Download linux-clang.qt-4.6.mkspecs.tgz

November 22, 2009

How to use flex and bison with qmake (my own way)

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: , , , 5 Comments

qmake (sort of) supports lex/yacc, but modern people prefer to use flex/bison. If you google, you can find some tricks like convincing qmake that yacc is spelled ‘bison’ and so on.  Morever qmake supports for lex/yacc has several drawbacks, such as weird naming scheme, and (when using the tricks), dependencies are not building files in the right order.

Finally, I created my own *.pri files, and here they are:

% cat flex.pri

flex.name = Flex ${QMAKE_FILE_IN}
flex.input = FLEXSOURCES
flex.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.lexer.cpp
flex.commands = flex -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.lexer.cpp ${QMAKE_FILE_IN}
flex.CONFIG += target_predeps
flex.variable_out = GENERATED_SOURCES
silent:flex.commands = @echo Lex ${QMAKE_FILE_IN} && $$flex.commands
QMAKE_EXTRA_COMPILERS += flex

% cat bison.pri

bison.name = Bison ${QMAKE_FILE_IN}
bison.input = BISONSOURCES
bison.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.cpp
bison.commands = bison -d -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.cpp ${QMAKE_FILE_IN}
bison.CONFIG += target_predeps
bison.variable_out = GENERATED_SOURCES
silent:bison.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands
QMAKE_EXTRA_COMPILERS += bison
bison_header.input = BISONSOURCES
bison_header.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.hpp
bison_header.commands = bison -d -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.parser.cpp ${QMAKE_FILE_IN}
bison_header.CONFIG += target_predeps no_link
silent:bison_header.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands
QMAKE_EXTRA_COMPILERS += bison_header

Of course, the proper way to use those is to include them and then define FLEXSOURCES / BISONSOURCES as needed. Example:

include(flex.pri)
include(bison.pri)
FLEXSOURCES = myproject.l
BISONSOURCES = myproject.y
© 2012 Thomas Capricelli All rights reserved - Wallow theme v0.46.5 by ([][]) TwoBeers - Powered by WordPress - Have fun!