diff options
| author | 2021-12-17 07:06:30 -0500 | |
|---|---|---|
| committer | 2021-12-17 07:06:30 -0500 | |
| commit | 1fdc150116cad39aae5c5da407c3312b47a59e3a (patch) | |
| tree | 123c79a4d7ad2d45781ba03ce939f7539fb428d8 /Plugins/DbSqliteCipher/update_sqlite_version.tcl | |
| parent | feda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff) | |
New upstream version 3.3.3+dfsg1.upstream/3.3.3+dfsg1
Diffstat (limited to 'Plugins/DbSqliteCipher/update_sqlite_version.tcl')
| -rw-r--r-- | Plugins/DbSqliteCipher/update_sqlite_version.tcl | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/Plugins/DbSqliteCipher/update_sqlite_version.tcl b/Plugins/DbSqliteCipher/update_sqlite_version.tcl new file mode 100644 index 0000000..d0d52a7 --- /dev/null +++ b/Plugins/DbSqliteCipher/update_sqlite_version.tcl @@ -0,0 +1,73 @@ +#!/usr/bin/env tclsh + +# This one has to be run under Unix, because of autotools + +# Download page: +# https://github.com/sqlcipher/sqlcipher/releases + +set THE_URL "https://codeload.github.com/sqlcipher/sqlcipher/zip/v4.4.3" + +proc process {} { + if {[catch { + wget $::THE_URL sqlite.zip + puts "Decompressing to 'sqlite' directory." + exec 7z x -osqlite sqlite.zip + + set dir [lindex [glob -directory sqlite sqlcipher-*] 0] + + puts "Running ./configure and make to generate sqlite3.c" + cd $dir + catch {exec ./configure --enable-fts5 --enable-json1 --enable-update-limit --enable-geopoly --enable-rtree --enable-session --enable-gcov --disable-tcl} + catch {exec make} + cd ../.. + + copy $dir/sqlite3.c + copy $dir/sqlite3.h + + file rename -force sqlite3.c sqlcipher.c + file rename -force sqlite3.h sqlcipher.h + }]} { + puts $::errorInfo + } + file delete -force sqlite.zip sqlite +} + +proc copy {file} { + set fd [open $file r] + set data [read $fd] + close $fd + + set data [string map [list sqlite3 sqlcipher_sqlite3] $data] + + set outFile [file tail $file] + puts "Copying $outFile" + set fd [open $outFile w+] + puts $fd $data + close $fd +} + +proc wget {url {filename {}}} { + puts "Downloading $url" + + package require http + if {[catch {package require twapi_crypto}]} { + package require tls + http::register https 443 [list ::tls::socket] + } else { + http::register https 443 [list ::twapi::tls_socket] + } + + if {$filename == ""} { + set filename [file tail $url] + } + set r [http::geturl $url -binary 1] + + set fo [open $filename w] + fconfigure $fo -translation binary + puts -nonewline $fo [http::data $r] + close $fo + + ::http::cleanup $r +} + +process
\ No newline at end of file |
