File: rules

package info (click to toggle)
graphviz 2.38.0-17
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 80,692 kB
  • ctags: 27,194
  • sloc: ansic: 1,038,718; sh: 14,765; cpp: 11,377; makefile: 4,480; yacc: 3,339; xml: 2,466; tcl: 1,950; cs: 1,890; objc: 1,157; perl: 422; lex: 375; awk: 241; python: 45; ruby: 41; php: 26
file content (279 lines) | stat: -rwxr-xr-x 8,866 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
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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

include /usr/share/python/python.mk

# Get build platform info
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_OS   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

ifeq ($(DEB_HOST_ARCH_OS),hurd)
CONFIGURE_LIBS    = LIBS="-Wl,--no-as-needed -Wl,-lpthread -Wl,--as-needed"
endif

UPSTREAM_VERSION  = $(shell dpkg-parsechangelog | perl -ne 'print $$1 if /^Version: (.*?)-(.*)$$/')

# sonames for various libraries
SO_CGRAPH	= 6
SO_CDT		= 5
SO_GVC		= 6
SO_PATHPLAN	= 4
SO_XDOT		= 4
SO_GVPR		= 2

#PHP_EXTENSION_DIR = $(shell php-config5 --extension-dir)
#PHP_PACKAGE       = $(CURDIR)/debian/libgv-php5

LUA_VERSION       = 5.2
LUA_PACKAGE       = $(CURDIR)/debian/libgv-lua

DEV_PACKAGE       = $(CURDIR)/debian/libgraphviz-dev

PYTHON_VERSIONS   = $(shell pyversions -r)
PYTHON_PACKAGE    = $(CURDIR)/debian/libgv-python

RUBY_PACKAGE      = $(CURDIR)/debian/libgv-ruby

CONFIG_SCRIPTS=config/config.guess libltdl/config/config.guess \
	       config/config.sub   libltdl/config/config.sub

ifneq (,$(filter $(DEB_HOST_ARCH), mipsel mips))
DEB_CFLAGS_MAINT_APPEND += "-fno-ipa-sra"
endif

# make's $(shell) doesn't use local variables, thus we need to define a
# custom command where DEB_LDFLAGS_MAINT_APPEND is passed.
# See: https://wiki.debian.org/HardeningWalkthrough#dpkg-buildflags
dpkg_buildflags = DEB_CFLAGS_MAINT_APPEND=$(DEB_CFLAGS_MAINT_APPEND) DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed" dpkg-buildflags

configure-stamp:
	dh_testdir

	# Update the config scripts
	for i in $(CONFIG_SCRIPTS); do \
		cp /usr/share/misc/`basename $$i` $$i ; \
	done

	# Configure the package
	dh_autoreconf
	./configure --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
	--disable-silent-rules \
	--prefix=/usr \
	--datadir=\$${prefix}/share \
	--infodir=\$${prefix}/share/info \
	--mandir=\$${prefix}/share/man \
	--disable-static \
	--without-included-ltdl \
	--with-pangocairo \
	--with-x \
	--with-gdk-pixbuf \
	--with-gnomeui \
	--with-gtk \
	--with-gts \
	--without-ipsepcola \
	--without-rsvg \
	--enable-guile \
	--enable-lua \
	--enable-php \
	--enable-ruby \
	--enable-tcl \
	--disable-java \
	--disable-r \
	--disable-sharp \
	$(shell echo $(PYTHON_VERSIONS) | sed -e's,python,--enable-python,g' -e 's,\.,,g') \
	$(CONFIGURE_LIBS) \
	$(shell $(dpkg_buildflags) --export=configure)

	touch configure-stamp

build-arch: build
build-indep: build
build: configure-stamp build-stamp
build-stamp:
	dh_testdir

	# Install missing script mksvgfonts.pl to lib/common
	cp debian/mksvgfonts.pl lib/common
	chmod 744 lib/common/mksvgfonts.pl

	# Build
	$(MAKE)
	touch build-stamp

	# Build the manpage from SONAME-independent perlpod
	sed -e 's/##SONAME##/$(SO_GVC)/g' \
		debian/libgvc-config-update.pod.in > \
		debian/libgvc$(SO_GVC)-config-update.pod
	pod2man --center "GRAPHVIZ CONFIGURATION MANAGEMENT" \
		--release $(UPSTREAM_VERSION) \
	  --section 8 \
		debian/libgvc$(SO_GVC)-config-update.pod \
		debian/libgvc$(SO_GVC)-config-update.8

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

	# Clean up if a build already happened
	[ ! -f Makefile ] || $(MAKE) distclean

	# Clean up intermediate and generated manpages
	rm -f debian/libgvc$(SO_GVC)-config-update.pod
	rm -f debian/libgvc$(SO_GVC)-config-update.8
	rm -f tclpkg/gv/*.pdf
	rm -f config.log lex.yy.c
	rm -f graphviz_version.h

	dh_clean $(CONFIG_SCRIPTS) \
		tclpkg/gv/gv.R tclpkg/gv/php_gv.h
	dh_autoreconf_clean
	dh_clean


install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Install the package into debian/tmp
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

	# Remove .la files
	find -name '*.la' -delete
	# Remove unneeded documentation
	rm $(CURDIR)/debian/tmp/usr/share/graphviz/doc/pdf/smyrna.pdf

	# Strip the rpath on /usr/lib (at least on amd64), but not
	# on /usr/lib/graphviz (needed for the plugins), and bail
	# out if it is another case, while ignoring if there's no
	# RPATH at all (there are shell scripts under /usr/bin).
	for i in `find debian/tmp/usr/bin debian/tmp/usr/lib -type f` ; do \
		case `chrpath -l -k $$i` in \
			*RPATH=/usr/lib/graphviz) ;; \
			*RPATH=/usr/lib) chrpath -d $$i ;; \
			*RPATH=/usr/lib:/usr/lib/graphviz) chrpath -r /usr/lib/graphviz $$i ;; \
			*RPATH=*) echo "Unknown RPATH: $$i" ; exit 1 ;; \
			*) ;; \
		esac ; \
	done

	# Compute the dependencies of the -dev package
	# NOTE: It is important to do that before splitting the files into
	# their respective packages, otherwise the symlinks are broken
	d-devlibdeps \
		--override s/libpathplan$(SO_PATHPLAN)-dev// \
		--override s/libcdt$(SO_CDT)-dev//      \
		--override s/libcgraph$(SO_CGRAPH)-dev//   \
		--override s/libgvpr$(SO_GVPR)-dev//   \
		--override s/libxdot$(SO_XDOT)-dev//   \
		$(CURDIR)/debian/libgraphviz-dev.substvars \
		$(CURDIR)/debian/tmp/usr/lib/*.so

	# Move from debian/tmp to the appropriate packages, rename one binary
	DH_COMPAT=9 dh_install --sourcedir=debian/tmp --list-missing
	mv $(CURDIR)/debian/libgvc$(SO_GVC)/usr/sbin/dot \
		$(CURDIR)/debian/libgvc$(SO_GVC)/usr/sbin/libgvc$(SO_GVC)-config-update

	# Some additional work for libgv-php5
#	install -d $(PHP_PACKAGE)/$(PHP_EXTENSION_DIR)
#	mv $(PHP_PACKAGE)/usr/lib/graphviz/php/libgv_php.so \
		$(PHP_PACKAGE)/$(PHP_EXTENSION_DIR)/gv.so
#	install -d $(PHP_PACKAGE)/usr/share/php/libgv-php5
#	mv $(PHP_PACKAGE)/usr/lib/graphviz/php/gv.php \
		$(PHP_PACKAGE)/usr/share/php/libgv-php5
#	rm -rf $(PHP_PACKAGE)/usr/lib/graphviz
#	echo "php:Depends=phpapi-`php-config5 --phpapi`" >> $(PHP_PACKAGE).substvars
#	install -d $(PHP_PACKAGE)/etc/php5/mods-available/
#	cp $(CURDIR)/debian/gv.ini $(PHP_PACKAGE)/etc/php5/mods-available/

	# Some additional work for libgv-lua
	# 1. Rename using the LUA_VERSION
	mv $(LUA_PACKAGE)/usr/lib/graphviz/lua/libgv_lua.so \
		$(LUA_PACKAGE)/usr/lib/graphviz/lua/liblua$(LUA_VERSION)-libgv.so
	# 2. Add a symlink
	install -d $(LUA_PACKAGE)/usr/lib/lua/$(LUA_VERSION)
	ln -s /usr/lib/graphviz/lua/liblua$(LUA_VERSION)-libgv.so \
		$(LUA_PACKAGE)/usr/lib/lua/$(LUA_VERSION)/gv.so

	# Some additional work for libgv-python
	# Note the sed call because of python{24,25} instead of python{2.4,2.5}
	# Note gv.py isn't really duplicated, it's just installed in a location
	# where python-support will find it. Both being identical, python-support
	# will just do the right thing.
	for i in $(PYTHON_VERSIONS); do \
		install -d $(PYTHON_PACKAGE)/usr/lib/$$i/$(call py_sitename_sh, $$i) ; \
		cp $(PYTHON_PACKAGE)/usr/lib/graphviz/python/gv.py \
			$(PYTHON_PACKAGE)/usr/lib/$$i/$(call py_sitename_sh, $$i) ; \
		mv $(PYTHON_PACKAGE)/usr/lib/graphviz/$$(echo $$i|sed -e 's/\.//')/*.so \
			$(PYTHON_PACKAGE)/usr/lib/$$i/$(call py_sitename_sh, $$i) ; \
	done
	# remove _gv.so symlink, will be recreated after dh_python2 run
	rm $(PYTHON_PACKAGE)/usr/lib/python2.7/dist-packages/_gv.so
	rm -rf $(PYTHON_PACKAGE)/usr/lib/graphviz

	# Debian-specific manpage
	dh_installman -plibgvc$(SO_GVC)      \
		$(CURDIR)/debian/libgvc$(SO_GVC)-config-update.8

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installman
	dh_installmenu -i
	rm -f debian/graphviz-doc/usr/share/doc/graphviz/ChangeLog
	dh_installchangelogs ChangeLog -i
	dh_perl -i
	dh_link -i
	dh_strip -i
	dh_compress -i -X.pdf
	dh_fixperms -i
	dh_makeshlibs -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
# Pass -a to all debhelper commands in this target to reduce clutter.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a -XMakefile
	dh_installexamples -a
	dh_installmenu -a
	dh_installman -a
	dh_installchangelogs ChangeLog -a
	dh_perl -a
	dh_python2 -a
	# recreate correct _gv.*.so symlink
	ln -s libgv_python27.$(DEB_HOST_MULTIARCH).so \
		$(PYTHON_PACKAGE)/usr/lib/python2.7/dist-packages/_gv.$(DEB_HOST_MULTIARCH).so
	dh_link -a usr/share/man/man1/gxl2gv.1 usr/share/man/man1/gxl2dot.1 usr/share/man/man1/gxl2gv.1 usr/share/man/man1/dot2gxl.1
	dh_strip -a
	dh_lintian -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs \
		-plibgvc$(SO_GVC) -plibcgraph$(SO_CGRAPH) \
		-plibcdt$(SO_CDT) -plibpathplan$(SO_PATHPLAN) \
		-plibxdot$(SO_XDOT) -plibgvpr$(SO_GVPR)
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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