interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / tool / mktoolzip.tcl

104 lines · 2417 bytes Raw Blame History
1#!/usr/bin/tclsh
2#
3# Run this script in order to generate a ZIP archive containing various
4# command-line tools.
5#
6# The makefile that invokes this script must first build the following
7# binaries:
8#
9# testfixture -- used to run this script
10# sqlite3 -- the SQLite CLI
11# sqldiff -- Program to diff two databases
12# sqlite3_rsync -- Remote db sync
13#
14# On Windows, add:
15#
16# sqlite3.def
17# sqlite3.dll
18#
19# Add the --snapshot option to generate a snapshot ZIP archive instead of
20# a release ZIP archive.
21#
22set bSnapshot 0
23for {set i 0} {$i<[llength $argv]} {incr i} {
24 set a [lindex $argv $i]
25 if {$a eq "-snapshot" || $a eq "--snapshot"} {
26 set bSnapshot 1
27 continue
28 }
29 puts stderr "unknown argument: $a"
30 exit 1
31}
32switch $tcl_platform(os) {
33 {Windows NT} {
34 set OS win
35 set EXE .exe
36 }
37 Linux {
38 set OS linux
39 set EXE {}
40 }
41 Darwin {
42 set OS osx
43 set EXE {}
44 }
45 default {
46 set OS unknown
47 set EXE {}
48 }
49}
50switch $tcl_platform(machine) {
51 arm64 {
52 set ARCH arm64
53 }
54 x86_64 {
55 set ARCH x64
56 }
57 amd64 -
58 intel {
59 if {$tcl_platform(pointerSize)==4} {
60 set ARCH x86
61 } else {
62 set ARCH x64
63 }
64 }
65 default {
66 set ARCH unk
67 }
68}
69if {$bSnapshot} {
70 set in [open [file join [file dirname [file dirname [info script]]] manifest]]
71 set manifest [read $in]
72 close $in
73 regexp {\nD (.{16})} $manifest all date
74 regsub -all {[-:T]} $date {} v2
75} else {
76 set in [open [file join [file dirname [file dirname [info script]]] VERSION]]
77 set vers [read $in]
78 close $in
79 scan $vers %d.%d.%d v1 v2 v3
80 set v2 [format 3%02d%02d00 $v2 $v3]
81}
82
83set name sqlite-tools-$OS-$ARCH-$v2.zip
84set filelist "sqlite3$EXE sqldiff$EXE sqlite3_rsync$EXE"
85proc make_zip_archive {name filelist} {
86 file delete -force $name
87 puts "fossil test-filezip $name $filelist"
88 if {[catch {exec fossil test-filezip $name {*}$filelist}]} {
89 puts "^--- Unable. Trying again as:"
90 puts "zip $name $filelist"
91 file delete -force $name
92 exec zip $name {*}$filelist
93 }
94 puts "$name: [file size $name] bytes"
95}
96make_zip_archive $name $filelist
97
98# On Windows, also try to construct a DLL
99#
100if {$OS eq "win" && [file exists sqlite3.dll] && [file exists sqlite3.def]} {
101 set name sqlite-dll-win-$ARCH-$v2.zip
102 set filelist [list sqlite3.def sqlite3.dll]
103 make_zip_archive $name $filelist
104}