6

I have been recently trying to package a small Python utility to put on my PPA and I've almost got it to work, but I'm having problems in making the package install the binary (a chmod +x Python script) under /usr/bin. Instead it installs under /. I have this directory structure -> http://db.tt/0KhIYQL.

My package Makefile is like so:

TARGET=usr/bin/txtrevise

make:
      chmod +x $(TARGET)

install:
      cp -r $(TARGET) $(DESTDIR)

I've used $(DESTDIR), as I understand it to place the file under the debian subdir when debuild is run.

I have the txtrevise script, my executable, under usr/bin folder under the root of my package. I also have the Makefile and usr/bin/textrevise in my tarball: txtrevise_1.1.original.tar.gz.

However when I build this and look inside of the Debian package, txtrevise is always at the root of the package instead of under usr/bin and will be installed to / instead of /usr/bin.

How can I get debuild to put the script in the right place?

Thanks. Any help would be greatly appreciated. I'm stumped.

Jorge Castro
  • 71,754
SammySP
  • 173

1 Answers1

4

The DESTDIR environment variable is defined in the GNU coding standards:

DESTDIR is a variable prepended to each installed target file.

...

If your installation step would normally install /usr/local/bin/foo and /usr/local/lib/libfoo.a, then an installation invoked as in the example above would install /tmp/stage/usr/local/bin/foo and /tmp/stage/usr/local/lib/libfoo.a instead.

Prepending the variable DESTDIR to each target in this way provides for "staged installs", where the installed files are not placed directly into their expected location but are instead copied into a temporary location (DESTDIR). However, installed files maintain their relative directory structure and any embedded file names will not be modified.

This is the way the debhelper scripts expect your make file to behave. So if you want your program to appear in /usr/bin when the package is installed, then you should copy the program to $(DESTDIR)/usr/bin (creating that directory structure if it doesn't exist).