commit 23767a719568e1e5ac1a5a14b75b2c60e04fdcc2 Author: rapture.party Date: Thu Apr 16 16:41:50 2026 -0400 Initial commit diff --git a/.gitea/workflows/update-formula.yml b/.gitea/workflows/update-formula.yml new file mode 100644 index 0000000..6c1b25b --- /dev/null +++ b/.gitea/workflows/update-formula.yml @@ -0,0 +1,88 @@ +name: Update Formulas + +on: + schedule: + - cron: '0 6 * * *' + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Checkout tap + uses: actions/checkout@v4 + + - name: Check for new release + id: check + shell: bash + run: | + RELEASE=$(curl -sf \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/encounter/objdiff/releases/latest) + + VERSION=$(echo "$RELEASE" | jq -r '.tag_name' | sed 's/^v//') + CURRENT=$(grep 'version "' Formula/objdiff-cli.rb | head -1 | sed 's/.*version "\([^"]*\)".*/\1/') + + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "current=$CURRENT" >> "$GITHUB_OUTPUT" + + if [ "$VERSION" = "$CURRENT" ]; then + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "Already on $VERSION, nothing to do." + else + echo "changed=true" >> "$GITHUB_OUTPUT" + echo "Updating $CURRENT -> $VERSION" + echo "$RELEASE" > /tmp/release.json + fi + + - name: Update formulas + if: steps.check.outputs.changed == 'true' + run: | + VERSION="${{ steps.check.outputs.version }}" + + # Pull sha256 from the digest field GitHub already provides in the API — + # no need to download any binaries. + extract_sha() { + jq -r --arg name "\$1" \ + '.assets[] | select(.name == $name) | .digest | ltrimstr("sha256:")' \ + /tmp/release.json + } + + # Replace sha256 line identified by the trailing comment (the binary name). + update_sha() { + local file="\$1" name="\$2" + local sha + sha=$$(extract_sha "$$name") + sed -i "s|sha256 \"[a-f0-9]*\" # $$name|sha256 \"$$sha\" # $$name|" "$$file" + } + + # Bump version in both formulas (url lines use #{version} interpolation, + # so they update automatically) + sed -i "s|version \"[^\"]*\"|version \"$VERSION\"|" Formula/objdiff-cli.rb + sed -i "s|version \"[^\"]*\"|version \"$VERSION\"|" Formula/objdiff.rb + + # Update sha256s — CLI + update_sha Formula/objdiff-cli.rb objdiff-cli-macos-arm64 + update_sha Formula/objdiff-cli.rb objdiff-cli-macos-x86_64 + update_sha Formula/objdiff-cli.rb objdiff-cli-linux-aarch64 + update_sha Formula/objdiff-cli.rb objdiff-cli-linux-x86_64 + + # Update sha256s — GUI + update_sha Formula/objdiff.rb objdiff-macos-arm64 + update_sha Formula/objdiff.rb objdiff-macos-x86_64 + update_sha Formula/objdiff.rb objdiff-linux-x86_64 + + - name: Commit and push + if: steps.check.outputs.changed == 'true' + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.name "gitea-actions[bot]" + git config user.email "gitea-actions[bot]@noreply" + # Re-point origin to include the token so push is authenticated. + # GITHUB_SERVER_URL in Gitea Actions is your instance URL. + git remote set-url origin \ + "https://x-access-token:$${TOKEN}@$${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" + git add Formula/ + git commit -m "chore: bump objdiff to v${{ steps.check.outputs.version }}" + git push diff --git a/Formula/objdiff-cli.rb b/Formula/objdiff-cli.rb new file mode 100644 index 0000000..5ef7659 --- /dev/null +++ b/Formula/objdiff-cli.rb @@ -0,0 +1,42 @@ +class ObjdiffCli < Formula + desc "CLI for diffing object files in decompilation projects" + homepage "https://github.com/encounter/objdiff" + version "3.7.1" + license "MIT OR Apache-2.0" + + on_macos do + on_arm do + url "https://github.com/encounter/objdiff/releases/download/v#{version}/objdiff-cli-macos-arm64" + sha256 "acd0f01e40319c862c84effd9f744a6ccfeec10074cbc89ef232d96d333ab528" # objdiff-cli-macos-arm64 + end + on_intel do + url "https://github.com/encounter/objdiff/releases/download/v#{version}/objdiff-cli-macos-x86_64" + sha256 "4b0f9aed00d5c71a9ea46e97c7887236dd9e5cc827c06d73c6ebd220fd4396fa" # objdiff-cli-macos-x86_64 + end + end + + on_linux do + on_arm do + url "https://github.com/encounter/objdiff/releases/download/v#{version}/objdiff-cli-linux-aarch64" + sha256 "5b0a3ada0a1ecfca93114cfb36f4caa1587f767923eb3643b24b6aa9a65d1f5d" # objdiff-cli-linux-aarch64 + end + on_intel do + url "https://github.com/encounter/objdiff/releases/download/v#{version}/objdiff-cli-linux-x86_64" + sha256 "40d856da01e0a676c0f33af534e562f098cd50e45ecb64f3b346418c7b264ae6" # objdiff-cli-linux-x86_64 + end + end + + def install + if OS.mac? + arch = Hardware::CPU.arm? ? "arm64" : "x86_64" + bin.install "objdiff-cli-macos-#{arch}" => "objdiff-cli" + else + arch = Hardware::CPU.arm? ? "aarch64" : "x86_64" + bin.install "objdiff-cli-linux-#{arch}" => "objdiff-cli" + end + end + + test do + system "#{bin}/objdiff-cli", "--version" + end +end diff --git a/Formula/objdiff.rb b/Formula/objdiff.rb new file mode 100644 index 0000000..ef61009 --- /dev/null +++ b/Formula/objdiff.rb @@ -0,0 +1,38 @@ +class Objdiff < Formula + desc "Visual diff tool for object files in decompilation projects" + homepage "https://github.com/encounter/objdiff" + version "3.7.1" + license "MIT OR Apache-2.0" + + on_macos do + on_arm do + url "https://github.com/encounter/objdiff/releases/download/v#{version}/objdiff-macos-arm64" + sha256 "fcb2492d4f123e9c43b83c5ea0acaf079b6dc92b3e53e1d0307f6664fe803686" # objdiff-macos-arm64 + end + on_intel do + url "https://github.com/encounter/objdiff/releases/download/v#{version}/objdiff-macos-x86_64" + sha256 "a1e80f9c5494adb604d2be61361196d7f2cc9415dcf3a05d0cc4a0529e6eb6fb" # objdiff-macos-x86_64 + end + end + + on_linux do + on_intel do + url "https://github.com/encounter/objdiff/releases/download/v#{version}/objdiff-linux-x86_64" + sha256 "2e904f63258fcee5f98e6d36594a2fcea250caacfe97c49b4544470d6805aaaf" # objdiff-linux-x86_64 + end + end + + def install + if OS.mac? + arch = Hardware::CPU.arm? ? "arm64" : "x86_64" + bin.install "objdiff-macos-#{arch}" => "objdiff" + else + bin.install "objdiff-linux-x86_64" => "objdiff" + end + end + + test do + # GUI won't run headless; just verify the binary exists and is executable + assert_predicate bin/"objdiff", :exist? + end +end