File: rules

package info (click to toggle)
dietlibc 0.34~cvs20160606-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 11,336 kB
  • sloc: ansic: 71,631; asm: 13,006; cpp: 1,860; makefile: 799; sh: 292; perl: 62
file content (137 lines) | stat: -rwxr-xr-x 4,417 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
133
134
135
136
137
#!/usr/bin/make -f

ifeq (,$(findstring terse,${DEB_BUILD_OPTIONS}))
export DH_VERBOSE=1
export V=1
export VERBOSE=1
endif

# dietlibc is static, where PIE is currently unsupported
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
export DEB_CFLAGS_MAINT_APPEND = -Wall -fno-pie
export DEB_LDFLAGS_MAINT_APPEND = -no-pie

# for "debian/rules get-orig-source"
ORIGTGZ_DATE:=          '2016-06-06 15:30Z'
ORIGTGZ_SOURCE:=	-D${ORIGTGZ_DATE}
ORIGTGZ_DESTINATION:=	0.34~cvs20160606

# determine whether we are cross-compiling
DEB_BUILD_GNU_TYPE?=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE?=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
ifeq (${DEB_BUILD_GNU_TYPE},${DEB_HOST_GNU_TYPE})
CROSS:=0
else
CROSS:=1
endif

EXTRA_MAKE_FLAGS =

TRIPLET ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEBIANARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

ARCH =$(DEBIANARCH)
ifeq ($(ARCH),amd64)
  ARCH =x86_64
else
ifeq ($(ARCH),powerpc)
  ARCH =ppc
else
ifeq ($(ARCH),powerpcspe)
  ARCH =ppc
  EXTRA_MAKE_FLAGS += SOFTFPU=1
else
ifeq ($(ARCH),ppc64el)
  ARCH =ppc64le
else
ifeq ($(ARCH),mips64el)
  ARCH =mips64
else
ifeq ($(ARCH),hppa)
  ARCH =parisc
else
ifeq ($(ARCH),arm64)
  ARCH =aarch64
else
ifneq (,$(findstring arm,$(ARCH)))
  ARCH =arm
endif
endif
endif
endif
endif
endif
endif
endif

VERSION =$(shell head -n1 debian/changelog |sed -e 's/.*(\(.*\)).*/\1/')
# Make this a recursively expanded variable, because we only want to
# evaluate it in the very last moment. Also, unset MAKELEVEL/MAKEFLAGS
# because this is not really a recursive make we want here.
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  DIETLIBC_CFLAGS =$(shell env -u MAKELEVEL -u MAKEFLAGS -- make --silent -f debian/find_orig_cflags.mk print_orig_dietlibc_cflags MYARCH='$(ARCH)' DEBUG=1)
else
  DIETLIBC_CFLAGS =$(shell env -u MAKELEVEL -u MAKEFLAGS -- make --silent -f debian/find_orig_cflags.mk print_orig_dietlibc_cflags MYARCH='$(ARCH)')
endif
# Dietlibc doesn't care about CPPFLAGS/LDFLAGS, so add them to CFLAGS
DEBIAN_CFLAGS =$(shell dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get LDFLAGS)

%:
	dh $@

override_dh_auto_configure:
override_dh_auto_build-indep:
override_dh_auto_build-arch:
	@# See Debian bug #523086
	mv -f parisc/strstr.S parisc/strstr.S.disabled
	dh_auto_build -- prefix=/usr/lib/$(TRIPLET)/diet \
		MYARCH='$(ARCH)' VERSION='$(VERSION)' DEBUG=1 \
		$(EXTRA_MAKE_FLAGS) \
		CFLAGS='$(DEBIAN_CFLAGS) $(DIETLIBC_CFLAGS)'

override_dh_auto_test-indep:
override_dh_auto_test-arch:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
ifeq (${CROSS},0)
	debian/unittests/suite.sh '$(ARCH)'
endif
endif

override_dh_auto_clean-indep:
override_dh_auto_clean-arch:
	dh_auto_clean -- MYARCH='$(ARCH)'
	rm -f debian/dietlibc-dev.postinst debian/dietlibc-dev.prerm
	@# See Debian bug #523086
	[ ! -f parisc/strstr.S.disabled ] || \
		mv -f parisc/strstr.S.disabled parisc/strstr.S

override_dh_auto_install-indep:
override_dh_auto_install-arch:
	mkdir -p debian/tmp/etc
	dh_auto_install --max-parallel=1 -- prefix=/usr/lib/$(TRIPLET)/diet MYARCH='$(ARCH)' VERSION='$(VERSION)' DEBUG=1 \
		CFLAGS='$(DEBIAN_CFLAGS) $(DIETLIBC_CFLAGS)'
	sed -e 's/|ARCH|/$(ARCH)/g;s/|TRIPLET|/$(TRIPLET)/g;s/|DEBIANARCH|/$(DEBIANARCH)/g' <debian/dietlibc-dev.postinst.in \
	  >debian/dietlibc-dev.postinst
	sed -e 's/|ARCH|/$(ARCH)/g;s/|TRIPLET|/$(TRIPLET)/g;s/|DEBIANARCH|/$(DEBIANARCH)/g' <debian/dietlibc-dev.prerm.in \
	  >debian/dietlibc-dev.prerm

_ANONCVSROOT:=		:pserver:cvs@cvs.fefe.de:/cvs
_CVSEXPORT:=		env CVS_RSH=ssh TZ=UTC cvs -qd ${_ANONCVSROOT} -z9 export
_RESET_TIMES:=          find dietlibc-${ORIGTGZ_DESTINATION} -type f | xargs touch -d${ORIGTGZ_DATE}
_PACK:=			find dietlibc-${ORIGTGZ_DESTINATION} -type f | LC_ALL=C.UTF-8 sort | \
			    paxcpio -oC512 -Hustar -Mdist
get-orig-source:
	rm -rf $@.tmp
	mkdir $@.tmp
	# to get a Debian .orig.tar.gz we need to pull the source from CVS
	cd $@.tmp; ${_CVSEXPORT} ${ORIGTGZ_SOURCE} dietlibc
	# fixup files with CR-LF line endings
	cd $@.tmp; find dietlibc -type f -print0 | \
	    xargs -0 perl -pi -e 's/\r$$//' --
	# then rename and pack it up
	mv $@.tmp/dietlibc $@.tmp/dietlibc-${ORIGTGZ_DESTINATION}
	cd $@.tmp; ${_RESET_TIMES}
	cd $@.tmp; ${_PACK} | xz -7 >../dietlibc_${ORIGTGZ_DESTINATION}.orig.tar.xz
	rm -rf $@.tmp
	# there we are...
	ls -l dietlibc_${ORIGTGZ_DESTINATION}.orig.tar.xz