| 1 |
#!/usr/bin/make -f |
| 2 |
#-*- makefile -*- |
| 3 |
|
| 4 |
# Uncomment this to turn on verbose mode. |
| 5 |
#export DH_VERBOSE=1 |
| 6 |
|
| 7 |
export DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) |
| 8 |
|
| 9 |
export LC_ALL:=C.UTF-8 |
| 10 |
|
| 11 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all future=+lfs |
| 12 |
DPKG_EXPORT_BUILDFLAGS = 1 |
| 13 |
include /usr/share/dpkg/buildflags.mk |
| 14 |
|
| 15 |
DESTDIR=$(CURDIR)/debian/tmp |
| 16 |
|
| 17 |
DDEBUG=`if (echo $(DEB_BUILD_OPTIONS) | grep -q debug) then \ |
| 18 |
echo "--enable-debug"; \ |
| 19 |
else \ |
| 20 |
echo ""; \ |
| 21 |
fi` |
| 22 |
|
| 23 |
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 24 |
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 25 |
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 26 |
|
| 27 |
export LDFLAGS += -Wl,--as-needed |
| 28 |
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
| 29 |
confflags += --build=$(DEB_HOST_GNU_TYPE) --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl8.6 |
| 30 |
export CROSS_BUILDING=no |
| 31 |
else |
| 32 |
confflags += --build=$(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl8.6 |
| 33 |
LDFLAGS += -L/usr/lib/$(DEB_HOST_MULTIARCH) |
| 34 |
export CROSS_BUILDING=yes |
| 35 |
endif |
| 36 |
|
| 37 |
ifeq ($(origin CC),default) |
| 38 |
HOST_CC ?= $(DEB_HOST_GNU_TYPE)-gcc |
| 39 |
else |
| 40 |
HOST_CC ?= $(CC) |
| 41 |
endif |
| 42 |
|
| 43 |
export CFLAGS += -O2 -fno-strict-aliasing \ |
| 44 |
-DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_COLUMN_METADATA \ |
| 45 |
-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS \ |
| 46 |
-DSQLITE_ENABLE_RTREE -DSQLITE_SOUNDEX \ |
| 47 |
-DSQLITE_ENABLE_UNLOCK_NOTIFY \ |
| 48 |
-DSQLITE_ENABLE_DBSTAT_VTAB \ |
| 49 |
-DSQLITE_ENABLE_DBPAGE_VTAB \ |
| 50 |
-DSQLITE_ALLOW_ROWID_IN_VIEW \ |
| 51 |
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \ |
| 52 |
-DSQLITE_ENABLE_LOAD_EXTENSION \ |
| 53 |
-DSQLITE_ENABLE_JSON1 \ |
| 54 |
-DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ |
| 55 |
-DSQLITE_THREADSAFE=1 \ |
| 56 |
-DSQLITE_USE_URI \ |
| 57 |
-DSQLITE_MAX_SCHEMA_RETRY=25 \ |
| 58 |
-DSQLITE_ENABLE_PREUPDATE_HOOK \ |
| 59 |
-DSQLITE_ENABLE_SESSION \ |
| 60 |
-DSQLITE_ENABLE_STMTVTAB \ |
| 61 |
-DSQLITE_STRICT_SUBTYPE \ |
| 62 |
-DSQLITE_MAX_VARIABLE_NUMBER=250000 |
| 63 |
|
| 64 |
configure: configure-stamp |
| 65 |
configure-stamp: |
| 66 |
dh_testdir |
| 67 |
./configure --prefix=/usr --mandir="/usr/share/man" \ |
| 68 |
--soname=legacy \ |
| 69 |
--disable-rpath \ |
| 70 |
--dynlink-tools \ |
| 71 |
$(confflags) --enable-threadsafe \ |
| 72 |
--enable-load-extension \ |
| 73 |
--enable-json \ |
| 74 |
--enable-fts4 \ |
| 75 |
--enable-fts5 \ |
| 76 |
--disable-amalgamation \ |
| 77 |
--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ |
| 78 |
--libexecdir=\$${libdir}/sqlite3 \ |
| 79 |
TCLLIBDIR=/usr/lib/tcltk/sqlite3 \ |
| 80 |
SHELL=/bin/sh \ |
| 81 |
$(DDEBUG) |
| 82 |
|
| 83 |
touch $@ |
| 84 |
|
| 85 |
build-arch: build-stamp |
| 86 |
build-indep: build-stamp |
| 87 |
|
| 88 |
build: build-arch build-indep |
| 89 |
build-stamp: configure |
| 90 |
dh_testdir |
| 91 |
$(MAKE) |
| 92 |
ifeq (,$(findstring $(DEB_BUILD_ARCH_OS),kfreebsd)) |
| 93 |
# build tools |
| 94 |
$(MAKE) showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer |
| 95 |
endif |
| 96 |
ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
| 97 |
$(MAKE) lemon |
| 98 |
endif |
| 99 |
cd ext/misc && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC -I../.. -shared csv.c -o csv.so |
| 100 |
cd ext/icu && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC -I../.. -I../../src -shared icu.c $(shell pkg-config --libs --cflags icu-uc icu-io) -o icu.so |
| 101 |
|
| 102 |
touch $@ |
| 103 |
|
| 104 |
clean: |
| 105 |
dh_testdir |
| 106 |
dh_testroot |
| 107 |
rm -f configure-stamp build-stamp |
| 108 |
rm -f config.log config.h pkgIndex.tcl |
| 109 |
[ ! -f Makefile ] || $(MAKE) distclean |
| 110 |
rm -f config.h sqlite3session.h mksourceid |
| 111 |
rm -f ext/misc/csv.so |
| 112 |
rm -f ext/icu/icu.so |
| 113 |
dh_clean |
| 114 |
|
| 115 |
install: build |
| 116 |
dh_testdir |
| 117 |
dh_testroot |
| 118 |
|
| 119 |
$(MAKE) install DESTDIR=$(DESTDIR) |
| 120 |
chrpath -d $(DESTDIR)/usr/bin/sqlite3 |
| 121 |
chrpath -d $(DESTDIR)/usr/lib/tcltk/sqlite3/lib*.so |
| 122 |
install -d $(DESTDIR)/usr/share/lemon |
| 123 |
install -m 0664 tool/lempar.c $(DESTDIR)/usr/share/lemon/ |
| 124 |
ifeq (,$(findstring $(DEB_BUILD_ARCH_OS),kfreebsd)) |
| 125 |
install -m 0775 showdb showjournal showstat4 showwal \ |
| 126 |
sqldiff sqlite3_analyzer \ |
| 127 |
$(DESTDIR)/usr/bin/ |
| 128 |
endif |
| 129 |
install -m 0775 lemon $(DESTDIR)/usr/bin/ |
| 130 |
install -d $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/ |
| 131 |
install -m 0775 ext/misc/csv.so \ |
| 132 |
$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/ |
| 133 |
install -m 0775 ext/icu/icu.so \ |
| 134 |
$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/ |
| 135 |
|
| 136 |
# Create the pkgIndex.tcl file for the Tcl module. This generated file |
| 137 |
# actually turns out to be relocatable. |
| 138 |
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
| 139 |
echo "pkg_mkIndex -verbose $(DESTDIR)/usr/lib/tcltk/sqlite3" | \ |
| 140 |
LD_LIBRARY_PATH=$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) \ |
| 141 |
tclsh8.6 |
| 142 |
grep -q 'package ifneeded sqlite3' \ |
| 143 |
$(DESTDIR)/usr/lib/tcltk/sqlite3/pkgIndex.tcl || \ |
| 144 |
(echo "pkgIndex.tcl seems to be wrong" && exit 1) |
| 145 |
else |
| 146 |
echo "" > $(DESTDIR)/usr/lib/tcltk/sqlite3/pkgIndex.tcl |
| 147 |
endif |
| 148 |
|
| 149 |
binary-indep: build install |
| 150 |
dh_testdir |
| 151 |
dh_testroot |
| 152 |
|
| 153 |
dh_install -i --sourcedir=$(DESTDIR) |
| 154 |
dh_installdocs -i |
| 155 |
lynx -dump -nolist www/changes.html >changelog |
| 156 |
dh_installchangelogs -i www/changes.html changelog |
| 157 |
rm changelog |
| 158 |
dh_compress -i |
| 159 |
dh_fixperms -i |
| 160 |
dh_installdeb -i |
| 161 |
dh_gencontrol -i |
| 162 |
dh_md5sums -i |
| 163 |
dh_builddeb -i |
| 164 |
|
| 165 |
binary-arch: build install |
| 166 |
dh_testdir |
| 167 |
dh_testroot |
| 168 |
|
| 169 |
dh_install -a --sourcedir=$(DESTDIR) |
| 170 |
dh_installman -a |
| 171 |
dh_installdocs -a |
| 172 |
lynx -dump -nolist www/changes.html >changelog |
| 173 |
dh_installchangelogs -a www/changes.html changelog |
| 174 |
rm changelog |
| 175 |
dh_strip -a |
| 176 |
dh_compress -a |
| 177 |
dh_fixperms -a |
| 178 |
dh_makeshlibs -a |
| 179 |
dh_installdeb -a |
| 180 |
dh_shlibdeps -a -Ldebian/libsqlite3-0/usr/lib/$(DEB_HOST_MULTIARCH) |
| 181 |
dh_gencontrol -a |
| 182 |
dh_md5sums -a |
| 183 |
dh_builddeb -a |
| 184 |
|
| 185 |
binary: binary-indep binary-arch |
| 186 |
.PHONY: build build-indep build-arch clean configure binary-indep binary-arch binary |