homebrew-core/Formula/sqlite.rb

63 lines
2.1 KiB
Ruby

class Sqlite < Formula
desc "Command-line interface for SQLite"
homepage "https://sqlite.org/"
url "https://www.sqlite.org/2020/sqlite-autoconf-3340000.tar.gz"
version "3.34.0"
sha256 "bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee"
license "blessing"
livecheck do
url "https://sqlite.org/news.html"
regex(%r{v?(\d+(?:\.\d+)+)</h3>}i)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "0a8e636f4fe9870f64c15b40fa1e1e0027431d39690f117cad7456e84b89582c"
sha256 cellar: :any, big_sur: "cdf256befc0752680a6742469b217e0dae42c691cb3565923d4bf2c5a0583152"
sha256 cellar: :any, catalina: "7e04c1fcd0294ec7625e43eea05714d8bb4d15d24675c99484f1403fdcb438ec"
sha256 cellar: :any, mojave: "64729f1390a8379a9c7e6c8579dda0a0c450328868ebeb7e7e632aa448bda2d1"
end
keg_only :provided_by_macos
depends_on "readline"
uses_from_macos "zlib"
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
--enable-session
]
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