[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: generic debian/rules that creates directories



T o n g <mlist4suntong@yahoo.com> writes:

> Is it possible to have a generic debian/rules that creates directories? 

> The upstream Makefiles was not designed to install into $DESTDIR but 
> to /, so it assumes /usr/bin exists, while that creates problems for me:

>   install -s -m 755 autogb /export/build/zh-autoconvert/bld/zh-
> autoconvert-0.3.16/debian/tmp/usr/bin
>   install: cannot create regular file '/export/build/zh-autoconvert/bld/
> zh-autoconvert-0.3.16/debian/tmp/usr/bin': No such file or directory

> Is it possible to alter the following `debian/rules` file so that it 
> plays nicely with such upstream Makefiles? 

There have been several replies to this, but none of them quite tell you
exactly what to do, so let me take a stab at that.

First, dh_installdirs is not actually useful for solving this particular
problem since dh_installdirs creates directories in the package staging
area.  Your problem is happening prior to that; make install of the
upstream source into debian/tmp is failing because it's expecting
$DESTDIR/usr/bin to already exist.  dh_installdirs doesn't create
directories in debian/tmp, so it doesn't help with that.

The quick solution that doesn't help other users of upstream is to edit
debian/rules and add the command:

    install -d debian/tmp/usr/bin

prior to running make install (or, more likely, dh_auto_install).  If
you're using dh rule minimization and therefore aren't currently running
that directly, you do this with an override, which looks like:

override_dh_auto_install:
        mkdir -p debian/tmp/usr/bin
        dh_auto_install

The solution that helps other users of upstream as well is to look at the
upstream Makefile (or Makefile.in or Makefile.am, although probably not
the last since Automake gets this right) and find where it's running that
install command.  Add, before that install command, the command:

    install -d $(DESTDIR)/$(bindir)

(or $(INSTALL) if upstream is generally using that).  This assumes an
Autoconf project that uses $(bindir); if upstream is using something else
to name the destination binary directory, use whatever variable upstream
is using; if they're just using usr/bin literally, then use:

    install -d $(DESTDIR)/usr/bin

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: