File: rules

package info (click to toggle)
ircd 2.10.07-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,232 kB
  • ctags: 2,253
  • sloc: ansic: 27,541; makefile: 742; sh: 327; perl: 18
file content (170 lines) | stat: -rwxr-xr-x 5,699 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
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
#!/usr/bin/make -f
# Sample debian.rules -*-makefile -*- for GNU Hello (1.3).
# Copyright 1994,1995 by Ian Jackson.
# I hereby give you perpetual unlimited permission to copy,
# modify and relicense this file, provided that you do not remove
# my name from the file itself.  (I assert my moral right of
# paternity under the Copyright, Designs and Patents Act 1988.)

package=ircd

CC = cc
SHELL = /bin/bash

# STOP_BEFORE_HACKS = 1
# STOP_AFTER_HACKS = 1

# This is defined to enable experimental linpeople patches...
# TWEAK=-DZIP_LINKS -DWEB_INTERFACE

# This should never be defined in official Debian release...
# HACK=-DGODMODE -DDEBUG

# This is the filename for the linpeople tarball.
DANCER=dancer-2.10.07+-1

build: build-ircd build-dancer

build-ircd:
	$(checkdir)
	rm -rf builddir && mkdir builddir
	cp -a Makefile.in doc config configure include ircd \
		LICENCE INSTALL .patches .indent.pro builddir
	cp debian/config.ircd builddir/config/.config
	cp debian/config.h.ircd builddir/config/config.h
	rm -f builddir/config/{config.cache,config.log}
	cp -p builddir/.patches debian/patches
	cd builddir && ./configure --prefix=/usr
	cd builddir && $(MAKE) CC="$(CC) $(HACK)" \
		IRCDLIBS="-lresolv -lcrypt" all
	test -f builddir/ircd/ircd && touch build-ircd

build-dancer: build-ircd
	$(checkdir)
	rm -rf debian/build && mkdir debian/build
	mkdir -p debian/build
	cd builddir && \
		cp -a Makefile* doc config configure include ircd \
		LICENCE INSTALL .patches .indent.pro ../debian/build
	cp -a debian/changelog debian/build
	cd debian/build && $(MAKE) distclean > /dev/null
	cp debian/config.dancer debian/build/config/.config
	test -d debian/orig || cp -a debian/build debian/orig
	if [ "$(STOP_BEFORE_HACKS)" != "" ]; then false; fi
	@set -e; echo; for file in hacks/*.hack; do \
		echo "H4x0ring with $$file ..."; \
		patch -d debian/build -s -p1 < $$file; done; echo
	find debian/build -name "*.orig" -print | xargs -r rm -f
	find debian/build -name ".*.orig" -print | xargs -r rm -f
	rm -vf debian/build/config/config.cache
	rm -rf debian/orig && cp -a debian/build debian/orig
	if [ "$(STOP_AFTER_HACKS)" != "" ]; then false; fi
	cp debian/config.dancer debian/build/config/.config
	cp debian/config.dancer debian/build/DEFAULTS
	cp debian/copyright debian/build/LICENSE
	cp debian/changelog debian/build/changelog
	mkdir debian/build/hacks && cp -a hacks/*.hack debian/build/hacks
	cp debian/config.h.dancer debian/build/config/config.h
	cd debian && tar -czf $(DANCER).tar.gz build
	@echo && sleep 3
	cd debian/build && ./configure --prefix=/usr \
		--cache-file=../../../builddir/config/config.cache
	cp debian/config.h.dancer debian/build/config/config.h
	cd debian/build && $(MAKE) \
		CC="$(CC) $(TWEAK) $(HACK)"
	test -f debian/build/ircd/ircd && touch build-dancer

libc5: build-dancer
	rm -rf debian/libc5 && mkdir -p debian/libc5
	cd debian/libc5 && tar -zxf ../$(DANCER).tar.gz
	sed "s/-lresolv -lcrypt//" debian/config.dancer \
		> debian/libc5/build/config/.config
	cd debian/libc5/build && \
		CC="i486-linuxlibc1-gcc" ./configure --prefix=/usr
	sed "s/-lresolv -lcrypt//" debian/config.h.dancer \
		> debian/libc5/build/config/config.h
	cd debian/libc5/build && $(MAKE) \
		CC="i486-linuxlibc1-gcc $(TWEAK) $(HACK)"
	test -f debian/libc5/build/ircd/ircd && touch build-libc5

clean:
	$(checkdir)
	dh_clean
	-$(MAKE) distclean
	rm -rf build-* stamp-configure ircd/crypt/mkpasswd builddir
	rm -rf $$(find . -name "*~") $$(find debian/* -type d)
	rm -rf *~ debian/*.gz debian/*~ debian/patches debian.diff
	find .. -name $(package)*.asc -size 0 -maxdepth 1 -exec rm {} ";"
	chmod +x configure */configure debian/{postinst,postrm} \
		ircd/crypt/sums

binary-indep:	checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch:	checkroot build
	dh_clean -k
	dh_installdirs
	dh_installmanpages doc/irc.1
	dh_installchangelogs
	dh_installdocs debian/{features.2.10,README_SERVER_NUMERIC} \
		debian/{config.*,patches} builddir/INSTALL doc/* debian/*.html
	rm -f debian/tmp/usr/doc/$(package)/{Makefile*,irc.1,ircd.8} \
		debian/tmp/usr/share/doc/$(package)/{Makefile*,irc.1,ircd.8}
	dh_installexamples debian/ircd.{conf,motd}
	cp -p debian/ircd.{conf,motd} debian/tmp/etc/ircd
	dh_compress
	install builddir/ircd/ircd debian/tmp/usr/sbin/ircd
	install debian/build/ircd/ircd debian/tmp/usr/lib/ircd/bin/dancer
	install builddir/ircd/chkconf debian/dancerconfig \
		debian/tmp/usr/lib/ircd/bin/
	rm -rf $$(find debian/tmp -name CVS)
	dh_strip
	dh_shlibdeps
	dh_fixperms
	chmod 660 debian/tmp/etc/$(package)/ircd.conf
	dh_suidregister /usr/sbin/ircd
	dh_installdeb
	dh_gencontrol -u-isp
	dpkg --build debian/tmp ..
	if egrep "^HACK=" debian/rules; then false; fi

define checkdir
	test -f ircd/ircd.c -a -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot

retry:
	rm -rf debian/build debian/orig build-dancer
	$(MAKE) -f debian/rules STOP_AFTER_HACKS=1

reset:
	rm -rf debian/build debian/orig build-dancer
	$(MAKE) -f debian/rules STOP_BEFORE_HACKS=1

try:
	-$(MAKE) -f debian/rules reset
	rm -f hacks/*~
	@echo -e "\n\n"
	patch -d debian/build -s -p1 < hacks/$(PATCH)*

make-diff:
	rm -f $$(find debian/build -name "*.orig" -o -name "*~" \
		-o -name "*.rej")
	cd debian && diff --minimal --new-file --recursive --show-c-function \
	     --unified=3 orig build > ../debian.diff || true
	@echo ; echo ; cat debian.diff