summaryrefslogtreecommitdiffhomepage
path: root/debian/rules
blob: 67741b19f6616dbe3dbf1a292cd89410ee88e842 (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
#!/usr/bin/make -f

# This is a bit unusual, in that I have to completely recompile everything
# twice.  The first is the normal, dynamically linked package.  The second is
# for the statically linked package.  This file has been adjusted accordingly.

# This is the debhelper compatability version to use.
export DH_COMPAT=1

bb=debian/tmp
bbbd=debian/bb_builddir
bbs=debian/busybox-static
bbsbd=debian/bb-static_builddir

#For the debian-installer .udeb package
PACKAGE=busybox-udeb
VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
ARCH=$(shell dpkg --print-architecture)
FILENAME=$(PACKAGE)_$(VERSION)_$(ARCH).udeb
PRIORITY=$(shell grep ^Priority: debian/control | cut -d ' ' -f 2)

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp-busybox build-stamp-busybox-static
	-$(MAKE) clean
	-rm -rf $(bb) $(bbbd) $(bbs) $(bbsbd)
	dh_clean

half_clean:
	dh_testdir
	dh_testroot
	rm -rf $(bbs) build-stamp-busybox-static
	-$(MAKE) clean

build: build-stamp-busybox
build-stamp-busybox:
	dh_testdir
	mkdir -p $(bbbd)
	cp Makefile Config.h $(bbbd)
	(cd $(bbbd); $(MAKE) "BB_SRC_DIR=../../")
	touch build-stamp-busybox

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	(cd $(bbbd); $(MAKE) "BB_SRC_DIR=../../" "PREFIX=../../$(bb)" install)
	mkdir -p $(bb)/usr/share/man/man1
	cp docs/BusyBox.1 $(bb)/usr/share/man/man1/busybox.1

# Now for the statically linked stuff
build-static: build-stamp-busybox-static
build-stamp-busybox-static:
	dh_testdir
	$(MAKE) DOSTATIC=true
	touch build-stamp-busybox-static

install-static: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	# Do not run 'make install', since we do not want all the symlinks. 
	# This just installes the busybox binary...
	#$(MAKE) "PREFIX=$(bbs)" install
	mkdir -p $(bbs)/bin/
	cp busybox $(bbs)/bin/busybox
	mkdir -p $(bbs)/usr/share/man/man1/
	cp docs/BusyBox.1 $(bbs)/usr/share/man/man1/busybox.1

do_static: half_clean build-static install-static


# Build architecture-independent files here.
binary-indep:
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: busybox busybox-static busybox-udeb

busybox: install
	@echo "--- Building: $@"
	dh_testdir
	dh_testroot
	dh_installdirs
	#
	#Note that for busybox, we do not install any docs,
	# or man apges or anything else.  This is in blatent violation of every
	# Debian policy out there, since this package is intended to be used
	# _only_ by the debian-installer.
	#
	#dh_installdocs       -p$@ docs/BusyBox.txt \
	#	docs/BusyBox.html docs/busybox.lineo.com AUTHORS README TODO
	#rm -rf $(bb)/usr/share/doc/busybox/busybox.lineo.com/CVS \
	#	$(bb)/usr/share/doc/busybox/busybox.lineo.com/.cvsignore \
	#	$(bb)/usr/share/doc/busybox/busybox.lineo.com/images/CVS \
	#	$(bb)/usr/share/doc/busybox/busybox.lineo.com/images/.cvsignore
	#dh_undocumented      -p$@
	#dh_installchangelogs -p$@ Changelog
	dh_strip             -p$@
	dh_compress          -p$@
	dh_fixperms          -p$@
	dh_installdeb        -p$@
	dh_shlibdeps         -p$@
	#
	#Make _very_ sure there are no docs lurking about.
	#
	rm -rf $(bb)/usr/share/doc
	rm -rf $(bb)/usr/share/man
	dh_gencontrol        -p$@
	dh_md5sums           -p$@
	dh_builddeb          -p$@


busybox-static: do_static
	@echo "--- Building: $@"
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_installdocs       -p$@ docs/BusyBox.txt \
		docs/BusyBox.html docs/busybox.lineo.com AUTHORS README TODO
	rm -rf $(bbs)/usr/share/doc/busybox-static/busybox.lineo.com/CVS \
		$(bbs)/usr/share/doc/busybox-static/busybox.lineo.com/.cvsignore \
		$(bbs)/usr/share/doc/busybox-static/busybox.lineo.com/images/CVS \
		$(bbs)/usr/share/doc/busybox-static/busybox.lineo.com/images/.cvsignore
	dh_undocumented      -p$@
	dh_installchangelogs -p$@ Changelog
	dh_strip             -p$@
	dh_compress          -p$@
	dh_fixperms          -p$@
	dh_installdeb        -p$@
	dh_shlibdeps         -p$@
	dh_gencontrol        -p$@
	dh_md5sums           -p$@
	dh_builddeb          -p$@


# Note that this builds a .udeb, which is not policy compliant or anything.
#
busybox-udeb: install
	@echo "--- Building: $@"
	dh_testdir
	dh_testroot
	dh_installdirs
	#
	#Note that for busybox, we do not install any docs,
	# or man apges or anything else.  This is in blatent violation of every
	# Debian policy out there, since this package is intended to be used
	# _only_ by the debian-installer.
	#
	#dh_installdocs       -p$@ docs/BusyBox.txt \
	#	docs/BusyBox.html docs/busybox.lineo.com AUTHORS README TODO
	#rm -rf $(bb)/usr/share/doc/busybox/busybox.lineo.com/CVS \
	#	$(bb)/usr/share/doc/busybox/busybox.lineo.com/.cvsignore \
	#	$(bb)/usr/share/doc/busybox/busybox.lineo.com/images/CVS \
	#	$(bb)/usr/share/doc/busybox/busybox.lineo.com/images/.cvsignore
	#dh_undocumented      -p$@
	#dh_installchangelogs -p$@ Changelog
	dh_strip             -p$@
	dh_compress          -p$@
	dh_fixperms          -p$@
	dh_installdeb        -p$@
	dh_shlibdeps         -p$@
	#
	#Make _very_ sure there are no docs lurking about.
	#
	rm -rf $(bb)/usr/share/doc
	rm -rf $(bb)/usr/share/man
	dh_gencontrol        -p$@
	# Don't write your stupid guesses to debian/files.
	#dh_gencontrol        -p$@ -- -fdebian/files~
	# Register file manually.
	dpkg-distaddfile $(FILENAME) debian-installer $(PRIORITY)
	dh_md5sums           -p$@
	dh_builddeb          -p$@ --filename=$(FILENAME)

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install