Package: debhelper
Version: 7.2.14
Severity: minor

Dear Joey,

the debhelper command sequencer "dh" isn't really helpful, if the build directory (i.e. the directory containing the configure script and Makefile) isn't the top-level source directory. As a prominent example, I would like to package the XVID library, which has both the configure script and the Makefile in a build/generic directory [1]. The most obvious debian/rules for this case would look like this:

        #!/usr/bin/make -f
        
        %:
                cd build/generic && dh $@

but it fails instantly because debian/control cannot be read from this directory. A possible solution would be symlinking the debian directory from the top-level directory into build/generic before the configure rule and remove this symlink in the clean rule, but this soon becomes very ugly and hackish to make it actually work. For example, the following debian/rules file works fine, but I have to manually override every relevant rule with the same stupid and redundant directory change (and thus I hate it):

        #!/usr/bin/make -f
        
        %:
                dh $@
        
        override_dh_auto_clean:
                ln -sf ../../debian build/generic
                cd build/generic && dh_auto_clean
                rm -rf build/generic/debian
        
        override_dh_auto_configure:
                ln -sf ../../debian build/generic
                cd build/generic && dh_auto_configure
        
        override_dh_auto_build:
                cd build/generic && dh_auto_build
        
        override_dh_auto_install:
                cd build/generic && dh_auto_install

Currently, I am managing this issue by patching a configure script and a Makefile into the top-level source directory using this patch:

        --- /dev/null
        +++ xvidcore-1.2.1+debian/Makefile
        @@ -0,0 +1,6 @@
        +#!/usr/bin/make -f
        +
        +all:
        +
        +%:
        +       -$(MAKE) -C build/generic $@
        --- /dev/null
        +++ xvidcore-1.2.1+debian/configure
        @@ -0,0 +1,3 @@
        +#!/bin/sh
        +
        +cd build/generic && ./configure $@

and the following debian/rules file:

        #!/usr/bin/make -f
        
        %:
                dh --with quilt $@
        
        override_dh_auto_configure:
                chmod +x configure
                dh_auto_configure

However, I still don't feel comfortable with this hack. My propose is to introduce another set of options to the "dh" command, namely --configure-dir and --build-dir which can be used to point to the directories containing the configure script and the Makefile and which would default to "./" if unset. With these two commands, my debian/rules file would finally look like this:

        #!/usr/bin/make -f
        
        %:
                dh --configure-dir build/generic \
                --build-dir build/generic $@

without the need for any further hacks.

I think it is important to keep --configure-dir and --build-dir separate! Consider I would like to package the libmp4v2 library from the mpeg4ip sources. I would have to run the configure script in the top-level source directory and then dive down into the libmp4v2 directory to run the Makefile there.

What do you say?

Cheers,
Fabian


[1] Another less prominent example is the rott package, where the Makefile is in the rott directory of the tarball.

--
Dipl.-Phys. Fabian Greffrath

Ruhr-Universität Bochum
Lehrstuhl für Energieanlagen und Energieprozesstechnik (LEAT)
Universitätsstr. 150, IB 3/134
D-44780 Bochum

Telefon: +49 (0)234 / 32-26334
Fax:     +49 (0)234 / 32-14227
E-Mail:  [email protected]



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to