File: rules

package info (click to toggle)
spamassassin 4.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,988 kB
  • sloc: perl: 88,863; ansic: 5,193; sh: 3,737; javascript: 339; sql: 295; makefile: 209; python: 49
file content (139 lines) | stat: -rwxr-xr-x 4,764 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/make -f
#
# SpamAssassin debian/rules
# (C) 2004-2008 Duncan Findlay <duncf@debian.org>
# (C) 2008-2020 Noah Meyerhans <noahm@debian.org>
# (C) 2022 Andreas Metzler <ametzler@debian.org>
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

include /usr/share/dpkg/buildflags.mk

# The architecture-dependent portion of this package can be built separately
# (i.e. without building the rest).

SOURCE := $(shell dpkg-parsechangelog -SSource)
VERSION := $(shell dpkg-parsechangelog -SVersion)
VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,')

DIR_ORIG = ../orig/$(SOURCE)-$(VERSION_UPSTREAM)
TAR_ORIG_NAME = $(SOURCE)_$(VERSION_UPSTREAM).orig.tar.xz
TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))

orig: $(DIR_ORIG)
	rsync --delete --exclude /debian --exclude .svk --exclude .svn --exclude .git --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
	QUILT_PATCHES='$(CURDIR)/debian/patches' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0

$(DIR_ORIG):
ifeq ($(TAR_ORIG),)
	$(error Cannot find orig tarball $(TAR_ORIG_NAME))
else
	mkdir -p ../orig
	tar -C ../orig -xaf $(TAR_ORIG)
endif


%:
	dh $@ --no-parallel

# For building both spamc and spamassassin
override_dh_auto_configure:
	dh_auto_configure --verbose -- \
		LDFLAGS="$(LDFLAGS)" \
		DESTDIR=$(CURDIR)/debian/spamassassin \
		CONFDIR=/etc/spamassassin \
		ENABLE_SSL=yes

override_dh_auto_clean:
	dh_auto_clean --verbose
	[ ! -f Makefile ] || $(MAKE) veryclean

	rm -f rules/70_sandbox.cf rules/72_active.cf
	rm -f spamd/spamc.1p sa-awl.1p sa-check_spamd.1p
	rm -Rf t/log/* t/home
	rm -f debian/semantic.cache Mail-SpamAssassin-*.tar.gz

maintainerclean:
	dh_testdir
	rm -f build-indep-stamp build-arch-stamp configure-stamp
	rm -rf $(filter-out debian .svk .svn .git, $(wildcard * .[^.]*))


override_dh_auto_test:
	env CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
		dh_auto_test --verbose --no-parallel -- HOME=$(CURDIR)/t/home \
		LDFLAGS="$(LDFLAGS)"

override_dh_auto_build-indep:
	dh_auto_build --verbose --no-parallel

	pod2man sa-awl.raw sa-awl.1p
	pod2man sa-check_spamd.raw sa-check_spamd.1p

override_dh_auto_build-arch:
	env CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
		dh_auto_build --verbose --no-parallel -- \
		spamc/spamc

	-mkdir -p blib/man1
	pod2man spamc/spamc.pod blib/man1/spamc.1p

override_dh_installsystemd-indep:
	dh_installsystemd -pspamassassin --no-enable --no-start --name spamassassin-maintenance
	dh_installsystemd -Nspamassassin

# SpamAssassin and sa-compile:
override_dh_auto_install-indep:
	dh_auto_install --verbose --no-parallel \
		--destdir=$(CURDIR)/debian/spamassassin

	rm -f debian/spamassassin/usr/bin/spamc debian/spamassassin/usr/share/man/man1/spamc.1p
#	...and sa-compile
	rm -f debian/spamassassin/usr/bin/sa-compile debian/spamassassin/usr/share/man/man1/sa-compile.1p

#	Move spamd to /usr/sbin + fix the man file
	sed 's#SPAMD 1#SPAMD 8#' \
	 debian/spamassassin/usr/share/man/man1/spamd.1p \
	 > debian/spamd/usr/share/man/man8/spamd.8p
	rm -f debian/spamassassin/usr/share/man/man1/spamd.1p

	mv debian/spamassassin/usr/bin/spamd debian/spamd/usr/sbin/

#	These files are renamed upon installation, which dh_install
#	doesn't support, so we do it "the old fashioned way":
	install -m755 debian/spamassassin-maint.sh \
		debian/spamassassin/usr/sbin/spamassassin-maint

	install -m644 ldap/README \
		debian/spamd/usr/share/doc/spamd/README.ldap
	install -m644 spamd/README \
		debian/spamd/usr/share/doc/spamd/README.spamd

override_dh_install-indep:
	dh_install
	rm -f debian/spamassassin/usr/share/spamassassin/70_sandbox.cf \
		debian/spamassassin/usr/share/spamassassin/sandbox-*.pm \
		debian/spamassassin/usr/share/spamassassin/*.pre

#	 File modes are inconsistent in upstream's rules repositories. Set them to something sane:
	chmod 644 debian/spamassassin/usr/share/spamassassin/*.cf


# spamc (arch specific) rules follow
override_dh_auto_install-arch:
	install -m755 spamc/spamc debian/spamc/usr/bin/spamc