Skip to content

Commit 1182886

Browse files
committed
Merge pull request #89 from fatalmind/master
Building for new (released in 2016) and old SQLite versions
2 parents 9527b5d + ca591dd commit 1182886

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ CCFLAGS:= -I$(SQLITE_OUT) -I$(SQLITE_AMAL_DIR) $(CCFLAGS)
2323

2424
$(SQLITE_ARCHIVE):
2525
@mkdir -p $(@D)
26-
curl -o$@ http://www.sqlite.org/2015/$(SQLITE_AMAL_PREFIX).zip
26+
curl -L --max-redirs 0 -f -o$@ http://www.sqlite.org/2016/$(SQLITE_AMAL_PREFIX).zip || \
27+
curl -L --max-redirs 0 -f -o$@ http://www.sqlite.org/2015/$(SQLITE_AMAL_PREFIX).zip || \
28+
curl -L --max-redirs 0 -f -o$@ http://www.sqlite.org/2014/$(SQLITE_AMAL_PREFIX).zip || \
29+
curl -L --max-redirs 0 -f -o$@ http://www.sqlite.org/2013/$(SQLITE_AMAL_PREFIX).zip || \
30+
curl -L --max-redirs 0 -f -o$@ http://www.sqlite.org/$(SQLITE_AMAL_PREFIX).zip || \
31+
curl -L --max-redirs 0 -f -o$@ http://www.sqlite.org/$(SQLITE_OLD_AMAL_PREFIX).zip
2732

2833
$(SQLITE_UNPACKED): $(SQLITE_ARCHIVE)
29-
unzip -qo $< -d $(TARGET)
34+
unzip -qo $< -d $(TARGET)/tmp.$(version)
35+
(mv $(TARGET)/tmp.$(version)/$(SQLITE_AMAL_PREFIX) $(TARGET) && rmdir $(TARGET)/tmp.$(version)) || mv $(TARGET)/tmp.$(version)/ $(TARGET)/$(SQLITE_AMAL_PREFIX)
3036
touch $@
3137

3238

Makefile.common

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ LINKFLAGS := $($(target)_LINKFLAGS)
151151
LIBNAME := $($(target)_LIBNAME)
152152
SQLITE_FLAGS := $($(target)_SQLITE_FLAGS)
153153
SQLITE_AMAL_PREFIX = sqlite-amalgamation-$(shell ./amalgamation_version.sh $(version))
154+
SQLITE_OLD_AMAL_PREFIX = sqlite-amalgamation-$(subst .,_,$(version))
154155
CCFLAGS := $(CCFLAGS)
155156
ifneq ($(jni_include),)
156157
CCFLAGS := $(CCFLAGS) -I"$(jni_include)"

src/main/ext/extension-functions.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,12 @@ int double_cmp(const void *a, const void *b);
205205
#endif /* _MAP_H_ */
206206

207207

208+
#if SQLITE_VERSION_NUMBER >= 3006001
208209
static char *sqlite3StrDup( const char *z ) {
209210
char *res = sqlite3_malloc( strlen(z)+1 );
210211
return strcpy( res, z );
211212
}
213+
#endif
212214

213215
/*
214216
** These are copied verbatim from fun.c so as to not have the names exported

src/main/java/org/sqlite/core/NativeDB.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_backup(
962962
jobject observer /* Progress function to invoke */
963963
)
964964
{
965+
#if SQLITE_VERSION_NUMBER >= 3006011
965966
int rc; /* Function return code */
966967
sqlite3* pDb; /* Database to back up */
967968
sqlite3* pFile; /* Database connection opened on zFilename */
@@ -993,6 +994,9 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_backup(
993994
** and return the result of this function. */
994995
(void)sqlite3_close(pFile);
995996
return rc;
997+
#else
998+
return SQLITE_INTERNAL;
999+
#endif
9961000
}
9971001

9981002
JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_restore(
@@ -1002,6 +1006,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_restore(
10021006
jobject observer /* Progress function to invoke */
10031007
)
10041008
{
1009+
#if SQLITE_VERSION_NUMBER >= 3006011
10051010
int rc; /* Function return code */
10061011
sqlite3* pDb; /* Database to back up */
10071012
sqlite3* pFile; /* Database connection opened on zFilename */
@@ -1039,5 +1044,8 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_restore(
10391044
** and return the result of this function. */
10401045
(void)sqlite3_close(pFile);
10411046
return rc;
1047+
#else
1048+
return SQLITE_INTERNAL;
1049+
#endif
10421050
}
10431051

0 commit comments

Comments
 (0)