|
| 1 | +class Sqlite < Formula |
| 2 | + desc "Command-line interface for SQLite" |
| 3 | + homepage "https://sqlite.org/index.html" |
| 4 | + url "https://www.sqlite.org/2024/sqlite-autoconf-3460100.tar.gz" |
| 5 | + version "3.46.1" |
| 6 | + sha256 "67d3fe6d268e6eaddcae3727fce58fcc8e9c53869bdd07a0c61e38ddf2965071" |
| 7 | + license "blessing" |
| 8 | + |
| 9 | + livecheck do |
| 10 | + url :homepage |
| 11 | + regex(%r{href=.*?releaselog/v?(\d+(?:[._]\d+)+)\.html}i) |
| 12 | + strategy :page_match do |page, regex| |
| 13 | + page.scan(regex).map { |match| match&.first&.tr("_", ".") } |
| 14 | + end |
| 15 | + end |
| 16 | + |
| 17 | + bottle do |
| 18 | + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/sqlite-3.46.1" |
| 19 | + sha256 cellar: :any_skip_relocation, aarch64_linux: "c5c38ebaabe2316877a81b8ee4adfda4d031c817da072beb3f94a7723bef9dc8" |
| 20 | + end |
| 21 | + |
| 22 | + keg_only :provided_by_macos |
| 23 | + |
| 24 | + depends_on "readline" |
| 25 | + |
| 26 | + uses_from_macos "zlib" |
| 27 | + |
| 28 | + def install |
| 29 | + # Default value of MAX_VARIABLE_NUMBER is 999 which is too low for many |
| 30 | + # applications. Set to 250000 (Same value used in Debian and Ubuntu). |
| 31 | + ENV.append "CPPFLAGS", %w[ |
| 32 | + -DSQLITE_ENABLE_API_ARMOR=1 |
| 33 | + -DSQLITE_ENABLE_COLUMN_METADATA=1 |
| 34 | + -DSQLITE_ENABLE_DBSTAT_VTAB=1 |
| 35 | + -DSQLITE_ENABLE_FTS3=1 |
| 36 | + -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 |
| 37 | + -DSQLITE_ENABLE_FTS5=1 |
| 38 | + -DSQLITE_ENABLE_JSON1=1 |
| 39 | + -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 |
| 40 | + -DSQLITE_ENABLE_RTREE=1 |
| 41 | + -DSQLITE_ENABLE_STAT4=1 |
| 42 | + -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 |
| 43 | + -DSQLITE_MAX_VARIABLE_NUMBER=250000 |
| 44 | + -DSQLITE_USE_URI=1 |
| 45 | + ].join(" ") |
| 46 | + |
| 47 | + args = %W[ |
| 48 | + --prefix=#{prefix} |
| 49 | + --disable-dependency-tracking |
| 50 | + --enable-dynamic-extensions |
| 51 | + --enable-readline |
| 52 | + --disable-editline |
| 53 | + --enable-session |
| 54 | + ] |
| 55 | + |
| 56 | + system "./configure", *args |
| 57 | + system "make", "install" |
| 58 | + |
| 59 | + # Avoid rebuilds of dependants that hardcode this path. |
| 60 | + inreplace lib/"pkgconfig/sqlite3.pc", prefix, opt_prefix |
| 61 | + end |
| 62 | + |
| 63 | + test do |
| 64 | + path = testpath/"school.sql" |
| 65 | + path.write <<~EOS |
| 66 | + create table students (name text, age integer); |
| 67 | + insert into students (name, age) values ('Bob', 14); |
| 68 | + insert into students (name, age) values ('Sue', 12); |
| 69 | + insert into students (name, age) values ('Tim', 13); |
| 70 | + select name from students order by age asc; |
| 71 | + EOS |
| 72 | + |
| 73 | + names = shell_output("#{bin}/sqlite3 < #{path}").strip.split("\n") |
| 74 | + assert_equal %w[Sue Tim Bob], names |
| 75 | + end |
| 76 | +end |
0 commit comments