设为首页 收藏本站
查看: 820|回复: 0

[经验分享] Windows下SQLite自动下载并编译(含dll和exe)

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-11-30 10:49:26 | 显示全部楼层 |阅读模式
好久没有光顾sqlite了,没想到已经到了3.7.8了。

以前手动下载,并且建工程,编译,挺浪费时间的。干脆用wget, 7z, 结合批处理,整理成一个可以下载并编译成dll和exe的脚本。
至于wget, 7z,网上都可以直接下载,不再缀述。

运行脚本之前,请先将vs2008(或者vs2005,vs2003,甚至vc6)的vcvars32.bat运行一下,得到vc的编译环境。


内容如下:


  • @echooff
  • setversion=%1
  • setos_cpu=win32-x86

  • rem
  • remfromsqlite3.7.4,
  • remsqlite3-product-version.zip
  • remsqlite3-product-version.tar.gz
  • remsqlite3-product-os-cpu-version.zip
  • remsqlite3-product-date.zip
  • @remsqlite-build307050030704003070800

  • ifnotexist"sqlite-amalgamation-%version%.zip"(
  • echofetchingsqlite-amalgamation-%version%.zip...
  • wgethttp://www.sqlite.org/sqlite-amalgamation-%version%.zip
  • ifnotexist"sqlite-amalgamation-%version%.zip"(
  • echodownloadsqlite-amalgamation-%version%.ziperror!
  • gotoEOF
  • )
  • )

  • 7zx-y-o.\sqlite-amalgamation-%version%"sqlite-amalgamation-%version%.zip"
  • ifexist".\sqlite-amalgamation-%version%\sqlite-amalgamation-%version%"(
  • move.\sqlite-amalgamation-%version%\sqlite-amalgamation-%version%\*.\sqlite-amalgamation-%version%\
  • )

  • ifnotexist".\sqlite-amalgamation-%version%\shell.c"(
  • echocopyshell.cfromanotherlocation...
  • ifnotexist".\sqlite-source-%version%.zip"(
  • echofetchingsqlite-source-%version%.zip...
  • wgethttp://www.sqlite.org/sqlite-source-%version%.zip
  • )
  • 7zx-y-o.\sqlite-source-%version%"sqlite-source-%version%.zip"
  • copy/y.\sqlite-source-%version%\shell.c.\sqlite-amalgamation-%version%\
  • rd/s/qsqlite-source-%version%

  • echocopyshell.cfromanotherlocation...
  • ifnotexist".\sqlite-src-%version%.zip"(
  • echofetchingsqlite-src-%version%.zip...
  • wgethttp://www.sqlite.org/sqlite-src-%version%.zip
  • )
  • 7zx-y-o.\"sqlite-src-%version%.zip"
  • copy/y.\sqlite-src-%version%\shell.c.\sqlite-amalgamation-%version%\
  • rd/s/qsqlite-src-%version%
  • )

  • ifnotexist".\sqlite-amalgamation-%version%\sqlite3.def"(
  • ifnotexist"sqlitedll-%version%.zip"(
  • echofetchingsqlitedll-%version%.zip...
  • wgethttp://www.sqlite.org/sqlitedll-%version%.zip
  • )
  • 7zx-y-o.\sqlitedll-%version%"sqlitedll-%version%.zip"
  • copy/y.\sqlitedll-%version%\sqlite3.def.\sqlite-amalgamation-%version%\
  • rd/s/qsqlitedll-%version%

  • echotryanotherdllzip
  • ifnotexist"sqlite-dll-%os_cpu%-%version%.zip"(
  • echofetchingsqlite-dll-%os_cpu%-%version%.zip...
  • wgethttp://www.sqlite.org/sqlite-dll-%os_cpu%-%version%.zip
  • )
  • 7zx-y-o.\sqlite-dll-%os_cpu%-%version%"sqlite-dll-%os_cpu%-%version%.zip"
  • copy/y.\sqlite-dll-%os_cpu%-%version%\sqlite3.def.\sqlite-amalgamation-%version%\
  • rd/s/qsqlite-dll-%os_cpu%-%version%
  • )

  • cd/dsqlite-amalgamation-%version%
  • echobeginbuildingsqlite-amalgamation-%version%

  • cl-Gs-GX-D_WIN32-nologo-Zi-DOS_WIN=1-DSQLITE_DEBUG=1-DWIN32=1-DTHREADSAFE=1-DSQLITE_OS_WIN=1-DSQLITE_ENABLE_COLUMN_METADATA=1-DSQLITE_SOUNDEX=1-DSQLITE_OMIT_LOAD_EXTENSION=1-I.shell.csqlite3.c-osqlite3.exe

  • echosqlite3.exebuildfinished......

  • cl/nologo/MLd/W3/Gm/GX/ZI/Od/D"WIN32"/D"_DEBUG"/D"_WINDOWS"/D"_MBCS"/D"_USRDLL"/D"SQLITE3_EXPORTS"/DTHREADSAFE=1/DSQLITE_OS_WIN=1/DSQLITE_ENABLE_COLUMN_METADATA=1/DSQLITE_SOUNDEX=1/DQLITE_OMIT_LOAD_EXTENSION=1/DSQLITE_ENABLE_RTREE=1/YX/Fp"sqlite3.pch"/FD/GZ/c/debugsqlite3.c

  • remlib-out:"sqlite3.lib"sqlite3.obj

  • link.exekernel32.libuser32.lib/nologo/dll/incremental:yes/debug/machine:I386/pdb:"sqlite3.pdb"/def:"sqlite3.def"/out:"sqlite3.dll"/implib:"sqlite3.lib"/pdbtype:septsqlite3.obj

  • echosqlite3.dllbuildfinished......

  • echoendbuildingsqlite-amalgamation-%version%
  • echo-----------------------------------------------
  • cd/d..


  • :EOF
  • @echoon



以下是我的执行结果:

引用
fetching sqlite-amalgamation-3070800.zip ...
--2011-09-20 08:48:30-- http://www.sqlite.org/sqlite-amalgamation-3070800.zip
Resolving www.sqlite.org... 67.18.92.124
Connecting to www.sqlite.org|67.18.92.124|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1329197 (1.3M) [application/zip]
Saving to: `sqlite-amalgamation-3070800.zip'

100%[==========================================================>] 1,329,197 119K/s in 11s

2011-09-20 08:48:41 (120 KB/s) - `sqlite-amalgamation-3070800.zip' saved [1329197/1329197]


7-Zip 9.15 beta Copyright (c) 1999-2010 Igor Pavlov 2010-06-20

Processing archive: sqlite-amalgamation-3070800.zip

Extracting sqlite-amalgamation-3070800
Extracting sqlite-amalgamation-3070800\shell.c
Extracting sqlite-amalgamation-3070800\sqlite3.c
Extracting sqlite-amalgamation-3070800\sqlite3.h
Extracting sqlite-amalgamation-3070800\sqlite3ext.h

Everything is Ok

Folders: 1
Files: 4
Size: 5059684
Compressed: 1329197
E:\xionghe\sqlite\sqlite-3.7.3\demo\sqlite-amalgamation-3070800\sqlite-amalgamation-3070800\shell.c
E:\xionghe\sqlite\sqlite-3.7.3\demo\sqlite-amalgamation-3070800\sqlite-amalgamation-3070800\sqlite3.c
E:\xionghe\sqlite\sqlite-3.7.3\demo\sqlite-amalgamation-3070800\sqlite-amalgamation-3070800\sqlite3.h
E:\xionghe\sqlite\sqlite-3.7.3\demo\sqlite-amalgamation-3070800\sqlite-amalgamation-3070800\sqlite3ext.h
fetching sqlitedll-3070800.zip ...
--2011-09-20 08:48:46-- http://www.sqlite.org/sqlitedll-3070800.zip
Resolving www.sqlite.org... 67.18.92.124
Connecting to www.sqlite.org|67.18.92.124|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2011-09-20 08:48:47 ERROR 404: Not Found.


7-Zip 9.15 beta Copyright (c) 1999-2010 Igor Pavlov 2010-06-20


Error:
cannot find archive
The system cannot find the path specified.
The system cannot find the file specified.
try another dll zip
fetching sqlite-dll-win32-x86-3070800.zip ...
--2011-09-20 08:48:47-- http://www.sqlite.org/sqlite-dll-win32-x86-3070800.zip
Resolving www.sqlite.org... 67.18.92.124
Connecting to www.sqlite.org|67.18.92.124|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 289182 (282K) [application/zip]
Saving to: `sqlite-dll-win32-x86-3070800.zip'

100%[==========================================================>] 289,182 127K/s in 2.2s

2011-09-20 08:48:51 (127 KB/s) - `sqlite-dll-win32-x86-3070800.zip' saved [289182/289182]


7-Zip 9.15 beta Copyright (c) 1999-2010 Igor Pavlov 2010-06-20

Processing archive: sqlite-dll-win32-x86-3070800.zip

Extracting sqlite3.def
Extracting sqlite3.dll

Everything is Ok

Files: 2
Size: 575107
Compressed: 289182
1 file(s) copied.
begin building sqlite-amalgamation-3070800
cl : Command line warning D9035 : option 'GX' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'EHsc' instead of 'GX'
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
shell.c
sqlite3.c
Generating Code...
sqlite3.exe build finished ......
cl : Command line warning D9035 : option 'GX' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'EHsc' instead of 'GX'
cl : Command line warning D9035 : option 'GZ' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'RTC1' instead of 'GZ'
cl : Command line warning D9002 : ignoring unknown option '/MLd'
cl : Command line warning D9002 : ignoring unknown option '/YX'
cl : Command line warning D9002 : ignoring unknown option '/debug'
sqlite3.c
LINK : warning LNK4044: unrecognized option '/pdbtype:sept'; ignored
LINK : sqlite3.dll not found or not built by the last incremental link; performing full link
Creating library sqlite3.lib and object sqlite3.exp
sqlite3.dll build finished ......
end building sqlite-amalgamation-3070800
-----------------------------------------------

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-307638-1-1.html 上篇帖子: android sqlite db-journal文件产生原因及说明 . 下篇帖子: iOS应用中关于Sqlite数据库的使用
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表