summaryrefslogtreecommitdiff
path: root/util-illumos/debian/rules
blob: 0bf95327abadf7e10adc384ace4cdf3c8d467015 (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
#!/usr/bin/make -f

include /usr/share/dpkg/buildflags.mk

export DH_VERBOSE = 1

# We've patched it, so i386 is suitable for any arch:
cmd := \
	biosdev \
	devprop \
	fdisk \
	fmthard \
	format \
	isainfo \
	isalist \
	lofiadm \
	mesg \
	mkfile \
	newtask/i386 \
	prtconf/i386 \
	pbind/i386 \
	prtdiag \
	prtvtoc \
	psradm \
	psrinfo \
	psrset/i386 \
	ramdiskadm \
	rtc \
	swap/i386 \
	sysdef/i386 \
	zonename \

unpack: unpack-stamp
unpack-stamp:
	dh_testdir
	dh_illumos_gate --build \
		usr/src/cmd/ \
		usr/src/man/man1\* \
		usr/src/man/man4/format.dat.4 \
		usr/src/uts/i86pc/sys/biosdisk.h \
		usr/src/psm/stand/bootblks/ufs/i386/mboot.S \
		usr/src/common/elfcap \
		usr/src/common/lzma


	# Buggy and unused:
	echo > usr/src/Makefile.msg.targ

	# Use GNU ld:
	sed -i '/LD_ALTEXEC/d' usr/env.sh
	echo 'BDIRECT=' >> usr/src/cmd/Makefile.cmd
	echo 'MAPFILE.NES=' >> usr/src/cmd/Makefile.cmd
	echo 'MAPFILE.PGA=' >> usr/src/cmd/Makefile.cmd
	echo 'MAPFILE.NED=' >> usr/src/cmd/Makefile.cmd

	# Disable ISA dirs:
	echo 'ROOTUSRSBIN32=$$(ROOTUSRSBIN)' >> usr/src/cmd/Makefile.cmd
	echo 'ROOTBIN32=$$(ROOTBIN)' >> usr/src/cmd/Makefile.cmd
	echo 'ROOTUSRSBIN64=$$(ROOTUSRSBIN)' >> usr/src/cmd/Makefile.cmd
	echo 'ROOTBIN64=$$(ROOTBIN)' >> usr/src/cmd/Makefile.cmd
	touch $@

patch: patch-stamp
patch-stamp: unpack-stamp
	dh_testdir
	[ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
	touch $@

unpatch:
	dh_testdir
	[ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt pop -a -f || test $$? = 2
	rm -f patch-stamp

dirs-stamp: unpack-stamp
	. usr/env.sh; mkdir -p \
		debian/tmp/etc \
		debian/tmp/sbin \
		debian/tmp/usr/bin \
		debian/tmp/usr/lib/fs/ufs \
		debian/tmp/usr/sbin
	touch $@

install: install-stamp

install-stamp: build-stamp
	: # for fdisk:
	install -m 644 -t debian/tmp/usr/lib/fs/ufs mboot
	:
	install -m 755 -t debian/tmp/sbin/ soconfig
	install -m 755 -t debian/tmp/sbin/ autopush
	install -m 755 -t debian/tmp/sbin/ dmesg
	ln -sf ../../sbin/dmesg debian/tmp/usr/sbin/dmesg
	install -m 755 usr/src/cmd/initpkg/swapadd.sh debian/tmp/sbin/swapadd
	touch $@

build build-arch build-indep: build-stamp

build-stamp: dirs-stamp patch-stamp
	$(CC) $(CFLAGS) $(LDFLAGS) ./usr/src/cmd/cmd-inet/usr.sbin/soconfig.c -o soconfig
	$(CC) $(CFLAGS) $(LDFLAGS) ./usr/src/cmd/autopush/autopush.c -o autopush
	:
	gcc -fno-builtin -nostdinc -c -o mboot.o ./usr/src/psm/stand/bootblks/ufs/i386/mboot.S
	ld -nostdlib -N -Ttext 600 -o mboot.exec mboot.o
	objcopy -O binary mboot.exec mboot
	rm mboot.exec mboot.o
	:
	dh_illumos_make --native $(cmd:%=usr/src/cmd/%)
	cp usr/src/cmd/dmesg/dmesg.sh dmesg
	touch $@

binary binary-arch binary-indep: binary-stamp
binary-stamp: install-stamp
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_install
	dh_installman
	dh_installdocs
	dh_installexamples
	dh_installchangelogs
	dh_bash-completion
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_strip
	dh_gencontrol
	dh_md5sums
	dh_builddeb
	touch $@

clean: unpatch
	dh_testdir
	dh_testroot
	dh_clean dmesg soconfig autopush mboot
	rm -rf usr .pc