diff --git a/.github/workflows/livecheck.yml b/.github/workflows/livecheck.yml index c30cde8..963d671 100644 --- a/.github/workflows/livecheck.yml +++ b/.github/workflows/livecheck.yml @@ -8,7 +8,7 @@ on: jobs: check: name: livecheck - runs-on: macos-14 + runs-on: macos-15 steps: - run: brew tap $GITHUB_REPOSITORY diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3eefc82..647afbe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,12 +5,31 @@ on: branches: - main pull_request: + paths: + - 'Formula/**' jobs: + create-comment: + runs-on: ubuntu-22.04 + permissions: + contents: write + pull-requests: write + steps: + - if: github.event_name == 'pull_request' + name: Create a comment + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + token: ${{ secrets.GITHUB_TOKEN }} + body: | + > [!WARNING] + > For Maintainers: When approving a PR, do not merge it directly. Instead add the `pr-pull` label. + > This will trigger the `brew pr-pull` workflow, which will automatically add the bottle and merge the PR. + test-bot: strategy: matrix: - os: [macos-14] + os: [macos-14, macos-15] runs-on: ${{ matrix.os }} steps: - name: Set up Homebrew diff --git a/Formula/sqlb-openssl@3.rb b/Formula/sqlb-openssl@3.rb index 20292dd..d9b993e 100644 --- a/Formula/sqlb-openssl@3.rb +++ b/Formula/sqlb-openssl@3.rb @@ -1,9 +1,9 @@ class SqlbOpensslAT3 < Formula desc "Cryptography and SSL/TLS Toolkit" homepage "https://openssl.org/" - url "https://github.com/openssl/openssl/releases/download/openssl-3.4.1/openssl-3.4.1.tar.gz" - # version "3.4.1" - sha256 "002a2d6b30b58bf4bea46c43bdd96365aaf8daa6c428782aa4feee06da197df3" + url "https://github.com/openssl/openssl/releases/download/openssl-3.5.1/openssl-3.5.1.tar.gz" + # version "3.5.1" + sha256 "529043b15cffa5f36077a4d0af83f3de399807181d607441d734196d889b641f" license "Apache-2.0" livecheck do @@ -12,8 +12,9 @@ class SqlbOpensslAT3 < Formula end bottle do - root_url "https://github.com/sqlitebrowser/homebrew-tap/releases/download/sqlb-openssl@3-3.4.1" - sha256 arm64_sonoma: "0ed4713c5f198968bb47af6daf3a4da66c672f834988c594139b748fb1abea4f" + root_url "https://github.com/sqlitebrowser/homebrew-tap/releases/download/sqlb-openssl@3-3.5.1" + sha256 arm64_sequoia: "24bd31b1b6e6946d23cc164b25aa317b7ed35fe0ffeb7b851c60111a86045860" + sha256 arm64_sonoma: "b7d2de84a548a8693af73e33b3f58c346e20afd872ba0cc0e2e9c6c00d024f5d" end keg_only :shadowed_by_macos, "macOS provides LibreSSL" diff --git a/Formula/sqlb-qt@5.rb b/Formula/sqlb-qt@5.rb new file mode 100644 index 0000000..a64f77e --- /dev/null +++ b/Formula/sqlb-qt@5.rb @@ -0,0 +1,195 @@ +# Patches for Qt must be at the very least submitted to Qt's Gerrit codereview +# rather than their bug-report Jira. The latter is rarely reviewed by Qt. +class SqlbQtAT5 < Formula + desc "Cross-platform application and UI framework" + homepage "https://www.qt.io/" + url "https://download.qt.io/official_releases/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.tar.xz" + # version "5.15.16" + # NOTE: Use *.diff for GitLab/KDE patches to avoid their checksums changing. + sha256 "efa99827027782974356aceff8a52bd3d2a8a93a54dd0db4cca41b5e35f1041c" + license all_of: ["GFDL-1.3-only", "GPL-2.0-only", "GPL-3.0-only", "LGPL-2.1-only", "LGPL-3.0-only"] + revision 1 + + livecheck do + url "https://download.qt.io/official_releases/qt/5.15/" + regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i) + end + + bottle do + root_url "https://github.com/sqlitebrowser/homebrew-tap/releases/download/sqlb-qt@5-5.15.16_1" + sha256 cellar: :any, arm64_sonoma: "3795b58979b95cf4d3152f9935990abf09b18afd8e8618503bef9fe9bdb5fc7c" + end + + keg_only :versioned_formula + + depends_on arch: :arm64 + + # Fix build with Xcode 14.3. + # https://bugreports.qt.io/browse/QTBUG-112906 + patch do + url "https://invent.kde.org/qt/qt/qtlocation-mapboxgl/-/commit/5a07e1967dcc925d9def47accadae991436b9686.diff" + sha256 "4f433bb009087d3fe51e3eec3eee6e33a51fde5c37712935b9ab96a7d7571e7d" + directory "qtlocation/src/3rdparty/mapbox-gl-native" + end + + # CVE-2023-51714 + # Remove with Qt 5.15.17 + patch do + url "https://download.qt.io/official_releases/qt/5.15/0001-CVE-2023-51714-qtbase-5.15.diff" + sha256 "2129058a5e24d98ee80a776c49a58c2671e06c338dffa7fc0154e82eef96c9d4" + directory "qtbase" + end + patch do + url "https://download.qt.io/official_releases/qt/5.15/0002-CVE-2023-51714-qtbase-5.15.diff" + sha256 "99d5d32527e767d6ab081ee090d92e0b11f27702619a4af8966b711db4f23e42" + directory "qtbase" + end + + # CVE-2024-25580 + # Remove with Qt 5.15.17 + patch do + url "https://download.qt.io/official_releases/qt/5.15/CVE-2024-25580-qtbase-5.15.diff" + sha256 "7cc9bf74f696de8ec5386bb80ce7a2fed5aa3870ac0e2c7db4628621c5c1a731" + directory "qtbase" + end + + # CVE-2024-36048 + # Remove with Qt 5.15.17 + patch do + url "https://download.qt.io/official_releases/qt/5.15/CVE-2024-36048-qtnetworkauth-5.15.diff" + sha256 "e5d385d636b5241b59ac16c4a75359e21e510506b26839a4e2033891245f33f9" + directory "qtnetworkauth" + end + + # CVE-2024-39936 + # Remove with Qt 5.15.18 + patch do + url "https://download.qt.io/official_releases/qt/5.15/CVE-2024-39936-qtbase-5.15.patch" + sha256 "2cc23afba9d7e48f8faf8664b4c0324a9ac31a4191da3f18bd0accac5c7704de" + directory "qtbase" + end + + def install + # Determine the minimum macOS version. + # Match the required version of the DB Browser for SQLite app. + ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.13" + ENV.append "CPPFLAGS", "-mmacosx-version-min=10.13" + ENV.append "LDFLAGS", "-mmacosx-version-min=10.13" + + args = [ + "-device-option", + "QMAKE_APPLE_DEVICE_ARCHS=x86_64 arm64", + "-verbose", + "-prefix", + prefix.to_s, + "-release", + "-opensource", + "-confirm-license", + "-nomake", + "examples", + "-nomake", + "tests", + ] + + args << "-no-rpath" + args << "-no-assimp" if Hardware::CPU.arm? + + # Work around Clang failure in bundled Boost and V8: + # error: integer value -1 is outside the valid range of values [0, 3] for this enumeration type + if DevelopmentTools.clang_build_version >= 1500 + args << "QMAKE_CXXFLAGS+=-Wno-enum-constexpr-conversion" + inreplace "qtwebengine/src/3rdparty/chromium/build/config/compiler/BUILD.gn", + /^\s*"-Wno-thread-safety-attributes",$/, + "\\0 \"-Wno-enum-constexpr-conversion\"," + end + + system "./configure", *args + system "make" + system "make", "install" + + # Install a qtversion.xml to ease integration with QtCreator + # As far as we can tell, there is no ability to make the Qt buildsystem + # generate this and it's in the Qt source tarball at all. + # Multiple people on StackOverflow have asked for this and it's a pain + # to add Qt to QtCreator (the official IDE) without it. + # Given Qt upstream seems extremely unlikely to accept this: let's ship our + # own version. + # If you read this and you can eliminate it or upstream it: please do! + # More context in https://github.com/Homebrew/homebrew-core/pull/124923 + qtversion_xml = share/"qtcreator/QtProject/qtcreator/qtversion.xml" + qtversion_xml.dirname.mkpath + qtversion_xml.write <<~XML + + + + + QtVersion.0 + + 1 + Qt %{Qt:Version} (#{opt_prefix}) + #{opt_bin}/qmake + Qt4ProjectManager.QtVersion.Desktop + + false + + + + Version + 1 + + + XML + + # Move `*.app` bundles into `libexec` to expose them to `brew linkapps` and + # because we don't like having them in `bin`. + bin.glob("*.app") do |app| + libexec.install app + bin.write_exec_script libexec/app.basename/"Contents/MacOS"/app.stem + end + end + + def caveats + <<~EOS + We agreed to the Qt open source license for you. + If this is unacceptable you should uninstall. + + You can add Homebrew's Qt to QtCreator's "Qt Versions" in: + Preferences > Qt Versions > Link with Qt... + pressing "Choose..." and selecting as the Qt installation path: + #{opt_prefix} + EOS + end + + test do + (testpath/"hello.pro").write <<~EOS + QT += core + QT -= gui + TARGET = hello + CONFIG += console + CONFIG -= app_bundle + TEMPLATE = app + SOURCES += main.cpp + EOS + + (testpath/"main.cpp").write <<~EOS + #include + #include + + int main(int argc, char *argv[]) + { + QCoreApplication a(argc, argv); + qDebug() << "Hello World!"; + return 0; + } + EOS + + # Work around "error: no member named 'signbit' in the global namespace" + ENV.delete "CPATH" + + system bin/"qmake", testpath/"hello.pro" + system "make" + assert_path_exists testpath/"hello" + assert_path_exists testpath/"main.o" + system "./hello" + end +end diff --git a/Formula/sqlb-sqlcipher.rb b/Formula/sqlb-sqlcipher.rb new file mode 100644 index 0000000..2bfb0f2 --- /dev/null +++ b/Formula/sqlb-sqlcipher.rb @@ -0,0 +1,124 @@ +class SqlbSqlcipher < Formula + desc "SQLite extension providing 256-bit AES encryption" + homepage "https://www.zetetic.net/sqlcipher/" + url "https://github.com/sqlcipher/sqlcipher/archive/refs/tags/v4.6.1.tar.gz" + # version "4.6.1" + sha256 "d8f9afcbc2f4b55e316ca4ada4425daf3d0b4aab25f45e11a802ae422b9f53a3" + license "BSD-3-Clause" + head "https://github.com/sqlcipher/sqlcipher.git", branch: "master" + + livecheck do + url :stable + strategy :github_latest + end + + bottle do + root_url "https://github.com/sqlitebrowser/homebrew-tap/releases/download/sqlb-sqlcipher-4.6.1" + sha256 cellar: :any, arm64_sonoma: "0f918b4a91bf719ad5b8b205900ca845a21e0b730a01f38b3d2f15a63a15dfdc" + end + + depends_on arch: :arm64 + depends_on "sqlitebrowser/tap/sqlb-openssl@3" + + # Build scripts require tclsh. `--disable-tcl` only skips building extension + uses_from_macos "tcl-tk" => :build + uses_from_macos "sqlite" + uses_from_macos "zlib" + + def install + # Determine the minimum macOS version. + # Match the required version of the DB Browser for SQLite app. + ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.13" + ENV.append "CPPFLAGS", "-mmacosx-version-min=10.13" + ENV.append "LDFLAGS", "-mmacosx-version-min=10.13" + + ENV.append "CFLAGS", "-arch x86_64" + + args = %W[ + --prefix=#{prefix}/darwin64-x86_64-cc + --enable-tempstore=yes + --with-crypto-lib=#{Formula["sqlb-openssl@3"].opt_prefix} + --enable-load-extension + --disable-tcl + ] + + # Build with full-text search enabled + cflags = %w[ + -DSQLCIPHER_CRYPTO_OPENSSL + -DSQLITE_ENABLE_COLUMN_METADATA + -DSQLITE_ENABLE_FTS3 + -DSQLITE_ENABLE_FTS3_PARENTHESIS + -DSQLITE_ENABLE_FTS5 + -DSQLITE_ENABLE_GEOPOLY + -DSQLITE_ENABLE_JSON1 + -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 + -DSQLITE_ENABLE_RTREE + -DSQLITE_ENABLE_SNAPSHOT=1 + -DSQLITE_ENABLE_STAT4 + -DSQLITE_HAS_CODEC + -DSQLITE_SOUNDEX + ].join(" ") + args << "CFLAGS=#{cflags}" + + system "./configure", *args + system "arch", "-x86_64", "make" + system "make", "install" + + ENV.delete("CFLAGS") + + args = %W[ + --prefix=#{prefix} + --enable-tempstore=yes + --with-crypto-lib=#{Formula["sqlb-openssl@3"].opt_prefix} + --enable-load-extension + --disable-tcl + ] + + # Build with full-text search enabled + cflags = %w[ + -DSQLCIPHER_CRYPTO_OPENSSL + -DSQLITE_ENABLE_COLUMN_METADATA + -DSQLITE_ENABLE_FTS3 + -DSQLITE_ENABLE_FTS3_PARENTHESIS + -DSQLITE_ENABLE_FTS5 + -DSQLITE_ENABLE_GEOPOLY + -DSQLITE_ENABLE_JSON1 + -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 + -DSQLITE_ENABLE_RTREE + -DSQLITE_ENABLE_SNAPSHOT=1 + -DSQLITE_ENABLE_STAT4 + -DSQLITE_HAS_CODEC + -DSQLITE_SOUNDEX + ].join(" ") + args << "CFLAGS=#{cflags}" + + system "make", "clean" + system "./configure", *args + system "make" + system "make", "install" + + mv "#{lib}/libsqlcipher.0.dylib", "#{lib}/libsqlcipher.0-arm64.dylib" + dylib_arm64 = MachO::MachOFile.new("#{lib}/libsqlcipher.0-arm64.dylib") + dylib_x86_64 = MachO::MachOFile.new("#{prefix}/darwin64-x86_64-cc/lib/libsqlcipher.0.dylib") + fat = MachO::FatFile.new_from_machos(dylib_arm64, dylib_x86_64) + fat.write("#{lib}/libsqlcipher.0.dylib") + + rm "#{lib}/libsqlcipher.dylib" + rm_r "#{prefix}/darwin64-x86_64-cc" + ln_s "#{lib}/libsqlcipher.0.dylib", "#{lib}/libsqlcipher.dylib" + 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', json_extract('{"age": 13}', '$.age')); + select name from students order by age asc; + EOS + + names = shell_output("#{bin}/sqlcipher < #{path}").strip.split("\n") + assert_equal %w[Sue Tim Bob], names + end +end diff --git a/Formula/sqlb-sqlite.rb b/Formula/sqlb-sqlite.rb new file mode 100644 index 0000000..d03c7f0 --- /dev/null +++ b/Formula/sqlb-sqlite.rb @@ -0,0 +1,88 @@ +class SqlbSqlite < Formula + desc "Command-line interface for SQLite" + homepage "https://sqlite.org/index.html" + url "https://www.sqlite.org/2025/sqlite-autoconf-3480000.tar.gz" + version "3.48.0" + sha256 "ac992f7fca3989de7ed1fe99c16363f848794c8c32a158dafd4eb927a2e02fd5" + license "blessing" + + env :std + + 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/sqlitebrowser/homebrew-tap/releases/download/sqlb-sqlite-3.48.0" + sha256 cellar: :any, arm64_sonoma: "d831dc34302fe7e7dddc12eab7182a16211344a73f59fd84e58e4d53caf55dcc" + end + + keg_only :shadowed_by_macos + + depends_on arch: :arm64 + + def install + # Determine the minimum macOS version. + # Match the required version of the DB Browser for SQLite app. + ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.13" + ENV.append "CPPFLAGS", "-mmacosx-version-min=10.13" + ENV.append "LDFLAGS", "-mmacosx-version-min=10.13" + + ENV.append "CFLAGS", "-arch x86_64 -arch arm64" + + # 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_MATH_FUNCTIONS=1 + -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 + -DSQLITE_ENABLE_RTREE=1 + -DSQLITE_ENABLE_SNAPSHOT=1 + -DSQLITE_ENABLE_SOUNDEX=1 + -DSQLITE_ENABLE_STAT4=1 + -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 + -DSQLITE_MAX_ATTACHED=125 + -DSQLITE_MAX_VARIABLE_NUMBER=250000 + -DSQLITE_USE_URI=1 + ].join(" ") + + args = %W[ + --prefix=#{prefix} + --disable-dependency-tracking + --enable-dynamic-extensions + --disable-readline + --disable-editline + ] + + 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