summaryrefslogtreecommitdiffstats
path: root/www/getthecode.html
blob: b36aba1f269a71788f2f0210e102ff273d621fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>How To Download Canonical SQLite Source Code</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
How To Download Canonical SQLite Source Code
</div>
</div>





<h1 id="introduction"><span>1. </span>Introduction</h1>

<p>Most programmers compile SQLite into their applications using
the <a href="amalgamation.html">amalgamation</a>.  The <a href="amalgamation.html">amalgamation</a> is C-code but it is not
"source code".  The <a href="amalgamation.html">amalgamation</a> is generated from source code
by scripts.

</p><p>This document describes how to obtain the canonical source code
for SQLite - the raw source files from which the amalgamation is
built.  See the <a href="howtocompile.html">How To Compile SQLite</a> page for additional information
on what to do with the canonical source code once it is obtained.

</p><h1 id="direct_downloads"><span>2. </span>Direct Downloads</h1>

<p>Snapshots of official releases of SQLite source code can often
be obtained directly from the <a href="download.html">download page</a> of the SQLite website.
Even if the specific version desired is not listed on the download page,
the naming conventions are fairly clear and so programmers can often
guess the name of an historical release and download it that way.

</p><h1 id="obtaining_code_directly_from_the_version_control_system"><span>3. </span>Obtaining Code Directly From the Version Control System</h1>

<p>For any historical version of SQLite, the source tree can be obtained
from the <a href="https://www.fossil-scm.org/">Fossil</a> version control system,
either downloading a tarball or ZIP archive for a specific version, or
by cloning the entire project history.

</p><p>SQLite sources are maintained on three geographically dispersed
servers:

</p><blockquote>
<a href="https://www.sqlite.org/src">https://www.sqlite.org/src</a> (Dallas)<br>
<a href="https://www2.sqlite.org/src">https://www2.sqlite.org/src</a> (Newark)<br>
<a href="https://www3.sqlite.org/src">https://www3.sqlite.org/src</a> (San Francisco)<br>
</blockquote>

<p>The documentation is maintained in separate source repositories on
those same servers:

</p><blockquote>
<a href="https://www.sqlite.org/docsrc">https://www.sqlite.org/docsrc</a> (Dallas)<br>
<a href="https://www2.sqlite.org/docsrc">https://www2.sqlite.org/docsrc</a> (Newark)<br>
<a href="https://www3.sqlite.org/docsrc">https://www3.sqlite.org/docsrc</a> (San Francisco)<br>
</blockquote>

<p>To download a specific historical version, first locate the specific
version desired by visiting the timeline page on one of these servers
(for example: <a href="https://www.sqlite.org/src/timeline">https://www.sqlite.org/src/timeline</a>).  If
you know the approximate date of the version you want to download, you
can add a query parameter like "c=YYYY-MM-DD" to the "timeline" URL to
see a timeline centered on that date.  For example, to see all the check-ins
that occurred around August 26, 2013, visit
<a href="https://www.sqlite.org/src/timeline?c=2013-08-26">https://www.sqlite.org/src/timeline?c=2013-08-26</a>.
If you are looking for an official release, visit the
<a href="chronology.html">chronology</a> page, click on the date to the left of the release
you are looking for, and that will take you immediately to the
check-in corresponding to the release.

</p><p>Once you locate a specific version, click on the hyperlink for that
version to see the "Check-in Information Page".
Then click on either the "Tarball" link or the
"ZIP archive" link to download the complete source tree.

</p><h1 id="verifying_that_the_code_is_unmodified"><span>4. </span>Verifying That The Code Is Unmodified</h1>

<p>
The "<tt>manifest</tt>" file at the root directory of the source tree
contains either a SHA3-256 hash or a SHA1 hash for every source file
in the repository. The name of the version of the entire source tree
is just the SHA3-256 hash of the "<tt>manifest</tt>" file itself, possibly with
the last line of that file omitted if the last line begins with 
"# Remove this line". The "<tt>manifest.uuid</tt>" file should contain
the SHA3-256 hash of the "<tt>manifest</tt>" file. If all of the above hash 
comparisons are correct, then you can be confident that your source
tree is authentic and unadulterated. Details on the format of
manifest files are available on the 
<a href="https://fossil-scm.org/home/doc/trunk/www/fileformat.wiki#manifest">
Fossil website</a>.

</p><p>
The process of checking source code authenticity is automated by the makefile:

</p><div class="codeblock"><pre>make verify-source
</pre></div>

<p>
Or on windows:

</p><div class="codeblock"><pre>nmake /f Makefile.msc verify-source
</pre></div>

<p>
Using the makefile to verify source integrity is good for detecting
accidental changes to the source tree, but malicious changes could
be hidden by also modifying the makefiles.

<a name="clone"></a>

</p><h1 id="cloning_the_complete_development_history"><span>5. </span>Cloning The Complete Development History</h1>

<p>To clone the entire history of SQLite, first go to the
<a href="https://www.fossil-scm.org/download.html">https://www.fossil-scm.org/download.html</a> page and grab a precompiled binary
for the Fossil version control program.  Or get the source code on the
same page and compile it yourself.

</p><p>As of 2017-03-12, you must use Fossil version
2.0 or later for the following instructions to work.  
The SQLite repository started using
artifacts named using SHA3 hashes instead of SHA1 hashes on that date,
and Fossil 2.0 or later is needed in order to understand the new SHA3
hashes.  To find out what version of Fossil you are running, 
type "fossil -v".</p>

<p>Fossil is a completely stand-alone
program, so install it simply by putting the "fossil" or "fossil.exe"
executable someplace on your $PATH or %PATH%.  After you have Fossil
installed, do this:

</p><div class="codeblock"><pre>fossil clone https://www.sqlite.org/src sqlite.fossil
</pre></div>

<p>The command above
will make a copy of the complete development history of
SQLite into the "sqlite.fossil" file on your computer.  Making this copy
takes about a minute and uses about 32 megabytes of transfer.  After
making the copy, "open" the repository by typing:

</p><div class="codeblock"><pre>fossil open sqlite.fossil
</pre></div>

<p>This second command will "checkout" the latest check-in from the SQLite
source tree into your current directory.  Subsequently, you can easily switch
to a different version by typing:

</p><div class="codeblock"><pre>fossil update VERSION
</pre></div>

<p>Where VERSION can be a branch name (like "trunk" or "session") to get the
latest check-in on a specific branch, or VERSION can be a SHA1 hash or a
prefix of a SHA1 hash for a specific check-in, or VERSION can be a tag
such as "version-3.8.8".  Every time you run "fossil update" it will
automatically reach out to the original repository at
https://www.sqlite.org/src to obtain new check-ins that might have been
made by others since your previous update.
</p>