Skip to content

Commit 95e16d3

Browse files
committed
doc: update README and create LICENSE-DEPENDENCIES
also rename the github actions pipelines to be more meaningful
1 parent e9b104d commit 95e16d3

File tree

5 files changed

+161
-22
lines changed

5 files changed

+161
-22
lines changed

.github/workflows/gem-install.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: gem install
1+
name: native packaging
22
concurrency:
33
group: "${{github.workflow}}-${{github.ref}}"
44
cancel-in-progress: true

.github/workflows/sqlite3-ruby.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: test suite
22
concurrency:
33
group: "${{github.workflow}}-${{github.ref}}"
44
cancel-in-progress: true

LICENSE-DEPENDENCIES

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Vendored Dependency Licenses
2+
3+
The library `sqlite3-ruby` (which lives at https://github.com/sparklemotion/sqlite3-ruby) may include the source code for `sqlite` (which lives at https://www.sqlite.org/)
4+
5+
`sqlite` source code is licensed under the public domain:
6+
7+
> https://www.sqlite.org/copyright.html
8+
9+
The license terms shipped with `sqlite` are included here for your convenience:
10+
11+
```
12+
The author disclaims copyright to this source code. In place of
13+
a legal notice, here is a blessing:
14+
15+
May you do good and not evil.
16+
May you find forgiveness for yourself and forgive others.
17+
May you share freely, never taking more than you give.
18+
```
19+
20+
Note that these license terms do not apply to the `sqlite3-ruby` library itself.

README.md

+138-20
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
* Download: http://rubygems.org/gems/sqlite3
66
* Documentation: http://www.rubydoc.info/gems/sqlite3
77

8-
[![Build Status](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml/badge.svg)](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml)
8+
[![Unit tests](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml/badge.svg)](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml)
9+
[![Native packages](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/gem-install.yml/badge.svg)](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/gem-install.yml)
910

1011

1112
## Description
1213

13-
This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org). You must have the SQLite engine installed in order to build this module.
14+
This library allows Ruby programs to use the SQLite3 database engine (http://www.sqlite.org).
1415

1516
Note that this module is only compatible with SQLite 3.6.16 or newer.
1617

@@ -43,9 +44,10 @@ end
4344
db.execute( "select * from numbers" ) do |row|
4445
p row
4546
end
47+
# => ["one", 1]
48+
# ["two", 2]
4649

4750
# Create another table with multiple columns
48-
4951
db.execute <<-SQL
5052
create table students (
5153
name varchar(50),
@@ -62,34 +64,142 @@ db.execute("INSERT INTO students (name, email, grade, blog)
6264
db.execute( "select * from students" ) do |row|
6365
p row
6466
end
67+
# => ["Jane", "[email protected]", "A", "http://blog.janedoe.com"]
68+
```
69+
70+
## Installation
71+
72+
### Native Gems (recommended)
73+
74+
As of v1.5.0 of this library, native (precompiled) gems are available for Ruby 2.6, 2.7, 3.0, and 3.1 on all these platforms:
75+
76+
- `aarch64-linux`
77+
- `arm-linux`
78+
- `arm64-darwin`
79+
- `x64-mingw32` / `x64-mingw-ucrt`
80+
- `x86-linux`
81+
- `x86_64-darwin`
82+
- `x86_64-linux`
83+
84+
If you are using one of these Ruby versions on one of these platforms, the native gem is the recommended way to install sqlite3-ruby.
85+
86+
For example, on a linux system running Ruby 3.1:
87+
88+
``` text
89+
$ ruby -v
90+
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
91+
92+
$ time gem install sqlite3
93+
Fetching sqlite3-1.5.0-x86_64-linux.gem
94+
Successfully installed sqlite3-1.5.0-x86_64-linux
95+
1 gem installed
96+
97+
real 0m4.274s
98+
user 0m0.734s
99+
sys 0m0.165s
65100
```
66101

67-
## Compilation and Installation
102+
#### Avoiding the precompiled native gem
103+
104+
The maintainers strongly urge you to use a native gem if at all possible. It will be a better experience for you and allow us to focus our efforts on improving functionality rather than diagnosing installation issues.
68105

69-
Install SQLite3, enabling the option SQLITE_ENABLE_COLUMN_METADATA (see [www.sqlite.org/compile.html](https://www.sqlite.org/compile.html) for details).
106+
If you're on a platform that supports a native gem but you want to avoid using it in your project, do one of the following:
70107

71-
Then do the following:
108+
- If you're not using Bundler, then run `gem install sqlite3 --platform=ruby`
109+
- If you are using Bundler
110+
- version 2.1 or later, then you'll need to run `bundle config set force_ruby_platform true`,
111+
- version 2.0 or earlier, then you'll need to run `bundle config force_ruby_platform true`
112+
113+
114+
### Compiling the Native Extension
115+
116+
If you are on a platform or version of Ruby that is not covered by the Native Gems, then the vanilla "ruby platform" (non-native) gem will be installed by the `gem install` or `bundle` commands.
117+
118+
119+
#### Packaged libsqlite3
120+
121+
By default, as of v1.5.0 of this library, libsqlite3 v3.38.5 is packaged with the gem and will be compiled and used automatically. This takes a bit longer than the native gem, but will provide a modern, well-supported version of libsqlite3.
122+
123+
For example, on a linux system running Ruby 2.5:
124+
125+
``` text
126+
$ ruby -v
127+
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
128+
129+
$ time gem install sqlite3
130+
Building native extensions. This could take a while...
131+
Successfully installed sqlite3-1.5.0
132+
1 gem installed
133+
134+
real 0m20.620s
135+
user 0m23.361s
136+
sys 0m5.839s
137+
```
72138

73-
ruby setup.rb config
74-
ruby setup.rb setup
75-
ruby setup.rb install
76139

77-
Alternatively, you can download and install the RubyGem package for
78-
SQLite3/Ruby (you must have RubyGems and SQLite3 installed, first):
140+
#### System libsqlite3
79141

80-
gem install sqlite3
142+
If you would prefer to build the sqlite3-ruby gem against your system libsqlite3, which requires that you install libsqlite3 and its development files yourself, you may do so by using the `--enable-system-libraries` flag at gem install time.
81143

82-
If you have sqlite3 installed in a non-standard location, you can specify the location of the include and lib files by doing:
144+
PLEASE NOTE:
83145

84-
gem install sqlite3 -- --with-sqlite3-include=/opt/local/include \
85-
--with-sqlite3-lib=/opt/local/lib
146+
- only versions of libsqlite3 `>= 3.5.0` are supported,
147+
- and some library features may depend on how your libsqlite3 was compiled.
148+
149+
For example, on a linux system running Ruby 2.5:
150+
151+
``` text
152+
$ time gem install sqlite3 -- --enable-system-libraries
153+
Building native extensions with: '--enable-system-libraries'
154+
This could take a while...
155+
Successfully installed sqlite3-1.5.0
156+
1 gem installed
157+
158+
real 0m4.234s
159+
user 0m3.809s
160+
sys 0m0.912s
161+
```
162+
163+
If you're using bundler, you can opt into system libraries like this:
164+
165+
``` sh
166+
bundle config build.sqlite3 --enable-system-libraries
167+
```
168+
169+
If you have sqlite3 installed in a non-standard location, you may need to specify the location of the include and lib files by using `--with-sqlite-include` and `--with-sqlite-lib` options (or a `--with-sqlite-dir` option, see [MakeMakefile#dir_config](https://ruby-doc.org/stdlib-3.1.1/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-dir_config)). If you have pkg-config installed and configured properly, this may not be necessary.
170+
171+
``` sh
172+
gem install sqlite3 -- \
173+
--enable-system-libraries \
174+
--with-sqlite3-include=/opt/local/include \
175+
--with-sqlite3-lib=/opt/local/lib
176+
```
177+
178+
179+
#### System libsqlcipher
180+
181+
If you'd like to link against a system-installed libsqlcipher, you may do so by using the `--with-sqlcipher` flag:
182+
183+
``` text
184+
$ time gem install sqlite3 -- --with-sqlcipher
185+
Building native extensions with: '--with-sqlcipher'
186+
This could take a while...
187+
Successfully installed sqlite3-1.5.0
188+
1 gem installed
189+
190+
real 0m4.772s
191+
user 0m3.906s
192+
sys 0m0.896s
193+
```
194+
195+
If you have sqlcipher installed in a non-standard location, you may need to specify the location of the include and lib files by using `--with-sqlite-include` and `--with-sqlite-lib` options (or a `--with-sqlite-dir` option, see [MakeMakefile#dir_config](https://ruby-doc.org/stdlib-3.1.1/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-dir_config)). If you have pkg-config installed and configured properly, this may not be necessary.
86196

87197

88198
## Support
89199

90200
### Something has gone wrong! Where do I get help?
91201

92-
The best place to get help is from the
202+
You can ask for help or support from the
93203
[sqlite3-ruby mailing list](http://groups.google.com/group/sqlite3-ruby) which
94204
can be found here:
95205

@@ -98,7 +208,7 @@ can be found here:
98208

99209
### I've found a bug! How do I report it?
100210

101-
After contacting the mailing list, you've found that you've actually discovered a bug. You can file the bug at the [github issues page](https://github.com/sparklemotion/sqlite3-ruby/issues) which can be found here:
211+
After contacting the mailing list, you've found that you've uncovered a bug. You can file the bug at the [github issues page](https://github.com/sparklemotion/sqlite3-ruby/issues) which can be found here:
102212

103213
> https://github.com/sparklemotion/sqlite3-ruby/issues
104214
@@ -108,8 +218,16 @@ After contacting the mailing list, you've found that you've actually discovered
108218
For help figuring out the SQLite3/Ruby interface, check out the SYNOPSIS as well as the RDoc. It includes examples of usage. If you have any questions that you feel should be addressed in the FAQ, please send them to [the mailing list](http://groups.google.com/group/sqlite3-ruby).
109219

110220

111-
## Source Code
221+
## Contributing
222+
223+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md).
224+
225+
226+
## License
227+
228+
This library is licensed under `BSD-3-Clause`, see [`LICENSE`](./LICENSE).
229+
112230

113-
The source repository is accessible via git:
231+
### Dependencies
114232

115-
git clone git://github.com/sparklemotion/sqlite3-ruby.git
233+
The source code of `sqlite` is distributed in the "ruby platform" gem. This code is public domain, see [`LICENSE-DEPENDENCIES`](./LICENSE-DEPENDENCIES) for details.

sqlite3.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
4242
"ChangeLog.cvs",
4343
"Gemfile",
4444
"LICENSE",
45+
"LICENSE-DEPENDENCIES",
4546
"README.md",
4647
"ext/sqlite3/aggregator.c",
4748
"ext/sqlite3/aggregator.h",

0 commit comments

Comments
 (0)