From 25f7ef37b1e9a175bed45766f1ababc644615409 Mon Sep 17 00:00:00 2001 From: SeongTae Jeong Date: Sun, 16 Jun 2024 18:43:07 +0900 Subject: [PATCH] Set to use the new Homebrew formulae Fix #3654, #3659 --- .github/workflows/build-macos.yml | 6 +++-- BUILDING.md | 38 +++---------------------------- CMakeLists.txt | 6 ++--- installer/macos/notarize.sh | 14 ++++++------ 4 files changed, 17 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index ff8f025b..ad4a9b89 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -34,7 +34,9 @@ jobs: run: | brew update brew tap sqlitebrowser/tap - brew install db4subqt@5 db4subsqlcipher db4subsqlitefts@5 ninja + brew unlink openssl@3 + brew install sqlb-openssl@3 + brew install sqlb-qt@5 sqlb-sqlcipher sqlb-sqlite ninja npm install -g appdmg - name: Configure build @@ -65,7 +67,7 @@ jobs: run: ninja test - name: Build Extension - run: clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-formats.c + run: clang -I /opt/homebrew/opt/sqlb-sqlite/include -L /opt/homebrew/opt/sqlb-sqlite/lib -fno-common -dynamiclib src/extensions/extension-formats.c - if: github.event_name != 'pull_request' name: Notarization diff --git a/BUILDING.md b/BUILDING.md index 6e14a3ef..5d6761ae 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -27,7 +27,6 @@ The wiki has information that is a bit more detailed or less common, but may be - [OpenSUSE](#opensuse) - [macOS](#macos) - [Build an `.app` bundle](#build-an-app-bundle) - - [Add the extension to the app bundle (Optional)](#add-the-extension-to-the-app-bundle-optional) - [Windows](#windows) - [Compiling on Windows with MSVC](#compiling-on-windows-with-msvc) - [Cross compiling for Windows](#cross-compiling-for-windows) @@ -138,11 +137,9 @@ It requires SQLite and at least Qt 5.15.9 to be installed first. These are the ```bash brew tap sqlitebrowser/tap # If you are using Apple Silicon Mac -brew install db4subqt@5 db4subsqlcipher db4subsqlitefts@5 -# If you are using Intel Mac -brew install db4sqt@5 db4ssqlcipher db4ssqlitefts@5 +brew install sqlb-qt@5 sqlb-sqlcipher sqlb-sqlite ``` -> You can don't need SQLCipher support, you can skip `db4ssqlcipher` and `db4ssqlitefts@5`. +> You can don't need SQLCipher support, you can skip `sqlb-sqlcipher`. Then it's just a matter of getting the source: @@ -163,39 +160,10 @@ mv DB\ Browser\ for\ SQLite.app /Applications > If you want to build universal binary, change the `cmake` command to
> `cmake -DcustomTap=1 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" ..`
-> Of course, this requires you to have an Apple Silicon Mac and an installation of formula starting with `db4sub`. +> Of course, this requires you to have an Apple Silicon Mac. An icon for "DB Browser for SQLite" should now be in your main macOS Applications list, ready to launch. -#### Add the extension to the app bundle (Optional) - -> **Note**: The following lines look a bit complicated, but are all commands that you need to run. - -```bash -/opt/homebrew/opt/db4sqtub@5/bin/macdeployqt DB\ Browser\ for\ SQLite.app -mkdir build/DB\ Browser\ for\ SQLite.app/Contents/Extensions -clang -I /opt/homebrew/opt/db4ssqliteftsub@5/include -L /opt/homebrew/opt/db4ssqliteftsub@5/lib -fno-common -dynamiclib src/extensions/extension-formats.c -o formats-arm64.dylib -arch -x86_64 clang -I /opt/homebrew/opt/db4ssqliteftsub@5/include -L /opt/homebrew/opt/db4ssqliteftsub@5/lib -fno-common -dynamiclib src/extensions/extension-formats.c -o formats-x86_64.dylib -lipo -create -output build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/formats.dylib formats-arm64.dylib formats-x86_64.dylib -install_name_tool -id "@executable_path/../Extensions/formats.dylib" build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/formats.dylib -ln -s formats.dylib build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/formats.dylib.dylib - -clang -I /opt/homebrew/opt/db4ssqliteftsub@5/include -L /opt/homebrew/opt/db4ssqliteftsub@5/lib -fno-common -dynamiclib src/extensions/extension-functions.c -o math-arm64.dylib -arch -x86_64 clang -I /opt/homebrew/opt/db4ssqliteftsub@5/include -L /opt/homebrew/opt/db4ssqliteftsub@5/lib -fno-common -dynamiclib src/extensions/extension-functions.c -o math-x86_64.dylib -lipo -create -output build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/math.dylib math-arm64.dylib math-x86_64.dylib -install_name_tool -id "@executable_path/../Extensions/math.dylib" build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/math.dylib -ln -s math.dylib build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/math.dylib.dylib - -curl -L -o src/extensions/fileio.c 'https://sqlite.org/src/raw?filename=ext/misc/fileio.c&ci=trunk' -curl -L -o src/extensions/test_windirent.c 'https://sqlite.org/src/raw?filename=src/test_windirent.c&ci=trunk' -curl -L -o src/extensions/test_windirent.h 'https://sqlite.org/src/raw?filename=src/test_windirent.h&ci=trunk' -clang -I /opt/homebrew/opt/db4ssqliteftsub@5/include -L /opt/homebrew/opt/db4ssqliteftsub@5/lib -fno-common -dynamiclib src/extensions/fileio.c src/extensions/test_windirent.c -o fileio-arm64.dylib -arch -x86_64 clang -I /opt/homebrew/opt/db4ssqliteftsub@5/include -L /opt/homebrew/opt/db4ssqliteftsub@5/lib -fno-common -dynamiclib src/extensions/fileio.c src/extensions/test_windirent.c -o fileio-x86_64.dylib -lipo -create -output build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/fileio.dylib fileio-arm64.dylib fileio-x86_64.dylib -install_name_tool -id "@executable_path/../Extensions/fileio.dylib" build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/fileio.dylib -ln -s fileio.dylib build/DB\ Browser\ for\ SQLite.app/Contents/Extensions/fileio.dylib.dylib -``` - > Also, we have a CI workflow for macOS, you can check it out [here](https://github.com/sqlitebrowser/sqlitebrowser/blob/master/.github/workflows/build-macos.yml) ### Windows diff --git a/CMakeLists.txt b/CMakeLists.txt index 028725f2..c0c4c1e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,12 +123,12 @@ if(APPLE) # For Apple Silicon Mac's and install dependencies via our Homebrew tap(sqlitebrowser/homebrew-tap) if(customTap AND EXISTS /opt/homebrew/opt/) - list(PREPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/db4subqt@5") - list(PREPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/db4subsqlitefts@5") + list(PREPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/sqlb-qt@5") + list(PREPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/sqlb-sqlite") if(sqlcipher) list(APPEND SQLCIPHER_INCLUDE_DIR "/opt/homebrew/include") - list(APPEND SQLCIPHER_LIBRARY "/opt/homebrew/opt/db4subsqlcipher/lib/libsqlcipher.0.dylib") + list(APPEND SQLCIPHER_LIBRARY "/opt/homebrew/opt/sqlb-sqlcipher/lib/libsqlcipher.0.dylib") endif() endif() endif() diff --git a/installer/macos/notarize.sh b/installer/macos/notarize.sh index 0b992896..b0433e06 100644 --- a/installer/macos/notarize.sh +++ b/installer/macos/notarize.sh @@ -10,7 +10,7 @@ security import $CERTIFICATE_PATH -P "$P12_PW" -A -t cert -f pkcs12 -k $KEYCHAIN security list-keychain -d user -s $KEYCHAIN_PATH # Run macdeployqt -find build -name "DB Browser for SQL*.app" -exec $(brew --prefix db4subqt@5)/bin/macdeployqt {} -sign-for-notarization=$DEV_ID \; +find build -name "DB Browser for SQL*.app" -exec $(brew --prefix sqlb-qt@5)/bin/macdeployqt {} -sign-for-notarization=$DEV_ID \; # Add the 'formats' and 'nalgeon/sqlean' extensions to the app bundle gh auth login --with-token <<< "$GH_TOKEN" @@ -23,7 +23,7 @@ for TARGET in $(find build -name "DB Browser for SQL*.app" | sed -e 's/ /_/g'); TARGET=$(echo $TARGET | sed -e 's/_/ /g') mkdir "$TARGET/Contents/Extensions" - clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-formats.c -o "$TARGET/Contents/Extensions/formats.dylib" + clang -I /opt/homebrew/opt/sqlb-sqlite/include -L /opt/homebrew/opt/sqlb-sqlite/lib -fno-common -dynamiclib src/extensions/extension-formats.c -o "$TARGET/Contents/Extensions/formats.dylib" if [ -f "$TARGET/Contents/Extensions/formats.dylib" ]; then install_name_tool -id "@executable_path/../Extensions/formats.dylib" "$TARGET/Contents/Extensions/formats.dylib" ln -s formats.dylib "$TARGET/Contents/Extensions/formats.dylib.dylib" @@ -47,11 +47,11 @@ for TARGET in $(find build -name "DB Browser for SQL*.app" | sed -e 's/ /_/g'); TARGET=$(echo $TARGET | sed -e 's/_/ /g') mkdir "$TARGET/Contents/translations" for i in ar cs de en es fr it ko pl pt pt_BR ru uk zh_CN zh_TW; do - find $(brew --prefix db4subqt@5)/translations -name "qt_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; - find $(brew --prefix db4subqt@5)/translations -name "qtbase_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; - find $(brew --prefix db4subqt@5)/translations -name "qtmultimedia_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; - find $(brew --prefix db4subqt@5)/translations -name "qtscript_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; - find $(brew --prefix db4subqt@5)/translations -name "qtxmlpatterns_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; + find $(brew --prefix sqlb-qt@5)/translations -name "qt_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; + find $(brew --prefix sqlb-qt@5)/translations -name "qtbase_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; + find $(brew --prefix sqlb-qt@5)/translations -name "qtmultimedia_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; + find $(brew --prefix sqlb-qt@5)/translations -name "qtscript_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; + find $(brew --prefix sqlb-qt@5)/translations -name "qtxmlpatterns_${i}.qm" 2> /dev/null -exec cp {} "$TARGET/Contents/translations/" \; done done