Search code examples
linuxubuntumakefiledebdpkg

Debian / Ubuntu package installed in root as default


Created a simple debian/ubuntu package with some library files (*.so).

Works fine except, it installs them as default in the root path "/".

Since I've recreated my Makefile to output to $DESTDIR/ instead of "the usual" directory that I provide in the Makefile, when compiling from source, how do I now set the path of where the files should be installed now? I know there are several choices when using dh_make to create the package, "s" being the default one. Still, can't seem to find anything on where to tell dpkg to put the installed files.

Secondly, a Deb Library package containing only ".so" files should still be a "Single binary" since I gather that using the Library is for development purposes? Since this is a library, I just wanna make sure that's not the cause of the files being installed in the wrong location. What I mean is .so files and header files installation?

What I've used:

dh_make -e [email protected] -f ../myfile-1.0.tar.gz
dpkg-buildpackage -rfakeroot

and some configurations set i debian/control, $DESTDIR in Makefile.


Solution

  • Seems that it was fairly simple, yet very confusing. This works, not sure if there is a better solution.

    In my makefile I have a few variables

    InstallTo = /usr/lib
    
    install:
          mkdir -p $(DESTDIR)$(InstallTo)
          cp $FILE_TO_COPY $(DESTDIR)$(InstallTo)
    

    This way it will create the directory tree inside the *.deb file. I had some trouble using /usr/local/lib instead of /usr/lib/ and rmdir complained when trying to delete it and it had no files (just directories). Not sure why, but changed it to /usr/lib instead.

    Since someone voted this up, I'm guessing someone were also looking for the answer and this is my solution. Perhaps someone can provide a better one if there is one.

    Just a note, $DESTDIR variable is the variable that dh_make suggest the user to use in our Makefile. It's the path to where dpkg will build the program and where it will install it so it can be included in the .deb file.