From b15393b8d5efbae17b68a1e5d92e9b9f4473f76f Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 Oct 2015 02:52:09 +0000 Subject: [PATCH 01/12] Change mkopcodeh.awk into tool/mkopcodeh.tcl. FossilOrigin-Name: ed0ebc460b54939862e3bddee2bb9bcb9f69c747 --- Makefile.in | 4 +- Makefile.msc | 4 +- main.mk | 4 +- manifest | 21 +++-- manifest.uuid | 2 +- mkopcodeh.awk | 228 -------------------------------------------- tool/mkopcodeh.tcl | 230 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 249 insertions(+), 244 deletions(-) delete mode 100644 mkopcodeh.awk create mode 100644 tool/mkopcodeh.tcl diff --git a/Makefile.in b/Makefile.in index 5c78abde94..20c8420d34 100644 --- a/Makefile.in +++ b/Makefile.in @@ -902,8 +902,8 @@ tclsqlite3$(TEXE): tclsqlite-shell.lo libsqlite3.la opcodes.c: opcodes.h $(TOP)/mkopcodec.awk $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c -opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk - cat parse.h $(TOP)/src/vdbe.c | $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h +opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl + cat parse.h $(TOP)/src/vdbe.c | $(TCLSH_CMD) $(TOP)/tool/mkopcodeh.tcl >opcodes.h # Rules to build parse.c and parse.h - the outputs of lemon. # diff --git a/Makefile.msc b/Makefile.msc index 678b547fed..124761757d 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1575,8 +1575,8 @@ tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(LIBRESOBJS) opcodes.c: opcodes.h $(TOP)\mkopcodec.awk $(NAWK) -f $(TOP)\mkopcodec.awk opcodes.h > opcodes.c -opcodes.h: parse.h $(TOP)\src\vdbe.c $(TOP)\mkopcodeh.awk - type parse.h $(TOP)\src\vdbe.c | $(NAWK) -f $(TOP)\mkopcodeh.awk > opcodes.h +opcodes.h: parse.h $(TOP)\src\vdbe.c $(TOP)\tool\mkopcodeh.tcl + type parse.h $(TOP)\src\vdbe.c | $(TCLSH_CMD) $(TOP)\tool\mkopcodeh.awk > opcodes.h # Rules to build parse.c and parse.h - the outputs of lemon. # diff --git a/main.mk b/main.mk index cded12e5a3..cc413faca2 100644 --- a/main.mk +++ b/main.mk @@ -582,9 +582,9 @@ tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) opcodes.c: opcodes.h $(TOP)/mkopcodec.awk $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c -opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk +opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl cat parse.h $(TOP)/src/vdbe.c | \ - $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h + tclsh $(TOP)/tool/mkopcodeh.tcl >opcodes.h # Rules to build parse.c and parse.h - the outputs of lemon. # diff --git a/manifest b/manifest index 662c7dfb6d..1a4dd94095 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Remove\sthree\sobsolete\sand\sunused\sfiles\sfrom\stool/ -D 2015-10-07T00:35:18.445 +C Change\smkopcodeh.awk\sinto\stool/mkopcodeh.tcl. +D 2015-10-07T02:52:09.315 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 2143eeef6d0cc26006ae5fc4bb242a4a8b973412 +F Makefile.in dd1f363468240142a5be1c9d58014dc9b8eae2f4 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc b9054642ab305be4174d8b0433c9951c2839701d +F Makefile.msc 8fb99d7b4e8b2e812a2360b8356d956d26e0e953 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 @@ -263,9 +263,8 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 151fcaba704fdeeb0a1941857ef6e1d6216732d8 +F main.mk 9fe51a296a2550282db357d2b3825cc32fbc455b F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea -F mkopcodeh.awk 0e7f04a8eb90f92259e47d80110e4e98d7ce337a F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -1352,6 +1351,7 @@ F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh d1a2da0e15b2ed33d60af35c7e9d483f13a8eb9f F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 +F tool/mkopcodeh.tcl e04177031532b7aa9379ded50e820231ac4abd6e F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 84af2b180484323a2ea22a2279e8bd9e3e1e492e F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 @@ -1389,7 +1389,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a05f903c64edeba8a9748aad68f5981943e68b3c -R d4529eb5d734c0707e0a910200ff6fc6 +P 0abd65294e6e8db68e7ce6724f02f17ba1cb3422 +R 33730b016d975e72f95dcd99735ce552 +T *branch * omit-awk +T *sym-omit-awk * +T -sym-trunk * U drh -Z 8d61b7e9a6e9a2f3b2856a04c9b6debc +Z 05cb2395dd6fc47d133085b2716a644b diff --git a/manifest.uuid b/manifest.uuid index c3e287c668..7bf1ca41d8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0abd65294e6e8db68e7ce6724f02f17ba1cb3422 \ No newline at end of file +ed0ebc460b54939862e3bddee2bb9bcb9f69c747 \ No newline at end of file diff --git a/mkopcodeh.awk b/mkopcodeh.awk deleted file mode 100644 index 474ae4f3b4..0000000000 --- a/mkopcodeh.awk +++ /dev/null @@ -1,228 +0,0 @@ -#!/usr/bin/awk -f -# -# Generate the file opcodes.h. -# -# This AWK script scans a concatenation of the parse.h output file from the -# parser and the vdbe.c source file in order to generate the opcodes numbers -# for all opcodes. -# -# The lines of the vdbe.c that we are interested in are of the form: -# -# case OP_aaaa: /* same as TK_bbbbb */ -# -# The TK_ comment is optional. If it is present, then the value assigned to -# the OP_ is the same as the TK_ value. If missing, the OP_ value is assigned -# a small integer that is different from every other OP_ value. -# -# We go to the trouble of making some OP_ values the same as TK_ values -# as an optimization. During parsing, things like expression operators -# are coded with TK_ values such as TK_ADD, TK_DIVIDE, and so forth. Later -# during code generation, we need to generate corresponding opcodes like -# OP_Add and OP_Divide. By making TK_ADD==OP_Add and TK_DIVIDE==OP_Divide, -# code to translate from one to the other is avoided. This makes the -# code generator run (infinitesimally) faster and more importantly it makes -# the library footprint smaller. -# -# This script also scans for lines of the form: -# -# case OP_aaaa: /* jump, in1, in2, in3, out2-prerelease, out3 */ -# -# When such comments are found on an opcode, it means that certain -# properties apply to that opcode. Set corresponding flags using the -# OPFLG_INITIALIZER macro. -# - - -# Remember the TK_ values from the parse.h file -/^#define TK_/ { - tk[$2] = 0+$3 # tk[x] holds the numeric value for TK symbol X -} - -# Find "/* Opcode: " lines in the vdbe.c file. Each one introduces -# a new opcode. Remember which parameters are used. -/^.. Opcode: / { - currentOp = "OP_" $3 - m = 0 - for(i=4; i<=NF; i++){ - x = $i - if( x=="P1" ) m += 1 - if( x=="P2" ) m += 2 - if( x=="P3" ) m += 4 - if( x=="P4" ) m += 8 - if( x=="P5" ) m += 16 - } - paramused[currentOp] = m -} - -# Find "** Synopsis: " lines that follow Opcode: -/^.. Synopsis: / { - if( currentOp ){ - x = $3 - for(i=4; i<=NF; i++){ - x = x " " $i - } - synopsis[currentOp] = x - } -} - -# Scan for "case OP_aaaa:" lines in the vdbe.c file -/^case OP_/ { - name = $2 - sub(/:/,"",name) - sub("\r","",name) - op[name] = -1 # op[x] holds the numeric value for OP symbol x - jump[name] = 0 - in1[name] = 0 - in2[name] = 0 - in3[name] = 0 - out2[name] = 0 - out3[name] = 0 - for(i=3; i=0 ) continue; - if( name=="OP_Transaction" \ - || name=="OP_AutoCommit" \ - || name=="OP_Savepoint" \ - || name=="OP_Checkpoint" \ - || name=="OP_Vacuum" \ - || name=="OP_JournalMode" \ - || name=="OP_VUpdate" \ - || name=="OP_VFilter" \ - || name=="OP_Next" \ - || name=="OP_NextIfOpen" \ - || name=="OP_SorterNext" \ - || name=="OP_Prev" \ - || name=="OP_PrevIfOpen" \ - ){ - cnt++ - while( used[cnt] ) cnt++ - op[name] = cnt - used[cnt] = 1 - def[cnt] = name - } - } - - # Generate the numeric values for opcodes - for(i=0; i=0} { + incr cnt + while {[info exists used($cnt)]} {incr cnt} + set op($name) $cnt + set used($cnt) 1 + set def($cnt) $name + } +} + +# Generate the numeric values for remaining opcodes +# +for {set i 0} {$i<$nOp} {incr i} { + set name $order($i) + if {$op($name)<0} { + incr cnt + while {[info exists used($cnt)]} {incr cnt} + set op($name) $cnt + set used($cnt) 1 + set def($cnt) $name + } +} +set max $cnt +for {set i 1} {$i<=$nOp} {incr i} { + if {![info exists used($i)]} { + set def($i) "OP_NotUsed_$i" + } + set name $def($i) + puts -nonewline [format {#define %-16s %3d} $name $i] + set com {} + if {[info exists sameas($i)]} { + set com "same as $sameas($i)" + } + if {[info exists synopsis($name)]} { + set x $synopsis($name) + if {$com==""} { + set com "synopsis: $x" + } else { + append com ", synopsis: $x" + } + } + if {$com!=""} { + puts -nonewline [format " /* %-42s */" $com] + } + puts "" +} + +# Generate the bitvectors: +# +set bv(0) 0 +for {set i 1} {$i<=$max} {incr i} { + set name $def($i) + if {[info exists jump($name)] && $jump($name)} {set a0 1} {set a0 0} + if {[info exists in1($name)] && $in1($name)} {set a1 2} {set a1 0} + if {[info exists in2($name)] && $in2($name)} {set a2 4} {set a2 0} + if {[info exists in3($name)] && $in3($name)} {set a3 8} {set a3 0} + if {[info exists out2($name)] && $out2($name)} {set a4 16} {set a4 0} + if {[info exists out3($name)] && $out3($name)} {set a5 32} {set a5 0} + set bv($i) [expr {$a0+$a1+$a2+$a3+$a4+$a5}] +} +puts "" +puts "/* Properties such as \"out2\" or \"jump\" that are specified in" +puts "** comments following the \"case\" for each opcode in the vdbe.c" +puts "** are encoded into bitvectors as follows:" +puts "*/" +puts "#define OPFLG_JUMP 0x0001 /* jump: P2 holds jmp target */" +puts "#define OPFLG_IN1 0x0002 /* in1: P1 is an input */" +puts "#define OPFLG_IN2 0x0004 /* in2: P2 is an input */" +puts "#define OPFLG_IN3 0x0008 /* in3: P3 is an input */" +puts "#define OPFLG_OUT2 0x0010 /* out2: P2 is an output */" +puts "#define OPFLG_OUT3 0x0020 /* out3: P3 is an output */" +puts "#define OPFLG_INITIALIZER \173\\" +for {set i 0} {$i<=$max} {incr i} { + if {$i%8==0} { + puts -nonewline [format "/* %3d */" $i] + } + puts -nonewline [format " 0x%02x," $bv($i)] + if {$i%8==7} { + puts "\\" + } +} +puts "\175" From 7651e0a43969cd7e8f524a300cdf8abd094a2a4b Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 Oct 2015 12:11:36 +0000 Subject: [PATCH 02/12] Convert the mkopcodec.awk script into tool/mkopcodec.tcl. FossilOrigin-Name: 1506cb33fcf61e2ef97b35b99e58fbf21f4f5496 --- Makefile.in | 4 ++-- Makefile.msc | 4 ++-- main.mk | 4 ++-- manifest | 21 +++++++++---------- manifest.uuid | 2 +- mkopcodec.awk | 50 ---------------------------------------------- tool/mkopcodec.tcl | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 66 insertions(+), 69 deletions(-) delete mode 100644 mkopcodec.awk create mode 100644 tool/mkopcodec.tcl diff --git a/Makefile.in b/Makefile.in index 20c8420d34..b78dbac1a2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -899,8 +899,8 @@ tclsqlite3$(TEXE): tclsqlite-shell.lo libsqlite3.la # Rules to build opcodes.c and opcodes.h # -opcodes.c: opcodes.h $(TOP)/mkopcodec.awk - $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c +opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl + $(TCLSH_CMD) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl cat parse.h $(TOP)/src/vdbe.c | $(TCLSH_CMD) $(TOP)/tool/mkopcodeh.tcl >opcodes.h diff --git a/Makefile.msc b/Makefile.msc index 124761757d..d21bab0d8e 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1572,8 +1572,8 @@ tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(LIBRESOBJS) # Rules to build opcodes.c and opcodes.h # -opcodes.c: opcodes.h $(TOP)\mkopcodec.awk - $(NAWK) -f $(TOP)\mkopcodec.awk opcodes.h > opcodes.c +opcodes.c: opcodes.h $(TOP)\tool\mkopcodec.tcl + $(TCLSH_CMD) $(TOP)\tool\mkopcodec.tcl opcodes.h > opcodes.c opcodes.h: parse.h $(TOP)\src\vdbe.c $(TOP)\tool\mkopcodeh.tcl type parse.h $(TOP)\src\vdbe.c | $(TCLSH_CMD) $(TOP)\tool\mkopcodeh.awk > opcodes.h diff --git a/main.mk b/main.mk index cc413faca2..9c7abf7277 100644 --- a/main.mk +++ b/main.mk @@ -579,8 +579,8 @@ tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) # Rules to build opcodes.c and opcodes.h # -opcodes.c: opcodes.h $(TOP)/mkopcodec.awk - $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c +opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl + tclsh $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl cat parse.h $(TOP)/src/vdbe.c | \ diff --git a/manifest b/manifest index 1a4dd94095..b54e68ae0a 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Change\smkopcodeh.awk\sinto\stool/mkopcodeh.tcl. -D 2015-10-07T02:52:09.315 +C Convert\sthe\smkopcodec.awk\sscript\sinto\stool/mkopcodec.tcl. +D 2015-10-07T12:11:36.664 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in dd1f363468240142a5be1c9d58014dc9b8eae2f4 +F Makefile.in da829ae5a1f60e3ff7d76a979628ce4a1bfc5d7d F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 8fb99d7b4e8b2e812a2360b8356d956d26e0e953 +F Makefile.msc 5ae4a363bc7cfbd18814e077f67bb418e6e3378d F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 @@ -263,8 +263,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 9fe51a296a2550282db357d2b3825cc32fbc455b -F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea +F main.mk b67cb215800e4602744db3c6abdb77aac8adbf5e F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -1351,6 +1350,7 @@ F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh d1a2da0e15b2ed33d60af35c7e9d483f13a8eb9f F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 +F tool/mkopcodec.tcl edde8adc42621b5e598127f8cdc6d52cfe21f52b F tool/mkopcodeh.tcl e04177031532b7aa9379ded50e820231ac4abd6e F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 84af2b180484323a2ea22a2279e8bd9e3e1e492e @@ -1389,10 +1389,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0abd65294e6e8db68e7ce6724f02f17ba1cb3422 -R 33730b016d975e72f95dcd99735ce552 -T *branch * omit-awk -T *sym-omit-awk * -T -sym-trunk * +P ed0ebc460b54939862e3bddee2bb9bcb9f69c747 +R 725a0812f70e1ffeb50dd24066c3fbf1 U drh -Z 05cb2395dd6fc47d133085b2716a644b +Z a24c1f360278b392b8819db30361ce0f diff --git a/manifest.uuid b/manifest.uuid index 7bf1ca41d8..3254b996cd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed0ebc460b54939862e3bddee2bb9bcb9f69c747 \ No newline at end of file +1506cb33fcf61e2ef97b35b99e58fbf21f4f5496 \ No newline at end of file diff --git a/mkopcodec.awk b/mkopcodec.awk deleted file mode 100644 index de19068c20..0000000000 --- a/mkopcodec.awk +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/awk -f -# -# This AWK script scans the opcodes.h file (which is itself generated by -# another awk script) and uses the information gleaned to create the -# opcodes.c source file. -# -# Opcodes.c contains strings which are the symbolic names for the various -# opcodes used by the VDBE. These strings are used when disassembling a -# VDBE program during tracing or as a result of the EXPLAIN keyword. -# -BEGIN { - print "/* Automatically generated. Do not edit */" - print "/* See the mkopcodec.awk script for details. */" - printf "#if !defined(SQLITE_OMIT_EXPLAIN)" - printf " || defined(VDBE_PROFILE)" - print " || defined(SQLITE_DEBUG)" - print "#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)" - print "# define OpHelp(X) \"\\0\" X" - print "#else" - print "# define OpHelp(X)" - print "#endif" - print "const char *sqlite3OpcodeName(int i){" - print " static const char *const azName[] = { \"?\"," - mx = 0 -} -/^.define OP_/ { - sub("OP_","",$2) - i = $3+0 - label[i] = $2 - if( mx Date: Wed, 7 Oct 2015 12:21:14 +0000 Subject: [PATCH 03/12] Change the addopcodes.awk script into tool/addopcodes.tcl. FossilOrigin-Name: 8bbf37142ef2759274668f6da114b5c8072e42db --- Makefile.in | 4 ++-- Makefile.msc | 4 ++-- addopcodes.awk | 34 ---------------------------------- main.mk | 4 ++-- manifest | 18 +++++++++--------- manifest.uuid | 2 +- tool/addopcodes.tcl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 61 insertions(+), 50 deletions(-) delete mode 100644 addopcodes.awk create mode 100644 tool/addopcodes.tcl diff --git a/Makefile.in b/Makefile.in index b78dbac1a2..eae80ece5e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -909,12 +909,12 @@ opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl # parse.h: parse.c -parse.c: $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk +parse.c: $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/tool/addopcodes.tcl cp $(TOP)/src/parse.y . rm -f parse.h ./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y mv parse.h parse.h.temp - $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h + $(TCLSH_CMD) $(TOP)/tool/addopcodes.tcl parse.h.temp >parse.h sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h diff --git a/Makefile.msc b/Makefile.msc index d21bab0d8e..785c65cb71 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1582,12 +1582,12 @@ opcodes.h: parse.h $(TOP)\src\vdbe.c $(TOP)\tool\mkopcodeh.tcl # parse.h: parse.c -parse.c: $(TOP)\src\parse.y lemon.exe $(TOP)\addopcodes.awk +parse.c: $(TOP)\src\parse.y lemon.exe $(TOP)\tool\addopcodes.tcl del /Q parse.y parse.h parse.h.temp 2>NUL copy $(TOP)\src\parse.y . .\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y move parse.h parse.h.temp - $(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h + $(TCLSH_CMD) $(TOP)\tool\addopcodes.tcl parse.h.temp > parse.h sqlite3.h: $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h diff --git a/addopcodes.awk b/addopcodes.awk deleted file mode 100644 index dcd31eff84..0000000000 --- a/addopcodes.awk +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/awk -# -# This script appends additional token codes to the end of the -# parse.h file that lemon generates. These extra token codes are -# not used by the parser. But they are used by the tokenizer and/or -# the code generator. -# -# -BEGIN { - max = 0 -} -/^#define TK_/ { - print $0 - if( max<$3 ) max = $3 -} -END { - printf "#define TK_%-29s %4d\n", "TO_TEXT", ++max - printf "#define TK_%-29s %4d\n", "TO_BLOB", ++max - printf "#define TK_%-29s %4d\n", "TO_NUMERIC", ++max - printf "#define TK_%-29s %4d\n", "TO_INT", ++max - printf "#define TK_%-29s %4d\n", "TO_REAL", ++max - printf "#define TK_%-29s %4d\n", "ISNOT", ++max - printf "#define TK_%-29s %4d\n", "END_OF_FILE", ++max - printf "#define TK_%-29s %4d\n", "ILLEGAL", ++max - printf "#define TK_%-29s %4d\n", "SPACE", ++max - printf "#define TK_%-29s %4d\n", "UNCLOSED_STRING", ++max - printf "#define TK_%-29s %4d\n", "FUNCTION", ++max - printf "#define TK_%-29s %4d\n", "COLUMN", ++max - printf "#define TK_%-29s %4d\n", "AGG_FUNCTION", ++max - printf "#define TK_%-29s %4d\n", "AGG_COLUMN", ++max - printf "#define TK_%-29s %4d\n", "UMINUS", ++max - printf "#define TK_%-29s %4d\n", "UPLUS", ++max - printf "#define TK_%-29s %4d\n", "REGISTER", ++max -} diff --git a/main.mk b/main.mk index 9c7abf7277..f3c1d2aabd 100644 --- a/main.mk +++ b/main.mk @@ -590,12 +590,12 @@ opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl # parse.h: parse.c -parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk +parse.c: $(TOP)/src/parse.y lemon $(TOP)/tool/addopcodes.tcl cp $(TOP)/src/parse.y . rm -f parse.h ./lemon -s $(OPTS) parse.y mv parse.h parse.h.temp - $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h + tclsh $(TOP)/tool/addopcodes.tcl parse.h.temp >parse.h sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION $(TOP)/ext/rtree/sqlite3rtree.h tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h diff --git a/manifest b/manifest index b54e68ae0a..a38c009e00 100644 --- a/manifest +++ b/manifest @@ -1,14 +1,13 @@ -C Convert\sthe\smkopcodec.awk\sscript\sinto\stool/mkopcodec.tcl. -D 2015-10-07T12:11:36.664 +C Change\sthe\saddopcodes.awk\sscript\sinto\stool/addopcodes.tcl. +D 2015-10-07T12:21:14.000 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in da829ae5a1f60e3ff7d76a979628ce4a1bfc5d7d +F Makefile.in b33d44230974d2d5ea2f0599855c5e36bd79b90a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 5ae4a363bc7cfbd18814e077f67bb418e6e3378d +F Makefile.msc b7d8a7efbbf38cee57bfc81d11ca28c42122ff81 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 -F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 @@ -263,7 +262,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk b67cb215800e4602744db3c6abdb77aac8adbf5e +F main.mk 1cb544e1b1943b8b6452a811869b3baee5bfcb13 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -1334,6 +1333,7 @@ F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac +F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 @@ -1389,7 +1389,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ed0ebc460b54939862e3bddee2bb9bcb9f69c747 -R 725a0812f70e1ffeb50dd24066c3fbf1 +P 1506cb33fcf61e2ef97b35b99e58fbf21f4f5496 +R d8eeb7e51eba4dfb24803600079d2858 U drh -Z a24c1f360278b392b8819db30361ce0f +Z f02ffe1dfbcccf71e8c30b4fbe822892 diff --git a/manifest.uuid b/manifest.uuid index 3254b996cd..95ca593f47 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1506cb33fcf61e2ef97b35b99e58fbf21f4f5496 \ No newline at end of file +8bbf37142ef2759274668f6da114b5c8072e42db \ No newline at end of file diff --git a/tool/addopcodes.tcl b/tool/addopcodes.tcl new file mode 100644 index 0000000000..46675cb258 --- /dev/null +++ b/tool/addopcodes.tcl @@ -0,0 +1,45 @@ +#!/usr/bin/tclsh +# +# This script appends additional token codes to the end of the +# parse.h file that lemon generates. These extra token codes are +# not used by the parser. But they are used by the tokenizer and/or +# the code generator. +# +# +set in [open [lindex $argv 0] rb] +set max 0 +while {![eof $in]} { + set line [gets $in] + if {[regexp {^#define TK_} $line]} { + puts $line + set x [lindex $line 2] + if {$x>$max} {set max $x} + } +} +close $in + +# The following are the extra token codes to be added +# +set extras { + TO_TEXT + TO_BLOB + TO_NUMERIC + TO_INT + TO_REAL + ISNOT + END_OF_FILE + ILLEGAL + SPACE + UNCLOSED_STRING + FUNCTION + COLUMN + AGG_FUNCTION + AGG_COLUMN + UMINUS + UPLUS + REGISTER +} +foreach x $extras { + incr max + puts [format "#define TK_%-29s %4d" $x $max] +} From 48cc9a31e12d3ac1acd927515d8d79cbbdbfe1e0 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 Oct 2015 12:36:42 +0000 Subject: [PATCH 04/12] Convert the tool/tostr.awk script into tool/tostr.tcl. Remove two obsolete Makefiles. Purge NAWK from the configure script and from unix makefiles. There are still two uses of NAWK in Makefile.msc. FossilOrigin-Name: 5b6775215327a89232f5059653747a18e83b8b4b --- Makefile.arm-wince-mingw32ce-gcc | 138 ------- Makefile.in | 5 +- Makefile.linux-gcc | 5 - Makefile.msc | 2 +- Makefile.vxworks | 673 ------------------------------- configure | 72 +--- configure.ac | 1 - main.mk | 5 +- manifest | 26 +- manifest.uuid | 2 +- tool/tostr.awk | 9 - tool/tostr.tcl | 12 + 12 files changed, 42 insertions(+), 908 deletions(-) delete mode 100644 Makefile.arm-wince-mingw32ce-gcc delete mode 100644 Makefile.vxworks delete mode 100644 tool/tostr.awk create mode 100644 tool/tostr.tcl diff --git a/Makefile.arm-wince-mingw32ce-gcc b/Makefile.arm-wince-mingw32ce-gcc deleted file mode 100644 index 323b7ea482..0000000000 --- a/Makefile.arm-wince-mingw32ce-gcc +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/make -# -# Makefile for SQLITE -# -# This is a template makefile for SQLite. Most people prefer to -# use the autoconf generated "configure" script to generate the -# makefile automatically. But that does not work for everybody -# and in every situation. If you are having problems with the -# "configure" script, you might want to try this makefile as an -# alternative. Create a copy of this file, edit the parameters -# below and type "make". -# - -#### The directory where to find the mingw32ce tools -MINGW32CE = /opt/mingw32ce/bin - -#### The target prefix of the mingw32ce tools -TARGET = arm-wince-mingw32ce - -#### The toplevel directory of the source tree. This is the directory -# that contains this "Makefile.in" and the "configure.in" script. -# -TOP = ../sqlite - -#### C Compiler and options for use in building executables that -# will run on the platform that is doing the build. -# -BCC = gcc -g -O2 -#BCC = /opt/ancic/bin/c89 -0 - -#### If the target operating system supports the "usleep()" system -# call, then define the HAVE_USLEEP macro for all C modules. -# -USLEEP = -#USLEEP = -DHAVE_USLEEP=1 - -#### If you want the SQLite library to be safe for use within a -# multi-threaded program, then define the following macro -# appropriately: -# -THREADSAFE = -DTHREADSAFE=1 -#THREADSAFE = -DTHREADSAFE=0 - -#### Specify any extra linker options needed to make the library -# thread safe -# -#THREADLIB = -lpthread -THREADLIB = - -#### Specify any extra libraries needed to access required functions. -# -#TLIBS = -lrt # fdatasync on Solaris 8 -TLIBS = - -#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1 -# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all -# malloc()s and free()s in order to track down memory leaks. -# -# SQLite uses some expensive assert() statements in the inner loop. -# You can make the library go almost twice as fast if you compile -# with -DNDEBUG=1 -# -#OPTS = -DSQLITE_DEBUG=2 -#OPTS = -DSQLITE_DEBUG=1 -#OPTS = -OPTS = -DNDEBUG=1 -DSQLITE_OS_WIN=1 -D_WIN32_WCE=1 -#OPTS += -DHAVE_FDATASYNC=1 - -#### The suffix to add to executable files. ".exe" for windows. -# Nothing for unix. -# -EXE = .exe -#EXE = - -#### C Compile and options for use in building executables that -# will run on the target platform. This is usually the same -# as BCC, unless you are cross-compiling. -# -#TCC = gcc -O6 -#TCC = gcc -g -O0 -Wall -#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage -#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6 -TCC = $(MINGW32CE)/$(TARGET)-gcc -O2 -#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive - -#### Tools used to build a static library. -# -#AR = ar cr -#AR = /opt/mingw/bin/i386-mingw32-ar cr -AR = $(MINGW32CE)/$(TARGET)-ar cr -#RANLIB = ranlib -#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib -RANLIB = $(MINGW32CE)/$(TARGET)-ranlib - -#MKSHLIB = gcc -shared -#SO = so -#SHPREFIX = lib -MKSHLIB = $(MINGW32CE)/$(TARGET)-gcc -shared -SO = dll -SHPREFIX = - -#### Extra compiler options needed for programs that use the TCL library. -# -#TCL_FLAGS = -#TCL_FLAGS = -DSTATIC_BUILD=1 -TCL_FLAGS = -I/home/drh/tcltk/8.5linux -#TCL_FLAGS = -I/home/drh/tcltk/8.5win -DSTATIC_BUILD=1 -#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux - -#### Linker options needed to link against the TCL library. -# -#LIBTCL = -ltcl -lm -ldl -LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl -#LIBTCL = /home/drh/tcltk/8.5win/libtcl85s.a -lmsvcrt -#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc - -#### Additional objects for SQLite library when TCL support is enabled. -TCLOBJ = -#TCLOBJ = tclsqlite.o - -#### Compiler options needed for programs that use the readline() library. -# -READLINE_FLAGS = -#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline - -#### Linker options needed by programs using readline() must link against. -# -LIBREADLINE = -#LIBREADLINE = -static -lreadline -ltermcap - -#### Which "awk" program provides nawk compatibilty -# -# NAWK = nawk -NAWK = awk - -# You should not have to change anything below this line -############################################################################### -include $(TOP)/main.mk diff --git a/Makefile.in b/Makefile.in index eae80ece5e..9d50a7f264 100644 --- a/Makefile.in +++ b/Makefile.in @@ -155,9 +155,6 @@ LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(TCC) $(LTCOMPILE_EXTRAS) LTLINK = $(LIBTOOL) --mode=link $(TCC) $(LTCOMPILE_EXTRAS) @LDFLAGS@ $(LTLINK_EXTRAS) LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL) -# nawk compatible awk. -NAWK = @AWK@ - # You should not have to change anything below this line ############################################################################### @@ -1096,7 +1093,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@ echo "static const char *tclsh_main_loop(void){" >> $@ echo "static const char *zMainloop = " >> $@ - $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@ + $(TCLSH_CMD) $(TOP)/tool/tostr.tcl $(TOP)/tool/spaceanal.tcl >> $@ echo "; return zMainloop; }" >> $@ sqlite3_analyzer$(TEXE): sqlite3_analyzer.c diff --git a/Makefile.linux-gcc b/Makefile.linux-gcc index 1c9f24f4ba..1491a4b02a 100644 --- a/Makefile.linux-gcc +++ b/Makefile.linux-gcc @@ -118,11 +118,6 @@ READLINE_FLAGS = LIBREADLINE = #LIBREADLINE = -static -lreadline -ltermcap -#### Which "awk" program provides nawk compatibilty -# -# NAWK = nawk -NAWK = awk - # You should not have to change anything below this line ############################################################################### include $(TOP)/main.mk diff --git a/Makefile.msc b/Makefile.msc index 785c65cb71..71b5fc8cc9 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1774,7 +1774,7 @@ sqlite3_analyzer.c: $(SQLITE3C) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@ echo static const char *tclsh_main_loop(void){ >> $@ echo static const char *zMainloop = >> $@ - $(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@ + $(TCLSH_CMD) $(TOP)\tool\tostr.tcl $(TOP)\tool\spaceanal.tcl >> $@ echo ; return zMainloop; } >> $@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS) diff --git a/Makefile.vxworks b/Makefile.vxworks deleted file mode 100644 index 706261fc00..0000000000 --- a/Makefile.vxworks +++ /dev/null @@ -1,673 +0,0 @@ -#!/usr/make -# -# Makefile for SQLITE on VxWorks - -ifeq ($(FORCPU),) - FORCPU = SH32gnule -endif - -TOOL_FAMILY = gnu - -include $(WIND_USR)/tool/gnu/make.$(FORCPU) - -#### The toplevel directory of the source tree. This is the directory -# that contains this "Makefile.in" and the "configure.in" script. -# -TOP = . - -#### C Compiler and options for use in building executables that -# will run on the platform that is doing the build. -# -BCC = gcc -g -O2 -#BCC = /opt/ancic/bin/c89 -0 - -#### If the target operating system supports the "usleep()" system -# call, then define the HAVE_USLEEP macro for all C modules. -# -USLEEP = -#USLEEP = -DHAVE_USLEEP=1 - -#### If you want the SQLite library to be safe for use within a -# multi-threaded program, then define the following macro -# appropriately: -# -THREADSAFE = -DSQLITE_THREADSAFE=1 -#THREADSAFE = -DSQLITE_THREADSAFE=0 - -#### Specify any extra linker options needed to make the library -# thread safe -# -#THREADLIB = -lpthread -THREADLIB = - -#### Specify any extra libraries needed to access required functions. -# -ifeq ($(CPU),SH32) - # for SH4 shared library - TLIBS_SHARED += -L$(WIND_USR)/lib/sh/SH32/commonle/PIC -else - # for all other CPUs shared library - TLIBS_SHARED += $(LD_LINK_PATH_ATEND) $(LD_PARTIAL_LAST_FLAGS) -endif -# for static library -TLIBS += $(LD_LINK_PATH_ATEND) $(LD_PARTIAL_LAST_FLAGS) - -#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1 -# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all -# malloc()s and free()s in order to track down memory leaks. -# -# SQLite uses some expensive assert() statements in the inner loop. -# You can make the library go almost twice as fast if you compile -# with -DNDEBUG=1 -# -#OPTS = -DSQLITE_DEBUG=2 -#OPTS = -DSQLITE_DEBUG=1 -#OPTS = -OPTS = -DNDEBUG=1 -DSQLITE_OS_UNIX=1 $(THREADSAFE) -OPTS += -DSQLITE_OMIT_LOAD_EXTENSION=1 -OPTS += -DSQLITE_ENABLE_LOCKING_STYLE=1 -OPTS += -DSQLITE_THREAD_OVERRIDE_LOCK=0 -OPTS += -DSQLITE_ENABLE_COLUMN_METADATA=1 -OPTS += -DHAVE_FDATASYNC=1 - -#### The suffix to add to executable files. ".exe" for windows. -# Nothing for unix. -# -EXE = .vxe -#EXE = - -#### C Compile and options for use in building executables that -# will run on the target platform. This is usually the same -# as BCC, unless you are cross-compiling. -# -#TCC = gcc -O6 -#TCC = gcc -g -O0 -Wall -#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage -#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6 -TCC = $(CC) $(DEFINE_CC) -O2 -g -mrtp $(CC_ARCH_SPEC) -D_REENTRANT=1 -D_VX_CPU=_VX_$(CPU) -D_VX_TOOL_FAMILY=$(TOOL_FAMILY) -D_VX_TOOL=$(TOOL) -TCC += -I$(WIND_USR)/h -I$(WIND_USR)/h/wrn/coreip -#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive - -#TCC_SHARED = $(TCC) -fPIC -TCC_SHARED = $(TCC) - -#### Tools used to build a static library. -# -#ARX = ar cr -#ARX = /opt/mingw/bin/i386-mingw32-ar cr -AR += cr -#RANLIB = ranlib -#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib - -#MKSHLIB = gcc -shared -#SO = so -#SHPREFIX = lib -MKSHLIB = $(CC) $(DEFINE_CC) -mrtp -shared $(CC_ARCH_SPEC) -D_VX_CPU=_VX_$(CPU) -D_VX_TOOL_FAMILY=$(TOOL_FAMILY) -D_VX_TOOL=$(TOOL) -SO = so -SHPREFIX = lib - -#### Extra compiler options needed for programs that use the TCL library. -# -#TCL_FLAGS = -#TCL_FLAGS = -DSTATIC_BUILD=1 -TCL_FLAGS = -I/home/drh/tcltk/8.5linux -#TCL_FLAGS = -I/home/drh/tcltk/8.5win -DSTATIC_BUILD=1 -#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux - -#### Linker options needed to link against the TCL library. -# -#LIBTCL = -ltcl -lm -ldl -LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl -#LIBTCL = /home/drh/tcltk/8.5win/libtcl85s.a -lmsvcrt -#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc - -#### Additional objects for SQLite library when TCL support is enabled. -TCLOBJ = -#TCLOBJ = tclsqlite.o - -#### Compiler options needed for programs that use the readline() library. -# -READLINE_FLAGS = -#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline - -#### Linker options needed by programs using readline() must link against. -# -LIBREADLINE = -#LIBREADLINE = -static -lreadline -ltermcap - -#### Which "awk" program provides nawk compatibilty -# -# NAWK = nawk -NAWK = awk - - -#### Pasted and adapted main.mk file -############################################################################### -# The following macros should be defined before this script is -# invoked: -# -# TOP The toplevel directory of the source tree. This is the -# directory that contains this "Makefile.in" and the -# "configure.in" script. -# -# BCC C Compiler and options for use in building executables that -# will run on the platform that is doing the build. -# -# THREADLIB Specify any extra linker options needed to make the library -# thread safe -# -# OPTS Extra compiler command-line options. -# -# EXE The suffix to add to executable files. ".exe" for windows -# and "" for Unix. -# -# TCC C Compiler and options for use in building executables that -# will run on the target platform. This is usually the same -# as BCC, unless you are cross-compiling. -# -# AR Tools used to build a static library. -# RANLIB -# -# TCL_FLAGS Extra compiler options needed for programs that use the -# TCL library. -# -# LIBTCL Linker options needed to link against the TCL library. -# -# READLINE_FLAGS Compiler options needed for programs that use the -# readline() library. -# -# LIBREADLINE Linker options needed by programs using readline() must -# link against. -# -# NAWK Nawk compatible awk program. Older (obsolete?) solaris -# systems need this to avoid using the original AT&T AWK. -# -# Once the macros above are defined, the rest of this make script will -# build the SQLite library and testing tools. -################################################################################ - -# This is how we compile -# -TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src -I$(TOP) -TCCX_SHARED = $(TCC_SHARED) $(OPTS) -I. -I$(TOP)/src -I$(TOP) \ - -I$(TOP)/ext/rtree -I$(TOP)/ext/icu -I$(TOP)/ext/fts3 \ - -I$(TOP)/ext/async - -# Object files for the SQLite library. -# -LIBOBJ+= alter.o analyze.o attach.o auth.o \ - backup.o bitvec.o btmutex.o btree.o build.o \ - callback.o complete.o date.o delete.o expr.o fault.o \ - fts3.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \ - fts3_tokenizer.o fts3_tokenizer1.o \ - func.o global.o hash.o \ - icu.o insert.o journal.o legacy.o loadext.o \ - main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \ - memjournal.o \ - mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \ - notify.o opcodes.o os.o os_unix.o os_win.o \ - pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \ - random.o resolve.o rowset.o rtree.o select.o status.o \ - table.o tokenize.o trigger.o \ - update.o util.o vacuum.o \ - vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o \ - walker.o where.o utf.o vtab.o - - - -# All of the source code files. -# -SRC = \ - $(TOP)/src/alter.c \ - $(TOP)/src/analyze.c \ - $(TOP)/src/attach.c \ - $(TOP)/src/auth.c \ - $(TOP)/src/backup.c \ - $(TOP)/src/bitvec.c \ - $(TOP)/src/btmutex.c \ - $(TOP)/src/btree.c \ - $(TOP)/src/btree.h \ - $(TOP)/src/btreeInt.h \ - $(TOP)/src/build.c \ - $(TOP)/src/callback.c \ - $(TOP)/src/complete.c \ - $(TOP)/src/ctime.c \ - $(TOP)/src/date.c \ - $(TOP)/src/delete.c \ - $(TOP)/src/expr.c \ - $(TOP)/src/fault.c \ - $(TOP)/src/func.c \ - $(TOP)/src/global.c \ - $(TOP)/src/hash.c \ - $(TOP)/src/hash.h \ - $(TOP)/src/hwtime.h \ - $(TOP)/src/insert.c \ - $(TOP)/src/journal.c \ - $(TOP)/src/legacy.c \ - $(TOP)/src/loadext.c \ - $(TOP)/src/main.c \ - $(TOP)/src/malloc.c \ - $(TOP)/src/mem0.c \ - $(TOP)/src/mem1.c \ - $(TOP)/src/mem2.c \ - $(TOP)/src/mem3.c \ - $(TOP)/src/mem5.c \ - $(TOP)/src/memjournal.c \ - $(TOP)/src/msvc.h \ - $(TOP)/src/mutex.c \ - $(TOP)/src/mutex.h \ - $(TOP)/src/mutex_noop.c \ - $(TOP)/src/mutex_unix.c \ - $(TOP)/src/mutex_w32.c \ - $(TOP)/src/notify.c \ - $(TOP)/src/os.c \ - $(TOP)/src/os.h \ - $(TOP)/src/os_common.h \ - $(TOP)/src/os_setup.h \ - $(TOP)/src/os_unix.c \ - $(TOP)/src/os_win.c \ - $(TOP)/src/os_win.h \ - $(TOP)/src/pager.c \ - $(TOP)/src/pager.h \ - $(TOP)/src/parse.y \ - $(TOP)/src/pcache.c \ - $(TOP)/src/pcache.h \ - $(TOP)/src/pcache1.c \ - $(TOP)/src/pragma.c \ - $(TOP)/src/prepare.c \ - $(TOP)/src/printf.c \ - $(TOP)/src/random.c \ - $(TOP)/src/resolve.c \ - $(TOP)/src/rowset.c \ - $(TOP)/src/select.c \ - $(TOP)/src/status.c \ - $(TOP)/src/shell.c \ - $(TOP)/src/sqlite.h.in \ - $(TOP)/src/sqlite3ext.h \ - $(TOP)/src/sqliteInt.h \ - $(TOP)/src/sqliteLimit.h \ - $(TOP)/src/table.c \ - $(TOP)/src/tclsqlite.c \ - $(TOP)/src/tokenize.c \ - $(TOP)/src/trigger.c \ - $(TOP)/src/utf.c \ - $(TOP)/src/update.c \ - $(TOP)/src/util.c \ - $(TOP)/src/vacuum.c \ - $(TOP)/src/vdbe.c \ - $(TOP)/src/vdbe.h \ - $(TOP)/src/vdbeapi.c \ - $(TOP)/src/vdbeaux.c \ - $(TOP)/src/vdbeblob.c \ - $(TOP)/src/vdbemem.c \ - $(TOP)/src/vdbeInt.h \ - $(TOP)/src/vtab.c \ - $(TOP)/src/walker.c \ - $(TOP)/src/where.c - -# Source code for extensions -# -SRC += \ - $(TOP)/ext/fts1/fts1.c \ - $(TOP)/ext/fts1/fts1.h \ - $(TOP)/ext/fts1/fts1_hash.c \ - $(TOP)/ext/fts1/fts1_hash.h \ - $(TOP)/ext/fts1/fts1_porter.c \ - $(TOP)/ext/fts1/fts1_tokenizer.h \ - $(TOP)/ext/fts1/fts1_tokenizer1.c -SRC += \ - $(TOP)/ext/fts2/fts2.c \ - $(TOP)/ext/fts2/fts2.h \ - $(TOP)/ext/fts2/fts2_hash.c \ - $(TOP)/ext/fts2/fts2_hash.h \ - $(TOP)/ext/fts2/fts2_icu.c \ - $(TOP)/ext/fts2/fts2_porter.c \ - $(TOP)/ext/fts2/fts2_tokenizer.h \ - $(TOP)/ext/fts2/fts2_tokenizer.c \ - $(TOP)/ext/fts2/fts2_tokenizer1.c -SRC += \ - $(TOP)/ext/fts3/fts3.c \ - $(TOP)/ext/fts3/fts3.h \ - $(TOP)/ext/fts3/fts3_expr.c \ - $(TOP)/ext/fts3/fts3_expr.h \ - $(TOP)/ext/fts3/fts3_hash.c \ - $(TOP)/ext/fts3/fts3_hash.h \ - $(TOP)/ext/fts3/fts3_icu.c \ - $(TOP)/ext/fts3/fts3_porter.c \ - $(TOP)/ext/fts3/fts3_tokenizer.h \ - $(TOP)/ext/fts3/fts3_tokenizer.c \ - $(TOP)/ext/fts3/fts3_tokenizer1.c -SRC += \ - $(TOP)/ext/icu/sqliteicu.h \ - $(TOP)/ext/icu/icu.c -SRC += \ - $(TOP)/ext/rtree/rtree.h \ - $(TOP)/ext/rtree/rtree.c - - -# Generated source code files -# -SRC += \ - keywordhash.h \ - opcodes.c \ - opcodes.h \ - parse.c \ - parse.h \ - sqlite3.h - - -# Source code to the test files. -# -TESTSRC = \ - $(TOP)/src/test1.c \ - $(TOP)/src/test2.c \ - $(TOP)/src/test3.c \ - $(TOP)/src/test4.c \ - $(TOP)/src/test5.c \ - $(TOP)/src/test6.c \ - $(TOP)/src/test7.c \ - $(TOP)/src/test8.c \ - $(TOP)/src/test9.c \ - $(TOP)/src/test_autoext.c \ - $(TOP)/src/test_async.c \ - $(TOP)/src/test_backup.c \ - $(TOP)/src/test_btree.c \ - $(TOP)/src/test_config.c \ - $(TOP)/src/test_devsym.c \ - $(TOP)/src/test_func.c \ - $(TOP)/src/test_hexio.c \ - $(TOP)/src/test_journal.c \ - $(TOP)/src/test_malloc.c \ - $(TOP)/src/test_md5.c \ - $(TOP)/src/test_mutex.c \ - $(TOP)/src/test_onefile.c \ - $(TOP)/src/test_osinst.c \ - $(TOP)/src/test_pcache.c \ - $(TOP)/src/test_schema.c \ - $(TOP)/src/test_server.c \ - $(TOP)/src/test_tclvar.c \ - $(TOP)/src/test_thread.c \ - $(TOP)/src/test_vfs.c \ - $(TOP)/src/test_wsd.c \ - -#TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c -#TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c - -TESTSRC2 = \ - $(TOP)/src/attach.c $(TOP)/src/backup.c $(TOP)/src/btree.c \ - $(TOP)/src/build.c $(TOP)/src/ctime.c $(TOP)/src/date.c \ - $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/os.c \ - $(TOP)/src/os_unix.c $(TOP)/src/os_win.c \ - $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c \ - $(TOP)/src/printf.c $(TOP)/src/random.c $(TOP)/src/pcache.c \ - $(TOP)/src/pcache1.c $(TOP)/src/select.c $(TOP)/src/tokenize.c \ - $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \ - $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c \ - $(TOP)/ext/fts3/fts3.c $(TOP)/ext/fts3/fts3_expr.c \ - $(TOP)/ext/fts3/fts3_tokenizer.c \ - $(TOP)/ext/async/sqlite3async.c - -# Header files used by all library source files. -# -HDR = \ - $(TOP)/src/btree.h \ - $(TOP)/src/btreeInt.h \ - $(TOP)/src/hash.h \ - $(TOP)/src/hwtime.h \ - keywordhash.h \ - $(TOP)/src/msvc.h \ - $(TOP)/src/mutex.h \ - opcodes.h \ - $(TOP)/src/os.h \ - $(TOP)/src/os_common.h \ - $(TOP)/src/os_setup.h \ - $(TOP)/src/os_win.h \ - $(TOP)/src/pager.h \ - $(TOP)/src/pcache.h \ - parse.h \ - sqlite3.h \ - $(TOP)/src/sqlite3ext.h \ - $(TOP)/src/sqliteInt.h \ - $(TOP)/src/sqliteLimit.h \ - $(TOP)/src/vdbe.h \ - $(TOP)/src/vdbeInt.h - -# Header files used by extensions -# -EXTHDR += \ - $(TOP)/ext/fts1/fts1.h \ - $(TOP)/ext/fts1/fts1_hash.h \ - $(TOP)/ext/fts1/fts1_tokenizer.h -EXTHDR += \ - $(TOP)/ext/fts2/fts2.h \ - $(TOP)/ext/fts2/fts2_hash.h \ - $(TOP)/ext/fts2/fts2_tokenizer.h -EXTHDR += \ - $(TOP)/ext/fts3/fts3.h \ - $(TOP)/ext/fts3/fts3_expr.h \ - $(TOP)/ext/fts3/fts3_hash.h \ - $(TOP)/ext/fts3/fts3_tokenizer.h -EXTHDR += \ - $(TOP)/ext/rtree/rtree.h -EXTHDR += \ - $(TOP)/ext/icu/sqliteicu.h - -# This is the default Makefile target. The objects listed here -# are what get build when you type just "make" with no arguments. -# -all: sqlite3.h libsqlite3.a sqlite3$(EXE) - -libsqlite3.a: $(LIBOBJ) - $(AR) libsqlite3.a $(LIBOBJ) - $(RANLIB) libsqlite3.a - -$(SHPREFIX)sqlite3.$(SO): $(LIBOBJ) - $(MKSHLIB) -o $(SHPREFIX)sqlite3.$(SO) $(LIBOBJ) $(TLIBS_SHARED) - -sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h - $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) \ - $(TOP)/src/shell.c \ - $(LIBREADLINE) $(TLIBS) $(THREADLIB) -L. -lsqlite3 - -# This target creates a directory named "tsrc" and fills it with -# copies of all of the C source code and header files needed to -# build on the target system. Some of the C source code and header -# files are automatically generated. This target takes care of -# all that automatic generation. -# -target_source: $(SRC) - rm -rf tsrc - mkdir tsrc - cp -f $(SRC) tsrc - rm tsrc/sqlite.h.in tsrc/parse.y - touch target_source - -sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl - tclsh $(TOP)/tool/mksqlite3c.tcl - cp sqlite3.c tclsqlite3.c - cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c - -fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl - tclsh $(TOP)/ext/fts2/mkfts2amal.tcl - -fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl - tclsh $(TOP)/ext/fts3/mkfts3amal.tcl - -# Rules to build the LEMON compiler generator -# -lemon: $(TOP)/tool/lemon.c $(TOP)/src/lempar.c - $(BCC) -o lemon $(TOP)/tool/lemon.c - cp $(TOP)/src/lempar.c . - -# Rules to build individual *.o files from generated *.c files. This -# applies to: -# -# parse.o -# opcodes.o -# -%.o: %.c $(HDR) - $(TCCX_SHARED) -c $< - -# Rules to build individual *.o files from files in the src directory. -# -%.o: $(TOP)/src/%.c $(HDR) - $(TCCX_SHARED) -c $< - -tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) - $(TCCX_SHARED) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c - - - -# Rules to build opcodes.c and opcodes.h -# -opcodes.c: opcodes.h $(TOP)/mkopcodec.awk - $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c - -opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk - cat parse.h $(TOP)/src/vdbe.c | \ - $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h - -# Rules to build parse.c and parse.h - the outputs of lemon. -# -parse.h: parse.c - -parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk - cp $(TOP)/src/parse.y . - rm -f parse.h - ./lemon $(OPTS) parse.y - mv parse.h parse.h.temp - awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h - -sqlite3.h: $(TOP)/src/sqlite.h.in - sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \ - -e s/--VERSION-NUMBER--/`cat ${TOP}/VERSION | sed 's/[^0-9]/ /g' | $(NAWK) '{printf "%d%03d%03d",$$1,$$2,$$3}'`/ \ - $(TOP)/src/sqlite.h.in >sqlite3.h - -keywordhash.h: $(TOP)/tool/mkkeywordhash.c - $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c - ./mkkeywordhash >keywordhash.h - - - -# Rules to build the extension objects. -# -icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c - -fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c - -fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c - -fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c - -fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c - -fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c - -fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c - -fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c - -fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c - -fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c - -fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c - -fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c - -fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c - -fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c - -rtree.o: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR) - $(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c - - -# Rules for building test programs and for running tests -# -tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a - $(TCCX_SHARED) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \ - $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB) - - -# Rules to build the 'testfixture' application. -# -TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 -TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE - -testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c - $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \ - $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \ - -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a - -amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c - $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \ - $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \ - -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) - -fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c - $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \ - -DSQLITE_ENABLE_FTS3=1 \ - $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \ - -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) - -fulltest: testfixture$(EXE) sqlite3$(EXE) - ./testfixture$(EXE) $(TOP)/test/all.test - -soaktest: testfixture$(EXE) sqlite3$(EXE) - ./testfixture$(EXE) $(TOP)/test/all.test -soak=1 - -fulltestonly: testfixture$(EXE) sqlite3$(EXE) - ./testfixture$(EXE) $(TOP)/test/full.test - -test: testfixture$(EXE) sqlite3$(EXE) - ./testfixture$(EXE) $(TOP)/test/veryquick.test - -sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \ - $(TOP)/tool/spaceanal.tcl - sed \ - -e '/^#/d' \ - -e 's,\\,\\\\,g' \ - -e 's,",\\",g' \ - -e 's,^,",' \ - -e 's,$$,\\n",' \ - $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h - $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \ - -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \ - $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \ - -o sqlite3_analyzer$(EXE) \ - $(LIBTCL) $(THREADLIB) - -TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO) -$(TEST_EXTENSION): $(TOP)/src/test_loadext.c - $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION) - -extensiontest: testfixture$(EXE) $(TEST_EXTENSION) - ./testfixture$(EXE) $(TOP)/test/loadext.test - -clean: - rm -f *.o sqlite3$(EXE) libsqlite3.a sqlite3.h opcodes.* - rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h - rm -f $(PUBLISH) - rm -f *.da *.bb *.bbg gmon.out - rm -rf quota2a quota2b quota2c - rm -rf tsrc target_source - rm -f testloadext.dll libtestloadext.so - rm -f sqlite3.c fts?amal.c tclsqlite3.c - rm -f sqlite3rc.h - rm -f shell.c sqlite3ext.h - rm -f $(SHPREFIX)sqlite3.$(SO) diff --git a/configure b/configure index 2969759f3c..2660574834 100755 --- a/configure +++ b/configure @@ -803,7 +803,6 @@ VERSION program_prefix TCLLIBDIR TCLSH_CMD -AWK INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM @@ -3911,13 +3910,13 @@ if ${lt_cv_nm_interface+:} false; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:3914: $ac_compile\"" >&5) + (eval echo "\"\$as_me:3913: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:3917: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:3916: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:3920: output\"" >&5) + (eval echo "\"\$as_me:3919: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5123,7 +5122,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5126 "configure"' > conftest.$ac_ext + echo '#line 5125 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6648,11 +6647,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6651: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6650: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6655: \$? = $ac_status" >&5 + echo "$as_me:6654: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6987,11 +6986,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6990: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6989: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6994: \$? = $ac_status" >&5 + echo "$as_me:6993: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7092,11 +7091,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7095: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7094: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7099: \$? = $ac_status" >&5 + echo "$as_me:7098: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7147,11 +7146,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7150: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7149: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7154: \$? = $ac_status" >&5 + echo "$as_me:7153: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9527,7 +9526,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9530 "configure" +#line 9529 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9623,7 +9622,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9626 "configure" +#line 9625 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9943,48 +9942,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - ######### # Enable large file support (if special flags are necessary) @@ -11885,7 +11842,6 @@ gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' -AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF diff --git a/configure.ac b/configure.ac index 92d9b47b39..ef6d51d0b8 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,6 @@ fi # AC_PROG_LIBTOOL AC_PROG_INSTALL -AC_PROG_AWK ######### # Enable large file support (if special flags are necessary) diff --git a/main.mk b/main.mk index f3c1d2aabd..2397713c96 100644 --- a/main.mk +++ b/main.mk @@ -35,9 +35,6 @@ # LIBREADLINE Linker options needed by programs using readline() must # link against. # -# NAWK Nawk compatible awk program. Older (obsolete?) solaris -# systems need this to avoid using the original AT&T AWK. -# # Once the macros above are defined, the rest of this make script will # build the SQLite library and testing tools. ################################################################################ @@ -701,7 +698,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@ echo "static const char *tclsh_main_loop(void){" >> $@ echo "static const char *zMainloop = " >> $@ - $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@ + tclsh $(TOP)/tool/tostr.tcl $(TOP)/tool/spaceanal.tcl >> $@ echo "; return zMainloop; }" >> $@ sqlite3_analyzer$(EXE): sqlite3_analyzer.c diff --git a/manifest b/manifest index a38c009e00..e48c25ca0f 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,8 @@ -C Change\sthe\saddopcodes.awk\sscript\sinto\stool/addopcodes.tcl. -D 2015-10-07T12:21:14.000 -F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in b33d44230974d2d5ea2f0599855c5e36bd79b90a -F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc b7d8a7efbbf38cee57bfc81d11ca28c42122ff81 -F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 +C Convert\sthe\stool/tostr.awk\sscript\sinto\stool/tostr.tcl.\s\sRemove\stwo\sobsolete\nMakefiles.\s\sPurge\sNAWK\sfrom\sthe\sconfigure\sscript\sand\sfrom\sunix\smakefiles.\nThere\sare\sstill\stwo\suses\sof\sNAWK\sin\sMakefile.msc. +D 2015-10-07T12:36:42.935 +F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 +F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 +F Makefile.msc 17ce18bb7e9ca2ad3abed9b0a1fcbef3fbe8f307 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -37,8 +35,8 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 2f61915a1bdfbc589244334401cf97d3401e6a39 x -F configure.ac 713de38000413e469188db2cb85bed759b56f322 +F configure 8f9f13f9a371bea36bc5b8818bbd56e4e8ba200d x +F configure.ac 27a3ebbfe43aab82319c68aa0a11377bbfe29246 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -262,7 +260,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 1cb544e1b1943b8b6452a811869b3baee5bfcb13 +F main.mk fdc70f6d0d018b97f351a8fa12db6b10d9baaffc F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -1382,14 +1380,14 @@ F tool/sqldiff.c b318efc2eaf7a7fac4d281a0ce736193cb2506df F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d F tool/symbols.sh fec58532668296d7c7dc48be9c87f75ccdb5814f -F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 +F tool/tostr.tcl 96022f35ada2194f6f8ccf6fd95809e90ed277c4 F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003 F tool/vdbe-compress.tcl 5926c71f9c12d2ab73ef35c29376e756eb68361c F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1506cb33fcf61e2ef97b35b99e58fbf21f4f5496 -R d8eeb7e51eba4dfb24803600079d2858 +P 8bbf37142ef2759274668f6da114b5c8072e42db +R 07b752064456f02ed0865632d443e697 U drh -Z f02ffe1dfbcccf71e8c30b4fbe822892 +Z 7087d810f3111cb2f52748462bb8f6e3 diff --git a/manifest.uuid b/manifest.uuid index 95ca593f47..7f24566eb2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8bbf37142ef2759274668f6da114b5c8072e42db \ No newline at end of file +5b6775215327a89232f5059653747a18e83b8b4b \ No newline at end of file diff --git a/tool/tostr.awk b/tool/tostr.awk deleted file mode 100644 index 83c6cc1a50..0000000000 --- a/tool/tostr.awk +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/awk -# -# Convert input text into a C string -# -{ - gsub(/\\/,"\\\\"); - gsub(/\"/,"\\\""); - print "\"" $0 "\\n\""; -} diff --git a/tool/tostr.tcl b/tool/tostr.tcl new file mode 100644 index 0000000000..cb06ee947f --- /dev/null +++ b/tool/tostr.tcl @@ -0,0 +1,12 @@ +#!/usr/bin/tcl +# +# Convert input text into a C string +# +set in [open [lindex $argv 0] rb] +while {![eof $in]} { + set line [gets $in] + if {[eof $in]} break; + set x [string map "\\\\ \\\\\\\\ \\\" \\\\\"" $line] + puts "\"$x\\n\"" +} +close $in From 80372ae248897f6c7f2931e3e6933a07a64c1aea Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 9 Oct 2015 17:36:06 +0000 Subject: [PATCH 05/12] Add tool capable of downloading a TclKit (and its associated SDK) on Windows. FossilOrigin-Name: 50673ddaf813335777673fa8585997a7551e5323 --- manifest | 14 +- manifest.uuid | 2 +- tool/GetFile.cs | 450 +++++++++++++++++++++++++++++++++++++++++++++ tool/GetTclKit.bat | 248 +++++++++++++++++++++++++ 4 files changed, 707 insertions(+), 7 deletions(-) create mode 100644 tool/GetFile.cs create mode 100644 tool/GetTclKit.bat diff --git a/manifest b/manifest index e48c25ca0f..f9798bddfc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Convert\sthe\stool/tostr.awk\sscript\sinto\stool/tostr.tcl.\s\sRemove\stwo\sobsolete\nMakefiles.\s\sPurge\sNAWK\sfrom\sthe\sconfigure\sscript\sand\sfrom\sunix\smakefiles.\nThere\sare\sstill\stwo\suses\sof\sNAWK\sin\sMakefile.msc. -D 2015-10-07T12:36:42.935 +C Add\stool\scapable\sof\sdownloading\sa\sTclKit\s(and\sits\sassociated\sSDK)\son\sWindows. +D 2015-10-09T17:36:06.162 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 17ce18bb7e9ca2ad3abed9b0a1fcbef3fbe8f307 @@ -1331,6 +1331,8 @@ F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac +F tool/GetFile.cs 963f7064b0b221b08feadb28894c3537916261ac +F tool/GetTclKit.bat 46092b151f7bb4f2a2735dfa1ada09736a4b35a4 F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 @@ -1387,7 +1389,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8bbf37142ef2759274668f6da114b5c8072e42db -R 07b752064456f02ed0865632d443e697 -U drh -Z 7087d810f3111cb2f52748462bb8f6e3 +P 5b6775215327a89232f5059653747a18e83b8b4b +R 785a6cb71a38ff7702fb9be84ec0066b +U mistachkin +Z 9f18b94f6375bd392631336361a9d038 diff --git a/manifest.uuid b/manifest.uuid index 7f24566eb2..38dfe5be77 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5b6775215327a89232f5059653747a18e83b8b4b \ No newline at end of file +50673ddaf813335777673fa8585997a7551e5323 \ No newline at end of file diff --git a/tool/GetFile.cs b/tool/GetFile.cs new file mode 100644 index 0000000000..9c489c6738 --- /dev/null +++ b/tool/GetFile.cs @@ -0,0 +1,450 @@ +/* +** 2015 October 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains C# code to download a single file based on a URI. +*/ + +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Net; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Threading; + +/////////////////////////////////////////////////////////////////////////////// + +#region Assembly Metadata +[assembly: AssemblyTitle("GetFile Tool")] +[assembly: AssemblyDescription("Download a single file based on a URI.")] +[assembly: AssemblyCompany("SQLite Development Team")] +[assembly: AssemblyProduct("SQLite")] +[assembly: AssemblyCopyright("Public Domain")] +[assembly: ComVisible(false)] +[assembly: Guid("5c4b3728-1693-4a33-a218-8e6973ca15a6")] +[assembly: AssemblyVersion("1.0.*")] + +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +#else +[assembly: AssemblyConfiguration("Release")] +#endif +#endregion + +/////////////////////////////////////////////////////////////////////////////// + +namespace GetFile +{ + /// + /// This enumeration is used to represent all the possible exit codes from + /// this tool. + /// + internal enum ExitCode + { + /// + /// The file download was a success. + /// + Success = 0, + + /// + /// The command line arguments are missing (i.e. null). Generally, + /// this should not happen. + /// + MissingArgs = 1, + + /// + /// The wrong number of command line arguments was supplied. + /// + WrongNumArgs = 2, + + /// + /// The URI specified on the command line could not be parsed as a + /// supported absolute URI. + /// + BadUri = 3, + + /// + /// The file name portion of the URI specified on the command line + /// could not be extracted from it. + /// + BadFileName = 4, + + /// + /// The temporary directory is either invalid (i.e. null) or does not + /// represent an available directory. + /// + BadTempPath = 5, + + /// + /// An exception was caught in . Generally, this + /// should not happen. + /// + Exception = 6, + + /// + /// The file download was canceled. This tool does not make use of + /// the method; therefore, this + /// should not happen. + /// + DownloadCanceled = 7, + + /// + /// The file download encountered an error. Further information about + /// this error should be displayed on the console. + /// + DownloadError = 8 + } + + /////////////////////////////////////////////////////////////////////////// + + internal static class Program + { + #region Private Data + /// + /// This is used to synchronize multithreaded access to the + /// and + /// fields. + /// + private static readonly object syncRoot = new object(); + + /////////////////////////////////////////////////////////////////////// + + /// + /// This event will be signed when the file download has completed, + /// even if the file download itself was canceled or unsuccessful. + /// + private static EventWaitHandle doneEvent; + + /////////////////////////////////////////////////////////////////////// + + /// + /// The previous file download completion percentage seen by the + /// event handler. This value + /// is never decreased, nor is it ever reset to zero. + /// + private static int previousPercent = 0; + + /////////////////////////////////////////////////////////////////////// + + /// + /// This will be the exit code returned by this tool after the file + /// download completes, successfully or otherwise. This value is only + /// changed by the event handler. + /// + private static ExitCode exitCode = ExitCode.Success; + #endregion + + /////////////////////////////////////////////////////////////////////// + + #region Private Support Methods + /// + /// This method displays an error message to the console and/or + /// displays the command line usage information for this tool. + /// + /// + /// The error message to display, if any. + /// + /// + /// Non-zero to display the command line usage information. + /// + private static void Error( + string message, + bool usage + ) + { + if (message != null) + Console.WriteLine(message); + + string fileName = Path.GetFileName( + Process.GetCurrentProcess().MainModule.FileName); + + Console.WriteLine(String.Format("usage: {0} ", fileName)); + } + + /////////////////////////////////////////////////////////////////////// + + /// + /// This method attempts to determine the file name portion of the + /// specified URI. + /// + /// + /// The URI to process. + /// + /// + /// The file name portion of the specified URI -OR- null if it cannot + /// be determined. + /// + private static string GetFileName( + Uri uri + ) + { + if (uri == null) + return null; + + string pathAndQuery = uri.PathAndQuery; + + if (String.IsNullOrEmpty(pathAndQuery)) + return null; + + int index = pathAndQuery.LastIndexOf('/'); + + if ((index < 0) || (index == pathAndQuery.Length)) + return null; + + return pathAndQuery.Substring(index + 1); + } + #endregion + + /////////////////////////////////////////////////////////////////////// + + #region Private Event Handlers + /// + /// This method is an event handler that is called when the file + /// download completion percentage changes. It will display progress + /// on the console. Special care is taken to make sure that progress + /// events are not displayed out-of-order, even if duplicate and/or + /// out-of-order events are received. + /// + /// + /// The source of the event. + /// + /// + /// Information for the event being processed. + /// + private static void DownloadProgressChanged( + object sender, + DownloadProgressChangedEventArgs e + ) + { + if (e != null) + { + int percent = e.ProgressPercentage; + + lock (syncRoot) + { + if (percent > previousPercent) + { + Console.Write('.'); + + if ((percent % 10) == 0) + Console.Write(" {0}% ", percent); + + previousPercent = percent; + } + } + } + } + + /////////////////////////////////////////////////////////////////////// + + /// + /// This method is an event handler that is called when the file + /// download has completed, successfully or otherwise. It will + /// display the overall result of the file download on the console, + /// including any information, if applicable. + /// The field is changed by this method to + /// indicate the overall result of the file download and the event + /// within the field will be signaled. + /// + /// + /// The source of the event. + /// + /// + /// Information for the event being processed. + /// + private static void DownloadFileCompleted( + object sender, + AsyncCompletedEventArgs e + ) + { + if (e != null) + { + lock (syncRoot) + { + if (previousPercent < 100) + Console.Write(' '); + } + + if (e.Cancelled) + { + Console.WriteLine("Canceled"); + + lock (syncRoot) + { + exitCode = ExitCode.DownloadCanceled; + } + } + else + { + Exception error = e.Error; + + if (error != null) + { + Console.WriteLine("Error: {0}", error); + + lock (syncRoot) + { + exitCode = ExitCode.DownloadError; + } + } + else + { + Console.WriteLine("Done"); + } + } + } + + if (doneEvent != null) + doneEvent.Set(); + } + #endregion + + /////////////////////////////////////////////////////////////////////// + + #region Program Entry Point + /// + /// This is the entry-point for this tool. It handles processing the + /// command line arguments, setting up the web client, downloading the + /// file, and saving it to the file system. + /// + /// + /// The command line arguments. + /// + /// + /// Zero upon success; non-zero on failure. This will be one of the + /// values from the enumeration. + /// + private static int Main( + string[] args + ) + { + // + // NOTE: Sanity check the command line arguments. + // + if (args == null) + { + Error(null, true); + return (int)ExitCode.MissingArgs; + } + + if (args.Length != 1) + { + Error(null, true); + return (int)ExitCode.WrongNumArgs; + } + + // + // NOTE: Attempt to convert the first (and only) command line + // argument to an absolute URI. + // + Uri uri; + + if (!Uri.TryCreate(args[0], UriKind.Absolute, out uri)) + { + Error("First argument is not an absolute URI.", false); + return (int)ExitCode.BadUri; + } + + // + // NOTE: Attempt to extract the file name portion of the URI we + // just created. + // + string fileName = GetFileName(uri); + + if (fileName == null) + { + Error("Could not extract the file name from the URI.", false); + return (int)ExitCode.BadFileName; + } + + // + // NOTE: Grab the temporary path setup for this process. If it is + // unavailable, we will not continue. + // + string directory = Path.GetTempPath(); + + if (String.IsNullOrEmpty(directory) || + !Directory.Exists(directory)) + { + Error("Temporary directory is invalid or unavailable.", false); + return (int)ExitCode.BadTempPath; + } + + try + { + using (WebClient webClient = new WebClient()) + { + // + // NOTE: Create the event used to signal completion of the + // file download. + // + doneEvent = new ManualResetEvent(false); + + // + // NOTE: Hookup the event handlers we care about on the web + // client. These are necessary because the file is + // downloaded asynchronously. + // + webClient.DownloadProgressChanged += + new DownloadProgressChangedEventHandler( + DownloadProgressChanged); + + webClient.DownloadFileCompleted += + new AsyncCompletedEventHandler( + DownloadFileCompleted); + + // + // NOTE: Build the fully qualified path and file name, + // within the temporary directory, where the file to + // be downloaded will be saved. + // + fileName = Path.Combine(directory, fileName); + + // + // NOTE: If the file name already exists (in the temporary) + // directory, delete it. + // + // TODO: Perhaps an error should be raised here instead? + // + if (File.Exists(fileName)) + File.Delete(fileName); + + // + // NOTE: After kicking off the asynchronous file download + // process, wait [forever] until the "done" event is + // signaled. + // + Console.WriteLine( + "Downloading \"{0}\" to \"{1}\"...", uri, fileName); + + webClient.DownloadFileAsync(uri, fileName); + doneEvent.WaitOne(); + } + + lock (syncRoot) + { + return (int)exitCode; + } + } + catch (Exception e) + { + // + // NOTE: An exception was caught. Report it via the console + // and return failure. + // + Error(e.ToString(), false); + return (int)ExitCode.Exception; + } + } + #endregion + } +} diff --git a/tool/GetTclKit.bat b/tool/GetTclKit.bat new file mode 100644 index 0000000000..25ee5a5590 --- /dev/null +++ b/tool/GetTclKit.bat @@ -0,0 +1,248 @@ +@ECHO OFF + +:: +:: GetTclKit.bat -- +:: +:: TclKit Download Tool +:: + +SETLOCAL + +REM SET __ECHO=ECHO +REM SET __ECHO2=ECHO +REM SET __ECHO3=ECHO +IF NOT DEFINED _AECHO (SET _AECHO=REM) +IF NOT DEFINED _CECHO (SET _CECHO=REM) +IF NOT DEFINED _VECHO (SET _VECHO=REM) + +SET OVERWRITE=^> +IF DEFINED __ECHO SET OVERWRITE=^^^> + +SET APPEND=^>^> +IF DEFINED __ECHO SET APPEND=^^^>^^^> + +SET PROCESSOR=%1 + +IF DEFINED PROCESSOR ( + CALL :fn_UnquoteVariable PROCESSOR +) ELSE ( + GOTO usage +) + +%_VECHO% Processor = '%PROCESSOR%' + +SET DUMMY2=%2 + +IF DEFINED DUMMY2 ( + GOTO usage +) + +SET ROOT=%~dp0\.. +SET ROOT=%ROOT:\\=\% + +%_VECHO% Root = '%ROOT%' + +SET TOOLS=%~dp0 +SET TOOLS=%TOOLS:~0,-1% + +%_VECHO% Tools = '%TOOLS%' + +IF NOT DEFINED windir ( + ECHO The windir environment variable must be set first. + GOTO errors +) + +%_VECHO% WinDir = '%windir%' + +IF NOT DEFINED TEMP ( + ECHO The TEMP environment variable must be set first. + GOTO errors +) + +%_VECHO% Temp = '%TEMP%' + +SET TCLKIT_URI=http://tclsh.com/ + +%_VECHO% TclKitUri = '%TCLKIT_URI%' + +IF /I "%PROCESSOR%" == "x86" ( + CALL :fn_TclKitX86Variables +) ELSE IF /I "%PROCESSOR%" == "x64" ( + CALL :fn_TclKitX64Variables +) ELSE ( + GOTO usage +) + +%_VECHO% TclKitPatchLevel = '%TCLKIT_PATCHLEVEL%' +%_VECHO% TclKitNoSdk = '%TCLKIT_NOSDK%' +%_VECHO% TclKitExe = '%TCLKIT_EXE%' +%_VECHO% TclKitLib = '%TCLKIT_LIB%' +%_VECHO% TclKitSdk = '%TCLKIT_SDK%' +%_VECHO% TclKitSdkZip = '%TCLKIT_SDK_ZIP%' +%_VECHO% TclKitFiles = '%TCLKIT_FILES%' + +CALL :fn_ResetErrorLevel + +FOR %%T IN (csc.exe) DO ( + SET %%T_PATH=%%~dp$PATH:T +) + +%_VECHO% Csc.exe_PATH = '%csc.exe_PATH%' + +IF DEFINED csc.exe_PATH ( + GOTO skip_addToPath +) + +IF DEFINED FRAMEWORKDIR ( + REM Use the existing .NET Framework directory... +) ELSE IF EXIST "%windir%\Microsoft.NET\Framework64\v2.0.50727" ( + SET FRAMEWORKDIR=%windir%\Microsoft.NET\Framework64\v2.0.50727 +) ELSE IF EXIST "%windir%\Microsoft.NET\Framework64\v3.5" ( + SET FRAMEWORKDIR=%windir%\Microsoft.NET\Framework64\v3.5 +) ELSE IF EXIST "%windir%\Microsoft.NET\Framework64\v4.0.30319" ( + SET FRAMEWORKDIR=%windir%\Microsoft.NET\Framework64\v4.0.30319 +) ELSE IF EXIST "%windir%\Microsoft.NET\Framework\v2.0.50727" ( + SET FRAMEWORKDIR=%windir%\Microsoft.NET\Framework\v2.0.50727 +) ELSE IF EXIST "%windir%\Microsoft.NET\Framework\v3.5" ( + SET FRAMEWORKDIR=%windir%\Microsoft.NET\Framework\v3.5 +) ELSE IF EXIST "%windir%\Microsoft.NET\Framework\v4.0.30319" ( + SET FRAMEWORKDIR=%windir%\Microsoft.NET\Framework\v4.0.30319 +) ELSE ( + ECHO No suitable version of the .NET Framework appears to be installed. + GOTO errors +) + +%_VECHO% FrameworkDir = '%FRAMEWORKDIR%' + +IF NOT EXIST "%FRAMEWORKDIR%\csc.exe" ( + ECHO The file "%FRAMEWORKDIR%\csc.exe" is missing. + GOTO errors +) + +SET PATH=%FRAMEWORKDIR%;%PATH% + +:skip_addToPath + +%__ECHO% csc.exe "/out:%TEMP%\GetFile.exe" /target:exe "%TOOLS%\GetFile.cs" + +IF ERRORLEVEL 1 ( + ECHO Compilation of "%TOOLS%\GetFile.cs" failed. + GOTO errors +) + +FOR %%F IN (%TCLKIT_FILES%) DO ( + IF NOT EXIST "%%F" ( + %__ECHO% "%TEMP%\GetFile.exe" "%TCLKIT_URI%%%F" + + IF ERRORLEVEL 1 ( + ECHO Download of "%%F" from "%TCLKIT_URI%" failed. + GOTO errors + ) + ) +) + +IF DEFINED TCLKIT_NOSDK GOTO skip_sdkUnZip + +IF NOT EXIST "%TEMP%\%TCLKIT_SDK%" ( + %__ECHO% MKDIR "%TEMP%\%TCLKIT_SDK%" + + IF ERRORLEVEL 1 ( + ECHO Could not create directory "%TEMP%\%TCLKIT_SDK%". + GOTO errors + ) +) + +%__ECHO% "%TEMP%\unzip.exe" -o "%TEMP%\%TCLKIT_SDK_ZIP%" -d "%TEMP%\%TCLKIT_SDK%" + +IF ERRORLEVEL 1 ( + ECHO Could not unzip "%TEMP%\%TCLKIT_SDK_ZIP%" to "%TEMP%\%TCLKIT_SDK%". + GOTO errors +) + +:skip_sdkUnZip + +%__ECHO% ECHO SET TCLSH_CMD=%TEMP%\%TCLKIT_EXE%%OVERWRITE%"%ROOT%\SetTclKitEnv.bat" + +IF DEFINED TCLKIT_NOSDK GOTO skip_sdkVariables + +%__ECHO% ECHO SET TCLINCDIR=%TEMP%\%TCLKIT_SDK%\include%APPEND%"%ROOT%\SetTclKitEnv.bat" +%__ECHO% ECHO SET TCLLIBDIR=%TEMP%\%TCLKIT_SDK%\lib%APPEND%"%ROOT%\SetTclKitEnv.bat" +%__ECHO% ECHO SET LIBTCL=%TCLKIT_LIB%%APPEND%"%ROOT%\SetTclKitEnv.bat" + +:skip_sdkVariables + +GOTO no_errors + +:fn_TclKitX86Variables + IF NOT DEFINED TCLKIT_PATCHLEVEL ( + SET TCLKIT_PATCHLEVEL=8.6.4 + ) + SET TCLKIT_EXE=tclkit-%TCLKIT_PATCHLEVEL%.exe + SET TCLKIT_LIB=libtclkit%TCLKIT_PATCHLEVEL:.=%.lib + SET TCLKIT_SDK=libtclkit-sdk-x86-%TCLKIT_PATCHLEVEL% + SET TCLKIT_SDK_ZIP=%TCLKIT_SDK%.zip + SET TCLKIT_FILES=%TCLKIT_EXE% unzip.exe %TCLKIT_SDK_ZIP% + GOTO :EOF + +:fn_TclKitX64Variables + IF NOT DEFINED TCLKIT_PATCHLEVEL ( + REM + REM NOTE: By default, use latest available version of the TclKit SDK + REM for x64. However, the "default" TclKit executable for x86 + REM is still used here because it is the only one "well-known" + REM to be available for download. + REM + SET TCLKIT_PATCHLEVEL=8.6.3 + SET TCLKIT_EXE=tclkit-8.6.4.exe + ) ELSE ( + SET TCLKIT_EXE=tclkit-%TCLKIT_PATCHLEVEL%.exe + ) + SET TCLKIT_LIB=libtclkit%TCLKIT_PATCHLEVEL:.=%.lib + SET TCLKIT_SDK=libtclkit-sdk-x64-%TCLKIT_PATCHLEVEL% + SET TCLKIT_SDK_ZIP=%TCLKIT_SDK%.zip + SET TCLKIT_FILES=%TCLKIT_EXE% unzip.exe %TCLKIT_SDK_ZIP% + GOTO :EOF + +:fn_UnquoteVariable + IF NOT DEFINED %1 GOTO :EOF + SETLOCAL + SET __ECHO_CMD=ECHO %%%1%% + FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO ( + SET VALUE=%%V + ) + SET VALUE=%VALUE:"=% + REM " + ENDLOCAL && SET %1=%VALUE% + GOTO :EOF + +:fn_ResetErrorLevel + VERIFY > NUL + GOTO :EOF + +:fn_SetErrorLevel + VERIFY MAYBE 2> NUL + GOTO :EOF + +:usage + ECHO. + ECHO Usage: %~nx0 ^ + ECHO. + ECHO The only supported values for processor are "x86" and "x64". + GOTO errors + +:errors + CALL :fn_SetErrorLevel + ENDLOCAL + ECHO. + ECHO Failure, errors were encountered. + GOTO end_of_file + +:no_errors + CALL :fn_ResetErrorLevel + ENDLOCAL + ECHO. + ECHO Success, no errors were encountered. + GOTO end_of_file + +:end_of_file +%__ECHO% EXIT /B %ERRORLEVEL% From dfff1ffec66d979a3d8175ec11acf94599524d67 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 9 Oct 2015 18:48:47 +0000 Subject: [PATCH 06/12] Tweak batch tool added in the previous check-in to permit the base URI to be overridden. FossilOrigin-Name: 1d2f82df6774f8d66bfc5d67d5dad9f068a1069c --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/GetTclKit.bat | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index f9798bddfc..0196378f6d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stool\scapable\sof\sdownloading\sa\sTclKit\s(and\sits\sassociated\sSDK)\son\sWindows. -D 2015-10-09T17:36:06.162 +C Tweak\sbatch\stool\sadded\sin\sthe\sprevious\scheck-in\sto\spermit\sthe\sbase\sURI\sto\sbe\soverridden. +D 2015-10-09T18:48:47.670 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 17ce18bb7e9ca2ad3abed9b0a1fcbef3fbe8f307 @@ -1332,7 +1332,7 @@ F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac F tool/GetFile.cs 963f7064b0b221b08feadb28894c3537916261ac -F tool/GetTclKit.bat 46092b151f7bb4f2a2735dfa1ada09736a4b35a4 +F tool/GetTclKit.bat b9fb86e129c43d51f53fe0320e7f5ad7c1f6a56f F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 @@ -1389,7 +1389,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5b6775215327a89232f5059653747a18e83b8b4b -R 785a6cb71a38ff7702fb9be84ec0066b +P 50673ddaf813335777673fa8585997a7551e5323 +R 633d2a263e4011119b12c5c71c6c891a U mistachkin -Z 9f18b94f6375bd392631336361a9d038 +Z 9124d78764e09fb7c7e86be9f7b744d5 diff --git a/manifest.uuid b/manifest.uuid index 38dfe5be77..b23b983a9e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50673ddaf813335777673fa8585997a7551e5323 \ No newline at end of file +1d2f82df6774f8d66bfc5d67d5dad9f068a1069c \ No newline at end of file diff --git a/tool/GetTclKit.bat b/tool/GetTclKit.bat index 25ee5a5590..41ebceec03 100644 --- a/tool/GetTclKit.bat +++ b/tool/GetTclKit.bat @@ -61,7 +61,9 @@ IF NOT DEFINED TEMP ( %_VECHO% Temp = '%TEMP%' -SET TCLKIT_URI=http://tclsh.com/ +IF NOT DEFINED TCLKIT_URI ( + SET TCLKIT_URI=http://tclsh.com/ +) %_VECHO% TclKitUri = '%TCLKIT_URI%' From cc7304888fac2bffbe5077d85c024a2e157eec37 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 10 Oct 2015 00:53:28 +0000 Subject: [PATCH 07/12] More fine-tuning to the new TclKit tools. FossilOrigin-Name: 43addd8aa04c3faceb9d303672e330294af01a16 --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/GetFile.cs | 2 +- tool/GetTclKit.bat | 9 +++++++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 0196378f6d..689702bf1b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tweak\sbatch\stool\sadded\sin\sthe\sprevious\scheck-in\sto\spermit\sthe\sbase\sURI\sto\sbe\soverridden. -D 2015-10-09T18:48:47.670 +C More\sfine-tuning\sto\sthe\snew\sTclKit\stools. +D 2015-10-10T00:53:28.483 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 17ce18bb7e9ca2ad3abed9b0a1fcbef3fbe8f307 @@ -1331,8 +1331,8 @@ F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac -F tool/GetFile.cs 963f7064b0b221b08feadb28894c3537916261ac -F tool/GetTclKit.bat b9fb86e129c43d51f53fe0320e7f5ad7c1f6a56f +F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5 +F tool/GetTclKit.bat 786f6a075beaa0187bd0e6751263f77f831bff77 F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 @@ -1389,7 +1389,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 50673ddaf813335777673fa8585997a7551e5323 -R 633d2a263e4011119b12c5c71c6c891a +P 1d2f82df6774f8d66bfc5d67d5dad9f068a1069c +R e581949b3345aa5207b2c38f2d8bf17e U mistachkin -Z 9124d78764e09fb7c7e86be9f7b744d5 +Z 2c1d38a7e80b3d62039ba691f1ca8a45 diff --git a/manifest.uuid b/manifest.uuid index b23b983a9e..e20379fb17 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d2f82df6774f8d66bfc5d67d5dad9f068a1069c \ No newline at end of file +43addd8aa04c3faceb9d303672e330294af01a16 \ No newline at end of file diff --git a/tool/GetFile.cs b/tool/GetFile.cs index 9c489c6738..56601f3e85 100644 --- a/tool/GetFile.cs +++ b/tool/GetFile.cs @@ -350,7 +350,7 @@ namespace GetFile if (!Uri.TryCreate(args[0], UriKind.Absolute, out uri)) { - Error("First argument is not an absolute URI.", false); + Error("Could not create absolute URI from argument.", false); return (int)ExitCode.BadUri; } diff --git a/tool/GetTclKit.bat b/tool/GetTclKit.bat index 41ebceec03..5bd9ab6345 100644 --- a/tool/GetTclKit.bat +++ b/tool/GetTclKit.bat @@ -133,7 +133,7 @@ IF ERRORLEVEL 1 ( ) FOR %%F IN (%TCLKIT_FILES%) DO ( - IF NOT EXIST "%%F" ( + IF NOT EXIST "%TEMP%\%%F" ( %__ECHO% "%TEMP%\GetFile.exe" "%TCLKIT_URI%%%F" IF ERRORLEVEL 1 ( @@ -154,7 +154,7 @@ IF NOT EXIST "%TEMP%\%TCLKIT_SDK%" ( ) ) -%__ECHO% "%TEMP%\unzip.exe" -o "%TEMP%\%TCLKIT_SDK_ZIP%" -d "%TEMP%\%TCLKIT_SDK%" +%__ECHO% "%TEMP%\unzip.exe" -n "%TEMP%\%TCLKIT_SDK_ZIP%" -d "%TEMP%\%TCLKIT_SDK%" IF ERRORLEVEL 1 ( ECHO Could not unzip "%TEMP%\%TCLKIT_SDK_ZIP%" to "%TEMP%\%TCLKIT_SDK%". @@ -173,6 +173,11 @@ IF DEFINED TCLKIT_NOSDK GOTO skip_sdkVariables :skip_sdkVariables +ECHO. +ECHO Wrote "%ROOT%\SetTclKitEnv.bat". +ECHO Please run it to set the necessary Tcl environment variables. +ECHO. + GOTO no_errors :fn_TclKitX86Variables From 946ef60ad0412ad50aeaecfa4942118da56c32a5 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 10 Oct 2015 01:55:57 +0000 Subject: [PATCH 08/12] Fix typo in the MSVC makefile. Replace remaining uses of AWK in the MSVC makefile with a Tcl script. FossilOrigin-Name: f8c2193b64979a2fe480fcf913573b5fac06235e --- Makefile.msc | 12 +++--------- manifest | 13 +++++++------ manifest.uuid | 2 +- tool/replace.tcl | 20 ++++++++++++++++++++ 4 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 tool/replace.tcl diff --git a/Makefile.msc b/Makefile.msc index 71b5fc8cc9..d8459e8492 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -809,12 +809,6 @@ LTLIBPATHS = $(LTLIBPATHS) /LIBPATH:$(ICULIBDIR) LTLIBS = $(LTLIBS) $(LIBICU) !ENDIF -# nawk compatible awk. -# -!IFNDEF NAWK -NAWK = gawk.exe -!ENDIF - # You should not have to change anything below this line ############################################################################### @@ -1331,7 +1325,7 @@ $(LIBRESOBJS): $(TOP)\src\sqlite3.rc $(HDR) echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h for /F %%V in ('type "$(TOP)\VERSION"') do ( \ echo #define SQLITE_RESOURCE_VERSION %%V \ - | $(NAWK) "/.*/ { gsub(/[.]/,\",\");print }" >> sqlite3rc.h \ + | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact . ^, >> sqlite3rc.h \ ) echo #endif >> sqlite3rc.h $(LTRCOMPILE) -fo $(LIBRESOBJS) $(TOP)\src\sqlite3.rc @@ -1576,7 +1570,7 @@ opcodes.c: opcodes.h $(TOP)\tool\mkopcodec.tcl $(TCLSH_CMD) $(TOP)\tool\mkopcodec.tcl opcodes.h > opcodes.c opcodes.h: parse.h $(TOP)\src\vdbe.c $(TOP)\tool\mkopcodeh.tcl - type parse.h $(TOP)\src\vdbe.c | $(TCLSH_CMD) $(TOP)\tool\mkopcodeh.awk > opcodes.h + type parse.h $(TOP)\src\vdbe.c | $(TCLSH_CMD) $(TOP)\tool\mkopcodeh.tcl > opcodes.h # Rules to build parse.c and parse.h - the outputs of lemon. # @@ -1858,7 +1852,7 @@ dll: sqlite3.dll sqlite3.def: libsqlite3.lib echo EXPORTS > sqlite3.def dumpbin /all libsqlite3.lib \ - | $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \ + | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_.*)$$" "\1" \ | sort >> sqlite3.def sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) diff --git a/manifest b/manifest index 689702bf1b..ac0312bb8a 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C More\sfine-tuning\sto\sthe\snew\sTclKit\stools. -D 2015-10-10T00:53:28.483 +C Fix\stypo\sin\sthe\sMSVC\smakefile.\s\sReplace\sremaining\suses\sof\sAWK\sin\sthe\sMSVC\smakefile\swith\sa\sTcl\sscript. +D 2015-10-10T01:55:57.399 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 17ce18bb7e9ca2ad3abed9b0a1fcbef3fbe8f307 +F Makefile.msc d40af03b1453a4f5b132cfa5ffef36a4c4fc3338 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -1363,6 +1363,7 @@ F tool/mkvsix.tcl bbe57cd9ae11c6cc70319241101ef8d2b8c3765b F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 34d7ac01fe4fd18e3637f64abe12c40eca0f6b97 F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b +F tool/replace.tcl 7727c60a04299b65a92f5e1590896fea0f25b9e0 F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/showdb.c b1e16174385d5bd0815823a7fda1ecc82ed6088b @@ -1389,7 +1390,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1d2f82df6774f8d66bfc5d67d5dad9f068a1069c -R e581949b3345aa5207b2c38f2d8bf17e +P 43addd8aa04c3faceb9d303672e330294af01a16 +R 006632f80fd4c638e12a5eb804e62e4f U mistachkin -Z 2c1d38a7e80b3d62039ba691f1ca8a45 +Z 791ad8ca8445d57bc0ffe78a443c7839 diff --git a/manifest.uuid b/manifest.uuid index e20379fb17..33acad9038 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -43addd8aa04c3faceb9d303672e330294af01a16 \ No newline at end of file +f8c2193b64979a2fe480fcf913573b5fac06235e \ No newline at end of file diff --git a/tool/replace.tcl b/tool/replace.tcl new file mode 100644 index 0000000000..b01a83accb --- /dev/null +++ b/tool/replace.tcl @@ -0,0 +1,20 @@ +#!/usr/bin/tcl +# +# Replace string with another string -OR- include +# only lines successfully modified with a regular +# expression. +# +set mode [string tolower [lindex $argv 0]] +set from [lindex $argv 1] +set to [lindex $argv 2] +if {$mode ni [list exact include]} {exit 1} +if {[string length $from]==0} {exit 2} +while {![eof stdin]} { + set line [gets stdin] + if {[eof stdin]} break + switch -exact $mode { + exact {set line [string map [list $from $to] $line]} + include {if {[regsub -all -- $from $line $to line]==0} continue} + } + puts stdout $line +} From ba461cac7b112037b75ed7a0d7b49f10204de6fc Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 10 Oct 2015 02:06:05 +0000 Subject: [PATCH 09/12] Remove a couple superfluous double quotes in the MSVC makefile. FossilOrigin-Name: 0f9e205b28e013412b19dfd588f2a6cf341c40e8 --- Makefile.msc | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index d8459e8492..d838aa685c 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1852,7 +1852,7 @@ dll: sqlite3.dll sqlite3.def: libsqlite3.lib echo EXPORTS > sqlite3.def dumpbin /all libsqlite3.lib \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_.*)$$" "\1" \ + | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_.*)$$" \1 \ | sort >> sqlite3.def sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) diff --git a/manifest b/manifest index ac0312bb8a..7f0ed5c665 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Fix\stypo\sin\sthe\sMSVC\smakefile.\s\sReplace\sremaining\suses\sof\sAWK\sin\sthe\sMSVC\smakefile\swith\sa\sTcl\sscript. -D 2015-10-10T01:55:57.399 +C Remove\sa\scouple\ssuperfluous\sdouble\squotes\sin\sthe\sMSVC\smakefile. +D 2015-10-10T02:06:05.870 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc d40af03b1453a4f5b132cfa5ffef36a4c4fc3338 +F Makefile.msc b32cae4343a16d4eb1c0dec49ee6877e54ad9678 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -1390,7 +1390,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 43addd8aa04c3faceb9d303672e330294af01a16 -R 006632f80fd4c638e12a5eb804e62e4f +P f8c2193b64979a2fe480fcf913573b5fac06235e +R 7cc2a5813618966360cf80bf66f0084c U mistachkin -Z 791ad8ca8445d57bc0ffe78a443c7839 +Z d70bac36f21bbf58c368f1d4e150ed30 diff --git a/manifest.uuid b/manifest.uuid index 33acad9038..b2060c7cc5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f8c2193b64979a2fe480fcf913573b5fac06235e \ No newline at end of file +0f9e205b28e013412b19dfd588f2a6cf341c40e8 \ No newline at end of file From 5b66350ac70d98df05caee2953803f9175bebb46 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 10 Oct 2015 23:39:55 +0000 Subject: [PATCH 10/12] Enhance TclKit batch tool (and MSVC makefile) to support targets that require the Tcl stub library. FossilOrigin-Name: bc6223b1d6c31a47c7b734cfb8a9ecf15ab809fc --- Makefile.msc | 6 +++++- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/GetTclKit.bat | 19 +++++++++++++++---- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index d838aa685c..d980e3c652 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -569,6 +569,10 @@ TCLLIBDIR = c:\tcl\lib LIBTCL = tcl85.lib !ENDIF +!IFNDEF LIBTCLSTUB +LIBTCLSTUB = tclstub85.lib +!ENDIF + # The locations of the ICU header and library files. These variables # (ICUINCDIR, ICULIBDIR, and LIBICU) may be overridden via the environment # prior to running nmake in order to match the actual installed location on @@ -1223,7 +1227,7 @@ libsqlite3.lib: $(LIBOBJ) $(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS) libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib - $(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS) + $(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS) sqlite3.exe: $(TOP)\src\shell.c $(JSON1_DEP) $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h $(LTLINK) $(SHELL_COMPILE_OPTS) $(JSON1_OPT) $(READLINE_FLAGS) $(TOP)\src\shell.c $(JSON1_SRC) \ diff --git a/manifest b/manifest index 7f0ed5c665..3b57e44a30 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Remove\sa\scouple\ssuperfluous\sdouble\squotes\sin\sthe\sMSVC\smakefile. -D 2015-10-10T02:06:05.870 +C Enhance\sTclKit\sbatch\stool\s(and\sMSVC\smakefile)\sto\ssupport\stargets\sthat\srequire\sthe\sTcl\sstub\slibrary. +D 2015-10-10T23:39:55.377 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc b32cae4343a16d4eb1c0dec49ee6877e54ad9678 +F Makefile.msc f846966b1c38bdc12a384bd48bfbdb257fb5b558 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -1332,7 +1332,7 @@ F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5 -F tool/GetTclKit.bat 786f6a075beaa0187bd0e6751263f77f831bff77 +F tool/GetTclKit.bat 32000d7c7cb27e5aac5d58789535bb1be662138f F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 @@ -1390,7 +1390,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f8c2193b64979a2fe480fcf913573b5fac06235e -R 7cc2a5813618966360cf80bf66f0084c +P 0f9e205b28e013412b19dfd588f2a6cf341c40e8 +R 3257d1b5b394e4f53f94f7465d06faaf U mistachkin -Z d70bac36f21bbf58c368f1d4e150ed30 +Z ec0928dd2133e890176fa11b64cc0e8a diff --git a/manifest.uuid b/manifest.uuid index b2060c7cc5..b13e4b4a8a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0f9e205b28e013412b19dfd588f2a6cf341c40e8 \ No newline at end of file +bc6223b1d6c31a47c7b734cfb8a9ecf15ab809fc \ No newline at end of file diff --git a/tool/GetTclKit.bat b/tool/GetTclKit.bat index 5bd9ab6345..8e250d9793 100644 --- a/tool/GetTclKit.bat +++ b/tool/GetTclKit.bat @@ -75,10 +75,12 @@ IF /I "%PROCESSOR%" == "x86" ( GOTO usage ) +%_VECHO% TclKitVersion = '%TCLKIT_VERSION%' %_VECHO% TclKitPatchLevel = '%TCLKIT_PATCHLEVEL%' %_VECHO% TclKitNoSdk = '%TCLKIT_NOSDK%' %_VECHO% TclKitExe = '%TCLKIT_EXE%' %_VECHO% TclKitLib = '%TCLKIT_LIB%' +%_VECHO% TclKitLibStub = '%TCLKIT_LIB_STUB%' %_VECHO% TclKitSdk = '%TCLKIT_SDK%' %_VECHO% TclKitSdkZip = '%TCLKIT_SDK_ZIP%' %_VECHO% TclKitFiles = '%TCLKIT_FILES%' @@ -125,11 +127,13 @@ SET PATH=%FRAMEWORKDIR%;%PATH% :skip_addToPath -%__ECHO% csc.exe "/out:%TEMP%\GetFile.exe" /target:exe "%TOOLS%\GetFile.cs" +IF NOT EXIST "%TEMP%\GetFile.exe" ( + %__ECHO% csc.exe "/out:%TEMP%\GetFile.exe" /target:exe "%TOOLS%\GetFile.cs" -IF ERRORLEVEL 1 ( - ECHO Compilation of "%TOOLS%\GetFile.cs" failed. - GOTO errors + IF ERRORLEVEL 1 ( + ECHO Compilation of "%TOOLS%\GetFile.cs" failed. + GOTO errors + ) ) FOR %%F IN (%TCLKIT_FILES%) DO ( @@ -170,6 +174,7 @@ IF DEFINED TCLKIT_NOSDK GOTO skip_sdkVariables %__ECHO% ECHO SET TCLINCDIR=%TEMP%\%TCLKIT_SDK%\include%APPEND%"%ROOT%\SetTclKitEnv.bat" %__ECHO% ECHO SET TCLLIBDIR=%TEMP%\%TCLKIT_SDK%\lib%APPEND%"%ROOT%\SetTclKitEnv.bat" %__ECHO% ECHO SET LIBTCL=%TCLKIT_LIB%%APPEND%"%ROOT%\SetTclKitEnv.bat" +%__ECHO% ECHO SET LIBTCLSTUB=%TCLKIT_LIB_STUB%%APPEND%"%ROOT%\SetTclKitEnv.bat" :skip_sdkVariables @@ -184,8 +189,11 @@ GOTO no_errors IF NOT DEFINED TCLKIT_PATCHLEVEL ( SET TCLKIT_PATCHLEVEL=8.6.4 ) + SET TCLKIT_VERSION=%TCLKIT_PATCHLEVEL:.=% + SET TCLKIT_VERSION=%TCLKIT_VERSION:~0,2% SET TCLKIT_EXE=tclkit-%TCLKIT_PATCHLEVEL%.exe SET TCLKIT_LIB=libtclkit%TCLKIT_PATCHLEVEL:.=%.lib + SET TCLKIT_LIB_STUB=libtclstub%TCLKIT_VERSION:.=%.a SET TCLKIT_SDK=libtclkit-sdk-x86-%TCLKIT_PATCHLEVEL% SET TCLKIT_SDK_ZIP=%TCLKIT_SDK%.zip SET TCLKIT_FILES=%TCLKIT_EXE% unzip.exe %TCLKIT_SDK_ZIP% @@ -204,7 +212,10 @@ GOTO no_errors ) ELSE ( SET TCLKIT_EXE=tclkit-%TCLKIT_PATCHLEVEL%.exe ) + SET TCLKIT_VERSION=%TCLKIT_PATCHLEVEL:.=% + SET TCLKIT_VERSION=%TCLKIT_VERSION:~0,2% SET TCLKIT_LIB=libtclkit%TCLKIT_PATCHLEVEL:.=%.lib + SET TCLKIT_LIB_STUB=libtclstub%TCLKIT_VERSION:.=%.a SET TCLKIT_SDK=libtclkit-sdk-x64-%TCLKIT_PATCHLEVEL% SET TCLKIT_SDK_ZIP=%TCLKIT_SDK%.zip SET TCLKIT_FILES=%TCLKIT_EXE% unzip.exe %TCLKIT_SDK_ZIP% From cf9fb7eb1c81eee0c37ff9f065da093ff6bf976c Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Oct 2015 03:44:39 +0000 Subject: [PATCH 11/12] The TclKit batch tool should not download the TclKit SDK when the TCLKIT_NOSDK environment variable is set. FossilOrigin-Name: 7c5d583bac89f8db94e7f73df09e1d04f0f24990 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/GetTclKit.bat | 10 ++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 3b57e44a30..1dab58c169 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sTclKit\sbatch\stool\s(and\sMSVC\smakefile)\sto\ssupport\stargets\sthat\srequire\sthe\sTcl\sstub\slibrary. -D 2015-10-10T23:39:55.377 +C The\sTclKit\sbatch\stool\sshould\snot\sdownload\sthe\sTclKit\sSDK\swhen\sthe\sTCLKIT_NOSDK\senvironment\svariable\sis\sset. +D 2015-10-12T03:44:39.745 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc f846966b1c38bdc12a384bd48bfbdb257fb5b558 @@ -1332,7 +1332,7 @@ F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5 -F tool/GetTclKit.bat 32000d7c7cb27e5aac5d58789535bb1be662138f +F tool/GetTclKit.bat f8159730269bdbf5c334383134011dda4df45511 F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 @@ -1390,7 +1390,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0f9e205b28e013412b19dfd588f2a6cf341c40e8 -R 3257d1b5b394e4f53f94f7465d06faaf +P bc6223b1d6c31a47c7b734cfb8a9ecf15ab809fc +R 47fe09613250f52fb94741367469a8c4 U mistachkin -Z ec0928dd2133e890176fa11b64cc0e8a +Z c3b529016ed8bb4851b8f9db9d7c6231 diff --git a/manifest.uuid b/manifest.uuid index b13e4b4a8a..d600833764 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bc6223b1d6c31a47c7b734cfb8a9ecf15ab809fc \ No newline at end of file +7c5d583bac89f8db94e7f73df09e1d04f0f24990 \ No newline at end of file diff --git a/tool/GetTclKit.bat b/tool/GetTclKit.bat index 8e250d9793..31988aadac 100644 --- a/tool/GetTclKit.bat +++ b/tool/GetTclKit.bat @@ -196,7 +196,10 @@ GOTO no_errors SET TCLKIT_LIB_STUB=libtclstub%TCLKIT_VERSION:.=%.a SET TCLKIT_SDK=libtclkit-sdk-x86-%TCLKIT_PATCHLEVEL% SET TCLKIT_SDK_ZIP=%TCLKIT_SDK%.zip - SET TCLKIT_FILES=%TCLKIT_EXE% unzip.exe %TCLKIT_SDK_ZIP% + SET TCLKIT_FILES=%TCLKIT_EXE% + IF NOT DEFINED TCLKIT_NOSDK ( + SET TCLKIT_FILES=%TCLKIT_FILES% unzip.exe %TCLKIT_SDK_ZIP% + ) GOTO :EOF :fn_TclKitX64Variables @@ -218,7 +221,10 @@ GOTO no_errors SET TCLKIT_LIB_STUB=libtclstub%TCLKIT_VERSION:.=%.a SET TCLKIT_SDK=libtclkit-sdk-x64-%TCLKIT_PATCHLEVEL% SET TCLKIT_SDK_ZIP=%TCLKIT_SDK%.zip - SET TCLKIT_FILES=%TCLKIT_EXE% unzip.exe %TCLKIT_SDK_ZIP% + SET TCLKIT_FILES=%TCLKIT_EXE% + IF NOT DEFINED TCLKIT_NOSDK ( + SET TCLKIT_FILES=%TCLKIT_FILES% unzip.exe %TCLKIT_SDK_ZIP% + ) GOTO :EOF :fn_UnquoteVariable From fcbe99ae3850b4aa1689cd458151890723af0f2d Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Oct 2015 03:56:21 +0000 Subject: [PATCH 12/12] Remove AWK requirement from the MSVC batch build tool. FossilOrigin-Name: 6d9cdb931cf4e2f0830184cff32e441e4966bd7e --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/build-all-msvc.bat | 33 +++++++++++++++------------------ 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/manifest b/manifest index 1dab58c169..439f387bb5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sTclKit\sbatch\stool\sshould\snot\sdownload\sthe\sTclKit\sSDK\swhen\sthe\sTCLKIT_NOSDK\senvironment\svariable\sis\sset. -D 2015-10-12T03:44:39.745 +C Remove\sAWK\srequirement\sfrom\sthe\sMSVC\sbatch\sbuild\stool. +D 2015-10-12T03:56:21.327 F Makefile.in 2a247c733c2dd6fab703df04dd009b26413956f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc f846966b1c38bdc12a384bd48bfbdb257fb5b558 @@ -1334,7 +1334,7 @@ F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5 F tool/GetTclKit.bat f8159730269bdbf5c334383134011dda4df45511 F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a -F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x +F tool/build-all-msvc.bat 2b1703b322da121e56b955cb58de091107f777c3 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2 @@ -1390,7 +1390,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bc6223b1d6c31a47c7b734cfb8a9ecf15ab809fc -R 47fe09613250f52fb94741367469a8c4 +P 7c5d583bac89f8db94e7f73df09e1d04f0f24990 +R 47cd1b08f2579a86c3f7eed6daa15a48 U mistachkin -Z c3b529016ed8bb4851b8f9db9d7c6231 +Z 42590804f6e58f764778427b7ddbdea9 diff --git a/manifest.uuid b/manifest.uuid index d600833764..03917d0b4d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7c5d583bac89f8db94e7f73df09e1d04f0f24990 \ No newline at end of file +6d9cdb931cf4e2f0830184cff32e441e4966bd7e \ No newline at end of file diff --git a/tool/build-all-msvc.bat b/tool/build-all-msvc.bat index 4842dc4074..a8ba1bc293 100755 --- a/tool/build-all-msvc.bat +++ b/tool/build-all-msvc.bat @@ -29,9 +29,9 @@ REM source tree for SQLite and "C:\Temp" represents the final destination REM directory for the generated output files. REM REM Please note that the SQLite build process performed by the Makefile -REM associated with this batch script requires both Gawk ^(gawk.exe^) and Tcl -REM 8.5 ^(tclsh85.exe^) to be present in a directory contained in the PATH -REM environment variable unless a pre-existing amalgamation file is used. +REM associated with this batch script requires a Tcl shell to be present +REM in a directory contained in the PATH environment variable unless a +REM pre-existing amalgamation file is used. REM REM There are several environment variables that may be set to modify the REM behavior of this batch script and its associated Makefile. The list of @@ -232,25 +232,22 @@ REM NOTE: Check for the external tools needed during the build process ^(i.e. REM those that do not get compiled as part of the build process itself^) REM along the PATH. REM -FOR %%T IN (gawk.exe tclsh85.exe) DO ( +IF DEFINED TCLSH_CMD ( + SET TCLSH_FILE=%TCLSH_CMD% +) ELSE ( + SET TCLSH_FILE=tclsh85.exe +) + +FOR %%T IN (%TCLSH_FILE%) DO ( SET %%T_PATH=%%~dp$PATH:T ) REM -REM NOTE: The Gawk executable "gawk.exe" is required during the SQLite build -REM process unless a pre-existing amalgamation file is used. +REM NOTE: A Tcl shell executable is required during the SQLite build process +REM unless a pre-existing amalgamation file is used. REM -IF NOT DEFINED gawk.exe_PATH ( - ECHO The Gawk executable "gawk.exe" is required to be in the PATH. - GOTO errors -) - -REM -REM NOTE: The Tcl 8.5 executable "tclsh85.exe" is required during the SQLite -REM build process unless a pre-existing amalgamation file is used. -REM -IF NOT DEFINED tclsh85.exe_PATH ( - ECHO The Tcl 8.5 executable "tclsh85.exe" is required to be in the PATH. +IF NOT DEFINED %TCLSH_FILE%_PATH ( + ECHO The Tcl shell executable "%TCLSH_FILE%" is required to be in the PATH. GOTO errors ) @@ -258,7 +255,7 @@ REM REM NOTE: Set the TOOLPATH variable to contain all the directories where the REM external tools were found in the search above. REM -SET TOOLPATH=%gawk.exe_PATH%;%tclsh85.exe_PATH% +CALL :fn_CopyVariable %TCLSH_FILE%_PATH TOOLPATH %_VECHO% ToolPath = '%TOOLPATH%'