aboutsummaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
Diffstat (limited to 'tool')
-rw-r--r--tool/buildtclext.tcl68
-rw-r--r--tool/lemon.c4
-rw-r--r--tool/mkshellc.tcl2
-rw-r--r--tool/mktoolzip.tcl64
4 files changed, 97 insertions, 41 deletions
diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl
index 8e5bef38a..535ed37e7 100644
--- a/tool/buildtclext.tcl
+++ b/tool/buildtclext.tcl
@@ -17,6 +17,7 @@ Options:
--uninstall Uninstall the extension
--version-check Check extension version against this source tree
--destdir DIR Installation root (used by "make install DESTDIR=...")
+ --tclConfig.sh FILE Use this tclConfig.sh instead of looking for one
Other options are retained and passed through into the compiler.}
@@ -29,6 +30,7 @@ set versioncheck 0
set CC {}
set OPTS {}
set DESTDIR ""; # --destdir "$(DESTDIR)"
+set tclConfigSh ""; # --tclConfig.sh FILE
for {set ii 0} {$ii<[llength $argv]} {incr ii} {
set a0 [lindex $argv $ii]
if {$a0=="--install-only"} {
@@ -56,6 +58,9 @@ for {set ii 0} {$ii<[llength $argv]} {incr ii} {
} elseif {$a0=="--destdir" && $ii+1<[llength $argv]} {
incr ii
set DESTDIR [lindex $argv $ii]
+ } elseif {$a0=="--tclConfig.sh" && $ii+1<[llength $argv]} {
+ incr ii
+ set tclConfigSh [lindex $argv $ii]
} elseif {[string match -* $a0]} {
append OPTS " $a0"
} else {
@@ -88,40 +93,47 @@ if {$tcl_platform(platform) eq "windows"} {
}
set OUT tclsqlite3.dll
} else {
- # Figure out the location of the tclConfig.sh file used by the
- # tclsh that is executing this script.
+ # Read the tclConfig.sh file into the $tclConfig variable
#
- if {[catch {
- set LIBDIR [tcl::pkgconfig get libdir,install]
- }]} {
- puts stderr "$argv0: tclsh does not support tcl::pkgconfig."
- exit 1
- }
- if {![file exists $LIBDIR]} {
- puts stderr "$argv0: cannot find the tclConfig.sh file."
- puts stderr "$argv0: tclsh reported library directory \"$LIBDIR\"\
+ if {"" eq $tclConfigSh} {
+ # Figure out the location of the tclConfig.sh file used by the
+ # tclsh that is executing this script.
+ #
+ if {[catch {
+ set LIBDIR [tcl::pkgconfig get libdir,install]
+ }]} {
+ puts stderr "$argv0: tclsh does not support tcl::pkgconfig."
+ exit 1
+ }
+ if {![file exists $LIBDIR]} {
+ puts stderr "$argv0: cannot find the tclConfig.sh file."
+ puts stderr "$argv0: tclsh reported library directory \"$LIBDIR\"\
does not exist."
- exit 1
- }
- if {![file exists $LIBDIR/tclConfig.sh]
- || [file size $LIBDIR/tclConfig.sh]<5000} {
- set n1 $LIBDIR/tcl$::tcl_version
- if {[file exists $n1/tclConfig.sh]
- && [file size $n1/tclConfig.sh]>5000} {
- set LIBDIR $n1
- } else {
- puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1"
exit 1
}
+ if {![file exists $LIBDIR/tclConfig.sh]
+ || [file size $LIBDIR/tclConfig.sh]<5000} {
+ set n1 $LIBDIR/tcl$::tcl_version
+ if {[file exists $n1/tclConfig.sh]
+ && [file size $n1/tclConfig.sh]>5000} {
+ set LIBDIR $n1
+ } else {
+ puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1"
+ exit 1
+ }
+ }
+ #puts "using $LIBDIR/tclConfig.sh"
+ set fd [open $LIBDIR/tclConfig.sh rb]
+ set tclConfig [read $fd]
+ close $fd
+ } else {
+ # User-provided tclConfig.sh
+ #
+ set fd [open $tclConfigSh rb]
+ set tclConfig [read $fd]
+ close $fd
}
- # Read the tclConfig.sh file into the $tclConfig variable
- #
- #puts "using $LIBDIR/tclConfig.sh"
- set fd [open $LIBDIR/tclConfig.sh rb]
- set tclConfig [read $fd]
- close $fd
-
# Extract parameter we will need from the tclConfig.sh file
#
set TCLMAJOR 8
diff --git a/tool/lemon.c b/tool/lemon.c
index 0aa6ff23a..324dda0c5 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -2023,10 +2023,10 @@ static char *msort(
list = NEXT(list);
NEXT(ep) = 0;
for(i=0; i<LISTSIZE-1 && set[i]!=0; i++){
- ep = merge(ep,set[i],cmp,offset);
+ ep = merge(set[i],ep,cmp,offset);
set[i] = 0;
}
- set[i] = ep;
+ set[i] = merge(set[i],ep,cmp,offset);
}
ep = 0;
for(i=0; i<LISTSIZE; i++) if( set[i] ) ep = merge(set[i],ep,cmp,offset);
diff --git a/tool/mkshellc.tcl b/tool/mkshellc.tcl
index 85e14f849..2f7a6ea25 100644
--- a/tool/mkshellc.tcl
+++ b/tool/mkshellc.tcl
@@ -62,7 +62,7 @@ while {1} {
if {[regexp {^# *include "sqlite} $lx]} {
set lx "/* $lx */"
}
- if {[regexp {^# *include "test_windirent.h"} $lx]} {
+ if {[regexp {^# *include "windirent.h"} $lx]} {
set lx "/* $lx */"
}
set lx [string map [list __declspec(dllexport) {}] $lx]
diff --git a/tool/mktoolzip.tcl b/tool/mktoolzip.tcl
index c22318441..041bf28cd 100644
--- a/tool/mktoolzip.tcl
+++ b/tool/mktoolzip.tcl
@@ -12,9 +12,27 @@
# sqlite3_analyzer -- Space analyzer
# sqlite3_rsync -- Remote db sync
#
+# On Windows, add:
+#
+# sqlite3.def
+# sqlite3.dll
+#
+# Add the --snapshot option to generate a snapshot ZIP archive instead of
+# a release ZIP archive.
+#
+set bSnapshot 0
+for {set i 0} {$i<[llength $argv]} {incr i} {
+ set a [lindex $argv $i]
+ if {$a eq "-snapshot" || $a eq "--snapshot"} {
+ set bSnapshot 1
+ continue
+ }
+ puts stderr "unknown argument: $a"
+ exit 1
+}
switch $tcl_platform(os) {
{Windows NT} {
- set OS win32
+ set OS win
set EXE .exe
}
Linux {
@@ -49,13 +67,39 @@ switch $tcl_platform(machine) {
set ARCH unk
}
}
-set in [open [file join [file dirname [file dirname [info script]]] VERSION]]
-set vers [read $in]
-close $in
-scan $vers %d.%d.%d v1 v2 v3
-set v2 [format 3%02d%02d00 $v2 $v3]
+if {$bSnapshot} {
+ set in [open [file join [file dirname [file dirname [info script]]] manifest]]
+ set manifest [read $in]
+ close $in
+ regexp {\nD (.{16})} $manifest all date
+ regsub -all {[-:T]} $date {} v2
+} else {
+ set in [open [file join [file dirname [file dirname [info script]]] VERSION]]
+ set vers [read $in]
+ close $in
+ scan $vers %d.%d.%d v1 v2 v3
+ set v2 [format 3%02d%02d00 $v2 $v3]
+}
+
set name sqlite-tools-$OS-$ARCH-$v2.zip
-set toollist "sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE sqlite3_rsync$EXE"
-puts "zip $name {*}$toollist"
-exec zip $name {*}$toollist
-puts "$name: [file size $name] bytes"
+set filelist "sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE sqlite3_rsync$EXE"
+proc make_zip_archive {name filelist} {
+ file delete -force $name
+ puts "fossil test-filezip $name $filelist"
+ if {[catch {exec fossil test-filezip $name {*}$filelist}]} {
+ puts "^--- Unable. Trying again as:"
+ puts "zip $name $filelist"
+ file delete -force $name
+ exec zip $name {*}$filelist
+ }
+ puts "$name: [file size $name] bytes"
+}
+make_zip_archive $name $filelist
+
+# On Windows, also try to construct a DLL
+#
+if {$OS eq "win" && [file exists sqlite3.dll] && [file exists sqlite3.def]} {
+ set name sqlite-dll-win-$ARCH-$v2.zip
+ set filelist [list sqlite3.def sqlite3.dll]
+ make_zip_archive $name $filelist
+}