Skip to content

Commit

Permalink
Add latest DBD::SQLite library. Re-enable SQLite JSON features.
Browse files Browse the repository at this point in the history
  • Loading branch information
mherger committed Jan 20, 2025
1 parent 9412e52 commit 39acc8d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 124 deletions.
Binary file added CPAN/DBD-SQLite-1.76.tar.gz
Binary file not shown.
51 changes: 6 additions & 45 deletions CPAN/DBD-SQLite-ICU-libcpp.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
diff -bur ../DBD-SQLite-1.58-orig/Makefile.PL ./Makefile.PL
--- ../DBD-SQLite-1.58-orig/Makefile.PL 2018-03-21 05:49:54.000000000 +0100
+++ ./Makefile.PL 2018-09-11 10:27:20.000000000 +0200
--- DBD-SQLite-1.76/Makefile.PL 2024-03-17 14:19:26
+++ Makefile.PL 2025-01-20 17:24:35
@@ -219,9 +219,12 @@
push @CC_LIBS, '-lsqlite3';
}
Expand All @@ -24,14 +23,13 @@ diff -bur ../DBD-SQLite-1.58-orig/Makefile.PL ./Makefile.PL
+ '-DSQLITE_ENABLE_ICU',
# '-DSQLITE_ENABLE_STAT3', # for sqlite >= 3.7.9
# '-DSQLITE_ENABLE_STAT4', # for sqlite >= 3.8.3.1
- '-DSQLITE_ENABLE_JSON1', # for sqlite >= 3.9.0
'-DSQLITE_ENABLE_JSON1', # for sqlite >= 3.9.0
- '-DSQLITE_ENABLE_FTS5', # for sqlite >= 3.9.0
+# '-DSQLITE_ENABLE_JSON1', # for sqlite >= 3.9.0
+# '-DSQLITE_ENABLE_FTS5', # for sqlite >= 3.9.0
'-DSQLITE_ENABLE_MATH_FUNCTIONS', # for sqlite >= 3.35.0
'-DNDEBUG=1',
);

@@ -304,6 +308,12 @@
@@ -320,6 +324,12 @@
push @CCFLAGS, "-std=gnu99";
}

Expand All @@ -44,7 +42,7 @@ diff -bur ../DBD-SQLite-1.58-orig/Makefile.PL ./Makefile.PL
my %CC_OPTIONS = (
INC => join( ' ', @CC_INC ),
DEFINE => join( ' ', @CC_DEFINE ),
@@ -313,7 +323,7 @@
@@ -329,7 +339,7 @@
$CC_OPTIONS{CCFLAGS} = join ' ', $Config{ccflags}, @CCFLAGS if @CCFLAGS;
$CC_OPTIONS{LDFLAGS} = join ' ', $Config{ldflags}, @LDFLAGS if @LDFLAGS;
$CC_OPTIONS{LDDLFLAGS} = join ' ', $Config{lddlflags}, @LDDLFLAGS if @LDDLFLAGS;
Expand All @@ -53,40 +51,3 @@ diff -bur ../DBD-SQLite-1.58-orig/Makefile.PL ./Makefile.PL



diff -bur ../DBD-SQLite-1.58-orig/sqlite3.c ./sqlite3.c
--- ../DBD-SQLite-1.58-orig/sqlite3.c 2018-03-22 17:47:02.000000000 +0100
+++ ./sqlite3.c 2018-09-11 10:31:24.000000000 +0200
@@ -171752,6 +171752,9 @@
UErrorCode status = U_ZERO_ERROR;
const char *zLocale; /* Locale identifier - (eg. "jp_JP") */
const char *zName; /* SQL Collation sequence name (eg. "japanese") */
+#ifdef _WIN32
+ const char *zDataPath;
+#endif
UCollator *pUCollator; /* ICU library collation object */
int rc; /* Return code from sqlite3_create_collation_x() */

@@ -171764,6 +171767,11 @@
return;
}

+#ifdef _WIN32
+ zDataPath = (const char *)sqlite3_value_text(apArg[2]);
+ u_setDataDirectory(zDataPath);
+#endif
+
pUCollator = ucol_open(zLocale, &status);
if( !U_SUCCESS(status) ){
icuFunctionError(p, "ucol_open", status);
@@ -171791,7 +171799,11 @@
unsigned char iContext; /* sqlite3_user_data() context */
void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
} scalars[] = {
+#ifdef _WIN32
+ {"icu_load_collation", 3, SQLITE_UTF8, 1, icuLoadCollation},
+#else
{"icu_load_collation", 2, SQLITE_UTF8, 1, icuLoadCollation},
+#endif
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU)
{"regexp", 2, SQLITE_ANY|SQLITE_DETERMINISTIC, 0, icuRegexpFunc},
{"lower", 1, SQLITE_UTF16|SQLITE_DETERMINISTIC, 0, icuCaseFunc16},
61 changes: 11 additions & 50 deletions CPAN/DBD-SQLite-ICU.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
diff -bur ../DBD-SQLite-1.58-orig/Makefile.PL ./Makefile.PL
--- ../DBD-SQLite-1.58-orig/Makefile.PL 2018-03-21 05:49:54.000000000 +0100
+++ ./Makefile.PL 2018-09-11 10:27:20.000000000 +0200
--- DBD-SQLite-1.76/Makefile.PL 2024-03-17 14:19:26
+++ Makefile.PL 2025-01-20 17:24:35
@@ -219,9 +219,12 @@
push @CC_LIBS, '-lsqlite3';
}

+push @CC_LIBS, '-L../build/lib -licudata_s -licui18n_s -licuuc_s -lstdc++';
+
my @CC_INC = (
Expand All @@ -24,17 +23,16 @@ diff -bur ../DBD-SQLite-1.58-orig/Makefile.PL ./Makefile.PL
+ '-DSQLITE_ENABLE_ICU',
# '-DSQLITE_ENABLE_STAT3', # for sqlite >= 3.7.9
# '-DSQLITE_ENABLE_STAT4', # for sqlite >= 3.8.3.1
- '-DSQLITE_ENABLE_JSON1', # for sqlite >= 3.9.0
'-DSQLITE_ENABLE_JSON1', # for sqlite >= 3.9.0
- '-DSQLITE_ENABLE_FTS5', # for sqlite >= 3.9.0
+# '-DSQLITE_ENABLE_JSON1', # for sqlite >= 3.9.0
+# '-DSQLITE_ENABLE_FTS5', # for sqlite >= 3.9.0
'-DSQLITE_ENABLE_MATH_FUNCTIONS', # for sqlite >= 3.35.0
'-DNDEBUG=1',
);

@@ -304,6 +308,12 @@
@@ -320,6 +324,12 @@
push @CCFLAGS, "-std=gnu99";
}

+my $MYEXTLIB = join( ' ', (
+ '../build/lib/libicuuc.a',
+ '../build/lib/libicudata.a',
Expand All @@ -44,49 +42,12 @@ diff -bur ../DBD-SQLite-1.58-orig/Makefile.PL ./Makefile.PL
my %CC_OPTIONS = (
INC => join( ' ', @CC_INC ),
DEFINE => join( ' ', @CC_DEFINE ),
@@ -313,7 +323,7 @@
@@ -329,7 +339,7 @@
$CC_OPTIONS{CCFLAGS} = join ' ', $Config{ccflags}, @CCFLAGS if @CCFLAGS;
$CC_OPTIONS{LDFLAGS} = join ' ', $Config{ldflags}, @LDFLAGS if @LDFLAGS;
$CC_OPTIONS{LDDLFLAGS} = join ' ', $Config{lddlflags}, @LDDLFLAGS if @LDDLFLAGS;
-
+$CC_OPTIONS{MYEXTLIB} = $MYEXTLIB;



diff -bur ../DBD-SQLite-1.58-orig/sqlite3.c ./sqlite3.c
--- ../DBD-SQLite-1.58-orig/sqlite3.c 2018-03-22 17:47:02.000000000 +0100
+++ ./sqlite3.c 2018-09-11 10:31:24.000000000 +0200
@@ -171752,6 +171752,9 @@
UErrorCode status = U_ZERO_ERROR;
const char *zLocale; /* Locale identifier - (eg. "jp_JP") */
const char *zName; /* SQL Collation sequence name (eg. "japanese") */
+#ifdef _WIN32
+ const char *zDataPath;
+#endif
UCollator *pUCollator; /* ICU library collation object */
int rc; /* Return code from sqlite3_create_collation_x() */

@@ -171764,6 +171767,11 @@
return;
}

+#ifdef _WIN32
+ zDataPath = (const char *)sqlite3_value_text(apArg[2]);
+ u_setDataDirectory(zDataPath);
+#endif
+
pUCollator = ucol_open(zLocale, &status);
if( !U_SUCCESS(status) ){
icuFunctionError(p, "ucol_open", status);
@@ -171791,7 +171799,11 @@
unsigned char iContext; /* sqlite3_user_data() context */
void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
} scalars[] = {
+#ifdef _WIN32
+ {"icu_load_collation", 3, SQLITE_UTF8, 1, icuLoadCollation},
+#else
{"icu_load_collation", 2, SQLITE_UTF8, 1, icuLoadCollation},
+#endif
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU)
{"regexp", 2, SQLITE_ANY|SQLITE_DETERMINISTIC, 0, icuRegexpFunc},
{"lower", 1, SQLITE_UTF16|SQLITE_DETERMINISTIC, 0, icuCaseFunc16},



33 changes: 4 additions & 29 deletions CPAN/buildme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,8 @@ function build {
cp icudt58*.dat $BUILD/share/icu/58.2

# Custom build for ICU support
tar_wrapper zxf DBD-SQLite-1.58.tar.gz
cd DBD-SQLite-1.58
tar_wrapper zxf DBD-SQLite-1.76.tar.gz
cd DBD-SQLite-1.76
if [[ "$GCC_LIBCPP" == true ]] ; then
# Need this because GLIBCXX uses -lstdc++, but LIBCPP uses -lc++
patch -p0 < ../DBD-SQLite-ICU-libcpp.patch
Expand All @@ -733,33 +733,8 @@ function build {
fi
cp -R ../hints .

if [ $PERL_MINOR_VER -eq 8 ]; then
# Running 5.8
export PERL5LIB=$PERL_BASE/lib/perl5

$PERL_BIN Makefile.PL INSTALL_BASE=$PERL_BASE $2

if [ "$OS" = 'Darwin' ]; then
# OSX does not seem to properly find -lstdc++, so we need to hack the Makefile to add it
$PERL_BIN -p -i -e "s{^LDLOADLIBS =.+}{LDLOADLIBS = -L$PWD/../build/lib -licudata_s -licui18n_s -licuuc_s -lstdc++}" Makefile
fi

$MAKE test
if [ $? != 0 ]; then
echo "make test failed, aborting"
exit $?
fi
$MAKE install
if [ $CLEAN -eq 1 ]; then
$MAKE clean
fi

cd ..
rm -rf DBD-SQLite-1.58
else
cd ..
build_module DBD-SQLite-1.58
fi
cd ..
build_module DBD-SQLite-1.76

;;

Expand Down

0 comments on commit 39acc8d

Please sign in to comment.