File: rules

package info (click to toggle)
libdbd-pg-perl 1.49-2%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 680 kB
  • ctags: 381
  • sloc: perl: 3,921; ansic: 3,183; makefile: 99; sh: 22
file content (136 lines) | stat: -rwxr-xr-x 3,139 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

debian_patches = 

export DH_COMPAT=4

package=libdbd-pg-perl

ifndef PERL
PERL = /usr/bin/perl 
endif

TMP     =`pwd`/debian/$(package)

PG_INCLUDEDIR = $(shell pg_config --includedir)
PG_LIBDIR = $(shell pg_config --libdir)

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  CFLAGS = -g
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -O0
else
  CFLAGS += -O2
endif
	

export POSTGRES_INCLUDE=$(PG_INCLUDEDIR)
export POSTGRES_LIB=$(PG_LIBDIR)

build: build-stamp
build-stamp: patched-stamp
	dh_testdir

	$(PERL) Makefile.PL INSTALLDIRS=vendor 
	touch Makefile
	$(MAKE) INC="-I/usr/include -I$(PG_INCLUDEDIR) -I/usr/lib/perl5/auto/DBI" OPTIMIZE="-Wall $(CFLAGS)" LD_RUN_PATH=""
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	
	-rm -f build-stamp install-stamp
	-make realclean
	-rm -f `find . -name "*~"`

	dh_clean
	debian/rules reverse-patches

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install PREFIX=$(TMP)/usr

	touch install-stamp

binary-indep: build install
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs README
	dh_installexamples
	dh_installmenu
	dh_installcron
	#dh_installmanpages
	dh_installchangelogs Changes
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b';false

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

# ---------------------------------------------------------------------------
# various rules to unpack addons and (un)apply patches.
# borrowed from egcs package

patch_dir       = debian/patches

apply-patches: patched-stamp
reverse-patches:
	@for stamp in none patched-*; do \
	  case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
	  patch=`echo $$stamp | sed -e 's/patched-//'`; \
	  echo "trying to revert patch $$patch ..."; \
	  if [ -x $(patch_dir)/$$patch.dpatch ]; then true; else \
	    chmod +x $(patch_dir)/$$patch.dpatch; fi; \
	  if $(patch_dir)/$$patch.dpatch -unpatch; then \
	    echo "reverted $$patch patch."; \
	    rm -f $$stamp; \
	  else \
	    echo "error in reverting $$patch patch."; \
	    exit 1; \
	  fi; \
	done
	rm -f patched-stamp

patched-%: $(patch_dir)/%.dpatch
	@if [ -x $< ]; then true; else chmod +x $<; fi
	@if [ -f $@ ]; then \
	  echo "$* patches already applied."; exit 1; \
	fi
	$< -patch
	@echo "$* patches applied." > $@

patched-stamp: $(foreach p,$(debian_patches),patched-$(p))
	@echo -e "\nPatches applied:" >> pxxx
	@for i in none $(debian_patches); do \
	  if [ -r debian/patches/$$i.dpatch ]; then \
	    echo -e "\n$$i:" >> pxxx; \
	    sed -n 's/^# *DP: */  /p' debian/patches/$$i.dpatch >> pxxx; \
	  fi \
	done
	mv -f pxxx patched-stamp