From: danielk1977 Date: Tue, 11 Aug 2009 05:50:36 +0000 (+0000) Subject: Instead of adding SQLITE_API macros sqlite3.h while creating sqlite3.c, add them... X-Git-Tag: cvs-to-fossil-cutover~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d04deb21d1f4dbffa1c0d153ab33b97a2f49932;p=thirdparty%2Fsqlite.git Instead of adding SQLITE_API macros sqlite3.h while creating sqlite3.c, add them as part of generating the sqlite3.h target, while copying from sqlite.h.in to sqlite3.h. This fixes a build problem that was causing multiple SQLITE_API macros to be added to a single line of sqlite3.h, and the problem cited by #4016. (CVS 6971) FossilOrigin-Name: 7f4810747b0864981f27edbd504bfab2efea1e3c --- diff --git a/Makefile.in b/Makefile.in index 5576de8ffe..4d84c0ce8b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -683,8 +683,7 @@ status.lo: $(TOP)/src/status.c $(HDR) $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/status.c sqlite3.h: $(TOP)/src/sqlite.h.in - sed -e s/--VERS--/$(RELEASE)/ $(TOP)/src/sqlite.h.in | \ - sed -e s/--VERSION-NUMBER--/$(VERSION_NUMBER)/ >sqlite3.h + cat $(TOP)/src/sqlite.h.in | tclsh $(TOP)/tool/mksqlite3h.tcl `cat ${TOP}/VERSION` > sqlite3.h table.lo: $(TOP)/src/table.c $(HDR) $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/table.c diff --git a/main.mk b/main.mk index 71599022f5..db658550d2 100644 --- a/main.mk +++ b/main.mk @@ -389,9 +389,7 @@ parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk 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 + cat $(TOP)/src/sqlite.h.in | tclsh $(TOP)/tool/mksqlite3h.tcl `cat ${TOP}/VERSION` > sqlite3.h keywordhash.h: $(TOP)/tool/mkkeywordhash.c $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c diff --git a/manifest b/manifest index fa0c2e3bde..dd8ea839eb 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Reduce\sthe\smaximum\ssupported\ssector\ssize\sto\s64KiB.\s(CVS\s6970) -D 2009-08-10T17:48:57 +C Instead\sof\sadding\sSQLITE_API\smacros\ssqlite3.h\swhile\screating\ssqlite3.c,\sadd\sthem\sas\spart\sof\sgenerating\sthe\ssqlite3.h\starget,\swhile\scopying\sfrom\ssqlite.h.in\sto\ssqlite3.h.\sThis\sfixes\sa\sbuild\sproblem\sthat\swas\scausing\smultiple\sSQLITE_API\smacros\sto\sbe\sadded\sto\sa\ssingle\sline\sof\ssqlite3.h,\sand\sthe\sproblem\scited\sby\s#4016.\s(CVS\s6971) +D 2009-08-11T05:50:37 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 -F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef +F Makefile.in c606c9b502dfde3b9c3b2d23ed49f3737829693b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.vxworks 10010ddbf52e2503c7c49c7c0b7c7a096f8638a6 F README b974cdc3f9f12b87e851b04e75996d720ebf81ac @@ -86,7 +86,7 @@ F ext/rtree/tkt3363.test 6662237ea75bb431cd5d262dfc9535e1023315fc F ext/rtree/viewrtree.tcl 09526398dae87a5a87c5aac2b3854dbaf8376869 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 -F main.mk c43b27aa54d11088af305fbdda8cdd922f5558fb +F main.mk dd83a99a4341e342ac26563246c3070673ed5e3f F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac @@ -726,7 +726,8 @@ F tool/lempar.c 2ed70b3fc896a47e07fedfe543324f008f53d223 F tool/mkkeywordhash.c 511a848b2ac7a3d93f36adc1e1086b4c5741224b F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c.tcl 666e5a61fe7ef2692835a08a60013d0552ad704f +F tool/mksqlite3c.tcl b790a58c9971e3ace07e92cab5604fec8849fa23 +F tool/mksqlite3h.tcl d27b76db9639f17c24dcd24e803c9e5e8f9eac23 F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87 F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c @@ -741,7 +742,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P 36650102285ef9663853cacd5daf8dd6d7cf418f -R cfef2a17eaf9c7d1135074826e78bc07 -U drh -Z df8e14bf7b01e354a5a71869750fff56 +P 8e1e0ba292150f8968e5295e8ba9cd7360b6a64b +R 308a6bcce7db99c384df7b8b7a17f2b7 +U danielk1977 +Z 90e0bfaf3a9074b7bda5def71f339420 diff --git a/manifest.uuid b/manifest.uuid index 3606b84603..e06b513676 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8e1e0ba292150f8968e5295e8ba9cd7360b6a64b \ No newline at end of file +7f4810747b0864981f27edbd504bfab2efea1e3c \ No newline at end of file diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 143f0e64b4..fbe3e12005 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -305,36 +305,3 @@ foreach file { close $out -# This block overwrites the copy of sqlite3.h in the current directory. -# -# It copies tsrc/sqlite3.h to ./sqlite3.h, adding SQLITE_API in front of the -# API functions and global variables as it goes. -# -set fd_in [open tsrc/sqlite3.h r] -set fd_out [open sqlite3.h w] -while {![eof $fd_in]} { - set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)} - set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(} - - set line [gets $fd_in] - if {[regexp {define SQLITE_EXTERN extern} $line]} { - puts $fd_out $line - puts $fd_out [gets $fd_in] - puts $fd_out "" - puts $fd_out "#ifndef SQLITE_API" - puts $fd_out "# define SQLITE_API" - puts $fd_out "#endif" - set line "" - } - - if {([regexp $varpattern $line] && ![regexp {^ *typedef} $line]) - || ([regexp $declpattern $line]) - } { - set line "SQLITE_API $line" - } - puts $fd_out $line -} -close $fd_out -close $fd_in - - diff --git a/tool/mksqlite3h.tcl b/tool/mksqlite3h.tcl new file mode 100644 index 0000000000..e7dae4b815 --- /dev/null +++ b/tool/mksqlite3h.tcl @@ -0,0 +1,47 @@ +#!/usr/bin/tclsh +# +# This script performs processing on src/sqlite.h.in. It: +# +# 1) Adds SQLITE_EXTERN in front of the declaration of global variables, +# 2) Adds SQLITE_API in front of the declaration of API functions, +# 3) Replaces the string --VERS-- with the current library version, +# formatted as a string (e.g. "3.6.17"), and +# 4) Replaces the string --VERSION-NUMBER-- with current library version, +# formatted as an integer (e.g. "3006017"). +# +# This script reads from stdin, and outputs to stdout. The current library +# version number should be passed as the only argument. Example invocation: +# +# cat sqlite.h.in | mksqlite3h.tcl 3.6.17 > sqlite3.h +# + +set zVersion [lindex $argv 0] +set nVersion [eval format "%d%03d%03d" [split $zVersion .]] + +while {![eof stdin]} { + set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)} + set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(} + + set line [gets stdin] + + regsub -- --VERS-- $line $zVersion line + regsub -- --VERSION-NUMBER-- $line $nVersion line + + if {[regexp {define SQLITE_EXTERN extern} $line]} { + puts $line + puts [gets stdin] + puts "" + puts "#ifndef SQLITE_API" + puts "# define SQLITE_API" + puts "#endif" + set line "" + } + + if {([regexp $varpattern $line] && ![regexp {^ *typedef} $line]) + || ([regexp $declpattern $line]) + } { + set line "SQLITE_API $line" + } + puts $line +} +