summaryrefslogtreecommitdiff
path: root/uts/debian/rules
blob: 7d7ab17510701787a06a347f32b9d9df421daff4 (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
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

%:
	dh $@

BUILD = build-tree
ROOT = $(BUILD)/root

ILLUMOS_GATE = illumos-gate

$(ILLUMOS_GATE):
	dh_illumos_gate --checkout --destdir=$(ILLUMOS_GATE)

.PHONY: orig-tarball
create-orig:
	dh_illumos_gate --create-orig --build \
		-X /doc/ \
		$(ILLUMOS_GATE)/usr/src/uts \
		$(ILLUMOS_GATE)/usr/src/common \
		$(ILLUMOS_GATE)/usr/src/lib/gss_mechs/mech_krb5/include/k5-int-pkinit.h \
		$(ILLUMOS_GATE)/usr/src/lib/gss_mechs/mech_krb5/include/preauth_plugin.h \
		$(ILLUMOS_GATE)/usr/src/lib/gss_mechs/mech_krb5/include/autoconf.h \
		$(ILLUMOS_GATE)/usr/src/lib/gss_mechs/mech_krb5/krb5/krb/int-proto.h

ifeq (illumos-amd64,$(DEB_HOST_ARCH))
libarch := amd64
kernelarch := amd64
else ifeq (illumos-i386,$(DEB_HOST_ARCH))
libarch := i386
kernelarch := ia32
else
$(error $(DEB_HOST_ARCH) is not supported)
endif

# building with GNU make is broken
make := -m 'sunmake'

override_dh_auto_configure:
	dh_illumos_gate --configure --destdir=$(BUILD) --root=$(ROOT)

	find $(BUILD)/usr/src/uts/common/sys/lvm -name \*.x \
		-exec ./debian/fix.x.pl {} \;

	# this shell script generates assembler source files
	# and passes that source to as.
	# Default output format is expected to be 32-bit:
	echo "export ELFWRAP='$(CURDIR)/debian/elfwrap -32'" >> $(BUILD)/usr/env.sh

	# We need a wrapper for GNU CPP to undefine some macros.
	# The wrapper is debian/cpp
	echo "export RPCGEN='rpcgen -Y $(CURDIR)/debian'" >> $(BUILD)/usr/env.sh

	# We need these versions for mdb:
	echo 'export YACC=/usr/bin/sgs-yacc' >> $(BUILD)/usr/env.sh
	echo 'export LEX=/usr/bin/sgs-lex' >> $(BUILD)/usr/env.sh

	# GCC does not support -msave-args for a while:
	echo 'export SAVEARGS=' >> $(BUILD)/usr/env.sh

	# Use GNU ld for helper programs (due to changes in crt1.o)
	# and sun ld for kernel modules
	sed -i /LD_ALTEXEC/d $(BUILD)/usr/env.sh
	echo 'export LD=sunld' >> $(BUILD)/usr/env.sh

	echo 'export DEF_BUILDS$(DEB_HOST_ARCH_BITS)=obj$(DEB_HOST_ARCH_BITS)' >> $(BUILD)/usr/env.sh
	echo 'export ALL_BUILDS$(DEB_HOST_ARCH_BITS)=obj$(DEB_HOST_ARCH_BITS)' >> $(BUILD)/usr/env.sh

# Disable 32-bit builds on 64-bit host, and vice versa
ifeq (64,$(DEB_HOST_ARCH_BITS))
	echo "export DEF_BUILDS32=''" >> $(BUILD)/usr/env.sh
	echo "export ALL_BUILDS32=''" >> $(BUILD)/usr/env.sh
else ifeq (32,$(DEB_HOST_ARCH_BITS))
	echo "export DEF_BUILDS64=''" >> $(BUILD)/usr/env.sh
	echo "export ALL_BUILDS64=''" >> $(BUILD)/usr/env.sh
else
$(error DEB_HOST_ARCH_BITS is not defined or holds something wrong) 
endif

override_dh_strip:
	: # we don't strip the kernel

override_dh_auto_build:
	mkdir -p \
		$(ROOT)/etc \
		$(ROOT)/etc/security \
		$(ROOT)/boot \
		$(ROOT)/boot/solaris
	dh_illumos_make $(BUILD)/usr/src/uts -t install_h $(make)
	dh_illumos_make --ctf $(BUILD)/usr/src/uts $(make)

override_dh_auto_install:
	rm -rf debian/tmp
	cp -a $(ROOT) debian/tmp
	set -x; for p in `grep -E -v '^(#|$$)' debian/notpacked`; do \
		rm -rf debian/tmp/$$p || exit 1; \
	done

override_dh_install:
	dh_install --fail-missing

override_dh_installdeb:
	(cd debian/illumos-kernel && find kernel platform usr/kernel \
		-type f -name \*.conf) > debian/illumos-kernel.conffiles
	dh_installdeb

override_dh_auto_clean:
	rm -rf $(BUILD)