|
| 1 | +# vim:ft=automake |
| 2 | +# included from Top Level Makefile.am |
| 3 | +# All paths should be given relative to the root |
| 4 | + |
| 5 | +EXTRA_DIST+= debian/changelog |
| 6 | +EXTRA_DIST+= debian/control |
| 7 | +EXTRA_DIST+= debian/control.in |
| 8 | +EXTRA_DIST+= debian/copyright |
| 9 | +EXTRA_DIST+= debian/include.am |
| 10 | + |
| 11 | +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 12 | + |
| 13 | +deb: |
| 14 | +# Setup meta folders |
| 15 | + mkdir -p debian/libwolfpkcs11/DEBIAN debian/libwolfpkcs11-dev/DEBIAN |
| 16 | +# "Install" wolfPKCS11 |
| 17 | + make install exec_prefix=$(CURDIR)/debian/libwolfpkcs11/usr \ |
| 18 | + prefix=$(CURDIR)/debian/libwolfpkcs11-dev/usr |
| 19 | +# deb shared lib stuff |
| 20 | + fakeroot dh_makeshlibs |
| 21 | + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info |
| 22 | + dh_installdeb |
| 23 | +# Generate the lib and src descriptions |
| 24 | + fakeroot dh_gencontrol |
| 25 | +# Make adjustments to the package structure and to satisfy lintian checks |
| 26 | +# Correct doc dir name |
| 27 | + @rm -rf debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev |
| 28 | + @if [ -d debian/libwolfpkcs11-dev/usr/share/doc/wolfpkcs11 ]; then \ |
| 29 | + mv debian/libwolfpkcs11-dev/usr/share/doc/wolfpkcs11 \ |
| 30 | + debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev; \ |
| 31 | + else \ |
| 32 | + mkdir -p debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev; \ |
| 33 | + fi |
| 34 | +# Clear lib folder |
| 35 | + @rm -rf debian/libwolfpkcs11-dev/usr/lib |
| 36 | + @mkdir -p debian/libwolfpkcs11-dev/usr/lib |
| 37 | +# Move the top level .so into the dev pkg |
| 38 | + @mv debian/libwolfpkcs11/usr/lib/libwolfpkcs11.so debian/libwolfpkcs11-dev/usr/lib |
| 39 | +# Create correct pkg doc dir |
| 40 | + @rm -rf debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11 |
| 41 | + @mkdir -p debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11 |
| 42 | +# Place changelog |
| 43 | + @gzip -n -9 -c debian/changelog | \ |
| 44 | + tee debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11/changelog.gz > \ |
| 45 | + debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev/changelog.gz |
| 46 | +# Place copyright |
| 47 | + @cp debian/copyright debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11 |
| 48 | + @cp debian/copyright debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev |
| 49 | +# Remove .la file https://wiki.debian.org/ReleaseGoals/LAFileRemoval |
| 50 | + @rm debian/libwolfpkcs11/usr/lib/libwolfpkcs11.la |
| 51 | +# Strip unwanted symbols |
| 52 | +# https://www.debian.org/doc/debian-policy/ch-files.html#binaries |
| 53 | + @strip --strip-unneeded debian/libwolfpkcs11/usr/lib/libwolfpkcs11.so.*.*.* |
| 54 | +# Place pkgconfig so that it is available for cross-compilation |
| 55 | +# https://lintian.debian.org/tags/pkg-config-unavailable-for-cross-compilation |
| 56 | + @rm -rf debian/libwolfpkcs11/usr/lib/$(DEB_HOST_MULTIARCH) |
| 57 | + @mkdir -p debian/libwolfpkcs11/usr/lib/$(DEB_HOST_MULTIARCH) |
| 58 | + @if [ -d debian/libwolfpkcs11/usr/lib/pkgconfig ]; then \ |
| 59 | + mv debian/libwolfpkcs11/usr/lib/pkgconfig \ |
| 60 | + debian/libwolfpkcs11/usr/lib/$(DEB_HOST_MULTIARCH); \ |
| 61 | + fi |
| 62 | +# Set the expected access rules |
| 63 | + @chmod 644 debian/libwolfpkcs11/usr/lib/libwolfpkcs11.so.*.*.* |
| 64 | + @chmod 644 debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11/changelog.gz \ |
| 65 | + debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11/copyright \ |
| 66 | + debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev/changelog.gz \ |
| 67 | + debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev/copyright |
| 68 | +# Do this as the last step to mark all directories with the correct access bits |
| 69 | + @find debian/libwolfpkcs11*/usr -type d | xargs chmod 755 |
| 70 | +# Generate debs |
| 71 | + dpkg-deb --root-owner-group -b debian/libwolfpkcs11 . |
| 72 | + dpkg-deb --root-owner-group -b debian/libwolfpkcs11-dev . |
| 73 | +# Check that everything is correct with lintian |
| 74 | +# - we don't provide a manual page for wolfpkcs11-config |
| 75 | +# - we don't care about matching the soname for our debs |
| 76 | + lintian *.deb --fail-on error,warning --tag-display-limit 0 \ |
| 77 | + --suppress-tags no-manual-page,package-name-doesnt-match-sonames |
| 78 | +# Clean up the working dirs |
| 79 | + make deb-clean |
| 80 | + |
| 81 | +deb-clean: |
| 82 | + rm -rf debian/libwolfpkcs11 debian/libwolfpkcs11-dev debian/files \ |
| 83 | + debian/*.substvars debian/.debhelper |
0 commit comments