From c987969785a996dc5761787887c09477e0e925e7 Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Thu, 5 Sep 2024 01:17:06 +0800 Subject: [PATCH] sqlite: update 3.46.1 bottle. --- Formula/s/sqlite.rb | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Formula/s/sqlite.rb diff --git a/Formula/s/sqlite.rb b/Formula/s/sqlite.rb new file mode 100644 index 00000000000..f673ba17991 --- /dev/null +++ b/Formula/s/sqlite.rb @@ -0,0 +1,76 @@ +class Sqlite < Formula + desc "Command-line interface for SQLite" + homepage "https://sqlite.org/index.html" + url "https://www.sqlite.org/2024/sqlite-autoconf-3460100.tar.gz" + version "3.46.1" + sha256 "67d3fe6d268e6eaddcae3727fce58fcc8e9c53869bdd07a0c61e38ddf2965071" + license "blessing" + + 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 + + bottle do + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/sqlite-3.46.1" + sha256 cellar: :any_skip_relocation, aarch64_linux: "c5c38ebaabe2316877a81b8ee4adfda4d031c817da072beb3f94a7723bef9dc8" + end + + keg_only :provided_by_macos + + depends_on "readline" + + uses_from_macos "zlib" + + 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_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 = %W[ + --prefix=#{prefix} + --disable-dependency-tracking + --enable-dynamic-extensions + --enable-readline + --disable-editline + --enable-session + ] + + system "./configure", *args + 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 <<~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