homebrew-core/Formula/sqlite.rb
2019-03-22 10:17:41 +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-3270200.tar.gz"
version "3.27.2"
sha256 "50c39e85ea28b5ecfdb3f9e860afe9ba606381e21836b2849efca6a0bfe6ef6e"
bottle do
cellar :any
sha256 "92e04d5ec9bc853574c91c6564d56cbe4ab032ab5449d347e004bcada6715c73" => :mojave
sha256 "c1f61110f6b98eb2cf21f99ef93d8644643498efe184130e93236777cc789c69" => :high_sierra
sha256 "ac9127f5cb35739bc3255a620cd2c10f917c43528ef7a8f74a6cea808baa0292" => :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