aboutsummaryrefslogtreecommitdiff
path: root/debian/rules
blob: 6a32cc7c09851eaf36b587906ea3ec1fa1ce8ccc (plain)
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
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

SHELL = /bin/bash

package=libcompface

version=1.0.0 #$(shell expr `pwd` : '.*-\([0-9.]*\)')
version_major=1 #$(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')
old_libpath := $(LD_LIBRARY_PATH)
LD_LIBRARY_PATH=shared:$(old_libpath)


build:		build-libc6
	$(checkdir)
	@echo '### Building binaries...'
	$(MAKE) LDFLAGS="-s -L$(CURDIR)/shared"
	touch build

build-libc6:
	$(checkdir)
	@echo LD_LIBRARY_PATH = $(LD_LIBRARY_PATH)
	@echo '### Building libc6/glibc2 libraries...'

	-mkdir shared static
#
# First build the shared library
#
	cd shared && \
	    $(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
		LDFLAGS="-lc"\
	        CFLAGS="-O2 -fPIC -pipe -D_BSD_SOURCE -D_REENTRANT" shared && \
		ln -sf $(package).so $(package).so.$(version_major) &&  \
		ln -sf $(package).so.$(version) $(package).so #&& \
#		strip --strip-unneeded $(package).so.$(version)
#
# Build the static library (it does not need Position Independent Code,
# which reserves one register; thus, without -fPIC we get more efficient
# code).
#
	cd static && \
	     $(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
	          CFLAGS="-O2 -pipe -D_BSD_SOURCE" LDFLAGS="-s" static #&& \
#		  strip --strip-debug $(package).a

	touch build-libc6

build-libc5:
	$(checkdir)
	@echo LD_LIBRARY_PATH = $(LD_LIBRARY_PATH)
	@echo '### Building libc5 libraries...'

	-cat debian/control.libc5 >> debian/control
	-mkdir shared5 static5
#
# First build the shared library
#
	cd shared5 && \
	    $(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
		CC=$(avar)-linuxlibc1-gcc\
		LDFLAGS="-lc"\
	        CFLAGS="-O2 -fPIC -pipe -D_BSD_SOURCE -D_REENTRANT" shared && \
		ln -sf $(package).so $(package).so.$(version_major) &&  \
		ln -sf $(package).so.$(version) $(package).so &&  \
		strip --strip-unneeded $(package).so.$(version)

#
# Build the static library (it does not need Position Independent Code,
# which reserves one register; thus, without -fPIC we get more efficient
# code).
#
	cd static5 && \
	     $(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
		  CC=$(avar)-linuxlibc1-gcc\
	          CFLAGS="-O2 -pipe -D_BSD_SOURCE" LDFLAGS="-s" static && \
		  strip --strip-debug $(package).a

	touch build-libc5

clean:
	$(checkdir)
	-rm -rf static shared static5 shared5
	-rm -f build build-*
	-make clean
	-rm -f `find . -name "*~"`
	-rm -rf debian/tmp `find debian/* -type d ! -name CVS` debian/files* core
	-rm -f debian/*substvars
	-cat debian/control.common > debian/control
	-dh_clean


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 binary-common binary-libc6
	@echo '### Installing architecture dependent files...'
#make install DESTDIR=`pwd`/debian/tmp

	mkdir debian/tmp/usr/share
	mkdir debian/tmp/usr/share/doc
	mv debian/tmp/usr/man debian/tmp/usr/share/
	mv debian/tmp/usr/doc/compface debian/tmp/usr/share/doc/
	mv debian/tmp/usr/doc/libcompfaceg1 debian/tmp/usr/share/doc/
	cp debian/copyright debian/tmp/usr/share/doc/libcompfaceg1
	cp debian/README.debian debian/tmp/usr/share/doc/libcompfaceg1
	cp debian/changelog debian/tmp/usr/share/doc/libcompfaceg1/changelog.Debian
	gzip -9 debian/tmp/usr/share/doc/libcompfaceg1/changelog.Debian
	mv debian/tmp/usr/doc/libcompfaceg1-dev debian/tmp/usr/share/doc/
	#gzip -9 debian/tmp/usr/share/man/man1/compface.1
	rm debian/tmp/usr/share/man/man1/uncompface.1 
	ln -s compface.1.gz debian/tmp/usr/share/man/man1/uncompface.1.gz
# gzip -9 debian/tmp/usr/share/man/man3/compface.3
	-rm debian/tmp/usr/share/man/man3/uncompface.3
	ln -s compface.3.gz debian/tmp/usr/share/man/man3/uncompface.3.gz

	#debstd 


	#-rm -rf debian/tmp/usr/man
	#-rm -rf debian/tmp/usr/doc
	#-rm -f  debian/tmp/usr/share/doc/libcompface
	#-rm -rf debian/tmp/usr/share/doc/libcompfaceg1
	#-rm -rf debian/tmp/usr/lib/libc5-compat
	#-rm -rf debian/tmp/usr/share/man/man1
	#-rm -rf debian/tmp/usr/bin
	#-rm -rf debian/tmp/usr/$(avar)-linuxlibc1
	#-rm -rf debian/tmp/usr/doc/libcompface 
	#-rm -rf debian/tmp/usr/share/doc/compface 
	#-rm -f  debian/tmp/usr/share/doc/libcompfaceg1
	#-rm -rf debian/tmp/usr/doc/libcompface1
	#-rm -f  debian/tmp/usr/doc/libcompface1-altdev

	dh_installdeb
	dh_installdocs
	dh_installman

	dh_movefiles
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_strip

	dh_shlibdeps	
	dh_md5sums

	#dpkg-gencontrol -plibcompfaceg1-dev -isp
	#chown -R root.root debian/tmp
	#chmod -R go=rX debian/tmp
	#dpkg --build debian/tmp ..

	dh_gencontrol
	dh_builddeb

binary-common:
	$(checkdir)
	@echo '### Installing common components...'

	-rm -rf debian/tmp `find debian/* -type d`
	install -d debian/tmp

	cd debian/tmp && install -d usr/man/man3 usr/man/man1 usr/bin usr/doc/libcompface usr/doc/compface

	install -m644 compface.3 debian/tmp/usr/man/man3/
	install -m644 README debian/tmp/usr/doc/compface
	install -m644 debian/copyright debian/tmp/usr/doc/compface
	install -m644 debian/changelog debian/tmp/usr/doc/compface/changelog.Debian
	gzip -9 debian/tmp/usr/doc/compface/changelog.Debian

	install -m644 compface.1 debian/tmp/usr/man/man1/
	ln -s compface.1 debian/tmp/usr/man/man1/uncompface.1
	install -m744 compface debian/tmp/usr/bin/
	install -m744 uncompface debian/tmp/usr/bin/


binary-libc6:
	@echo '### Installing libc6 components...'

	cd debian/tmp && install -d usr/lib usr/include

	install -m644 static/$(package).a debian/tmp/usr/lib/
	install -m644 compface.h debian/tmp/usr/include/

	-ln -s $(package).so.$(version) debian/tmp/usr/lib/$(package).so
	-ln -s $(package).so.$(version) debian/tmp/usr/lib/$(package).so.$(version_major)

	cp shared/$(package).so.$(version) debian/tmp/usr/lib
	chmod 644 debian/tmp/usr/lib/$(package).so.$(version)

	-rm -r debian/tmp/usr/doc/libcompface
	-mkdir debian/tmp/usr/doc/libcompfaceg1
	-ln -s libcompfaceg1 debian/tmp/usr/doc/libcompface
	-ln -s libcompfaceg1 debian/tmp/usr/doc/libcompfaceg1-dev


binary-libc5:
	@echo '### Installing libc5 components...'

	cd debian/tmp && install -d usr/lib/libc5-compat usr/$(avar)-linuxlibc1/{lib,include}

	install -m644 static5/$(package).a debian/tmp/usr/$(avar)-linuxlibc1/lib/
	install -m644 compface.h debian/tmp/usr/$(avar)-linuxlibc1/include/

	-ln -s $(package).so.$(version) debian/tmp/usr/lib/libc5-compat/$(package).so
	-ln -s $(package).so.$(version) debian/tmp/usr/lib/libc5-compat/$(package).so.$(version_major)

	cp shared5/$(package).so.$(version) debian/tmp/usr/lib/libc5-compat
	chmod 644 debian/tmp/usr/lib/libc5-compat/$(package).so.$(version)

	-mkdir debian/tmp/usr/doc/libcompface1
	install -m644 debian/copyright debian/tmp/usr/doc/libcompface1
	install -m644 debian/changelog debian/tmp/usr/doc/libcompface1/changelog.Debian
	gzip -9 debian/tmp/usr/doc/libcompface1/changelog.Debian
	-ln -s libcompface1 debian/tmp/usr/doc/libcompface1-altdev


define checkdir
	test -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

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

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