Changing default directory for debhelper while packaging (.deb)
You need to set --sourcedirectory
instead of --builddirectory
on dh $@
call, it will affect all dh_auto_*
. So you may remove those overrides.
BUILD SYSTEM OPTIONS
The following command line options are supported by all of the
dh_auto_* debhelper programs. These programs support a variety
of build systems, and normally
heuristically determine which to use, and how to use them. You
can use these command line options to override the default
behavior. Typically these are passed to
dh(1), which then passes them to all the dh_auto_* programs.
-Ddirectory, --sourcedirectory=directory
Assume that the original package source tree is at the
specified directory rather than the top level directory of
the Debian source package tree.
-B[directory], --builddirectory=[directory]
Enable out of source building and use the specified directory
as the build directory. If directory parameter is omitted, a
default build directory will be chosen.
Source: man debhelper
NOTE:
-
Avoid using hard-coded paths
Example
/usr/local
, Use instead$prefix
variable. autotools have/usr/local
as default, debhelper reset to/usr
(No need to set manually)Suggested fixes:
spamdyke/Makefile.in
defineprefix
and change symbolic link target.prefix := @prefix@ ... install: spamdyke mkdir -p ${DESTDIR}$(prefix)/bin/ cp spamdyke ${DESTDIR}$(prefix)/bin/spamdyke-@PACKAGE_VERSION@ rm -f ${DESTDIR}$(prefix)/bin/spamdyke ln -s $(prefix)/bin/spamdyke-@PACKAGE_VERSION@ ${DESTDIR}$(prefix)/bin/spamdyke
debian/rules
remove the override#!/usr/bin/make -f export DH_VERBOSE=1 %: dh $@ --sourcedirectory=spamdyke
Reference: GNU Coding Standards
Related videos on Youtube
Marcin Orlowski
Updated on September 18, 2022Comments
-
Marcin Orlowski over 1 year
I am trying to turn Spamdyke 4.3.1 (download link) into Debian package (
.deb
). This is pretty easy software to build, no crazy dependencies, justlibssl-dev
so:apt-get install build-essential devscripts \ debhelper dh-make libssl-dev
and then once you unpack the sources:
cd spamdyke-4.3.1/spamdyke ./configure --exec_prefix=/usr make
and usual
make install
As I am willing to make the Debian package out of this software, I created all the necessary files in
debian/
folder and modified itsinstall
target inspamdyke/Makefile.in
by adding${DESTDIR}
:install: spamdyke cp spamdyke ${DESTDIR}/usr/local/bin/spamdyke-@PACKAGE_VERSION@ rm -f ${DESTDIR}/usr/local/bin/spamdyke ln -s ${DESTDIR}/usr/local/bin/spamdyke-@PACKAGE_VERSION@ ${DESTDIR}/usr/local/bin/spamdyke
But my current problem is that the distribution archive keeps all the sources in
spamdyke/
folder instead of root folder which is not whatdh_*
tools expect to do all the heavy lifting automatically:drwxr-xr-x 4 vagrant vagrant 4096 Feb 3 10:57 debian drwxr-xr-x 3 vagrant vagrant 4096 Jan 30 19:43 documentation drwxr-xr-x 2 vagrant vagrant 4096 Feb 5 21:00 spamdyke drwxr-xr-x 997 vagrant vagrant 77824 Jan 30 19:43 tests drwxr-xr-x 2 vagrant vagrant 4096 Jan 20 2012 utils
Unfortunately I am unable to create correct
debian/rules
to make all the packaging work. I would love to keep mydebian/rules
as simple as possible and frankly I hoped that pointing it tospamdyke
source folder with--builddirectory
option would be sufficient at least for configure and build steps. My currentdebian/rules
now looks like this:#!/usr/bin/make -f export DH_VERBOSE = 1 %: dh $@ --builddirectory=spamdyke override_dh_auto_configure: dh_auto_configure --builddirectory=spamdyke -- --exec_prefix=/usr override_dh_auto_build: dh_auto_make --builddirectory=spamdyke
however
debuild -b -us -uc
produces pretty empty.deb
package in result, with lintian complaining aboutempty-binary-package
:dpkg-genchanges: binary-only upload (no source code included) dpkg-source --after-build spamdyke-4.3.1 dpkg-buildpackage: binary-only upload (no source included) Now running lintian... W: spamdyke: new-package-should-close-itp-bug E: spamdyke: copyright-should-refer-to-common-license-file-for-gpl W: spamdyke: empty-binary-package Finished running lintian.
I hope must be missing something obvious here, but at the moment I am unable to find out what to search for. Any hints appreciated. Thanks in advance.
-
Marcin Orlowski about 7 yearsThanks for the answer. Indeed
--sourcedirectory
seemed the missing thing, so at least it builds now, but I am now failing oninstall
target with step ` cp spamdyke ${DESTDIR}${PREFIX}/spamdyke-@PACKAGE_VERSION@` ($PREFIX
isPREFIX = /usr/local/bin
) which unwraps tocp spamdyke /home/vagrant/spamdyke4/spamdyke-4.3.1/debian/spamdyke/usr/local/bin/spamdyke-4.3.1
which does not seem correct. Any further hints? -
user.dz about 7 years@MarcinOrlowski , Is it possible to share your current working tree , through a git repo or something? At least can try it locally. Packager should never make any changes to the source only through Debian quilt patches or submitting changes upstream. Packager owns only
debian
folder. -
Marcin Orlowski about 7 yearsI am aware of flaws of my attempt but my current goal is to make .deb with just the binary. I do not care docs etc - it's for internal purposes. Once I got this done I will try to make it more "by the book". As for repo: github.com/MarcinOrlowski/deb-test - I recreated it from scratch commiting each step separately so you can trace what I do wrong. Funny thing though is that now I can be
.deb
built with binary inside (yes!) - still, symlink made byinstall
is wrong right now but that's cosmetic I believe, so it seemed if fcked something in meantime too. Please take a look though -
Marcin Orlowski about 7 yearsI finally have deb more/less done, yet I am not sure about
$PREFIX
thing you mentioned. Using$PREFIX
gives no effect as it is not initialized. I also saw some example (linkusing$prefix
yet these were initialized manually. What do I miss? My recent version is on github -
user.dz about 7 years@MarcinOrlowski, agree, the project does not use
Makefile.am
so the definition is not insert automatically, but it uses autoreconf ., I just tested it, few min i will update my answer -
Marcin Orlowski about 7 yearsI applied what you suggested and it works perfect, w/o the need of overriding targets. Thanks again for all your efforts and assistance. Really appreciated.