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

include /usr/share/dpkg/architecture.mk
VERSION := $(shell dpkg-parsechangelog | perl -ne '/Version:\s+(.+)-[^-]+/ && print $$1')

export DH_VERBOSE = 1

%:
	dh $@


BUILD = build-tree
ROOT = $(BUILD)/root
ILLUMOS_GATE = illumos-gate

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

.PHONY: create-orig
create-orig: $(ILLUMOS_GATE)
	dh_illumos_gate --create-orig --build \
		$(ILLUMOS_GATE)/usr/src/tools \
		$(ILLUMOS_GATE)/usr/src/lib/libctf \
		$(ILLUMOS_GATE)/usr/src/common/ctf \
		$(ILLUMOS_GATE)/usr/src/uts/common/sys/ctf.h \
		$(ILLUMOS_GATE)/usr/src/uts/common/sys/ctf_api.h \
		$(ILLUMOS_GATE)/usr/src/uts/common/sys/multiboot.h

test-orig: create-orig
	./debian/rules clean
	rm -rf usr .pc
	tar xf ../onbld_$(VERSION).orig.tar.xz --strip=1
	quilt push -a
	./debian/rules build
	fakeroot ./debian/rules binary


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


override_dh_auto_build:
	. $(BUILD)/usr/env.sh; mkdir -p \
		$(ROOT)/usr/include \
		$(ROOT)/usr/include/sys \
		$(ROOT)$$DEB_LIBDIR_32 \
		$(ROOT)$$DEB_LIBDIR_64 \
		$(ROOT)$$DEB_USRLIBDIR_32 \
		$(ROOT)$$DEB_USRLIBDIR_64

	dh_illumos_make $(BUILD)/usr/src/lib/libctf -t install_h
	cp usr/src/uts/common/sys/*.h $(ROOT)/usr/include/sys/

	# libncurses.so is actually a linker script
	# and sunld does not understand it,
	# but we do not need sunld here ;-)
	sed -i -r 's/.*(export +LD_ALTEXEC.*)/#\1/' $(BUILD)/usr/env.sh
	dh_illumos_make --no-onbld --native $(BUILD)/usr/src/tools

	# Then we need sunld:
	sed -i -r 's/#(export +LD_ALTEXEC.*)/\1/' $(BUILD)/usr/env.sh
	dh_illumos_make --no-onbld $(BUILD)/usr/src/lib/libctf -t install_h
	dh_illumos_make --no-onbld $(BUILD)/usr/src/lib/libctf

	# Then - don't:
	sed -i -r 's/(export +LD_ALTEXEC.*)/#\1/' $(BUILD)/usr/env.sh
	dh_illumos_make --no-onbld --native $(BUILD)/usr/src/tools/ctf/stabs


override_dh_auto_install:
	rm -rf debian/tmp
	cp -a $(ROOT) debian/tmp
	cp -a $(BUILD)/usr/src/tools/proto/root_i386-nd/opt debian/tmp/opt
	cp -a $(BUILD)/usr/src/tools/scripts/genoffsets.pl debian/tmp/opt/onbld/bin/genoffsets

	for l in `find debian/tmp/lib32 -maxdepth 1 -type l -name \*.so`; do \
		ln -sf `readlink -f $$l` debian/tmp/usr/lib32/`basename $$l`; \
		rm $$l; \
	done
	for l in `find debian/tmp/lib/$(DEB_HOST_MULTIARCH) -maxdepth 1 -type l -name \*.so`; do \
		ln -sf `readlink -f $$l` debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/`basename $$l`; \
		rm $$l; \
	done
	symlinks -c debian/tmp/usr/lib32
	symlinks -c debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)


override_dh_auto_clean:
	rm -rf $(BUILD)