class Sqlite < Formula bottle do root_url "https://homebrew.hyprnet/bottles" sha256 cellar: :any, arm64_sequoia: "d72213dd3ac143c71b042851046aa3cc71b812c16f88c741db0550ab7d629a27" sha256 cellar: :any, arm64_tahoe: "e1149946e2c8c81edcb09d9a6842cc262986745513822f68f71631f4594773a9" sha256 cellar: :any, sequoia: "fa1c1ec844206b09df111e79e137af6c73018b8ab48ba9350e8240418f696e34" sha256 cellar: :any, x86_64_linux: "a44eff3774c1d944e3adf975d8489eff5ec841322ba8e37a88b924e5106f4805" end desc "Command-line interface for SQLite" homepage "https://sqlite.org/index.html" url "https://www.sqlite.org/2026/sqlite-autoconf-3530400.tar.gz" version "3.53.4" sha256 "0e9483900e92cd5de8fd48d16bf9200145a61f7fd5be542a5ac81d8a9516eb9c" license "blessing" compatibility_version 1 livecheck do url :homepage regex(%r{href=.*?releaselog/v?(\d+(?:[._]\d+)+)\.html}i) strategy :page_match do |page, regex| page.scan(regex).map { |match| match&.first&.tr("_", ".") } end end no_autobump! because: :incompatible_version_format keg_only :provided_by_macos depends_on "readline" on_linux do depends_on "zlib-ng-compat" end def install # 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", %w[ -DSQLITE_ENABLE_API_ARMOR=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_USE_URI=1 ].join(" ") args = [ "--enable-readline", "--disable-editline", "--enable-session", "--with-readline-cflags=-I#{formula_opt_include("readline")}", "--with-readline-ldflags=-L#{formula_opt_lib("readline")} -lreadline", ] args << "--soname=legacy" if OS.linux? system "./configure", *args, *std_configure_args ENV.deparallelize system "make", "install" # Avoid rebuilds of dependants that hardcode this path. inreplace lib/"pkgconfig/sqlite3.pc", prefix, opt_prefix end test do path = testpath/"school.sql" path.write <<~SQL 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; SQL names = shell_output("#{bin}/sqlite3 < #{path}").strip.split("\n") assert_equal %w[Sue Tim Bob], names end end