Package: fortune-mod / 1:1.99.1-7

shortcut_cookie_lists_build_system.diff Patch series | 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
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
Description: With source format 3.0 (quilt), the sequence
 debuild && debuild clean may result in a succession of
 patch -> build -> unpatch -> clean actions, so that some
 files generated by the patched build system or added cookies
 may not be removed.
 .
 This is worst: upstream build system renames and reencodes
 the cookies during the build...
 .
 We store all generated files in a specific "gen" directory
 to provide an easy work-around in debian/rules clean target, in the
 hope that upstream will copy the idea.
Author: Nicolas Boulenguez <nicolas.boulenguez@free.fr>

Index: b/datfiles/Makefile
===================================================================
--- a/datfiles/Makefile	2012-07-07 17:31:00.000000000 +0200
+++ b/datfiles/Makefile	2012-07-07 17:34:58.000000000 +0200
@@ -1,16 +1,47 @@
+# COOKIEDIR  must point to the installation directory.
+# If OFFENSIVE=1, offensive cookies are installed into OCOOKIEDIR.
+# If WCOOKIEDIR=1, html cookies are installed into WCOOKIEDIR.
 
-COOKIES=art ascii-art computers cookie definitions drugs education ethnic \
-	food fortunes goedel humorists kids law linuxcookie literature \
-	love magic medicine men-women miscellaneous news people pets \
-	platitudes politics riddles science songs-poems sports \
-	startrek translate-me wisdom work linux perl knghtbrd \
-	paradoxum zippy debian disclaimer tao
+COOKIES := $(filter-out gen html off Makefile,$(wildcard *))
+RECODED := $(addprefix gen/,$(COOKIES))
+DAT     := $(addsuffix .dat,$(RECODED))
 
-STRFILE=../util/strfile
+STRFILE := ../util/strfile
 
-.PHONY: all cookies o-cookies w-cookies install clean
+.PHONY: all check clean install
 
-all: cookies o-cookies w-cookies
+all:: $(RECODED) $(DAT)
+
+$(DAT): gen/%.dat: gen/%
+	$(STRFILE) $<
+
+$(RECODED): gen/%: % | gen
+	recode latin1..u8 < $< > $@
+
+gen:
+	mkdir $@
+
+install:: all
+	install -m 0755 -d $(COOKIEDIR)
+	install -m 0644 $(RECODED) $(DAT) $(COOKIEDIR)
+	for i in $(COOKIES) ; do \
+	  ln -sf $$i $(COOKIEDIR)/$$i.u8 ; \
+	done
+
+ifeq (1,$(OFFENSIVE))
+all install::
+	$(MAKE) $@ -C off OCOOKIEDIR=$(OCOOKIEDIR)
+endif
+
+ifeq (1,$(WEB))
+all install::
+	$(MAKE) $@ -C html WCOOKIEDIR=$(WCOOKIEDIR)
+endif
+
+clean::
+	rm -rf gen
+	$(MAKE) $@ -C off
+	$(MAKE) $@ -C html
 
 check:
 	for i in $(COOKIES) ; \
@@ -28,46 +59,3 @@
 			fi; \
 			echo " passed " ;\
 		done;
-
-cookies: cookies-stamp
-
-o-cookies:
-	if [ $(OFFENSIVE) = 1 ] ; then \
-	    cd off && $(MAKE) OCOOKIEDIR=$(OCOOKIEDIR) ; fi
-
-w-cookies:
-	if [ $(WEB) = 1 ] ; then \
-	    cd html && $(MAKE) WCOOKIEDIR=$(WCOOKIEDIR); fi
-
-cookies-stamp:
-	rm -f *.dat
-	for i in $(COOKIES) ; \
-	    do \
-	        if [ ! -f $$i.old ] ; then \
-	        	cp $$i $$i.old; \
-		fi; \
-	        recode latin1..u8 $$i ; \
-		$(STRFILE) $$i ; \
-		ln -s $$i $$i.u8 || exit $? ; \
-	    done
-	touch cookies-stamp
-
-install: cookies-stamp
-	install -m 0755 -d $(COOKIEDIR)
-	if [ $(OFFENSIVE) = 1 ] ; then cd off && $(MAKE) install ; fi
-	if [ $(WEB) = 1 ] ; then cd html && $(MAKE) install ; fi
-	for i in $(COOKIES) ; do \
-		install -m 0644 $$i $$i.dat $(COOKIEDIR) || exit $? ; \
-		cp -d $$i.u8 $(COOKIEDIR) ; \
-		done
-
-clean:
-	rm -f cookies-stamp *.dat
-	rm -f *.u8
-	cd off && $(MAKE) clean
-	cd html && $(MAKE) clean
-	for i in $(COOKIES) ; do \
-		if [ -f $$i.old ] ; then \
-			mv $$i.old $$i; \
-		fi; \
-	done
Index: b/datfiles/off/Makefile
===================================================================
--- a/datfiles/off/Makefile	2012-07-07 17:31:00.000000000 +0200
+++ b/datfiles/off/Makefile	2012-07-07 17:31:06.000000000 +0200
@@ -1,52 +1,31 @@
+# OCOOKIEDIR must point to the installation directory.
 
-OCOOKIES_UNROTATED=drugs misandry privates sex astrology ethnic \
-	miscellaneous racism songs-poems black-humor hphobia misogyny \
-	religion vulgarity definitions limerick politics riddles zippy \
-	cookie fortunes linux art atheism debian knghtbrd
-
-OCOOKIES_ROTATED=
-
-OCOOKIES=$(OCOOKIES_UNROTATED) $(OCOOKIES_ROTATED)
-
-STRFILE=../../util/strfile
-ROT=../../util/rot
-
-
-all:	ocookies-stamp
-
-ocookies-stamp:	rotated-stamp
-	rm -f *.dat
-	for i in $(OCOOKIES) ; do $(STRFILE) -x $$i || exit $$? ; done
-	touch ocookies-stamp
-
-rotated-stamp: recoded-stamp
-	for i in $(OCOOKIES_UNROTATED) ; \
-	    do $(ROT) < unrotated/$$i > $$i || exit $$? ; ln -s $$i $$i.u8; done
-	touch rotated-stamp
-
-recoded-stamp:
-	for i in $(OCOOKIES_UNROTATED) ; \
-	    do \
-	        if [ ! -f unrotated/$$i.old ]; then \
-	    	    cp unrotated/$$i unrotated/$$i.old ; \
-		fi; \
-		recode latin1..u8 unrotated/$$i; \
-	    done
-	touch recoded-stamp
-	
-install:
+COOKIES := $(subst unrotated/,,$(wildcard unrotated/*))
+RECODED := $(addprefix gen/,$(COOKIES))
+DAT     := $(addsuffix .dat,$(RECODED))
+
+STRFILE := ../../util/strfile
+ROT     := ../../util/rot
+
+.PHONY: all clean install
+
+all: $(RECODED) $(DAT)
+
+$(DAT): gen/%.dat: gen/%
+	$(STRFILE) -x $<
+
+$(RECODED): gen/%: unrotated/% | gen
+	recode latin1..u8 < $< | $(ROT) > $@
+
+gen:
+	mkdir $@
+
+install: all
 	install -m 0755 -d $(OCOOKIEDIR)
-	for i in $(OCOOKIES) ; \
-	    do install -m 0644 $$i $$i.dat $(OCOOKIEDIR) || exit $$? ; \
-	    cp -d $$i.u8 $(OCOOKIEDIR) ; \
+	install -m 0644 $(RECODED) $(DAT) $(OCOOKIEDIR)
+	for i in $(COOKIES) ; do \
+	  ln -sf $$i $(OCOOKIEDIR)/$$i.u8 ; \
 	done
 
 clean:
-	rm -f ocookies-stamp rotated-stamp recoded-stamp *.dat $(OCOOKIES_UNROTATED)
-	rm -f *u8
-	for i in $(OCOOKIES_UNROTATED) ; do \
-		if [ -f unrotated/$$i.old ] ; then \
-			mv unrotated/$$i.old unrotated/$$i; \
-		fi; \
-	done
-									
+	rm -rf gen