File: rules

package info (click to toggle)
discover 2.1.2-8
  • links: PTS
  • area: main
  • in suites: bullseye, buster
  • size: 6,248 kB
  • sloc: sh: 8,115; ansic: 7,275; xml: 1,809; makefile: 732
file content (157 lines) | stat: -rwxr-xr-x 4,386 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
#!/usr/bin/make -f

# $Progeny$

# Copyright 2002 Hewlett-Packard Company
# Copyright 2000, 2001, 2002, 2004 Progeny Linux Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

include /usr/share/dpkg/architecture.mk

VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
ARCH=$(shell dpkg --print-architecture)

# if $DEB_BUILD_OPTIONS *doesn't* contain "noopt"
ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
# -O2 seems to make the program segfault (See: #846364)
# -O1 seems to work correctly
OPTIMIZE:=-O2
endif

# Figure out where the kernel PCMCIA headers are, searching the
# directories in order of modification time (most recent
# first).
#PCMCIA_HEADERS:=$(shell \
#	for KDIR in $$(ls -dt /usr/src/kernel* /usr/src/linux* 2>/dev/null); \
#	  do \
#	    if [ -d $$KDIR ]; then \
#		for HFILE in $$(find $$KDIR -name version.h); do \
#		    if expr "$$HFILE" : ".*/pcmcia/version\.h" > \
#		      /dev/null 2>&1; then \
#			echo "$${HFILE%/pcmcia/version.h}"; \
#			break 2; \
#		    fi \
#		done \
#	    fi \
#	done)
# if we found some, pass them to configure

ifneq ($(PCMCIA_HEADERS),)
CONFIGURE_PCMCIA:=--with-pcmcia-headers=$(PCMCIA_HEADERS)
endif

CFLAGS_DEB=CFLAGS="-g $(OPTIMIZE)"
RUN_CONFIGURE=  ../configure $(CONFIGURE_PCMCIA) \
		--prefix=/usr \
		--sbindir=/sbin \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--with-default-url=file:///lib/discover/list.xml \
		--disable-curl

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
RUN_CONFIGURE += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
endif

configure: configure-deb

configure-deb: configure-deb-stamp
configure-deb-stamp:
	dh_testdir
	dh_autotools-dev_updateconfig

	mkdir builddeb
	cd builddeb && $(CFLAGS_DEB) $(RUN_CONFIGURE)

	touch $@

build: build-deb

build-deb: configure-deb-stamp build-deb-stamp
build-deb-stamp:
	dh_testdir

	cd builddeb && $(MAKE)

	touch $@

clean:
	dh_testdir
	dh_testroot
	dh_autotools-dev_restoreconfig

	rm -rf builddeb build-deb-stamp configure-deb-stamp config.log config.status

	debconf-updatepo

	debconf-updatepo
	dh_clean

install: install-deb

install-deb: build-deb
	dh_testdir
	dh_testroot
	dh_installdirs -v

	cd builddeb && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

	# reportbug helper script
	install -d debian/tmp/usr/share/bug/discover
	install -m 755 debian/discover.bug debian/tmp/usr/share/bug/discover

	rm $(CURDIR)/debian/tmp/usr/bin/discover-static
	mv $(CURDIR)/debian/tmp/usr/bin/discover \
		$(CURDIR)/debian/tmp/sbin/discover

	rm -f $(CURDIR)/debian/tmp/etc/discover.conf.example
	rm -f $(CURDIR)/debian/tmp/etc/discover-modprobe.conf.example

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: discover-deb

discover-deb: install-deb
	dh_testdir
	dh_testroot
	dh_movefiles

	dh_installdocs
	dh_installchangelogs
#	XXX: dh_installinit appears to be busted :-P (see Debian #140881)
#	dh_installinit -v --no-restart-on-upgrade --update-rcd-params="start 36 S ."
	dh_compress
	dh_fixperms
	dh_strip
	dh_makeshlibs
	dh_installdebconf
	dh_installdeb
	dh_shlibdeps -ldebian/libdiscover2/usr/lib
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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