File: rules

package info (click to toggle)
ctfutils 10.3~svn297264-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 3,492 kB
  • sloc: ansic: 60,377; makefile: 225
file content (163 lines) | stat: -rwxr-xr-x 4,593 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
SHELL=bash

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

CFLAGS = -Wall -Wno-unknown-pragmas -g -pipe -fPIC -I. \
         -D_GNU_SOURCE -DNEED_SOLARIS_BOOLEAN \
	-isystem /usr/include/freebsd \
	-Werror=implicit-function-declaration \
	$(NULL)

# Satisfy 64-bit off_t assumptions in the compat layer (see #734782)
CFLAGS += -D_FILE_OFFSET_BITS=64

# Enable fseeko / ftello prototypes, used in the compat layer
CFLAGS += -D_LARGEFILE_SOURCE

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))

	# Do not mess with MAKEFLAGS until we transfer control to BSD make (see below)
	BSD_MAKEFLAGS += -j$(NUMJOBS)
endif

full_version	:= $(shell dpkg-parsechangelog | grep ^Version: | sed -e 's/^.*: //g')
tar_version	:= $(shell echo $(full_version) | sed -e 's/-.*//g')
svn_revision	:= $(shell echo $(full_version) | sed -e 's/.*~svn\([0-9]*\)-[0-9]*/\1/g')
version		:= $(shell echo $(full_version) | sed -e 's/[~+-].*//g')
major           := $(shell echo $(version) | sed -e 's/\..*//g')
revision	:= $(shell echo $(full_version) | sed -e 's/^[^+-]*//g')

SVN_BASE	:= https://svn.freebsd.org/base
#SVN		:= $(SVN_BASE)/release/$(version).0
SVN		:= $(SVN_BASE)/releng/$(version)
#SVN		:= $(SVN_BASE)/stable/$(major)
#SVN		:= $(SVN_BASE)/head

SOURCE = ctfutils
ORIG_DIR = $(SOURCE)-$(tar_version)
ORIG_TAR = $(SOURCE)_$(tar_version).orig.tar.xz

PATH := /usr/lib/freebsd:$(PATH)
SOURCE_DATE_EPOCH ?= $(shell date -d "$$(dpkg-parsechangelog -SDate)" +%s)
DESTDIR = $(CURDIR)/debian/tmp
PMAKE = \
	MAKEFLAGS=$(BSD_MAKEFLAGS) \
	COPTS="$(CFLAGS)" CFLAGS="$(CFLAGS)" NO_WERROR=1 NOGCCERROR=1 \
	OPENSOLARIS_USR_DISTDIR="$(CURDIR)/cddl/contrib/opensolaris" \
	OPENSOLARIS_SYS_DISTDIR="$(CURDIR)/sys/cddl/contrib/opensolaris" \
        NOSHARED=NO NO_SHARED=NO DESTDIR=$(DESTDIR) make
export SHLIB_MAJOR = 0

get-orig-source:
	rm -rf $(ORIG_DIR)
	for i in \
		cddl/compat/opensolaris \
		sys/cddl/compat/opensolaris \
		\
		cddl/contrib/opensolaris/common/ctf \
		cddl/contrib/opensolaris/tools/ctf \
		cddl/contrib/opensolaris/lib/libctf \
		cddl/contrib/opensolaris/lib/libgen \
		sys/cddl/contrib/opensolaris/uts/common/ctf \
		sys/cddl/contrib/opensolaris/uts/common/sys \
		\
		cddl/lib/libctf \
		cddl/usr.bin/ctfconvert \
		cddl/usr.bin/ctfdump \
		cddl/usr.bin/ctfmerge \
	         ; do \
	    svn export $(SVN)/$$i $(ORIG_DIR)/$$i || exit ; \
	done
	# Clamp timestamps to be no newer than last changelog entry, see
	# https://wiki.debian.org/ReproducibleBuilds/TimestampsInTarball
	find $(ORIG_DIR) -newermt "@$(SOURCE_DATE_EPOCH)" -print0 \
	 | xargs -0r touch --no-dereference --date="@$(SOURCE_DATE_EPOCH)"
	# Create tarball with files sorted in a stable order, see
	# https://wiki.debian.org/ReproducibleBuilds/FileOrderInTarballs
	find $(ORIG_DIR) -print0 | LC_ALL=C sort -z \
	 | tar --null --no-recursion --files-from - \
	    --numeric-owner --owner 0 --group 0 \
	    -cJf ../$(ORIG_TAR)
	rm -rf $(ORIG_DIR)

build: build-arch build-indep

build-arch: build-ctfutils

build-indep:
# We have nothing to do by default.


build-libctf: build-libctf-stamp
build-libctf-stamp:
	$(PMAKE) -C $(CURDIR)/cddl/lib/libctf
	touch $@

build-ctfutils: build-ctfutils-stamp
build-ctfutils-stamp: build-libctf-stamp build-libctf-stamp
	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/ctfconvert
	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/ctfdump
	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/ctfmerge
	touch $@

clean:
	dh_testdir
	dh_testroot
	$(PMAKE) -C $(CURDIR)/cddl/lib/libctf clean
	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/ctfconvert clean
	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/ctfdump clean
	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/ctfmerge clean

	rm -f *stamp
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep -s
	dh_installdirs -s
	dh_install -s


binary: binary-arch binary-indep

binary-indep: build install
# We have nothing to do by default.

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -a
	dh_installdocs -a
#	dh_installexamples
	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
#	dh_perl
#	dh_python
	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

.PHONY: build clean binary-indep binary-arch binary install configure build-arch build-indep