1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
#!/usr/bin/make -f
# temporarily deactivate tests
# ... and maybe we are back with testing again
#export LOCAL_DEB_BUILD_OPTIONS = nocheck
derives_from_ubuntu := $(shell (dpkg-vendor --derives-from Ubuntu && echo "yes") || echo "no")
# Enabling PIE globally doesn't work, but ./configure already enables PIE
# where necessary.
# temporarily deactivate tests
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
arch = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes) $(DEB_HOST_ARCH), yes i386)
skip_packages = -Ncups -Ncups-core-drivers
endif
# The build system uses only DSOFLAGS but not LDFLAGS to build some libraries.
# Add LDFLAGS to enable (hardening) build flags.
export DSOFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
%:
dh $@ --without autoreconf
ifeq ($(DEB_HOST_ARCH_OS),hurd)
CONFIG_LIBUSB=--disable-libusb
else
CONFIG_LIBUSB=--enable-libusb
endif
ifeq ($(derives_from_ubuntu),yes)
CUPS_CONFIGURE_DISTRO_OPTIONS=--disable-browsing
else
CUPS_CONFIGURE_DISTRO_OPTIONS=
endif
override_dh_auto_configure:
# Rebuild ./configure to get build system patches working
aclocal
autoconf
# --with-error-policy=retry-job # Set default job error policy to "retry-job", since it is less confusing and a better default on most machines
# --enable-sync-on-close # Set SyncOnClose to yes; considered saner on Linux
# --with-max-log-size=0 # Deactivate CUPS' internal logrotating, as we provide a better one, especially LogLevel debug2 gets usable now
dh_auto_configure -- \
$(CUPS_CONFIGURE_DISTRO_OPTIONS) \
--with-docdir=/usr/share/cups/doc-root \
--localedir=/usr/share/cups/locale \
--enable-libpaper \
--enable-ssl \
--enable-gnutls \
--enable-threads \
--enable-static \
--enable-debug \
--enable-dbus \
--with-dbusdir=/etc/dbus-1 \
--enable-gssapi \
--enable-avahi \
--disable-launchd \
--with-cups-group=lp \
--with-system-groups="root lpadmin" \
--with-rundir=/run/cups \
--with-printcap=/run/cups/printcap \
--with-log-file-perm=0640 \
--with-local_protocols='dnssd' \
--with-systemd=/usr/lib/systemd/system \
--with-error-policy=retry-job \
--enable-sync-on-close \
--with-max-log-size=0 \
$(CONFIG_LIBUSB)
override_dh_auto_install:
dh_auto_install -- install BUILDROOT=$(shell pwd)/debian/tmp
MANPAGES_L10N_CUPS=man1/cups.1 man5/subscriptions.conf.5 man5/mime.convs.5 man7/filter.7 man8/cupsfilter.8 man8/cups-exec.8 man8/cups-deviced.8 man8/cups-driverd.8 man8/cupsd-helper.8 man8/cupsd-lpd.8
MANPAGES_L10N_CUPS=man1/cups.1 man5/subscriptions.conf.5 man5/mime.convs.5 man7/filter.7 man8/cupsfilter.8 man8/cups-exec.8 man8/cups-deviced.8 man8/cups-driverd.8 man8/cupsd-helper.8 man8/cups-lpd.8
MANPAGES_L10N_CUPS_SERVER_COMMON=man5/cupsd-logs.conf.5 man5/cupsd-logs.5
MANPAGES_L10N_CUPS_DAEMON=man5/classes.conf.5 man5/cupsd.conf.5 man5/cups-files.conf.5 man5/cups-snmp.conf.5 man5/mailto.conf.5 man5/mime.types.5 man5/printers.conf.5 man7/backend.7 man7/notifier.7 man8/cupsd.8 man8/cups-snmp.8
MANPAGES_L10N_CUPS_CLIENT=man1/cupstestppd.1 man1/lp.1 man1/lpoptions.1 man1/lppasswd.1 man1/lpstat.1 man1/cancel.1 man5/client.conf.5 man8/cupsenable.8 man8/lpadmin.8 man8/lpinfo.8 man8/lpmove.8 man8/cupsreject.8 man8/cupsdisable.8 man8/cupsaccept.8 man8/cupsctl.8
MANPAGES_L10N_CUPS_BSD=man1/lpr.1 man1/lprm.1 man1/lpq.1 man8/lpc.8
MANPAGES_L10N_CUPS_IPP_UTILS=man1/ippeveprinter.1 man1/ippfind.1 man1/ipptool.1 man5/ipptoolfile.5 man7/ippeveps.7 man7/ippevepcl.7
MANPAGES_L10N_CUPS_LIBCUPS2_DEV=man1/cups-config.1
MANPAGES_L10N_CUPS_PPDC=man1/ppdc.1 man1/ppdhtml.1 man1/ppdi.1 man1/ppdmerge.1 man1/ppdpo.1 man5/ppdcfile.5
override_dh_installman:
dh_installman
ifneq (,$(filter libcups2-dev,$(shell dh_listpackages)))
# Try to install the translated manpages to libcups2-dev
set -e; for m in $(MANPAGES_L10N_CUPS_LIBCUPS2_DEV); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
if [ -L $$manp ]; then \
ln -sf $$(readlink $$manp) $$(echo $$manp | sed -e 's#^debian/tmp#debian/libcups2-dev#');\
else \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/libcups2-dev#');\
fi; \
fi; \
done; \
done
endif
ifneq (,$(filter cups-ppdc,$(shell dh_listpackages)))
# Try to install the translated manpages to cups-ppdc
set -e; for m in $(MANPAGES_L10N_CUPS_PPDC); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
if [ -L $$manp ]; then \
ln -sf $$(readlink $$manp) $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-ppdc#');\
else \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-ppdc#');\
fi; \
fi; \
done; \
done
endif
ifneq (,$(filter cups-server-common,$(shell dh_listpackages)))
# Try to install the translated manpages to cups-server-common
set -e; for m in $(MANPAGES_L10N_CUPS_SERVER_COMMON); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
if [ -L $$manp ]; then \
ln -sf $$(readlink $$manp) $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-server-common#');\
else \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-server-common#');\
fi; \
fi; \
done; \
done
endif
ifneq (,$(filter cups,$(shell dh_listpackages)))
# Try to install the translated manpages to cups
set -e; for m in $(MANPAGES_L10N_CUPS); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
if [ -L $$manp ]; then \
ln -sf $$(readlink $$manp) $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups#');\
else \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups#');\
fi; \
fi; \
done; \
done
endif
ifneq (,$(filter cups-daemon,$(shell dh_listpackages)))
# Try to install the translated manpages to cups-daemon
set -e; for m in $(MANPAGES_L10N_CUPS_DAEMON); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
if [ -L $$manp ]; then \
ln -sf $$(readlink $$manp) $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-daemon#');\
else \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-daemon#');\
fi; \
fi; \
done; \
done
endif
ifneq (,$(filter cups-client,$(shell dh_listpackages)))
# Try to install the translated manpages to cups-client
set -e; for m in $(MANPAGES_L10N_CUPS_CLIENT); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
if [ -L $$manp ]; then \
ln -sf $$(readlink $$manp) $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-client#');\
else \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-client#');\
fi; \
fi; \
done; \
done
endif
ifneq (,$(filter cups-bsd,$(shell dh_listpackages)))
# Try to install the translated manpages to cups-bsd
set -e; for m in $(MANPAGES_L10N_CUPS_BSD); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
if [ -L $$manp ]; then \
ln -sf $$(readlink $$manp) $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-bsd#');\
else \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-bsd#');\
fi; \
fi; \
done; \
done
endif
# handling of links does not really work here
ifneq (,$(filter cups-ipp-utils,$(shell dh_listpackages)))
# Try to install the translated manpages to cups-ipp-utils
set -e; for m in $(MANPAGES_L10N_CUPS_IPP_UTILS); do \
for manp in $$(ls debian/tmp/usr/share/man/*/$$m); do \
if [ -r $$manp ]; then \
install -D -m 644 $$manp $$(echo $$manp | sed -e 's#^debian/tmp#debian/cups-ipp-utils#');\
fi; \
done; \
done
endif
override_dh_install:
dh_install
ifneq (,$(filter cups-server-common,$(shell dh_listpackages)))
# Remove all files which get replaced by the ones in the cups-filters
# package
rm -f debian/cups-server-common/usr/share/cups/data/testprint
endif
# Ensure that we don't ship anything in /var/run or /run
rm -rf debian/cups*/var/run
rm -rf debian/cups*/run
ifneq (,$(filter cups,$(shell dh_listpackages)))
# Make the usb backend run as root, since /dev/bus/usb/* are
# root:root in udev < 147, and cups does not use the usblp kernel
# module any more; udev 147 makes most of those printers accessible to
# lp, but apparently not all of them
chmod go-x debian/cups/usr/lib/cups/backend-available/usb
endif
ifneq (,$(filter libcups2-dev,$(shell dh_listpackages)))
# debian/libcups2-dev.install entry cannot rename files on-the-fly
cp cups/language-private.h debian/libcups2-dev/usr/include/cups/i18n.h
# debian/libcups2-dev.install cannot interpolate before compat 13
sed -e 's/@DEB_VERSION_UPSTREAM@/${DEB_VERSION_UPSTREAM}/' < debian/cups.pc.in > debian/cups.pc
install -D -m 644 debian/cups.pc debian/libcups2-dev/usr/lib/${DEB_HOST_GNU_TYPE}/pkgconfig/cups.pc
endif
ifneq (,$(filter cups-daemon,$(shell dh_listpackages)))
# Install AppArmor, ufw profile, and Apport hook
install -D -m 644 debian/local/apparmor-profile debian/cups-daemon/etc/apparmor.d/usr.sbin.cupsd
dh_apparmor --profile-name=usr.sbin.cupsd -p cups-daemon
install -D -m 644 debian/local/cups.ufw.profile debian/cups-daemon/etc/ufw/applications.d/cups
install -D -m 644 debian/local/apport-hook.py debian/cups-daemon/usr/share/apport/package-hooks/source_cups.py
endif
override_dh_installchangelogs:
dh_installchangelogs CHANGES.md
override_dh_installinit:
dh_installinit --name=cups
override_dh_fixperms:
dh_fixperms -Xusr/lib/cups/backend-available
# dh_fixperms has to run before dh_strip_nondeterminism for Rules-Requires-Root: no
override_dh_strip_nondeterminism: override_dh_fixperms
dh_strip_nondeterminism
override_dh_auto_test:
ifeq (,$(findstring nocheck,$(LOCAL_DEB_BUILD_OPTIONS)))
# nowadays even tests that ran on previous versions
# no longer work. maybe some porter can shed some
# light on it. For now, I disable the tests on riscv64
echo ${arch}
if [ "${arch}" = "riscv64" ]; then \
echo "Do not make tests on this architecture" ;\
else \
echo "Do make tests on this architecture" ;\
CUPS_TESTBASE=$(shell mktemp -d /tmp/cups.XXXXXX) dh_auto_test ; \
fi
# Check that cups-config is not architecture-specific
[ -r cups-config ] && grep -vq $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) cups-config
endif
ifeq (,$(findstring noopt,$(LOCAL_DEB_BUILD_OPTIONS)))
override_dh_makeshlibs:
dh_makeshlibs -- -c4
endif
override_dh_auto_clean:
[ ! -f Makedefs ] || dh_auto_clean
rm -f man/client.conf.man packaging/cups.list
rm -f conf/mime.convs conf/snmp.conf init/org.cups.cups-lpd.plist
[ ! -f Makedefs ] || make distclean
override_dh_installdocs:
dh_installdocs -plibcupsimage2-dev --link-doc=libcupsimage2t64
dh_installdocs -pcups-bsd --link-doc=libcups2t64
dh_installdocs --remaining-packages
rm -f debian/libcups2-dev/usr/share/doc/libcups2-dev/examples/scripting/php/*.o
rm -f debian/libcups2-dev/usr/share/doc/libcups2-dev/examples/scripting/php/*.so
override_dh_installpam:
dh_installpam -pcups-daemon --name=cups
dh_installpam --remaining-packages
override_dh_builddeb:
dh_builddeb ${skip_packages}
override_dh_gencontrol:
dh_gencontrol ${skip_packages}
|