File: rules

package info (click to toggle)
libhdf4 4.2.15-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 27,468 kB
  • sloc: ansic: 153,757; sh: 15,814; fortran: 12,369; java: 4,731; xml: 1,150; makefile: 1,028; yacc: 680; pascal: 420; lex: 170; cpp: 77; csh: 41
file content (193 lines) | stat: -rwxr-xr-x 6,518 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
#!/usr/bin/make -f
#
# Copyright (C) 2008 Francesco Paolo Lovergine <frankie@debian.org>
# Released under GPL. See /usr/share/common-licenses/GPL for
# more information about the license.
#

# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

include /usr/share/dpkg/pkg-info.mk

UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

RELEASE := 4.2.15
PACKAGE := libhdf4
SOVER   := 0

DESTDIR     := $(CURDIR)/debian/tmp
DESTDIR_ALT := $(CURDIR)/debian/tmp-alt

F77  := gfortran
CC   := gcc
CXX  := g++
LIBS := -ljpeg -lz -lm

CFLAGS  = $(shell DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags --get CFLAGS)
CFLAGS += $(shell DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags --get CPPFLAGS)
LDFLAGS = $(shell DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags --get LDFLAGS)

ifneq (,$(findstring verbose,$(DEB_BUILD_OPTIONS)))
   DH_VERBOSE=1
   export DH_VERBOSE
endif

ifneq (,$(filter $(DEB_BUILD_ARCH),s390x sparc64))
   DISABLE_TESTS=1
else
   DISABLE_TESTS=0
endif

TEMPLATES=$(wildcard debian/*.in)

templates:
	for TEMPLATE in $(TEMPLATES) ; do \
		sed -e 's/@PACKAGE@/$(PACKAGE)/g' \
		    -e 's/@SOVER@/$(SOVER)/g' \
		    -e 's/@RELEASE@/$(RELEASE)/g' \
			$$TEMPLATE > `echo $$TEMPLATE | sed 's/.in$$//'` ; \
	done

%:
	dh $@ --with autoreconf

override_dh_clean:
	$(RM) -r HDF$(RELEASE) HDF4 HDF4_ALT $(DESTDIR_ALT)
	dh_clean

override_dh_auto_clean:
	if [ -e HDF4 ]; then \
		dh_auto_clean --sourcedirectory=HDF4 \
		              --builddirectory=debian/build-hdf4 ; \
	fi

	if [ -e HDF4_ALT ]; then \
		dh_auto_clean --sourcedirectory=HDF4_ALT \
		              --builddirectory=debian/build-hdf4-alt ; \
	fi

override_dh_autoreconf:
	mkdir HDF$(RELEASE)
	bash debian/copysources.sh $(RELEASE)
	patch <debian/rename_hdf_hdfalt -p1

	dh_autoreconf

override_dh_auto_configure: templates
	rm -rf HDF4 && ln -sf HDF$(RELEASE) HDF4

	# configure the 'regular' netcdf-clashing flavor.
	dh_auto_configure --sourcedirectory=HDF4 \
	                  --builddirectory=debian/build-hdf4 \
	                  -- --prefix=/usr \
	                     --includedir=/usr/include/hdf \
	                     --libdir=/usr/lib \
	                     --enable-shared \
	                     --enable-fortran \
	                     --with-szlib=yes \
	                     F77="$(F77)" CC="$(CC)" CXX="$(CXX)" \
	                     CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

	# configure the netcdf compatible flavor, without fortran functions.
	dh_auto_configure --sourcedirectory=HDF4_ALT \
	                  --builddirectory=debian/build-hdf4-alt \
	                  -- --prefix=/usr \
	                     --includedir=/usr/include/hdf \
	                     --libdir=/usr/lib \
	                     --enable-shared \
	                     --disable-fortran \
	                     --disable-netcdf \
	                     --with-szlib=yes \
	                     CC="$(CC)" CXX="$(CXX)" \
	                     CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

override_dh_auto_build:
	TESTS_ENVIRONMENT="LD_LIBRARY_PATH=$(CURDIR)/HDF4/hdf/src:$(CURDIR)/HDF4/mfhdf/libsrc:/usr/lib" \
		dh_auto_build --sourcedirectory=HDF4 \
		              --builddirectory=debian/build-hdf4 \
		              -- F77="$(F77)" CC="$(CC)" CXX="$(CXX)" \
		                 CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
		                 LIBS="$(LIBS)"

	TESTS_ENVIRONMENT="LD_LIBRARY_PATH=$(CURDIR)/HDF4_ALT/hdf/src:$(CURDIR)/HDF4_ALT/mfhdf/libsrc:/usr/lib" \
		dh_auto_build --sourcedirectory=HDF4_ALT \
		              --builddirectory=debian/build-hdf4-alt \
		              -- CC="$(CC)" CXX="$(CXX)" \
		                 CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
		                 LIBS="$(LIBS)"

override_dh_auto_test:
	if [ "$(DISABLE_TESTS)" = 0 ]; then \
		dh_auto_test --sourcedirectory=HDF4 \
		             --builddirectory=debian/build-hdf4 \
		             -- F77="$(F77)" CC="$(CC)" CXX="$(CXX)" \
		                CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
		                LIBS="$(LIBS)" ; \
	fi

	if [ "$(DISABLE_TESTS)" = 0 ]; then \
		dh_auto_test --sourcedirectory=HDF4_ALT \
		             --builddirectory=debian/build-hdf4-alt \
		             -- CC="$(CC)" CXX="$(CXX)" \
		                CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
		                LIBS="$(LIBS)" ; \
	fi

override_dh_auto_install:
	dh_auto_install --sourcedirectory=HDF4 \
	                --builddirectory=debian/build-hdf4 \
	                --destdir=$(DESTDIR)

	dh_auto_install --sourcedirectory=HDF4_ALT \
	                --builddirectory=debian/build-hdf4-alt \
	                --destdir=$(DESTDIR_ALT)

	install -d -o root -g root $(DESTDIR)/usr/share/doc/$(PACKAGE)

	mkdir -p $(DESTDIR)/usr/share/man/man3
	sed -e "s/^\.TH HDF 1/\.TH HDF 3/" $(DESTDIR)/usr/share/man/man1/hdf.1 > $(DESTDIR)/usr/share/man/man3/hdf.3
	rm -f $(DESTDIR)/usr/share/man/man1/hdf.1 $(DESTDIR_ALT)/usr/share/man/man1/hdf.1
	
	mv $(DESTDIR_ALT)/usr/lib $(DESTDIR)/usr/lib-alt
	mv $(DESTDIR_ALT)/usr/include $(DESTDIR)/usr/include-alt

	# Move examples to -doc package
	mkdir -p $(DESTDIR)/usr/share/doc/$(PACKAGE)-doc
	mv $(DESTDIR)/usr/share/hdf4_examples $(DESTDIR)/usr/share/doc/$(PACKAGE)-doc/examples
	
	# strip rpath into binaries and libraries	
	for obj in $(DESTDIR)/usr/bin/* $(DESTDIR)/usr/lib/*.so.* $(DESTDIR)/usr/lib-alt/*.so.*; do \
		chrpath -d $${obj} || true; \
	done

	# Empty out the dependency field in our .la files
	for file in $(DESTDIR)/usr/lib/*.la $(DESTDIR)/usr/lib-alt/*.la; do \
		sed -i -e "/dependency_libs/ s/'.*'/''/" $$file ; \
	done

	# rename programs also provided by netcdf-bin
	mv $(DESTDIR)/usr/bin/ncdump $(DESTDIR)/usr/bin/ncdump-hdf
	mv $(DESTDIR)/usr/bin/ncgen $(DESTDIR)/usr/bin/ncgen-hdf

	# rename manuals also provided by netcdf-bin
	mv $(DESTDIR)/usr/share/man/man1/ncdump.1 $(DESTDIR)/usr/share/man/man1/ncdump-hdf.1
	sed -i -e 's/ncdump/ncdump-hdf/g' $(DESTDIR)/usr/share/man/man1/ncdump-hdf.1

	mv $(DESTDIR)/usr/share/man/man1/ncgen.1 $(DESTDIR)/usr/share/man/man1/ncgen-hdf.1
	sed -i -e 's/ncgen/ncgen-hdf/g' $(DESTDIR)/usr/share/man/man1/ncgen-hdf.1

override_dh_install:
	dh_install --list-missing --sourcedir=$(DESTDIR)

override_dh_installman:
	dh_installman
	$(RM) $(CURDIR)/debian/hdf4-tools/usr/share/man/man1/hdf.1

override_dh_makeshlibs:
	dh_makeshlibs -- -v$(UPSTREAM_VERSION)

override_dh_shlibdeps:
	dh_shlibdeps -l$(DESTDIR)/usr/lib:$(DESTDIR)/usr/lib-alt