summaryrefslogtreecommitdiff
path: root/ACE/debianbuild/rules
blob: 5602c1aed85cb28446c589fe6b4edb7397f19d8f (plain)
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#!/usr/bin/make -f

# debian/rules file for the ACE Debian GNU/Linux package
# written February 2002 by Ossama Othman <ossama@debian.org>
# Modified August 2003 by Brian Nelson <pyro@debian.org>
# Copyright (C) 2004  Raphael Bossek <bossekr@debian.org>
# Copyright © 2005-2008 Thomas Girard <thomas.g.girard@free.fr>

INSTALL := install -o root -g root
INSTALL_755 := $(INSTALL) -m 755

export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
confflags += --build $(DEB_HOST_GNU_TYPE)
else
confflags += --build $(DEB_BUILD_GNU_TYPE) \
             --host $(DEB_HOST_GNU_TYPE)
endif

TCL_HOME := /usr/lib
TK_HOME  := /usr/lib

ACE_SUBDIR := ACE_wrappers
ACE_ARCHIVE := $(shell ls -1 ACE+TAO+CIAO-src-*.tar.bz2 2>/dev/null || echo ace-archive-missing)
MPC_SUBDIR := MPC
MPC_ARCHIVE := $(shell ls -1 MPC*.tar.gz 2>/dev/null || echo mpc-archive-missing)

MWCFLAGS := -type automake -features "ssl=1,zlib=1,zzip=1,xt=1,tk=1,fl=1,qt=1,fox=1" -noreldefs

MAN1 := debian/Basic_Logging_Service.1 \
	debian/Event_Logging_Service.1 \
	debian/Notify_Logging_Service.1 \
	debian/RTEvent_Logging_Service.1 \
	debian/TAO_ORB_Options.1 \
	debian/mpc-ace.1
MAN5 :=

DOXYGEN_FILES_TO_REMOVE := -name '*.tag' -o \
                           -name '*.md5' -o \
                           -name '*.dot' -o \
                           -name '*.idx' -o \
                           -name '*.map' -o \
                           -name 'index.hh?'

ifneq (mpc-archive-missing,$(MPC_ARCHIVE))
export MPC_ROOT := $(shell pwd)/$(MPC_SUBDIR)
endif
export ACE_ROOT := $(shell pwd)/$(ACE_SUBDIR)
export TAO_ROOT := $(ACE_ROOT)/TAO
export CIAO_ROOT := $(TAO_ROOT)/CIAO
export DANCE_ROOT := $(CIAO_ROOT)/DAnCE
export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(ACE_ROOT)/lib
export QTDIR := /usr/share/qt4

# This dpatch is only a place holder. The `prepatch' targets stops
# here by default.
PREPATCH_MARK := 50-prepatch-dummy-mark.dpatch
UNTIL := $(PREPATCH_MARK)

# Where we install every file before calling dh_install
DT := debian/tmp

CONFIG := objdir/ace/config.h

extract-stamp: $(ACE_ARCHIVE)
	tar -xjf $<
	cp debian/platform_macros.GNU.in $(ACE_ROOT)/include/makeinclude
	touch $@

.PHONY: extract
extract: extract-stamp

$(MPC_ROOT): $(MPC_ARCHIVE)
	tar -xzf $<
	touch $@

debian/mpc-ace.sgml: ACE_wrappers/MPC/docs/MPC.sgml
	sed -e 's/mpc\.pl/mpc-ace/g' -e 's/mwc\.pl/mwc-ace/g' $< > $@

debian/%.1 debian/%.5: debian/%.sgml
	docbook-to-man $< > $@

# Prepare a ACE_wrappers directory where most of the patches are applied.
ifneq (mpc-archive-missing,$(MPC_ARCHIVE))
prepatch-stamp: extract-stamp $(MPC_ROOT)
else
prepatch-stamp: extract-stamp
endif
	dpatch apply-until $(UNTIL)
	cd $(ACE_ROOT) &&    bin/mwc.pl -noreldefs $(MWCFLAGS) ACE.mwc
	cd $(TAO_ROOT) && ../bin/mwc.pl -noreldefs $(MWCFLAGS) TAO.mwc
	patch -p0 < debian/patches/09-autoconf-fix-no-base-include-headers.diff
	patch -p0 < debian/patches/21-generate-platform_macros.GNU.diff
	touch $@

.PHONY: prepatch
prepatch: prepatch-stamp

pl-stamp: extract-stamp
	for fn in `find "$(ACE_ROOT)" -name "*.pl"`; do (echo '#!/usr/bin/perl'; cat "$$fn") > "$${fn}T"; mv "$${fn}T" "$$fn"; chmod a+x "$$fn"; done
	touch $@

patch-stamp: pl-stamp autotools-stamp
	dpatch apply-all
	chmod +x $(ACE_ROOT)/configure $(ACE_ROOT)/TAO/configure
	touch $@

.PHONY: patch
patch: patch-stamp

unpatch: patch-stamp
	dpatch unpatch
	rm -f $<

ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
      CXXFLAGS+=-O2
endif

autotools-stamp: prepatch-stamp
	patch -p0 < debian/patches/93-hack-to-fix-libtoolize.dpatch
	patch -p1 -d $(ACE_ROOT) < debian/patches/94-build-crosscompile.dpatch
	patch -p1 -d $(TAO_ROOT) < debian/patches/94-build-crosscompile.dpatch
	patch -p1 -d $(ACE_ROOT) < debian/patches/95-build-ace-for-tao.dpatch
	patch -p1 -d $(ACE_ROOT) < debian/patches/96-build-athena3d.dpatch
	cd $(ACE_ROOT) && bin/bootstrap

#	cd $(ACE_ROOT) && autoconf && autoheader && aclocal && automake && libtoolize
#	cd $(TAO_ROOT) && autoconf && autoheader && aclocal && automake && libtoolize

#	echo "ACE_ROOT - autoconf"
#	autoconf
#	echo "ACE_ROOT - autoheader"
#	autoheader
#	echo "ACE_ROOT - aclocal"
#	aclocal
#	echo "ACE_ROOT - automake"
#	automake
#	echo "ACE_ROOT - libtoolize"
#	libtoolize

#	cd $(TAO_ROOT)
#	echo "TAO_ROOT - autoconf"
#	autoconf
#	echo "TAO_ROOT - autoheader"
#	autoheader
#	echo "TAO_ROOT - aclocal"
#	aclocal
#	echo "TAO_ROOT - automake"
#	automake
#	echo "TAO_ROOT - libtoolize"
#	libtoolize

	touch $@

.PHONY: autotools
autotools: autotools-stamp

build: build-stamp manpages-stamp

manpages-stamp: $(MAN1) $(MAN5)
	touch $@

doxygen-stamp: extract-stamp
	cd $(ACE_ROOT) && bin/generate_doxygen.pl -is_release
	find $(ACE_ROOT)/html/ace $(DOXYGEN_FILES_TO_REMOVE) | xargs -r rm -f
	find $(ACE_ROOT)/html/tao $(DOXYGEN_FILES_TO_REMOVE) | xargs -r rm -f
	touch $@

.PHONY: doxygen
doxygen: doxygen-stamp

build-stamp: configure-stamp
	dh_testdir
	mkdir -p objdir/ace/QtReactor
	$(MAKE) -C objdir
	$(MAKE) -C objdir/TAO

	touch $@

clean:
	dh_testdir
	rm -rf $(ACE_SUBDIR) $(MPC_SUBDIR) objdir debian/patched $(MAN1) $(MAN5) *-stamp debian/mpc-ace.sgml
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) -C objdir install DESTDIR=$(CURDIR)/$(DT)
	$(MAKE) -C objdir/TAO install DESTDIR=$(CURDIR)/$(DT)

#	We provide scripts replacement for tao_idl and tao_ifr ; they
#	automatically define ACE_ROOT and TAO_ROOT
	mv $(DT)/usr/bin/tao_idl $(DT)/usr/bin/tao_idl.real
	$(INSTALL_755) -D debian/tao_idl $(DT)/usr/bin/tao_idl
	mv  $(DT)/usr/bin/tao_ifr  $(DT)/usr/bin/tao_ifr.real
	$(INSTALL_755) -D debian/tao_ifr $(DT)/usr/bin/tao_ifr

#       Copy MPC files.
	$(INSTALL_755) -D $(ACE_ROOT)/bin/mpc.pl $(DT)/usr/bin/mpc-ace
	$(INSTALL_755) -D $(ACE_ROOT)/bin/mwc.pl $(DT)/usr/bin/mwc-ace

#	Be lintian clean, fix permissions on examples
	-chmod -x `find $(TAO_ROOT)/examples/ -perm 755 ! -type d -a ! \( -name "*.pl" -o -name "*.sh" \)`

#       We don't install .la files
	find $(DT) -name '*.la' -print0 | xargs -0 rm
	rm -f $(DT)/usr/bin/TAO_Service
	dh_install --sourcedir=$(DT) --fail-missing

binary-indep: build install doxygen-stamp
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installexamples -i
	dh_installman -i
	dh_installchangelogs -i $(ACE_ROOT)/ChangeLog
	dh_perl -i
	dh_link -i
	dh_compress -i -Xexamples -Xtutorials
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a -A
	dh_installman -a
	dh_installinfo -pgperf-ace $(ACE_ROOT)/apps/gperf/ace_gperf.info
	dh_installchangelogs -a $(ACE_ROOT)/ChangeLog
	dh_installchangelogs -pgperf-ace $(ACE_ROOT)/apps/gperf/ChangeLog
	dh_strip -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a -V
	dh_installdeb -a
	dh_shlibdeps -a -l `ls -1 debian/lib*.install | sed -e 's#\(.*\)\.install#\1/usr/lib#' | tr '\n' ':' | sed -e 's#:$$##'`
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch

configure-stamp: patch-stamp
	mkdir -p objdir
	cd objdir && ../ACE_wrappers/configure $(confflags) --prefix=/usr \
           --disable-tao-examples --disable-tao-tests \
           --disable-ace-examples --disable-ace-tests \
           --enable-fl-reactor --enable-qt-reactor --enable-xt-reactor \
           --enable-tk-reactor \
           --with-fox-config=/usr/bin --enable-fox-reactor \
           --with-tclconfig=$(TCL_HOME) --with-tkconfig=$(TK_HOME) \
           --with-zlib --with-zzip \
           --enable-ipv6 --enable-ipv4-ipv6 \
           --enable-inline \
           --enable-pthreads \
           --enable-symbol-visibility \
           --enable-ace-reactor-notification-queue
	echo '#define TAO_IDL_INCLUDE_DIR "/usr/include/tao"' >> $(CONFIG)

	# bz#3138
	echo "#define ACE_HAS_RECURSIVE_MUTEXES" >> $(CONFIG)

	echo "#define ACE_HAS_SCANDIR" >> $(CONFIG)
	echo "#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR" >> $(CONFIG)

	# bz#3144
	echo "#define ACE_HAS_SENDFILE" >> $(CONFIG)

	echo "#define ACE_LACKS_WCSICMP" >> $(CONFIG)

	echo "#define ACE_POSIX_SIG_PROACTOR" >> $(CONFIG)

	# TODO: ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO?

	# Remove PACKAGE_* from the generated config.h
	sed -i -e '/package/I D' objdir/ace/config.h
	touch $@

.PHONY: configure
configure: configure-stamp

.PHONY: build clean binary-indep binary-arch binary install unpatch source diff