File: rules

package info (click to toggle)
itk3 3.4.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,400 kB
  • sloc: ansic: 3,679; sh: 573; tcl: 417; makefile: 74
file content (104 lines) | stat: -rwxr-xr-x 4,158 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
#!/usr/bin/make -f

vmajor=$(shell dpkg-parsechangelog | grep ^Version: | sed 's/[^0-9]*\([0-9]*\).*/\1/')
vminor=$(shell dpkg-parsechangelog | grep ^Version: | sed 's/[^0-9]*[0-9]*\.\([0-9]*\).*/\1/')
v=$(vmajor).$(vminor)
v1=$(vmajor).$(shell expr $(vminor) + 1)
dtmp=$(shell pwd)/debian/tmp

tclv=8.6

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/architecture.mk

%:
	dh $@

override_dh_autoreconf:
	[ -f configure.backup ] || cp configure configure.backup
	dh_autoreconf

override_dh_auto_configure:
	LDFLAGS="$(LDFLAGS) -Wl,-soname,\$$@.1" \
	dh_auto_configure -- \
		       --includedir=/usr/include/itcl$(vmajor) \
		       --enable-shared \
		       --enable-threads \
		       --with-itcl=/usr/lib/$(DEB_HOST_MULTIARCH) \
		       --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl$(tclv) \
		       --with-tk=/usr/lib/$(DEB_HOST_MULTIARCH)/tk$(tclv)

override_dh_auto_build:
	$(MAKE)

override_dh_clean:
	dh_clean
	[ ! -f configure.backup ] || mv configure.backup configure
	# library/Archetype.itk.orig does not differ from library/Archetype.itk but is
	# being removed when cleaning, so restore it
	[ -f library/Archetype.itk.orig ] || cp library/Archetype.itk library/Archetype.itk.orig
	rm -f itkConfig.sh pkgIndex.tcl

override_dh_auto_install:
	$(MAKE) prefix=$(dtmp)/usr \
		exec_prefix=$(dtmp)/usr \
		includedir=$(dtmp)/usr/include/itcl$(vmajor) \
		install
	#
	# Fix up the itk libraries.
	mv $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/itk*/libitk$(v).so $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/libitk$(v).so.1
	mv $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/itk*/*.a $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)
	ln -sf libitk$(v).so.1 $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/libitk$(v).so
	#  (itkConfig.sh doesn't get installed at all, so we install it here)
	sed -e "s:^\(ITK_\(BUILD_\)\?LIB_SPEC\)=.*$$:\1='-L/usr/lib/$(DEB_HOST_MULTIARCH) -litk$(v)':" \
	    -e "s:^\(ITK_\(BUILD_\)\?STUB_LIB_SPEC\)=.*$$:\1='-L/usr/lib/$(DEB_HOST_MULTIARCH) -litkstub$(v)':" \
	    -e "s:^\(ITK_SRC_DIR\)=.*$$:\1='/usr/include/itcl$(vmajor)/itk-private':" \
	    -e "s:^\(ITK_LIB_FILE\)=.*$$:\1=libitk$(v).so.1:" \
	    -e "s:^\(ITK_STUB_LIB_FILE\)=.*$$:\1=libitkstub$(v).a:" \
	    -e "s:^\(ITCL_VERSION\)=.*$$:\1='$(v)':" \
	    -e "s:^\(ITCL_MAJOR_VERSION\)=.*$$:\1='$(vmajor)':" \
	    -e "s:^\(ITCL_MINOR_VERSION\)=.*$$:\1='$(vminor)':" \
	    itkConfig.sh > $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/itkConfig.sh
	#
	# Move the Tcl library to /usr/lib/tcltk/$(DEB_HOST_MULTIARCH)
	install -d -m 755 $(dtmp)/usr/share/tcltk/itk$(v)
	mv $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/itk$(v)/tclIndex $(dtmp)/usr/share/tcltk/itk$(v)
	mv $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/itk$(v)/*.itk $(dtmp)/usr/share/tcltk/itk$(v)
	mv $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/itk$(v)/itk.tcl $(dtmp)/usr/share/tcltk/itk$(v)
	install -d -m 755 $(dtmp)/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)
	mv $(dtmp)/usr/lib/$(DEB_HOST_MULTIARCH)/itk$(v) $(dtmp)/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)
	#
	# Fix up the pkgIndex.tcl
	sed -i -e's/\.so/.so.1/' -e's/\$$dir/\/usr lib $(DEB_HOST_MULTIARCH)/' \
	    $(dtmp)/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/itk$(v)/pkgIndex.tcl
	#
	# Fix up the include files.
	install -d $(dtmp)/usr/include/itcl$(vmajor)/itk-private/generic
	cp generic/*.h $(dtmp)/usr/include/itcl$(vmajor)/itk-private/generic
	#
	# Fix up the manpages.
	mv $(dtmp)/usr/share/man/mann $(dtmp)/usr/share/man/man3
	#
	cd $(dtmp)/usr/share/man/man3 && \
	  for i in *.n ; do \
	    sed -i -e's/^\.TH \([^ ]\+\) n /.TH \1 3itk /' $$i ; \
	    mv $$i `echo $$i | sed -e 's/\.n/\.3itk/'` ; \
          done

override_dh_auto_test:
	# Tests require X-Window, so, diable them

override_dh_link:
	rm -rf debian/itk$(vmajor)-dev/usr/share/doc/itk$(vmajor)-dev
	dh_link

override_dh_makeshlibs:
	dh_makeshlibs -a -V 'itk$(vmajor) (>= $(v)~), itk$(vmajor) (<< $(v1)~)'

get-orig-source:
	wget -O itk3_3.4.2.orig.tar.gz \
	     http://prdownloads.sourceforge.net/incrtcl/itk3.4.2.tar.gz

.PHONY: override_dh_auto_configure override_dh_auto_build override_dh_clean override_dh_auto_test \
	override_dh_auto_install override_dh_makeshlibs override_dh_link get-orig-source