File: rules

package info (click to toggle)
hyperestraier 1.4.13-14
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,416 kB
  • ctags: 4,500
  • sloc: ansic: 39,262; java: 3,039; ruby: 2,777; perl: 1,554; makefile: 1,298; sh: 985
file content (210 lines) | stat: -rwxr-xr-x 7,930 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

# 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

#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# work-around for upstream build that thinks $(HOME) belongs in the
# include path for all builds!
export HOME=$(CURDIR)/junkhome

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_ARCH      ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_GNU_CPU   ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
DEB_BUILD_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)

JAVA_UNSUPPORTED_CPUS = zhppaz zmipsz zs390xz zmipselz
JAVA_UNSUPPORTED_SYSTEMS = zkfreebsd-gnuz zgnuz

export RUBYLIBDIR=/usr/lib/ruby/vendor_ruby

export CFLAGS += $(shell dpkg-buildflags --get CFLAGS) -D_FILE_OFFSET_BITS=64
export CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
export CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS)
export LDFLAGS += $(shell dpkg-buildflags --get LDFLAGS)
export GCJFLAGS += $(shell dpkg-buildflags --get GCJFLAGS)
export MYCFLAGS := $(CFLAGS)

export CONFIGURE_VARS += CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" GCJFLAGS="$(GCJFLAGS)"
CONFIGURE_SWITCHES = --host=$(DEB_HOST_GNU_TYPE) \
		     --build=$(DEB_BUILD_GNU_TYPE) \
		     --prefix=/usr \
		     --mandir=\$${prefix}/share/man \
		     --infodir=\$${prefix}/share/info \
		     --includedir=\$${prefix}/include/estraier \
		     --libexecdir=\$${prefix}/lib/estraier

ifeq (,$(findstring z$(DEB_BUILD_GNU_CPU)z,$(JAVA_UNSUPPORTED_CPUS)))
ifeq (,$(findstring z$(DEB_BUILD_GNU_SYSTEM)z,$(JAVA_UNSUPPORTED_SYSTEMS)))
DEFAULT_JAVA ?= $(shell readlink /etc/alternatives/java | sed s@/jre/bin/java@@)
JAVA_HOME ?= $(DEFAULT_JAVA)
CONFIGURE_VARS += JAVA_HOME="$(JAVA_HOME)"
BUILD_JAVA = true
endif
endif

config.status: configure
	dh_testdir
	# Add here commands to configure the package.
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	$(CONFIGURE_VARS) ./configure $(CONFIGURE_SWITCHES)
	cd rubypure && $(CONFIGURE_VARS) ./configure $(CONFIGURE_SWITCHES)
	$(MAKE)
ifeq "$(BUILD_JAVA)" "true"
	cd javapure && $(CONFIGURE_VARS) ./configure $(CONFIGURE_SWITCHES) \
		--libdir=\$${prefix}/share/hyperestraier
	cd javanative && $(CONFIGURE_VARS) LIBS="../libestraier.a" ./configure $(CONFIGURE_SWITCHES)
endif
	cd perlnative && $(CONFIGURE_VARS) ./configure $(CONFIGURE_SWITCHES)

#Architecture 
build: build-arch build-indep

build-indep:

build-arch: build-arch-stamp
build-arch-stamp:  config.status
	# Add here commands to compile the arch part of the package.
	$(MAKE) && $(MAKE) check
	$(MAKE) estseek.fcgi
	cd rubypure && $(MAKE)
	perl -p -i -e 's@^#! /usr/bin/ruby1\.8 -w@#! /usr/bin/ruby -w@' rubypure/estcall.rb
	perl -p -i -e 's@^#! /usr/bin/ruby1\.8 -w@#! /usr/bin/ruby -w@' rubynative/estcmd.rb
ifeq "$(BUILD_JAVA)" "true"
	cd javapure && $(MAKE)
	cd javanative && $(MAKE) && $(MAKE) check
endif
	cd perlnative/src && perl Makefile.PL INC="-I/usr/include/qdbm -I. -I../.. -I/usr/include/estraier" \
		OPTIMIZE="$(CFLAGS) $(CPPFLAGS) $(FFLAGS)" \
		LIBS="-L../.. -lestraier -lqdbm -lz -lm -lc" INSTALLDIRS=vendor && $(MAKE) \
		OTHERLDFLAGS="$(LDFLAGS)"
	cd perlnative && $(MAKE) check
	#$(MAKE) doc
	touch build-arch-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-arch-stamp build-indep-stamp binary-arch-stamp binary-indep-stamp
	rm -rf config.sub config.guess rubypure/pure rubynative/native
	# Add here commands to clean up after the build process.
	[ ! -f Makefile ] || $(MAKE) distclean
	-cd rubypure && $(MAKE) distclean
	-cd rubynative && $(MAKE) distclean
	-cd rubynative/src && $(MAKE) distclean
	-cd javapure && $(MAKE) distclean
	-cd javanative && $(MAKE) distclean
	-cd perlnative && $(MAKE) distclean
	dh_clean 

# Build architecture dependant packages using the common target.
binary-arch: binary-arch-stamp
binary-arch-stamp: build-arch
	dh_testdir
	dh_testroot
	dh_prep 
	dh_installdirs -s
	# Add here commands to install the arch part of the package into 
	# debian/tmp.
	$(MAKE) install prefix=$(CURDIR)/debian/hyperestraier/usr
	perl -p -i -e 's/^\.TH ESTWAVER 3/\.TH ESTWAVER 1/' $(CURDIR)/debian/hyperestraier/usr/share/man/man1/estwaver.1

	# ruby
	mkdir -p $(CURDIR)/debian/ruby-hyperestraier/$(RUBYLIBDIR)
	cp -Rf rubypure/estraierpure.rb $(CURDIR)/debian/ruby-hyperestraier/$(RUBYLIBDIR)
	install -m 644 rubynative/estraier-doc.rb $(CURDIR)/debian/ruby-hyperestraier/$(RUBYLIBDIR)

	# build Ruby with gem2deb
	dh_ruby --install

	# create example directory tree
	cp -pR rubypure/example rubypure/pure
	cp -Rf rubypure/estcall.rb rubypure/pure
	cp -pR rubynative/example rubynative/native
	cp -Rf rubynative/estcmd.rb rubynative/native

ifeq "$(BUILD_JAVA)" "true"
	cd javapure && $(MAKE) install DESTDIR=$(CURDIR)/debian/libestraier-java
	mv $(CURDIR)/debian/libestraier-java/usr/share/hyperestraier/estraierpure.jar $(CURDIR)/debian/libestraier-java/usr/share/hyperestraier/lib/
	cd javanative && $(MAKE) install \
		DESTDIR=$(CURDIR)/debian/libestraier-java
	cp -L $(CURDIR)/debian/libestraier-java/usr/lib/libjestraier.so $(CURDIR)/debian/libestraier-java/usr/lib/jni/libjestraier.so
	mv $(CURDIR)/debian/libestraier-java/usr/lib/estraier.jar $(CURDIR)/debian/libestraier-java/usr/share/hyperestraier/lib/
	-rm -f $(CURDIR)/debian/libestraier-java/usr/lib/libjestraier.so*
endif
	chrpath -d perlnative/src/blib/arch/auto/Estraier/Estraier.so
	perl -p -i -e 's/^Perl Binding/Estraier - Perl Binding/' perlnative/src/blib/man3/Estraier.3pm
	cd perlnative && $(MAKE) install \
		DESTDIR=$(CURDIR)/debian/libestraier-perl
	# estmttest is test only
	rm $(CURDIR)/debian/hyperestraier/usr/bin/estmttest
	install -m 755 estseek.fcgi $(CURDIR)/debian/hyperestraier/usr/lib/estraier/
	chrpath -d $(CURDIR)/debian/hyperestraier/usr/lib/estraier/*cgi
	chrpath -d `file $(CURDIR)/debian/hyperestraier/usr/bin/* | awk -F: '/ELF/{print $$1}'`
	dh_install -s
	dh_movefiles --source=./debian/hyperestraier
	cd $(CURDIR)/debian/hyperestraier/usr/share/hyperestraier && \
	rm -rf COPYING ChangeLog THANKS doc
	find $(CURDIR)/debian -type d -empty -delete

	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
	touch binary-arch-stamp

# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installexamples
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installpam
#	dh_installmime
	dh_installinit
#	dh_installcron
	dh_installman
	dh_link
ifeq "$(BUILD_JAVA)" "true"
	-rm -f $(CURDIR)/debian/libestraier-java/usr/share/java/estraier.jar
endif
	dh_fixperms
	dh_strip
	dh_compress 
	dh_perl
	dh_makeshlibs --no-package=libestraier-java -V
	dh_installdeb
	dh_shlibdeps -l debian/libestraier8/usr/lib
	dh_gencontrol
	dh_lintian
	dh_md5sums
	dh_builddeb

binary: binary-arch binary-indep
binary-indep:
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch