From bec88ec264193c8e6a7912de654dc908a11c59f7 Mon Sep 17 00:00:00 2001 From: BreakZer0 Date: Wed, 25 Mar 2026 19:01:32 +0100 Subject: [PATCH 1/3] refactor: rename basename to pkg_basename for macOS compat macOS declares basename() in with a conflicting return type, causing a compile error. Rename the static function to avoid the conflict. --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index af49c62..274aeac 100644 --- a/main.c +++ b/main.c @@ -28,7 +28,7 @@ along with this program; see the file COPYING. If not, see * **/ static const char* -basename(const char *path) { +pkg_basename(const char *path) { const char* ptr = path; while(path && *path) { @@ -139,14 +139,14 @@ int main(int argc, char *argv[]) { } if(!output[0]) { - strcpy(output, basename(url)); + strcpy(output, pkg_basename(url)); if(endswith(output, ".json")) { output[strlen(output)-5] = 0; strcat(output, ".pkg"); } } - if(dl_package(url, output, on_progress, (void*)basename(output))) { + if(dl_package(url, output, on_progress, (void*)pkg_basename(output))) { return -1; } From 94c4cec97145d13911c36d92eba91f1e13ce1013 Mon Sep 17 00:00:00 2001 From: BreakZer0 Date: Wed, 25 Mar 2026 19:01:36 +0100 Subject: [PATCH 2/3] feat: add Makefile.macos for macOS builds Uses Homebrew's curl include/lib paths via brew --prefix, supporting both Apple Silicon and Intel Macs. --- Makefile.macos | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Makefile.macos diff --git a/Makefile.macos b/Makefile.macos new file mode 100644 index 0000000..9e36109 --- /dev/null +++ b/Makefile.macos @@ -0,0 +1,31 @@ +# Copyright (C) 2024 John Törnblom +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not see +# . + +BREW_PREFIX := $(shell brew --prefix) +CURL_PREFIX := $(BREW_PREFIX)/opt/curl + +CFLAGS := -O2 -Wall -Werror -I$(CURL_PREFIX)/include +LDFLAGS := -L$(CURL_PREFIX)/lib +LDADD := -lcurl + +ELF := fetchpkg +all: $(ELF) + +$(ELF): main.c dl.c parson.c sha256.c sha1.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDADD) + +clean: + rm -f $(ELF) From 5c3c0684c37d96bcf9d405bea5b9d452b1ee5723 Mon Sep 17 00:00:00 2001 From: BreakZer0 Date: Wed, 25 Mar 2026 19:12:18 +0100 Subject: [PATCH 3/3] ci: add macOS workflow Runs on macos-latest after CI completes successfully. Builds with Homebrew curl and uploads arm64 artifact. --- .github/workflows/ci.macos.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/ci.macos.yml diff --git a/.github/workflows/ci.macos.yml b/.github/workflows/ci.macos.yml new file mode 100644 index 0000000..84d58db --- /dev/null +++ b/.github/workflows/ci.macos.yml @@ -0,0 +1,33 @@ +name: CI macOS + +on: + workflow_run: + workflows: ["CI"] + types: + - completed + +concurrency: + group: macos-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: macos-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Install dependencies + run: brew install curl + + - name: Build macOS + run: make -f Makefile.macos + + - name: Upload macOS + uses: actions/upload-artifact@v4 + with: + name: macOS-arm64 + path: ./fetchpkg + if-no-files-found: error