homebrew-core/Formula/sqlite.rb
2019-02-10 17:31:04 +08:00

53 lines
1.8 KiB
Ruby

class Sqlite < Formula
desc "Command-line interface for SQLite"
homepage "https://sqlite.org/"
url "https://sqlite.org/2019/sqlite-autoconf-3270100.tar.gz"
version "3.27.1"
sha256 "54a92b8ff73ff6181f89b9b0c08949119b99e8cccef93dbef90e852a8b10f4f8"
bottle do
cellar :any
sha256 "fce7a51b1a037f6e6270e8b7fd41ef2bc2941cc7535b6998fc83387f8e17a7a7" => :mojave
sha256 "ca58657c0fac5c9f583a607acc4bd2780052b5cd641c2e096b0ba21a3105cb59" => :high_sierra
sha256 "b06da00bb4a0879d77d42dc72fdc670d015dd9a4801c17e28e8d9f3454e60a2f" => :sierra
end
keg_only :provided_by_macos, "macOS provides an older sqlite3"
depends_on "readline"
def install
ENV.append "CPPFLAGS", "-DSQLITE_ENABLE_COLUMN_METADATA=1"
# Default value of MAX_VARIABLE_NUMBER is 999 which is too low for many
# applications. Set to 250000 (Same value used in Debian and Ubuntu).
ENV.append "CPPFLAGS", "-DSQLITE_MAX_VARIABLE_NUMBER=250000"
ENV.append "CPPFLAGS", "-DSQLITE_ENABLE_RTREE=1"
ENV.append "CPPFLAGS", "-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1"
ENV.append "CPPFLAGS", "-DSQLITE_ENABLE_JSON1=1"
args = %W[
--prefix=#{prefix}
--disable-dependency-tracking
--enable-dynamic-extensions
--enable-readline
--disable-editline
]
system "./configure", *args
system "make", "install"
end
test do
path = testpath/"school.sql"
path.write <<~EOS
create table students (name text, age integer);
insert into students (name, age) values ('Bob', 14);
insert into students (name, age) values ('Sue', 12);
insert into students (name, age) values ('Tim', 13);
select name from students order by age asc;
EOS
names = shell_output("#{bin}/sqlite3 < #{path}").strip.split("\n")
assert_equal %w[Sue Tim Bob], names
end
end