4

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, just libssl-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 its install target in spamdyke/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 what dh_* 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 my debian/rules as simple as possible and frankly I hoped that pointing it to spamdyke source folder with --builddirectory option would be sufficient at least for configure and build steps. My current debian/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 about empty-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.

3

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 define prefix 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

  • 1
    Thanks for the answer. Indeed --sourcedirectory seemed the missing thing, so at least it builds now, but I am now failing on install target with step ` cp spamdyke ${DESTDIR}${PREFIX}/spamdyke-@PACKAGE_VERSION@` ($PREFIX is PREFIX = /usr/local/bin) which unwraps to cp 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? – Marcin Orlowski Apr 23 '17 at 11:45
  • @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. – user.dz Apr 23 '17 at 12:00
  • I 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 by install 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 Apr 23 '17 at 13:23
  • 1
    @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 – user.dz Apr 23 '17 at 16:54
  • 1
    I 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. – Marcin Orlowski Apr 23 '17 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.