File: rules

package info (click to toggle)
openser 1.1.0-9etch1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,828 kB
  • ctags: 11,809
  • sloc: ansic: 120,528; sh: 5,249; yacc: 1,716; makefile: 1,261; php: 656; perl: 205; sql: 190
file content (233 lines) | stat: -rwxr-xr-x 8,227 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

ALL_PACKAGES = openser openser-mysql-module openser-postgres-module \
	openser-jabber-module openser-cpl-module openser-radius-modules \
	openser-unixodbc-module

DEBVERSION:=$(shell head -n 1 debian/changelog \
                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//')

FILENAME := openser_$(UPVERSION).orig.tar.gz
UPFILENAME := openser-$(UPVERSION)-notls_src.tar.gz
URL := http://openser.org/pub/openser/$(UPVERSION)/src/openser-$(UPVERSION)-notls_src.tar.gz

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

# Include dpatch rules
include /usr/share/dpatch/dpatch.make


# Is this the TLS version ?
TLS=$(shell test -d tls && echo 1)

# modules depending on mysql
MYSQL_MODULES = mysql
# modules depending on postgres
POSTGRES_MODULES = postgres
# modules depending on unixODBC
UNIXODBC_MODULES=unixodbc
# jabber related modules
JABBER_MODULES = jabber
# cpl related modules
CPL_MODULES = cpl-c
# module depending on radiusclient
RADIUS_MODULES = avp_radius auth_radius group_radius uri_radius

ALL_MODULES = $(MYSQL_MODULES) $(POSTGRES_MODULES) $(UNIXODBC_MODULES) $(JABBER_MODULES) $(CPL_MODULES) $(RADIUS_MODULES)

# modules not in the "main" package or unstable modules
EXCLUDED_MODULES = $(ALL_MODULES) pa

# the same but with path prepended (needed for modules="...")
MYSQL_MOD_PATH=$(addprefix modules/, $(MYSQL_MODULES))
POSTGRES_MOD_PATH=$(addprefix modules/, $(POSTGRES_MODULES))
UNIXODBC_MOD_PATH=$(addprefix modules/, $(UNIXODBC_MODULES))
JABBER_MOD_PATH=$(addprefix modules/, $(JABBER_MODULES))
CPL_MOD_PATH=$(addprefix modules/, $(CPL_MODULES))
RADIUS_MOD_PATH=$(addprefix modules/, $(RADIUS_MODULES))

ifeq (cc, $(CC))
	CC = gcc
endif

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
else
	ifeq (arm, $(DEB_HOST_ARCH))
		CFLAGS += -O1
	else
		CFLAGS += -O2
	endif
endif

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp:
	dh_testdir
	# Add here commands to configure the package.

	touch configure-stamp


build: build-stamp
build-stamp: patch-stamp configure-stamp 
	dh_testdir

	# Add here commands to compile the package.
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) all skip_modules="$(EXCLUDED_MODULES)" cfg-target=/etc/openser/
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(MYSQL_MOD_PATH)" cfg-target=/etc/openser/
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(POSTGRES_MOD_PATH)" cfg-target=/etc/openser/
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(UNIXODBC_MOD_PATH)" cfg-target=/etc/openser/
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(JABBER_MOD_PATH)" cfg-target=/etc/openser/
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(CPL_MOD_PATH)" cfg-target=/etc/openser/
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(RADIUS_MOD_PATH)" cfg-target=/etc/openser/

	touch build-stamp

clean: real-clean unpatch
real-clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) TLS=$(TLS) include_modules="$(ALL_MODULES)" proper
	rm -f cfg.tab.h
	rm -f utils/openserunix/openserunix.o utils/openserunix/openserunix

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/openser
	# openser base package
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install skip_modules="$(EXCLUDED_MODULES)" \
		basedir=$(CURDIR)/debian/openser \
		prefix=/usr \
		cfg-prefix=$(CURDIR)/debian/openser \
		cfg-target=/etc/openser/

	find $(CURDIR)/debian/openser/etc/openser -type f -exec chmod -x {} \;
	sed -i -e "s/^PATH.*//" $(CURDIR)/debian/openser/usr/sbin/openserctl

	# install only the mysql module
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(MYSQL_MOD_PATH)"  \
		basedir=$(CURDIR)/debian/openser-mysql-module \
		prefix=/usr \
		cfg-prefix=$(CURDIR)/debian/openser-mysql-module \
		cfg-target=/etc/openser/ \
		doc-dir=share/doc/openser-mysql-module

	mv $(CURDIR)/debian/openser-mysql-module/usr/sbin/openser_mysql.sh $(CURDIR)/debian/openser-mysql-module/usr/sbin/openser_mysql
	sed -i -e "s/^PATH.*//" $(CURDIR)/debian/openser-mysql-module/usr/sbin/openser_mysql
	chmod +x $(CURDIR)/debian/openser-mysql-module/usr/sbin/openser_mysql

	# install only the postgres module
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(POSTGRES_MOD_PATH)"  \
		basedir=$(CURDIR)/debian/openser-postgres-module \
		prefix=/usr \
		cfg-prefix=$(CURDIR)/debian/openser-postgres-module \
		cfg-target=/etc/openser/ \
		doc-dir=share/doc/openser-postgres-module

	mv $(CURDIR)/debian/openser-postgres-module/usr/sbin/openser_postgresql.sh $(CURDIR)/debian/openser-postgres-module/usr/sbin/openser_postgresql
	sed -i -e "s/^PATH.*//" $(CURDIR)/debian/openser-postgres-module/usr/sbin/openser_postgresql
	chmod +x $(CURDIR)/debian/openser-postgres-module/usr/sbin/openser_postgresql

	# install only the unixodbc module
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(UNIXODBC_MOD_PATH)"  \
		basedir=$(CURDIR)/debian/openser-unixodbc-module \
		prefix=/usr \
		cfg-prefix=$(CURDIR)/debian/openser-unixodbc-module \
		cfg-target=/etc/openser/ \
		doc-dir=share/doc/openser-unixodbc-module

	# install only the jabber module
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(JABBER_MOD_PATH)"  \
		basedir=$(CURDIR)/debian/openser-jabber-module \
		prefix=/usr \
		cfg-prefix=$(CURDIR)/debian/openser-jabber-module \
		cfg-target=/etc/openser/ \
		doc-dir=share/doc/openser-jabber-module

	# install only the cpl module
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(CPL_MOD_PATH)"  \
		basedir=$(CURDIR)/debian/openser-cpl-module \
		prefix=/usr \
		cfg-prefix=$(CURDIR)/debian/openser-cpl-module \
		cfg-target=/etc/openser/ \
		doc-dir=share/doc/openser-cpl-module

	# install only the radius modules
	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(RADIUS_MOD_PATH)"  \
		basedir=$(CURDIR)/debian/openser-radius-modules \
		prefix=/usr \
		cfg-prefix=$(CURDIR)/debian/openser-radius-modules \
		cfg-target=/etc/openser/ \
		doc-dir=share/doc/openser-radius-modules

	mkdir -p $(CURDIR)/debian/openser-radius-modules/etc/openser/
	mv $(CURDIR)/debian/openser/etc/openser/dictionary.radius $(CURDIR)/debian/openser-radius-modules/etc/openser/


	# the modules packages all ship an empty /usr/sbin directory, let's clean that up
	for p in $(ALL_PACKAGES); \
		do rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/$$p/usr/sbin; done

# This single target is used to build all the packages, all at once, or
# one at a time. So keep in mind: any options passed to commands here will
# affect _all_ packages. Anything you want to only affect one package
# should be put in another target, such as the install target.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
#	dh_installlogrotate
	dh_installinit -popenser -- defaults 23
	dh_installcron
	dh_installman
	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_strip --dbg-package=openser-dbg
	dh_compress 
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-independent packages using the common target
binary-indep: build install
# We have nothing to do by default.

binary: binary-indep binary-arch

print-version:
	@@echo "Debian version:          $(DEBVERSION)"
	@@echo "Upstream version:        $(UPVERSION)"

get-orig-source:
	@@dh_testdir
	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
	@@echo Downloading $(FILENAME) from $(URL) ...
	@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)

.PHONY: build clean binary-indep binary-arch binary install configure patch unpatch real-clean