Manually editing debianrules file needed for simple build process?

592 views Asked by At

I'm a newbie trying to build a deb to put into a PPA, following this Ubuntu guide, but I run into troubles with the rules file, where I consult this overview and the Debian Policy Manual. I gather that in many cases one can leave the rules file as is, in its very short form, however this does not work for me, probably because a small amount of trickery is needed before being able to run make on the upstream package.

The build process for manually building and installing upstream is:

  1. cd packagedir/src
  2. cp makefile.unix makefile.my
  3. Run three sed lines on makefile.my
  4. make -f makefile.my
  5. sudo cp -f binaryfile /usr/local/bin/

I've managed to adjust the rules file (adding targets) into what appears to be successfully performing steps 1-4, but when compilation finishes through the bzr builddeb -- -us -uc command, I'm met with an error that says "dpkg-genchanges: error: cannot read files list file: No such file or directory", and it makes me wonder if I'm really doing a lot of work that is not necessary. After all, the build and install process is not very complicated.

So my question is: Can I revert the rules file, and easily implement the five steps above in the build process, or do I need to continue down the road that I've taken, manually editing the rules file? In both cases I need guidance on how to continue :)

1

There are 1 answers

0
the paul On

Yes, you can revert the rules file and pretty easily implement those steps inside the dh framework (as opposed to just adding those steps verbatim).

It might look something like

#!/usr/bin/make -f

%:
        dh $@

override_dh_auto_configure:
        sed -e "$my_sed_program" makefile.unix > makefile.my

override_dh_auto_build:
        make -f makefile.my

And then in debian/$packagename.install:

binaryfile    /usr/bin

That might not work exactly as is; it depends on details of how your build process works, but maybe that will get you closer.

A side note: don't install binaryfile into /usr/local/bin, unless you really really have to; packages should leave /usr/local alone and let the local system admin choose what to put there. The OS knows how to keep track of files owned by packages and where they are and whether they conflict with others, so there should be no downside to putting it in /usr/bin instead.