File: rules

package info (click to toggle)
ldc 1%3A1.40.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 63,308 kB
  • sloc: cpp: 85,368; ansic: 21,877; makefile: 1,705; sh: 1,018; asm: 584; objc: 135; exp: 48; python: 12
file content (88 lines) | stat: -rwxr-xr-x 3,125 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
#!/usr/bin/make -f
# -*- makefile -*-
#export DH_VERBOSE=1

include /usr/share/dpkg/architecture.mk

CFLAGS += $(CPPFLAGS)
CXXFLAGS += $(CPPFLAGS)

# FIXME: Needs to downgrade debug information to DWARF 4 format
# ... otherwise DWZ will explode (see https://sourceware.org/bugzilla/show_bug.cgi?id=24756)
LDC_COMPILER_FLAGS = -g --dwarf-version=4
LDC_BUILD_FLAGS = -DINCLUDE_INSTALL_DIR='/usr/lib/ldc/${DEB_HOST_MULTIARCH}/include/d' \
		-DLDC_DYNAMIC_COMPILE=OFF -DPHOBOS_SYSTEM_ZLIB=ON
BOOTSTRAP_DC := $(shell which ldmd2 2>/dev/null || which gdmd 2>/dev/null)
BOOTSTRAP_LDC_FLAGS = -DD_COMPILER=$(BOOTSTRAP_DC) -DBUILD_SHARED_LIBS=ON -DPHOBOS_SYSTEM_ZLIB=ON

ifeq ($(DEB_HOST_ARCH),armhf)
	LDC_COMPILER_FLAGS += -mattr=-neon
endif

ifeq ($(DEB_HOST_ARCH),mips64el)
	LDC_COMPILER_FLAGS += -mabi=n64 -mcpu=mips64r2 -mattr=+xgot
endif

ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
	export DEB_BUILD_MAINT_OPTIONS += abi=+time64,+lfs
endif

LDC_COMPILER_FLAGS_CMAKE_ENCODED = $(shell echo '$(LDC_COMPILER_FLAGS)' | sed 's|\s\+|;|g')
LDC_BUILD_FLAGS += -DD_COMPILER_FLAGS='$(LDC_COMPILER_FLAGS)'
BOOTSTRAP_LDC_FLAGS += -DDRUNTIME_EXTRA_FLAGS='$(LDC_COMPILER_FLAGS_CMAKE_ENCODED)' -DPHOBOS2_EXTRA_FLAGS='$(LDC_COMPILER_FLAGS_CMAKE_ENCODED)'

BOOTSTRAP_S1_BUILD_DIR := $(CURDIR)/bootstrap-stage1
STAGE1_LDMD = $(BOOTSTRAP_S1_BUILD_DIR)/bin/ldmd2

BOOTSTRAP_S2_BUILD_DIR := $(CURDIR)/bootstrap-stage2
STAGE2_LDMD = $(BOOTSTRAP_S2_BUILD_DIR)/bin/ldmd2

# Clear DFLAGS: dpkg sets "-frelease", which is automatically read by ldmd2
# and will lead to failures as ldmd2 doesn't understand GDC flags.
# Setting this to emptystring however will mess up gdmd, so since none of the
# compiler wrappers seems to parse this properly at all, we must unset it.
export DEB_DFLAGS_MAINT_STRIP = -frelease

%:
	dh $@

override_dh_auto_configure:
ifeq ($(BOOTSTRAP_DC),)
	$(error Neither GDMD nor LDMD2 found)
endif
	# Bootstrap LDC using the GNU D Compiler
	dh_auto_configure -B$(BOOTSTRAP_S1_BUILD_DIR) -- $(BOOTSTRAP_LDC_FLAGS)
	dh_auto_build -B$(BOOTSTRAP_S1_BUILD_DIR)

	# Build LDC again using the previously bootstrapped copy
	dh_auto_configure -B$(BOOTSTRAP_S2_BUILD_DIR) -- \
			-DD_COMPILER=$(STAGE1_LDMD) \
			-DBUILD_SHARED_LIBS=OFF $(LDC_BUILD_FLAGS)
	dh_auto_build -B$(BOOTSTRAP_S2_BUILD_DIR)

	# Configure the to-be-released LDC versions, build them with S2 self-built LDC
	dh_auto_configure -- \
			-DD_COMPILER=$(STAGE2_LDMD) \
			-DBUILD_SHARED_LIBS=BOTH $(LDC_BUILD_FLAGS)

override_dh_auto_install:
	dh_auto_install
	rm -rf $(CURDIR)/debian/tmp/usr/lib/ldc/*/include/d/etc/c/zlib/

override_dh_installman:
	dh_installman debian/ldc2.1 debian/ldmd2.1

override_dh_clean:
	rm -f configure-stamp build-stamp
	rm -rf $(BOOTSTRAP_S1_BUILD_DIR) $(BOOTSTRAP_S2_BUILD_DIR)
	dh_clean

override_dh_makeshlibs:
	dh_makeshlibs -V

override_dh_auto_test:
	# Tests, std.zip, std.zip-debug, std.zip-shared, std.zip-debug-shared, dmd-testsuite-debug. dmd-testsuite fail at the moment, so
	# we only run unit tests temporarily
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	ctest -V -R "ldc2-unittest" --test-dir $(BOOTSTRAP_S2_BUILD_DIR)
endif