[Build-common-hackers] Re: cdbs question

Martin-Éric Racine q-funk@pp.fishpool.fi
Mon, 1 Dec 2003 23:08:14 +0200 (EET)


NOTE:  I am not subscribed to this list, nor do I intend to. 
I just need help with transitioning to CDBS and Colin Walters suggested that I
redirect my questions towards this list.

On Mon, 1 Dec 2003, Colin Walters wrote:

> On Mon, 2003-12-01 at 13:53, Martin-Éric Racine wrote:
> 
> > I have one source which produces a single binary which does not require=
 any
> > special configuration, thus it uses a very short Makefile to build the =
binary
> > and install the basic documentation (README, ChangeLog). That used to w=
ork
> > rather well with a typical debhelper-based debian/rules but fails here:=
 all I
> > get is a package with the /usr/share/docs/packagename content and nothi=
ng else.
> > It only uses the "include /usr/share/cdbs/1/rules/debhelper.mk" rule, r=
ight now.
> > 
> > Does CDBS require a source tree with the GNU configuration system (conf=
igure,
> > Makefile.in, etc.) to work, or what am I missing? 
> 
> CDBS at its core requires absolutely nothing; you can just include what
> makefile fragments you want.  Individual makefile fragments (rules or
> classes) however may make assumptions about your source tree.  Some of th=
ose
> assumptions are overridable via variables; others are not.
> 
> debhelper.mk only implements the binary package creation steps.  If you w=
ant
> to implement the compilation/installation steps, you have to either inclu=
de
> an appropriate rule fragment (such as class/makefile.mk) or implement it
> yourself inside debian/rules.
> 
> In this specific case, since it sounds like your package has a strange
> Makefile, I suggest you include makefile-vars.mk, and implement the build=
ing
> steps yourself.  Take a look at makefile.mk to see how it does it (it's n=
ot
> very complex).
> 
> By the way, questions on CDBS are best directed to
> build-common-hackers@lists.alioth.debian.org.

I really cannot see what would fail in the following diminutive Makefile:

8X-----
CC = gcc
CFLAGS = -Wall -O9
INSTALL_BIN = /usr/bin/install -D -m 755
INSTALL_DAT = /usr/bin/install -D -m 644

all:
        $(CC) $(CFLAGS) foobar.c -o foobar

clean:
        rm -f *.o foobar

install:
        $(INSTALL_BIN) foobar $(DESTDIR)/usr/lib/cups/backend/foobar
        $(INSTALL_DAT) ChangeLog $(DESTDIR)/usr/share/doc/foobar/ChangeLog
        $(INSTALL_DAT) README $(DESTDIR)/usr/share/doc/foobar/README

uninstall:
        rm $(DESTDIR)/usr/lib/cups/backend/foobar
        rm -r $(DESTDIR)/usr/share/doc/foobar
8X-----

The addition of $(DESTDIR) to the software's crude Makefile was all it took to
make it work with a traditional debian/rules made of dh_* -powered targets, but
it won't do with CDBS, for some reason.

I tried the following short debian/rules with it. Compared to my previous mail
to Colin, it improved the situation, in that the binary is built, but then it
does not get installed in the appropriate subdir:

#!/usr/bin/make -f
include /usr/share/cdbs/1/class/makefile.mk
include /usr/share/cdbs/1/rules/debhelper.mk

Could anybody help me fix this Makefile to make it CDBS-friendly?  Thanks!

-- 
Martin-Éric Racine, ICT Consultant
http://www.pp.fishpool.fi/~q-funk/