User Tools

Site Tools


how_to_build_a_debian_package

How To Build a Debian Package for Raspberry pi

In this tutorial, all examples are related to the building of the owncloud-client package for raspberry pi like described in Building owncloud client for Raspberry pi's raspbian. I assume files needed in the package are already copied in the deb/owncloud folder.

Fin dependencies

To find dependencies to declare in the deb package control file, use readelf command:

readelf -d /usr/local/bin/owncloud
readelf -d /usr/local/lib/arm-linux-gnueabihf/libowncloud_csync.so.2.5.0
readelf -d /usr/local/lib/arm-linux-gnueabihf/libowncloudsync.so.2.5.0

The output is like this:

 0x00000001 (NEEDED)                     Shared library: [libQt5DBus.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5WebKitWidgets.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5Xml.so.5]
 0x00000001 (NEEDED)                     Shared library: [libowncloudsync.so.0]
 0x00000001 (NEEDED)                     Shared library: [libowncloud_csync.so.0]
 0x00000001 (NEEDED)                     Shared library: [libsqlite3.so.0]
 0x00000001 (NEEDED)                     Shared library: [libQt5Concurrent.so.5]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libqt5keychain.so.1]
 0x00000001 (NEEDED)                     Shared library: [libQt5Widgets.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5WebKit.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5Network.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5Gui.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5Core.so.5]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [ld-linux-armhf.so.3]

Just find the corresponding packages using apt search and add them in dependencies list.

Create package

First, create DEBIAN folder:

cd /home/pi/dev/owncloud-client/deb/owncloud-client
mkdir DEBIAN

Then, create a control file for he package:

vim DEBIAN/control

The content:

control
Package: owncloud-client
Version: 2.1.0+debian+rpi1
Homepage: https://wiki.sgripon.net/doku.php?id=building_owncloud_client_for_raspberry_pi
Depends: libc6 (>= 2.13-28), libgcc1 (>= 1:4.4.0), libqt4-network (>= 4:4.7.0~beta1), libqt4-test (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqtcore4 (>= 4:4.8.0), libqtgui4 (>= 4:4.7.0~beta1), libqtkeychain0 (>= 0.1.0), libstdc++6 (>= 4.4.0), libqtwebkit4, libqt4-xmlpatterns
Priority: optional
Section: net
Architecture: armhf
Essential: no
Installed-Size: 1024
Maintainer: Sebastien Gripon <oc-rpi-deb@sgripon.net>
Description: GUI app to sync a folder to ownCloud
 Specify one ore more directories on the local machine to sync your ownCloud
 server, and always have your latest files wherever you are. Make a change to
 the files on one computer, it will flow across the others using these desktop
 sync clients.

It is also to add a post installation script in order to update dynamic libraries links:

vim /home/pi/dev/owncloud-client/deb/owncloud-client/DEBIAN/postinst
postinst
#!/bin/sh
set -e
 
echo "Postinst running ..."
ldconfig
echo "Done"

And give the good credentials:

sudo chmod 0755 /home/pi/dev/owncloud-client/deb/owncloud-client/DEBIAN/postinst

Then build the package:

cd /home/pi/dev/owncloud-client/deb
dpkg-deb --build owncloud-client

After that, you just have to install it:

sudo dpkg -i owncloud-client.deb

References

how_to_build_a_debian_package.txt · Last modified: 2018/11/01 22:56 by sgripon

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki