~grass/grass/grass64_release_debian

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
#!/usr/bin/make -f

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


# 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_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

VERSION=$(shell echo `head -2 $(CURDIR)/include/VERSION`|sed -e 's/ //')
ABI=$(shell echo `head -3 $(CURDIR)/include/VERSION`|sed -e 's/ //g' -e 's/RC/-/')
BASE_NAME=grass$(VERSION)
PKG_NAME=grass

CFLAGS=-Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	STRIP = 
else
	STRIP = strip
endif

TCLINC = /usr/include/tcl

#include /usr/share/dpatch/dpatch.make

versions: 
	@echo "Version: $(VERSION)"
	@echo "ABI: $(ABI)"

templates: $(patsubst %.in,%,$(wildcard debian/*.in))

debian/% :: debian/%.in
	sed -e 's/@VERSION@/$(VERSION)/' -e 's/@ABI@/$(ABI)/' $< >$@

configure: patch config.status
config.status: 
	dh_testdir
	# Add here commands to configure the package.
	CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
                    --prefix=/usr/lib \
                    --sysconfdir=/etc \
                    --sharedstatedir=/var \
                    --enable-socket \
                    --enable-shared \
                    --with-postgres \
                    --with-mysql \
                    --with-cxx \
                    --with-x \
                    --with-gdal \
                    --with-freetype \
                    --with-motif \
                    --with-readline \
                    --with-nls \
                    --with-odbc \
                    --with-geos \
                    --with-ffmpeg \
                    --with-lapack \
                    --with-netcdf \
                    --with-blas \
                    --with-tcltk \
                    --with-tcltk-includes=/usr/include/tcl8.5/ \
                    --with-postgres-includes=/usr/include/postgresql/ \
		    --with-sqlite \
		    --enable-largefile \
                   --with-ffmpeg-includes="/usr/include/libavcodec/ /usr/include/libavformat /usr/include/libswscale" \
                    --with-freetype-includes=/usr/include/freetype2 \
                    --with-postgres-includes=$(shell pg_config --includedir) \
                    --with-mysql-includes=$(shell mysql_config --include|sed -e 's/-I//') \
		    --with-proj-share=/usr/share/proj \
		    --with-wxwidgets=/usr/bin/wx-config \
		    --with-python \
		    --with-cairo

	touch $@

# This target generates arch-dep stuff, unfortunately most doc requires working bins to 
# be properly generated...
build: configure build-stamp
build-stamp:  
	
	dh_testdir
	$(MAKE) 
	chmod 755 debian/fixpaths.sh debian/fixscripts.sh

	touch $@

build-arch: build
# This target generates truly arch-indep stuff
build-indep: configure build-indep-stamp
build-indep-stamp: 
	dh_testdir

	$(MAKE) htmldocs

	touch $@

clean: templates clean-patched unpatch 
clean-patched:
	dh_testdir
	dh_testroot

	# Add here commands to clean up after the build process.
	[ ! -f $(CURDIR)/include/Make/Platform.make ] || $(MAKE) distclean

ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	[ ! -f $(CURDIR)/configure.in ] || cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	[ ! -f $(CURDIR)/configure.in ] || cp -f /usr/share/misc/config.guess config.guess
endif
	dh_clean 

	rm -f lib/proj/nad2bin
	rm -f tools/timer/main.o
	rm -f raster/r.le/r.le.setup/polytocell/*.o
	rm -f raster/r.terraflow/IOStream/lib/src/libiostream.a
	rm -f debian/$(BASE_NAME).1
	rm -f error.log
	# clean doxygen documentation (programming man)
	rm -rf doxygenhtml lib/vector/html lib/db/html lib/gis/html \
		lib/vector/latex lib/db/latex lib/gis/latex \
		lib/g3d/html \
		lib/ogsf/html \
		lib/proj/html \
		lib/gmath/html \
		lib/segment/html \
		lib/vector/dglib/html \
		rfc/html \
		lib/g3d/latex \
		lib/ogsf/latex \
		lib/proj/latex \
		lib/gmath/latex \
		lib/segment/latex \
		lib/vector/dglib/latex \
		rfc/latex \

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# install grass core into debian/tmp
	$(MAKE) $(STRIP)
	$(MAKE) install INST_DIR=$(CURDIR)/debian/tmp/usr/lib/$(BASE_NAME) \
		prefix=$(CURDIR)/debian/tmp/usr/lib/$(BASE_NAME) \
		BINDIR=$(CURDIR)/debian/tmp/usr/lib
		
		cp $(CURDIR)/debian/grass64 $(CURDIR)/debian/$(PKG_NAME)/usr/bin/grass64

	# change section from 1 to .1grass 
	mv debian/tmp/usr/lib/$(BASE_NAME)/man/man1/grass6.1 debian/$(BASE_NAME).1
	for m in debian/tmp/usr/lib/$(BASE_NAME)/man/man1/*.1; do n=`basename $$m .1`; mv $$m debian/tmp/usr/lib/$(BASE_NAME)/man/man1/$$n.1grass; done
	for m in debian/tmp/usr/lib/$(BASE_NAME)/man/man1/*.1grass; do sed -i -e 's/^.TH \(.*\) 1/.TH \1 1grass/' $$m; done


	# install icon file for debian menu system
	install -d debian/tmp/usr/share/icons debian/tmp/usr/lib
	install -m 644 debian/grass.xpm debian/tmp/usr/share/icons/$(BASE_NAME).xpm



install-indep: build-indep
	dh_testdir -i
	dh_testroot -i
	install -m 644  -d debian/tmp
	install -m 644  -d debian/tmp/programming-manual64/vector/html/search \
			   debian/tmp/programming-manual64/db/html/search \
			   debian/tmp/programming-manual64/gis/html/search 
			   
	-install -m 644 lib/vector/html/* debian/tmp/programming-manual64/vector/html
	-install -m 644 lib/vector/html/search/* debian/tmp/programming-manual64/vector/html/search
	-install -m 644 lib/db/html/* debian/tmp/programming-manual64/db/html
	-install -m 644 lib/db/html/search/* debian/tmp/programming-manual64/db/html/search
	-install -m 644 lib/gis/html/* debian/tmp/programming-manual64/gis/html
	-install -m 644 lib/gis/html/search/* debian/tmp/programming-manual64/gis/html/search
binary-indep: install install-indep 
	dh_testdir -i
	dh_testroot -i
	dh_installchangelogs -i CHANGES
	dh_installdocs -i
	dh_install -i
	dh_link -i
	dh_strip -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: install
	dh_testdir -a
	dh_testroot  -a
	dh_installchangelogs -a CHANGES
	dh_installdocs  -a
	dh_installexamples  -a
	dh_install -a
	dh_installmenu -a
	dh_installman -p$(PKG_NAME) debian/$(BASE_NAME).1 -a
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a -a
	dh_installdeb -a
	dh_shlibdeps -a -l$(CURDIR)/debian/$(PKG_NAME)/usr/lib/$(BASE_NAME)/lib
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a
	
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install patch unpatch configure clean-patched versions