summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 42f6c149b16d6513aea1e400487fad25ceac3d5b (plain)
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
#!/usr/bin/make -f
# -*- makefile -*-

# 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

# The build system is averse to VPATH building, so we can't properly use
# postgresql-server-dev-all
SRCDIR      = $(CURDIR)
PKGVERS     = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }')
ORIG_EXCLUDE=--exclude-vcs --exclude=debian

PG_BUILDEXT = ./debian/pg_buildext

## include /usr/share/postgresql-common/pgxs_debian_control.mk
# produce a debian/control file from a debian/control.in
debian/control-pgstamp: debian/control.in debian/pgversions
	( set -e; \
	  VERSIONS=`$(PG_BUILDEXT) supported-versions $(CURDIR)`; \
	  grep-dctrl -vP PGVERSION debian/control.in > debian/control.tmp; \
	  for v in $$VERSIONS; do                    \
		grep -q "^$$v" debian/pgversions   \
		&& grep-dctrl -P PGVERSION debian/control.in       \
		| sed -e "s:PGVERSION:$$v:" >> debian/control.tmp; \
	  done; \
	  mv debian/control.tmp debian/control ) || (rm -f debian/control.tmp; exit 1)
	touch $@

config.mak: debian/control-pgstamp
	#./autogen.sh
	./configure --prefix=/usr --with-asciidoc --with-sk3-subdir

override_dh_auto_configure: config.mak

override_dh_auto_clean: config.mak
	$(MAKE) -C doc realclean
	dh_auto_clean -- distclean
	for version in `cat $(CURDIR)/debian/pgversions`; do \
		rm -rf "debian/postgresql-$${version}-pgq3"; \
	done
	rm -f debian/control-pgstamp

# build sql modules for several postgres versions
override_dh_auto_install: config.mak
	mkdir -p $(CURDIR)/debian/tmp
	dh_auto_install
	$(MAKE) -C doc htmlinstall DESTDIR=$(CURDIR)/debian/tmp
	# now care about any previous supported versions
	for version in $$($(PG_BUILDEXT) supported-versions $(CURDIR)); do \
		echo "### Building for PostgreSQL $$version" && \
		make -C sql clean install \
			PG_CONFIG=/usr/lib/postgresql/$$version/bin/pg_config \
			DESTDIR=$(CURDIR)/debian/tmp \
		|| exit 1 ; \
	done

orig: config.mak
	rm -rf dist
	make tgz
	mv dist/*.tar.gz ../skytools3_$(PKGVERS).orig.tar.gz

%:
	dh $@