#!/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), aarch64-linux-gnu) export HOST_MACHINE_TYPE = tarm64le else ifeq ($(DEB_HOST_GNU_TYPE), arm-linux-gnueabihf) export HOST_MACHINE_TYPE = tarm32le else ifeq ($(DEB_HOST_GNU_TYPE), riscv64-linux-gnu) export HOST_MACHINE_TYPE = trv64le else ifeq ($(DEB_HOST_GNU_TYPE), loongarch64-linux-gnu) export HOST_MACHINE_TYPE = tla64le else ifeq ($(DEB_HOST_GNU_TYPE), powerpc-linux-gnu) export HOST_MACHINE_TYPE = tppc32le else ifeq ($(DEB_HOST_GNU_TYPE), i686-gnu) export HOST_MACHINE_TYPE = ti3gnu else # Example bytecode machine type: tpb64l export HOST_MACHINE_TYPE = tpb$(DEB_HOST_ARCH_BITS)$(shell echo $(DEB_HOST_ARCH_ENDIAN) | cut -c1) $(warning Cannot yet build for $(DEB_HOST_GNU_TYPE), building for $(HOST_MACHINE_TYPE)) USE_BYTECODE = 1 endif ifeq ($(origin CC),default) CC := $(DEB_HOST_GNU_TYPE)-gcc LD := $(DEB_HOST_GNU_TYPE)-ld endif # We want the system-provided versions of these INSTALLED_CHEZ=/usr/bin/chezscheme export STEXLIB=/usr/share/stex export ZUO=/usr/bin/zuo LIBDIR=usr/lib/csv$(CHEZ_VERSION)/$(HOST_MACHINE_TYPE) %: dh $@ override_dh_auto_configure: ifeq ($(USE_BYTECODE),1) CC=$(CC) ./configure --as-is --pbarch --threads --installschemename=chezscheme --installprefix=$(shell pwd)/debian/tmp/usr ZLIB=-lz LZ4=-llz4 else CC=$(CC) ./configure --as-is -m=$(HOST_MACHINE_TYPE) --installschemename=chezscheme --installprefix=$(shell pwd)/debian/tmp/usr ZLIB=-lz LZ4=-llz4 endif ln -s /usr/share/r6rs nanopass override_dh_auto_test: ifeq (fullcheck,$(filter fullcheck,$(DEB_BUILD_OPTIONS))) dh_auto_test endif override_dh_auto_build: make -j`nproc` ZUO=/usr/bin/zuo ifneq (,$(filter chezscheme-doc,$(DOPACKAGES))) $(ZUO) main.zuo docs endif override_dh_auto_install: make install TempRoot=$(shell pwd)/debian/tmp ifneq (,$(filter chezscheme-doc,$(DOPACKAGES))) $(ZUO) main.zuo install-docs 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 main.zuo rm -f nanopass rm -rf ./build ./pb ./xc-* "./$(HOST_MACHINE_TYPE)" rm -rf "./boot/$(HOST_MACHINE_TYPE)/" if test -f csug/Makefile; then make -C csug clean STEXLIB=$(STEXLIB) ; fi rm -f csug/primdata.ss csug/Makefile rm -rf csug/csug.pdf csug/math csug/gifs csug/*.html rm -f release_notes/Makefile release_notes/macros.tex release_notes/release_notes.log release_notes/release_notes.tex release_notes/release_notes.htoc rm -rf release_notes/gifs/ release_notes/math/ release_notes/release_notes.aux release_notes/release_notes.firstrun release_notes/release_notes.haux release_notes/release_notes.hfirstrun release_notes/release_notes.hsecondrun release_notes/release_notes.hthirdrun release_notes/release_notes.html release_notes/release_notes.mathrun release_notes/release_notes.pdf release_notes/release_notes.secondrun release_notes/release_notes.thirdrun dh_auto_clean override_dh_installdocs: dh_installdocs -A NOTICE