File: rules

package info (click to toggle)
ircd-irc2 2.11.2p3~dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,120 kB
  • ctags: 3,232
  • sloc: ansic: 39,108; sh: 3,139; makefile: 393
file content (114 lines) | stat: -rwxr-xr-x 3,656 bytes parent folder | download
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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

# We copy around a number of things in case we're linux:
BUILD_OS=$(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)

export PROC := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	BUILDFLAGS += OPTIMIZE=-O0
else
	BUILDFLAGS += OPTIMIZE=-O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

DEBVERSION := $(shell head -n 1 debian/changelog \
		    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
UPVERSION := $(shell echo $(DEBVERSION) | sed 's/~dfsg-.//')

FILENAME := ircd-irc2_$(UPVERSION)~dfsg.orig.tar.gz
UPFILENAME := ircd-irc2_$(UPVERSION).orig.tar.gz
URL := http://ftp.irc.org/ftp/irc/server/irc$(UPVERSION).tgz

%:
	dh "$@" --with autotools_dev --with systemd

override_dh_auto_configure:
	mkdir builddir
	cp debian/maint/config.h builddir
	cp support/configure builddir
	cd builddir;./configure \
		CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--host=$(DEB_HOST_GNU_TYPE) \
		--bindir=/usr/bin \
		--datadir=/usr/share \
		--infodir=\$${prefix}/share/info \
		--localstatedir=/var \
		--with-rundir=/var/run/ircd \
		--mandir=\$${prefix}/share/man \
		--prefix=/usr \
		--sbindir=/usr/sbin \
		--sysconfdir=/etc/ircd \
		--with-logdir=/var/log/ircd \
		--with-zlib \
		--enable-ipv6

override_dh_auto_build:
	$(MAKE) -C builddir all

override_dh_clean:
	-rm -rf builddir
	-rm -f $(shell support/config.guess)
	dh_clean
	
override_dh_install:
	ln -sf builddir $(shell support/config.guess)
	cd builddir;../ircd/buildm4 ircd.m4
	dh_install
	# ircd-package
	cp builddir/chkconf debian/ircd-irc2/usr/sbin
	cp builddir/iauth debian/ircd-irc2/usr/sbin
	cp builddir/ircd debian/ircd-irc2/usr/sbin
	cp builddir/ircd-mkpasswd debian/ircd-irc2/usr/sbin 
	cp builddir/ircdwatch debian/ircd-irc2/usr/sbin

override_dh_installexamples:
	dh_installexamples
	# convert example config to % since we're IPv6 now
	sed -i -e '/^[^#]:/s,:,\%,g' debian/ircd-irc2/usr/share/doc/ircd-irc2/ircd.conf.example

override_dh_installinfo:
	dh_installinfo
	# synthesize dircategory and direntry
	mkdir -p debian/ircd-irc2/usr/share/info/
	cat debian/ircd-irc2.info-dir-entry doc/INSTALL.info >debian/ircd-irc2/usr/share/info/ircd-irc2.info

override_dh_fixperms:
	dh_fixperms
	# fix permissions of var/log/ircd
	chown irc:irc debian/ircd-irc2/var/log/ircd
	chmod -R 0755 debian/ircd-irc2/var/log/ircd

print-version:
	@@echo "Debian version:          $(DEBVERSION)"
	@@echo "Upstream version:        $(UPVERSION)"
get-orig-source:
	@@dh_testdir
	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
	@@#this is for stable versions
	@@echo Downloading $(UPFILENAME) from $(URL) ...
	@@wget -nv -T10 -t3 -O ../tarballs/$(UPFILENAME) $(URL)
	@@echo 'Repacking as DFSG-free (RFCs)...'
	@@mkdir -p ../tarballs/ircd-irc2-$(UPVERSION).tmp/
	@@cd ../tarballs/ircd-irc2-$(UPVERSION).tmp ; tar xfz ../$(UPFILENAME)
	@@find ../tarballs/ircd-irc2-$(UPVERSION).tmp/ -iname 'rfc*' -delete
	@@echo Writing archive ../tarballs/$(FILENAME) ...
	@@cd ../tarballs/ircd-irc2-$(UPVERSION).tmp ; tar cfz ../$(FILENAME) *
	@@echo Cleaning up...
	@@$(RM) -rf ../tarballs/ircd-irc2-$(UPVERSION).tmp/ ../tarballs/$(UPFILENAME)