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

#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

DESTDIR=$(CURDIR)/debian/tmp

DDEBUG=`if (echo $(DEB_BUILD_OPTIONS) | grep -q debug) then \
		echo "--enable-debug"; \
	else \
		echo ""; \
	fi`


#export DEB_CFLAGS_MAINT_APPEND = -O2 -fno-strict-aliasing
export CFLAGS += -O2 -fno-strict-aliasing \
	-DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_COLUMN_METADATA \
	-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_SOUNDEX=1 \
	-DSQLITE_ENABLE_UNLOCK_NOTIFY \
	-DSQLITE_OMIT_LOOKASIDE=1 \
	-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 \
	-DSQLITE_MAX_SCHEMA_RETRY=25 \
	-DSQLITE_HAS_CODEC

configure: configure-stamp
configure-stamp:
	dh_testdir
	autoconf
	echo CFLAGS = $$CFLAGS
	./configure --prefix=/usr --mandir="/usr/share/man" \
	  $(confflags) --enable-threadsafe \
	  --enable-load-extension \
	  --disable-tcl \
	  --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
	  --libexecdir=\$${libdir}/sqlcipher \
	  $(DDEBUG)

	# remove double -ldl from sqlcipher.pc
	sed -i "s/\([-ldl .+]\) -ldl/\1/" sqlcipher.pc

	touch $@

build-arch: build-stamp
build-indep: build-stamp

build: build-arch build-indep
build-stamp: configure
	dh_testdir
	$(MAKE)

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f configure-stamp build-stamp
	rm -f config.log config.h pkgIndex.tcl configure
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f config.h
	dh_clean

install: build
	dh_testdir
	dh_testroot

	$(MAKE) install DESTDIR=$(DESTDIR)
	chrpath -d $(DESTDIR)/usr/bin/sqlcipher

	# Remove *.la files per policy 3.9.1.0
	sed -i "/dependency_libs/ s/'.*'/''/" `find $(DESTDIR) -name '*.la'`

binary-indep: build install
	dh_testdir
	dh_testroot

	dh_lintian -i
	dh_install -i --sourcedir=$(DESTDIR)
	dh_installdocs -i
	dh_installchangelogs -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
	dh_testdir
	dh_testroot

	for file in libsqlcipher0.install libsqlcipher-dev.install; do \
		sed -e"s,\$${DEB_HOST_MULTIARCH},${DEB_HOST_MULTIARCH},g" \
			debian/$${file}.in > debian/$$file; \
	done
	dh_lintian -a
	dh_install -a --sourcedir=$(DESTDIR)
	dh_installman -a
	dh_installdocs -a
	dh_installchangelogs -a
	dh_strip -a --dbg-package=libsqlcipher0-dbg
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a -Ldebian/libsqlcipher0/usr/lib/$(DEB_HOST_MULTIARCH)
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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