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
|
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/buildopts.mk
CHANGELOG_DATE ?= $(shell LC_ALL=C date -u -d @$(SOURCE_DATE_EPOCH) +"%d %B %Y")
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
BUILDDIR=$(CURDIR)/debian/build
MAKEFILE := $(firstword $(MAKEFILE_LIST))
COMPONENTS := \
generic \
ice40-qt ice40 \
gowin-qt gowin \
ecp5-qt ecp5 \
#
ifneq ($(filter pkg.nextpnr.himbaechel,$(DEB_BUILD_PROFILES)),)
COMPONENTS += himbaechel-qt himbaechel
endif
%:
dh $@
CMAKE_FLAGS_common := \
-DCURRENT_GIT_VERSION="$(DEB_VERSION)" \
-DBUILD_PYTHON=ON \
-DBUILD_TESTS=ON \
-DEXTERNAL_CHIPDB=ON
CMAKE_FLAGS_generic := \
$(CMAKE_FLAGS_common) \
-DARCH=generic
CMAKE_FLAGS_ice40 := \
$(CMAKE_FLAGS_common) \
-DARCH=ice40 \
-DICEBOX_DATADIR=/usr/share/fpga-icestorm/chipdb \
-DICESTORM_INSTALL_PREFIX=/usr/share/fpga-icestorm/chipdb
CMAKE_FLAGS_ecp5 := \
$(CMAKE_FLAGS_common) \
-DTRELLIS_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/trellis/ \
-DTRELLIS_DATADIR=/usr/share/trellis/ \
-DARCH=ecp5
CMAKE_FLAGS_gowin := \
$(CMAKE_FLAGS_common) \
-DARCH=gowin
CMAKE_FLAGS_himbaechel := \
$(CMAKE_FLAGS_common) \
-DARCH=himbaechel
CMAKE_FLAGS_ice40-qt := $(CMAKE_FLAGS_ice40) -DBUILD_GUI=ON
CMAKE_FLAGS_ice40 := $(CMAKE_FLAGS_ice40) -DBUILD_GUI=OFF
CMAKE_FLAGS_ecp5-qt := $(CMAKE_FLAGS_ecp5) -DBUILD_GUI=ON
CMAKE_FLAGS_ecp5 := $(CMAKE_FLAGS_ecp5) -DBUILD_GUI=OFF
CMAKE_FLAGS_gowin-qt := $(CMAKE_FLAGS_gowin) -DBUILD_GUI=ON
CMAKE_FLAGS_gowin := $(CMAKE_FLAGS_gowin) -DBUILD_GUI=OFF
CMAKE_FLAGS_himbaechel-qt := $(CMAKE_FLAGS_himbaechel) -DBUILD_GUI=ON
CMAKE_FLAGS_himbaechel := $(CMAKE_FLAGS_himbaechel) -DBUILD_GUI=OFF
HELP2MAN_FLAGS = \
--name="Next Generation Place and Route" \
--version-string="$(DEB_VERSION)" \
--section=1 \
--manual="General Commands" \
--no-info \
--no-discard-stderr
override_dh_auto_clean:
rm -rf $(BUILDDIR)
rm -f debian/nextpnr-*.1
dh_auto_clean
override_dh_auto_configure override_dh_auto_build override_dh_auto_test override_dh_auto_install:
+$(MAKE) -f$(MAKEFILE) $(DEB_BUILD_OPTION_PARALLEL:%=-j%) \
$(patsubst %,$(subst override_dh_auto_,,$@)/%,$(COMPONENTS))
override_dh_installman:
help2man $(HELP2MAN_FLAGS) debian/nextpnr-generic/usr/bin/nextpnr-generic > debian/nextpnr-generic.1
help2man $(HELP2MAN_FLAGS) debian/nextpnr-ice40-qt/usr/bin/nextpnr-ice40 > debian/nextpnr-ice40.1
help2man $(HELP2MAN_FLAGS) debian/nextpnr-gowin-qt/usr/bin/nextpnr-gowin > debian/nextpnr-gowin.1
help2man $(HELP2MAN_FLAGS) debian/nextpnr-ecp5-qt/usr/bin/nextpnr-ecp5 > debian/nextpnr-ecp5.1
ifneq ($(filter pkg.nextpnr.himbaechel,$(DEB_BUILD_PROFILES)),)
help2man $(HELP2MAN_FLAGS) debian/nextpnr-himbaechel-qt/usr/bin/nextpnr-himbaechel > debian/nextpnr-himbaechel.1
endif
dh_installman
override_dh_installexamples:
dh_installexamples --exclude=.gitignore
configure/%:
dh_auto_configure -B$(BUILDDIR)/$* -- $(CMAKE_FLAGS_$*)
# HACK: dh_auto_build strips the MAKEFLAGS jobserver option. Prevent this
# by calling make manually.
build/%:
cd $(BUILDDIR)/$* && exec $(MAKE) "INSTALL=install --strip-program=true"
test/%:
dh_auto_test -B$(BUILDDIR)/$*
install/%: ARCH=$(subst -qt,,$*)
install/%:
dh_auto_install -B$(BUILDDIR)/$* --destdir=$(CURDIR)/debian/nextpnr-$*
if [ $(ARCH) != generic ] && [ -z "$(filter %-qt,$*)" ]; then \
install -D --mode=0644 -t \
$(CURDIR)/debian/nextpnr-$*-chipdb/usr/share/nextpnr/$(ARCH)/ \
$(BUILDDIR)/$*/$(ARCH)/chipdb/*.bin; fi
|