File: rules

package info (click to toggle)
chezscheme 9.5.4%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 61,640 kB
  • sloc: ansic: 17,508; sh: 759; makefile: 509; csh: 423
file content (132 lines) | stat: -rwxr-xr-x 4,741 bytes parent folder | download
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
#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

export CHEZ_VERSION = $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -e 's/[+~].*$$//')
export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DOPACKAGES = $(shell dh_listpackages)

# Translate the host architecture (the arch we're building for) to
# terms the build system understands.
ifeq ($(DEB_HOST_GNU_TYPE), x86_64-linux-gnu)
    export HOST_MACHINE_TYPE = ta6le
else ifeq ($(DEB_HOST_GNU_TYPE), i386-linux-gnu)
    export HOST_MACHINE_TYPE = ti3le
else ifeq ($(DEB_HOST_GNU_TYPE), i686-linux-gnu)
    export HOST_MACHINE_TYPE = ti3le
else ifeq ($(DEB_HOST_GNU_TYPE), arm-linux-gnueabihf)
    export HOST_MACHINE_TYPE = arm32le
else ifeq ($(DEB_HOST_GNU_TYPE), arm-linux-gnueabi)
    export HOST_MACHINE_TYPE = arm32le
else
    $(error Cannot yet build for $(DEB_HOST_GNU_TYPE))
endif
ifeq ($(origin CC),default)
CC := $(DEB_HOST_GNU_TYPE)-gcc
LD := $(DEB_HOST_GNU_TYPE)-ld
endif

# Avoid using /usr/bin/scheme to run stex
INSTALLED_CHEZ=/usr/bin/chezscheme

LIBDIR=usr/lib/csv$(CHEZ_VERSION)/$(HOST_MACHINE_TYPE)

fix_conf = sed -i -e 's,^ncursesLib=.*,ncursesLib=-lncurses -lz -llz4,g'

%:
	dh $@

override_dh_auto_configure:
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	if [ ! -d boot/$(HOST_MACHINE_TYPE) ]; then \
          cp -r /usr/lib/csv$(CHEZ_VERSION)/$(HOST_MACHINE_TYPE) boot/$(HOST_MACHINE_TYPE); \
          touch boot/$(HOST_MACHINE_TYPE)/.debian-cleanup; \
	fi
	CC=$(CC) ./configure --workarea=build -m=$(HOST_MACHINE_TYPE) --installprefix=/usr --temproot=$(shell pwd)/debian/tmp ZLIB= LZ4=
else
	./configure --workarea=crossbuilder --threads --installprefix=/usr --temproot=$(shell pwd)/debian/tmp ZLIB= LZ4=
	$(fix_conf) crossbuilder/c/Mf-config
	make -C crossbuilder
	./workarea $(HOST_MACHINE_TYPE)
	mv $(HOST_MACHINE_TYPE) build
	echo "ncursesLib=-lncurses -lz -llz4" >> build/c/Mf-config
	echo 'Kernel=$${KernelO}' >> build/c/Mf-config
	echo 'KernelLinkDeps=$${KernelOLinkDeps}' >> build/c/Mf-config
	echo 'KernelLinkLibs=$${KernelOLinkLibs}' >> build/c/Mf-config
endif
	$(fix_conf) build/c/Mf-config
	(cd build/s; ln -s ../../s/primdata.ss primdata.ss)
	cp -a release_notes/ build/
	cp -a csug/ build/
	(echo "\def\INSERTREVISIONMONTHSPACEYEAR{}"; cat csug/copyright.stex) > \
	    build/csug/copyright.stex

override_dh_auto_test:
ifeq (fullcheck,$(filter fullcheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test
endif

override_dh_auto_build-arch:
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	make -C build
else
	$(eval BUILD_MACHINE_TYPE = $(shell awk -F= '/^m=/ {print $$2}' crossbuilder/Mf-install))
	make -C build/s -f Mf-cross m=$(BUILD_MACHINE_TYPE) xm=$(HOST_MACHINE_TYPE) base=$(CURDIR)/crossbuilder
	make -C build/c CC=$(CC) LD=$(LD)
endif

override_dh_auto_build-indep:
ifneq (,$(filter chezscheme-doc,$(DOPACKAGES)))
	make -C build/release_notes Scheme=$(INSTALLED_CHEZ) STEXLIB=/usr/share/stex
	make -C build/csug Scheme=$(INSTALLED_CHEZ) STEXLIB=/usr/share/stex
endif

override_dh_auto_install-arch:
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	make install
else
	make -C build -f ../crossbuilder/Mf-install m=$(HOST_MACHINE_TYPE)
endif
	sed -e 's,^\\fI\(Chez Scheme\)\\fP,chezscheme \- Chez Scheme,' \
	    -e 's,^\\fI\(Petite Chez Scheme\)\\fP,petite \- Petite Chez Scheme,' \
	    build/scheme.1 > build/chezscheme.1

override_dh_auto_install-indep:
ifneq (,$(filter chezscheme-doc,$(DOPACKAGES)))
	make -C build/release_notes Scheme=$(INSTALLED_CHEZ) STEXLIB=/usr/share/stex INSTALL=../installsh \
	    installdir=$(shell pwd)/debian/tmp/usr/share/doc/chezscheme-doc/ \
	    install
	make -C build/csug Scheme=$(INSTALLED_CHEZ) STEXLIB=/usr/share/stex INSTALL=../installsh \
	    installdir=$(shell pwd)/debian/tmp/usr/share/doc/chezscheme-doc/html/ \
	    install
	rm -f debian/tmp/usr/share/doc/chezscheme-doc/html/canned/*-orig.png
	ln -sf ../csug.css debian/tmp/usr/share/doc/chezscheme-doc/html/canned/csug.css
endif

ifneq (,$(filter chezscheme,$(DOPACKAGES)))
override_dh_link:
	dh_link $(LIBDIR)/scheme.boot $(LIBDIR)/chezscheme.boot \
	        $(LIBDIR)/scheme.boot $(LIBDIR)/scheme-script.boot \
	        /usr/share/man/man1/chezscheme.1.gz \
	        /usr/share/man/man1/petite.1.gz \
	        /usr/share/man/man1/chezscheme.1.gz \
	        /usr/share/man/man1/scheme-script-chez.1.gz
endif

override_dh_auto_clean:
	rm -f Makefile csug/Makefile release_notes/Makefile
	dh_auto_clean
	if [ -f boot/$(HOST_MACHINE_TYPE)/.debian-cleanup ]; then \
	  rm -rf boot/$(HOST_MACHINE_TYPE); \
	fi

override_dh_installdocs:
	dh_installdocs -A NOTICE

override_dh_installchangelogs:
	dh_installchangelogs LOG

override_dh_installman-arch:
	dh_installman build/chezscheme.1