Fun with find

A friend of mine was asking how to append a string to files contained in a directory structure of unknown depth. I dug around a little bit and found this gem.

Eric has been having several difficult issues building KDE 4-point-something on Funtoo (a Gentoo fork) and it occurred to him that it might be possible to add a specific use flag to every IUSE contained within the build. Unfortunately, due to the nature of the package directory structure, it would prove tiresome attempting to append the same string to each file. Besides, that’s what scripting is all about, isn’t it?

Here’s one possible solution:

find . -type f -name 'IUSE' -exec sh -c 'echo "exceptions" >> {}' \;

For a more secure solution, use -execdir:

find . -type f -name 'IUSE' -execdir sh -c 'echo "exceptions" >> {}' \;

If that syntax frightens you, for loop constructs are also a possibility:

for file in `find . -type f -name 'IUSE'` ; do echo "exceptions" >> $i ; done

If you know of others, share them!

No comments.
***

Build Pidgin (or Carrier) in Ubuntu

I had a request from Will to give a run down on how to build Pidgin (Carrier, rather) from scratch in Ubuntu. It’s not too difficult, but Ubuntu doesn’t ship with many of the development headers and libraries required to build either of these two applications. Worse, Carrier doesn’t ship with a working configure script, so you need the auto* tools to build that first.

Now, I’m sure someone will probably say “But you can just download the .deb and install it from there, it’s easy!”

Yeah, you can. This post isn’t about easy: It’s about giving the user a choice. After all, that’s what open source is about, right? :) So, for the sake of argument, let’s assume that the individual reading this post has absolutely no other choice but to build Pidgin/Carrier from scratch.

Easy enough?

I’ve listed the packages that are required to have a fully functioning IM client. I also have “barely optional” and “optional” packages listed as well. Barely optional are packages which you don’t need to install, but if you don’t, certain things probably won’t work and your IM client might not play very nicely with other applications like the desktop environment. Optional packages are those which you really don’t need, but if you have a really morbid fascination for installing everything, you can choose to grab them all.

If you’re installing from Synaptic, here’s the list of packages you’ll need:

  • Required Packages
    • automake
    • libtool
    • gettext
    • libglib2.0-dev
    • libgtk2.0-dev
    • libxss-dev
    • libstartup-notification0-dev
    • libgtkspell-dev
    • libxml2-dev
    • libgstreamer0.10-dev
    • libnss3-dev
    • libgnutls-dev
  • Barely Optional Packages
    • libdbus-glib-1-dev
    • libnm-glib-dev
  • Optional Packages
    • libmeanwhile-dev
    • libavahi-client-dev
    • libperl-dev
    • tcl8.5-dev

I’ll explain more about each of the optional categories in a moment. First, let’s map out the commands you’ll need to run to get this started:

Install the Packages

You will probably need to update Ubuntu first. If you don’t, you’ll have to reinstall a bunch of packages down the road. Though, I suspect that if you’re going this far, you’re already expecting to install a lot of things. In that case…

Here’s the command line you’ll need to get started:

apt-get install automake libtool gettext libglib2.0-dev libgtk2.0-dev libxss-dev libstartup-notification0-dev libgtkspell-dev libxml2-dev libgstreamer0.10-dev libnss3-dev libgnutls-dev libdbus-glib-1-dev libnm-glib-dev

Then, unpack the Pidgin or Carrier sources:

Pidgin
tar jxvf pidgin*.tar.bz2 (Use zxvf if you have a gzip instead)

Carrier
tar jxvf carrier*.tar.bz2 (Use zxvf if you have a gzip instead)

Carrier only
Create the configure script for the next step:
./autogen.sh

Carrier and Pidgin Both
./configure --disable-meanwhile --disable-avahi --disable-perl --disable-tcl

And that’s it. Before I close this post, though…

What are all these darned packages anyway?

I’m glad you asked. It’s a mess, I’ll give you a short drill-down:

Barely Optional Packages:

  • libdbus-glib-1-dev: D-Bus support. This handles communication between user applications, the system–heck–even the kernel. You can read more about D-Bus. To disable D-Bus support use: --disable-dbus. Be careful, though. Disabling this might cause minor problems with Pidgin’s ability to interface with your desktop environment. Then again, maybe you want this…
  • libnm-glib-dev: NetworkManager. This handles network connectivity from the desktop environment. I’m not sure why libpurple or Pidgin would need this, but I imagine it has something to do with Pidgin’s ability to start when the desktop environment starts. To disable NetworkManager support use: --disable-nm. Note that you might not want to do this.

Optional Packages:

  • libmeanwhile-dev: Meanwhile/Sametime IM support. Use --disable-meanwhile to disable this.
  • libavahi-client-dev libavahi-glib-dev: Avahi/Bonjour autodiscovery support. This isn’t really necessary. If you plan on enabling it, you do need both libraries installed. Use --disable-avahi to disable this.
  • libperl-dev: Perl scripting support. Yep, some people use this. Use --disable-perl to disable this.
  • tcl8.5-dev: Tcl scripting support. Use --disable-tcl to disable this.

Other noteworthy things…

  • Installing libgtk-dev pulls in a lot of packages. In fact, it pulls in about 53 dependencies.
  • libxss-dev is required for Pidgin to track mouse/keyboard activity.
  • libxml2-dev is needed for–you guessed it–XML-related stuff. Incidentally, if you’re building PHP from scratch, you’ll need this.
  • It isn’t recommended to disable NSS and GnuTLS support with --disable-nss and --disable-gnutls; if you do, MSN, Novell Groupwise, and Google Talk support won’t be built.

So there you have it: Building Pidgin or Carrier yourself should be (reasonably) easy!

6 comments.
***

Quickie: Linux Mint

If you’re into the whole Linux thing, you might be interested in Linux Mint. It’s an Ubuntu-base distribution and aims to ship with more of the software one might expect of Windows and the likes. Personally, I like the GTK theme Mint uses over Ubuntu’s (though, I don’t like GTK in general). Let’s take a look:

screenshot-17

Unlike Ubuntu, the Linux Mint folks have altered the default layout of the theme to be more in line with Windows. I kinda like the application (Mint?) menu, though it is a little buggy. Admittedly, some of the mouse-overs on the various submenus are a bit of a nuisance. Though, being as it’s based on Ubuntu 9.04, the fonts look really quite nice.

Here’s a shot of the terminal window:

screenshot-20

Interestingly, sound worked right off the bat for me–and they’re using PulseAudio.

All in all, it looks like it’ll be worthwhile to play around with. I might even install it on a spare drive!

If you like Ubuntu, give it a try.

4 comments.
***