Installing GNU Gift on Debian Lenny


We're going to assume:

  • you want to place all gift related files in /home/gift/gift/
  • you are logging in as a user named gift, and can use sudo to execute tasks as root.


First, install both gnuift (the debian name for the gift package), and apache 2 (the preforking version, so we can install PHP5 later).

sudo apt-get install gnuift apache2-mpm-prefork

Compiling from Source

first, install gift's build dependencies

sudo apt-get install cvs automake autoconf libtool libexpat1-dev make g++

per the directions on Savannah, use CVS to download the newest version:

mkdir -p /home/gift/gift/src/
cd /home/gift/gift/src/
cvs -z3 co gift

Generate files required to build:

cd gift

Set up the build system:


Build Gift:


Obtaining Sample Image Data

I grabbed my sample image data from The Open Clip Art Project.

Specifically, I downloaded their 0.19 release, then ran the following command, to move all the .png files into one flat directory, for gift to index:

cd /home/gift/
tar -xjf openclipart-0.19.tar.bz2
mkdir -p gift/clipart/
cp -a `find openclipart-0.19 -name *.png` gift/clipart/

Indexing your Collection

To index your collection, call gift-add-collection with the full path of the images you want to import.

(in addition, touch the config file, to prevent a lenny specific defect, described below) /home/gift/gift/clipart/

now wait a long, long time.

Speeding this up

Downloading and installing the new version from CVS results in this step taking half(!) as long.

In addition, you can create the thumbnails using a separate script, at the same time. the will skip generating a thumbnail if you create them for it.

# first argument: path to images to thumbnail

target=`dirname $1`/`basename $1`
echo $target
cd $target
for each in `ls -1`; do {
convname=`echo $each | sed "s/[.]/_thumbnail_/"`;
if [ ! -f "${target}_thumbnails/${convname}.jpg" ]; then
        echo converting $each;
        convert -geometry 128x128 ${each} ../${target}_thumbnails/${convname}.jpg;

Fixing up gift-config.mrml

gift always fails to generate this file correctly. specifically:

Lenny Defects

Out of Memory

Copying /home/gift/gift-config.mrml to /home/gift/gift-config.mrml-old

Ran out of memory for input buffer at /usr/lib/perl5/XML/Parser/ line 469, <LOCALELIST> line 270.                                                             

Run out of memory? create a 256 meg swap file, and use it:

dd if=/dev/zero of=/home/gift/swapfile bs=4k count=65536
sudo mkswap /home/gift/swapfile
sudo swapon /home/gift/swapfile

now, re-run


The packages in lenny commonly fail to create a config file, because there isn't one to move out of the way. touching the file before running (as we perform above) works around the problem. it also has the same defect as cvs, which we describe next.

CVS Defects

CVS seems to just fail to change the collection IDs in gift-config.mrml. To repair a file generated by CVS, meerly take the collection ID spit out as the last thing you see when running, and use it to replace the collection IDs in the 'adefault' algorithm, and in the collection id declaration.

When this breaks

on my machine running gift from debian's lenny packages, this broke creating the gift-config.mrml file.

Copying /home/gift/gift-config.mrml to /home/gift/gift-config.mrml-old

Couldn't open /home/gift/gift-config.mrml:
No such file or directory at /usr/bin/ line 585

To fix it, I touched the file in question, and re-ran

Setting up a Frontend

apt-get install libapache2-mod-php5 php-xml-parser
rm /var/www/index.html
cd /var/www/
tar -xzf rainbowsock.tar.gz
Last modified 10 years ago Last modified on Aug 16, 2011, 12:28:54 AM