-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |