WezM.net The weblog of Wesley Moore

16Aug/090

Local Package Management with GNU Stow

I’m a bit of a purist when it comes to installing UNIX style software. I prefer to install it via the package manager on the platform of choice (E.g. apt on Debian or Mac Ports on Mac OS X). However these repositories don’t always contain the particular package you’re after or may contain an outdated version.

In situations like these where you end up building the package yourself I used to employ a system where I would install it into a subdirectory within my home directory. I did this because it doesn’t overwrite a pre-existing system installed version, doesn’t require root privileges and permits quick removal. To achieve this I just passed the --prefix option to the configure script before building. For example if I was building vala I might run the configure script as follows:

./configure --prefix=$HOME/Local/vala

Following that with the typical make, make install sees the package built and installed into that directory. The problem with this approach is that for every package you build you have to add the target directory to search paths such as: PATH, LD_LIBRARY_PATH, MANPATH, PKG_CONFIG_PATH. After a while this gets a bit unwieldy. This is where GNU Stow comes in.

Stow manages these separate target directories by creating symlinks into the parent directories. For example to build vala I would pass a prefix of $HOME/Local/stow/vala to the configure script. After vala is built and installed, change to the $HOME/Local/stow directory and run stow vala. This results in symlinks to the files in $HOME/Local/stow/vala being created in $HOME/Local, with directory structure preserved. So if vala installs files to bin and lib these files will end up under $HOME/Local/bin and $HOME/Local/lib respectively.

Stow can also delete the symlinks to support uninstalling. The end result is that you only need to add one extra directory to each of the search paths and custom software can be built, installed and uninstalled all without messing with the standard system and root privileges.

2Mar/090

Debian 5.0 ‘Lenny’ Released

Debian GNU/Linux 5.0 was released on Valentines day 2009, “after 22 months of constant development”, according to the announcement. 22 months is still a long time between releases but its certainly an improvement over the nearly three years between 3.0 and 3.1 (sarge) and consistent with the 21 months between 3.1 and 4.0.

As always the upgrade procedure is straightforward and worked seamlessly for me. I followed the instructions on go2linux.

20Jan/090

Determining Non-Automatically Installed Debian Packages

Tonight I began migrating from my current VPS at vpsFarm to a new one at Crucial Paradigm. The primary driver behind this is financial. Firstly I wanted to reduce the cost of running a VPS and secondly I wanted a VPS billed in Australian dollars so I wasn’t exposed to wildly varying value of the Australian dollar. Due to the recent slump in the exchange rate the vpsFarm server started costing $10 or so more a month.

23May/080

Stop Vim Completion Searching Included Files

I use vim coupled with the SuperTab plugin for my text editing and auto-completion needs. In some vim setups (E.g. Mac OS X) it is configured by default to search included files when completing words. This sounds like a useful feature but it turns out not to be. It has a habit of searching the include files of system libraries and modules, the keywords of which you rarely want. Its also quite a slow operation as it trawls through all the files. The solution is to add the following in your .vimrc file.

set complete=.,w,b,u,t

This is the same set of flags as the default except with the ‘i’ option removed. See the help for the ‘complete’ option for an explanation of what each flag means.

16Apr/080

MP3 Decoder Libraries Compared

For my current software project I have the need to decode MP3 files for the purpose of producing an audio waveform. It doesn’t need to be overly accurate as the decoded samples will be displayed, not played. However it does need to be fast, as a typical use case for the application will be MP3 files of around 100Mb (full length CDs). The application is for Mac OS X, although the results of my testing below could be useful for other platforms.

Assisted by a code sample from Apple I wrote an initial version of the decoder that would read the source MP3 file and write the raw linear PCM data out to a file. I did this using the Core Audio framework built into Mac OS X. Once the program was working I tested it against some sample files and came to the conclusion that 4 seconds to decode a 3 min track was great but over 100 seconds for a full length CD, not so great.

I did some searching and came up with two other libraries that seemed well suited to the task of MP3 decoding, they were mpg123 (libmpg123) and MAD (libmad). mpg123 had claims of being very fast, mad claimed it was very accurate.

Methodology

I built the two additional libraries with the default configuration options, except for libmad, which I added the --enable-speed option. With the help of example code I made programs out of each that were comparable to the first version for Core Audio. I.e. MP3 file in, 16-bit Linear PCM audio samples out.

To provide a benchmark I wrote a script that would run each of the three programs against a source MP3 file. Each program reported the elapsed time (via time(3)) and the processor time (via clock(3)) when it finished decoding. The programs were run one after another on the source file 10 times. Their PCM output was written to a new file for each invocation.

Recent Comments

Categories

Links

Archives

Tags

adaptive atom awk bash benchmark books cake consolas core-audio debian decoder delivery expand feed font fonts git glob gripe installer iPhone ipod Linux mad melbourne microsoft mp3 mpg123 music package pocket-reference rss ruby script sed shell smoothing snow-leopard textmate title tux UNIX uri-scheme variable virtualbox

Meta

Contact