Reputation: 1531
I am trying to build my first library.
Libraries ought to be installed in different architectures. A library built for i386 usually goes at /usr/lib/i386-linux-gnu/ but if built for amd64 it goes to /usr/lib/amd64-linux-gnu/
So, my debian/rules file
#!/usr/bin/make -f
export DH_VERBOSE=1
%:
dh $@
override_dh_auto_configure:
dh_auto_configure -- LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH)
I am able to take the LIB_INSTALL_DIR inside my .pro file:
isEmpty(LIB_INSTALL_DIR){
message("LIB_INSTALL_DIR is empty. It shouldn't be if this isn't an example build.")
DESTDIR = .
} else {
DESTDIR = $$LIB_INSTALL_DIR
}
message(Library will be placed at $$DESTDIR)
The thing is that DESTDIR tries to send the library in my own filesystem and not to build it into the deb package. For example, it tries to send it on my own /usr/lib/i386-linux-gnu/, but it is unable, because it doesn't have the permission to do so.
On the other hand,
target.files = *.so
target.path = $$LIB_INSTALL_DIR
INSTALLS+=target
fails as well. Inside the .deb package I can find the created /usr/lib/i386-linux-gnu/ folder, but it is empty, simply because the INSTALLS runs the installations that it has to do prior to build time, not after it.
Finally, I cannot pass any variable inside debian/install, something that would be very convenient.
I know that this is could also be a Qt question, but I think that this is the right place to ask it because I may be suggested to use some other method for handling this.
Upvotes: 0
Views: 1713
Reputation: 1531
You won't need to edit DESTDIR inside your project file.
Just use:
target.path = $$LIB_INSTALL_DIR
INSTALLS += target
Upvotes: 0
Reputation: 31364
DESTDIR
has a special meaning for install targets: it is used to prefix the actual install targets with an alternative root-directory.
the usual build-systems in Debian make use of this feature by setting DESTDIR
to /path/where/the/package/is/built/debian/tmp
or similar - so this means that a properly working DESTDIR
is crucial to install the files into the package rather than your system.
you might want to have a look how this is handled by other packages that use dh
, CMake
and install into /usr/lib/<arch>
.
a quick search revealed that the libssh2 is such a package, and it uses the following in debian/rules
:
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
%:
dh $@ --with autoreconf
override_dh_auto_configure:
dh_auto_configure -- $(CONFIGURE_EXTRA_FLAGS)
Upvotes: 0