[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=
> > special configuration, thus it uses a very short Makefile to build the =
> > and install the basic documentation (README, ChangeLog). That used to w=
> > 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=
> > 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=
> assumptions are overridable via variables; others are not.
> debhelper.mk only implements the binary package creation steps.  If you w=
> to implement the compilation/installation steps, you have to either inclu=
> 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=
> steps yourself.  Take a look at makefile.mk to see how it does it (it's n=
> 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:

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

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

        rm -f *.o foobar

        $(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

        rm $(DESTDIR)/usr/lib/cups/backend/foobar
        rm -r $(DESTDIR)/usr/share/doc/foobar

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