I think the important thing your build is missing is that on make install the Makefile honours the DESTDIR variable (which on packaging target should be something like ./debian/myprog).
After the build, before the packaging, the library should be in myprog-1.1.0/debian/myprog/usr/lib not tmp.
Just as reference: Following is a minimal working example and the commands I've used to get the package. Put all these files in the directory myprog-1.0.1.
Makefile:
CFLAGS += -O2 -Wall LIBS += -L$(BUILDDIR)/usr/lib -lfunc ifeq ($(BUILDDIR),) BUILDDIR = build endif all: $(BUILDDIR)/usr/bin/myprog $(BUILDDIR)/usr/lib/libfunc.so install: $(BUILDDIR)/usr/bin/myprog $(BUILDDIR)/usr/lib/libfunc.so mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/lib cp $(BUILDDIR)/usr/bin/myprog $(DESTDIR)/usr/bin cp $(BUILDDIR)/usr/lib/libfunc.so $(DESTDIR)/usr/lib dir-stamp: mkdir -p $(BUILDDIR)/usr/bin $(BUILDDIR)/usr/lib touch $@ $(BUILDDIR)/usr/bin/myprog: myprog.c $(BUILDDIR)/usr/lib/libfunc.so $(CC) $(CFLAGS) -o $@ $< $(LIBS) $(BUILDDIR)/usr/lib/libfunc.so: func.c dir-stamp $(CC) $(CFLAGS) -shared -o $@ $< clean: -rm -fr dir-stamp $(BUILDDIR)
myprog.c:
#include <stdio.h> #include <stdlib.h> #include "func.h" int main(int argc, char **argv) { printf("%d\n", func(atoi(argv[1]), atoi(argv[2]))); return 0; }
func.h:
#ifndef FUNC_H #define FUNC_H int func(int a, int b); #endif
func.c:
#include "func.h" int func(int a, int b) { return a + b; }
And here the commands:
dh_make --createorig #choose type of package (single) rm debian/*.ex debian/*.EX (if not needed) # update: depcheck against the built command dpkg-depcheck -d ./build/usr/bin/myprog 1 1 #edit debian/control (add Build-Depends) dpkg-buildpackage -us -uc -rfakeroot dpkg --contents ../myprog_1.0.1-1_i386.deb ./ ./usr/ ./usr/share/ ./usr/share/doc/ ./usr/share/doc/myprog/ ./usr/share/doc/myprog/changelog.Debian.gz ./usr/share/doc/myprog/copyright ./usr/share/doc/myprog/README.Debian ./usr/lib/ ./usr/lib/libfunc.so ./usr/bin/ ./usr/bin/myprog
Using cmake:
I'm not confident with cmake, but a quick test worked.
The only odd thing is the prefix at command line to generate the Makefile, could be a problem depending on the complexity of your project.
By default cmake uses /usr/local as prefix the an error is given building the package on rmdir, but using /usr works.
Notice also I've added OWNER_WRITE, because there was an error removing myprog rpath, there's probably a better way to set the wanted permissions correctly.
CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(myprog C) ADD_DEFINITIONS(-O2 -Wall) ADD_EXECUTABLE(myprog myprog.c) ADD_LIBRARY(func SHARED func.c) TARGET_LINK_LIBRARIES(myprog func) INSTALL(TARGETS myprog DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) INSTALL(TARGETS func DESTINATION "lib" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
Generate the Makefile using:
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
.debfile? If the files are not in there, is your.dsccorrect and referring to the libraries that need to be included in your.deb?debuild -uc -us.debuildis from thedevscriptspackage. What you you using to look inside the debian binary package?.debfiles, but I think you are missing something in your.dscif things get compiled but not included in the.deb.