Wednesday, June 12

Overloading rules with GNU makefile

If you are familiar with BSD makefile, and specially ports,
you know you have the ability to override some 'default' rules.

This kind of facility is very useful in large Makefile systems,
when you need a specific behavior for one part of your code, without
rewriting all your Makefile base.

The BSD way

In BSD makefile, this is easily done by the 'target' command, who “takes
a target name as an argument and evaluates to true if the target
has been defined”(man manpage). So you can write something like this
in your as a default rules in your, let's say, default.mk makefilefile.

.if !target(overloadrule)
overloadrule:
@echo “You use the default rule”
.endif

all: overloadrule configure build install
@echo “do complicate things here”
…..

then later, use the default.mk file as a base and if required
overload the 'overloadrule' rule just by rewriting it :

overloadrule:
@echo “This is my specific rule !”

.include <default.mk>

What about linux ?

Linux uses GNU makefile, and GNU makefile doesn't know the 'target' command
So, we need another way to implement this kind of facility for my Linux projects.
I sail the web looking for a simple answer to my question without result, and
finally I found the “ifndef endif” couple who does the job !
So following the previous example, you will have a default.mk and a specific.mk files
in GNU makefile syntax, with the following content :

% cat default.mk
ifndef overloadrule
overloadrule:
endif

% cat specific.mk
overloadrule:
@echo “This is my specific rule !”

include default.mk

Note 1 : AFAIK, with GNU makefile, the default rule must be empty, otherwise the mechanism doesn't work
Note 2 : If overloadrule is the first rule in your Makefile, make will deduce this is the default rule, and always execute the rule. To be safe, you need to have a default rule before the overloaded one.
Posted @ 6/12/2013 11:41am – PermalinkEdit

Tuesday, October 16

Playing with GMediaRender, a free UPnP media render (the begins)


GMediaRender is a UPnP media render for POSIX-compliant systems.
In the UPnP terminology, the render is the piece of software drived by the UPnP controler who plays (render) the media stored in the UPnP server, see the schema below.

At home, I have an UPnP server (minidlna) to store all my -legal- music, and I want to drive the music I play in my stereo from my android phone.
To accomplish that, I do the following :

  • chose one of the existing application to control DLNA devices from the store (let's say bubble UPnP)
  • install gmediarender in a small computer with the audio output going to my stereo
  • run the applications and let's the party begins !

Install GMediaRender for FreeBSD

GMediaRender is not yet available for FreeBSD, so you have to compile the application by yourself. A small patch I wrote is required for that.

The first step is install from ports or packages, the dependencies :

  1. devel/upnp (libupnp > v1.6.0)
  2. multimedia/gstreamer
  3. multimedia/gstreamer-plugins-all (for the gstreamer the plugins)

Then build GMediaRender :

  1. Download GMediaRender v0.0.6 tarball
  2. uncompress it and apply the patch : patch < gmediarender-0.0.6-freebsd-001.patch
  3. go to the gmediarender-0.0.6 directory and run the configure script : ./configure –with-libupnp=/usr/local
  4. build and install : gmake && gmake install


Posted @ 10/16/2012 7:49pm – PermalinkEdit

Monday, October 15

Acer Aspire V5-171


Last week I brought a new laptop, the Acer Aspire V5-171-32364G50ass, a cheap, small, not too heavy, and reasonably powerful laptop to run with FreeBSD.
Some of the characteristics of the computer are :

  • cpu : Intel Core i3-2367M (1.40 GHz, 3 MB)
  • screen : 11.6” LED
  • memory : 4 GB DDR3 SDRAM
  • hard drive : 500 GB Serial ATA
  • Weight : (Approximate) 1.38 kg
  • Maximum Battery Run Time 5 Hours

And on the top of that, Acer have (at least for french customers) a refund process for the pre-installed operating system and applications.
Cause I plan to use this laptop with freeBSD, so I use an external laptop to install my favorite OS and made some tests to check the support for the most sensitive hardware components.

Video card for X11

The laptop comes wit an Intel HD Graphic 3000, not officially supported by FreeBSD, so you have to upgrade the system to the latest version (9 stable or head). The full process is detailed in this post on the FreeBSD forums.

The touch-pad

Once X11 installed, the touch-pad seems to work, but before use it some calibration is required.

The sound

Not tested yet.

The WiFi

Ouch ! By default it doesn't work, but on the internet I found some testimonials about peoples running the wifi with linux on this laptop. More investigations are required, otherwise I'll buy a cheap wifi dongle.


Posted @ 10/15/2012 10:49am – PermalinkEdit

Monday, October 1

First post


Fist part of the migration is now complete …..
Posted @ 10/1/2012 10:07am – PermalinkEdit