dep

Package manager for embedded C libraries
git clone git://git.finwo.net/app/dep
Log | Files | Refs | README | LICENSE

commit 3d3644c0cbcf34731bd9dd8076f377eb7ece5a74
parent ae8a971403588e0ee3da09e752a5748a8b8cf067
Author: finwo <finwo@pm.me>
Date:   Sat, 14 Mar 2026 02:22:34 +0100

Fuck microsoft

Diffstat:
M.github/workflows/release.yml | 46+++-------------------------------------------
MMakefile | 22+++++-----------------
MREADME.md | 2++
Maction.yml | 16+---------------
Msrc/command/add/main.c | 4----
Msrc/command/install/main.c | 16----------------
Msrc/command/repository/main.c | 4----
Msrc/common/fs-utils.c | 8--------
Msrc/common/net-utils.c | 8--------
9 files changed, 11 insertions(+), 115 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml @@ -15,10 +15,6 @@ jobs: arch: x86_64 - os: linux arch: arm64 - - os: macos - arch: arm64 - - os: windows - arch: x86_64 steps: - name: Checkout code @@ -28,55 +24,19 @@ jobs: id: artifact run: | ARTIFACT="dep-${{ matrix.os }}-${{ matrix.arch }}" - if [ "${{ matrix.os }}" = "windows" ]; then - ARTIFACT="${ARTIFACT}.exe" - fi echo "name=$ARTIFACT" >> $GITHUB_OUTPUT - - name: Install dependencies (Linux) - if: matrix.os == 'linux' + - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y clang curl libcurl4-openssl-dev - - name: Set up Homebrew - if: matrix.os == 'macos' - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@main - - - name: Install dependencies (macOS) - if: matrix.os == 'macos' - run: | - brew install llvm - - - name: Install dependencies (Windows cross-compile) - if: matrix.os == 'windows' - run: | - sudo apt-get update - sudo apt-get install -y mingw-w64 curl - - - name: Build for Linux - if: matrix.os == 'linux' - run: make dep - - - name: Build for macOS - if: matrix.os == 'macos' + - name: Build run: make dep - - name: Build for Windows - if: matrix.os == 'windows' - run: | - make dep CC=x86_64-w64-mingw32-gcc LDFLAGS='-lwinhttp -lcrypt32' \ - EXE_EXT=.exe ARCH_TARGET=pep-x86-64 ARCH_BIN=i386 \ - OBJCOPY=x86_64-w64-mingw32-objcopy - - name: Rename binary run: | - if [ "${{ matrix.os }}" = "windows" ]; then - mv dep.exe ${{ steps.artifact.outputs.name }} - else - mv dep ${{ steps.artifact.outputs.name }} - fi + mv dep ${{ steps.artifact.outputs.name }} - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/Makefile b/Makefile @@ -3,13 +3,10 @@ CC?=clang FIND=$(shell which gfind find | head -1) OBJCOPY?=objcopy -UNAME_P:=$(shell uname -p) UNAME_M:=$(shell uname -m) ARCH_TARGET?=$(shell echo $(UNAME_M) | sed -e 's/x86_64/elf64-x86-64/' -e 's/arm64/elf64-littleaarch64/' -e 's/aarch64/elf64-littleaarch64/') ARCH_BIN?=$(shell echo $(UNAME_M) | sed -e 's/x86_64/i386/' -e 's/arm64/aarch64/' -e 's/aarch64/aarch64/') -EXE_EXT?= - SRC:= INCLUDES:= CFLAGS:= @@ -19,6 +16,7 @@ DESTDIR?=/usr/local SRC+=$(shell $(FIND) src/ -type f -name '*.c') INCLUDES+=-Isrc INCLUDES+=-Ilib/.dep/include + LIBS:= LIBS+=lib/cofyc/argparse @@ -29,17 +27,7 @@ SRC+=lib/emmanuel-marty/em_inflate/lib/em_inflate.c LIBS+=lib/erkkah/naett SRC+=lib/erkkah/naett/naett.c -ifeq ($(OS),Windows_NT) - LDFLAGS+=-lwinhttp -else - UNAME_S := $(shell uname -s) - ifeq ($(UNAME_S),Linux) - LDFLAGS+=-lcurl -lpthread - endif - ifeq ($(UNAME_S),Darwin) - LDFLAGS+=-framework Foundation - endif -endif +LDFLAGS+=-lcurl -lpthread LIBS+=lib/rxi/microtar SRC+=lib/rxi/microtar/src/microtar.c @@ -93,12 +81,12 @@ lib/tidwall/json.c: ${CC} $< ${CFLAGS} -c -o $@ dep: $(LIBS) $(OBJ) - ${CC} ${OBJ} ${CFLAGS} ${LDFLAGS} -o dep${EXE_EXT} - strip --strip-all dep${EXE_EXT} + ${CC} ${OBJ} ${CFLAGS} ${LDFLAGS} -o dep + strip --strip-all dep .PHONY: install install: dep - install dep${EXE_EXT} ${DESTDIR}/bin + install dep ${DESTDIR}/bin .PHONY: clean clean: diff --git a/README.md b/README.md @@ -31,6 +31,8 @@ Help topics: Installation ------------ +**Note: Windows is not supported.** This project only targets posix-compliant operating systems. + To install dep, build it from source and place the binary in your `$PATH`: ```sh diff --git a/action.yml b/action.yml @@ -12,9 +12,6 @@ runs: ARCH=$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]') ARTIFACT_NAME="dep-${OS}-${ARCH}" - if [ "$OS" = "windows" ]; then - ARTIFACT_NAME="${ARTIFACT_NAME}.exe" - fi echo "artifact_name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT @@ -44,9 +41,6 @@ runs: if [ -n "$DOWNLOAD_URL" ]; then echo "Downloading $ARTIFACT from release $TAG" curl -sL "$DOWNLOAD_URL" -o "${GITHUB_ACTION_PATH}/dist/dep" - if [ "$ARTIFACT" = "dep-windows-x86_64.exe" ]; then - mv "${GITHUB_ACTION_PATH}/dist/dep" "${GITHUB_ACTION_PATH}/dist/dep.exe" - fi echo "status=success" >> $GITHUB_OUTPUT else echo "Prebuilt binary not found for $ARTIFACT in release $TAG, will build from source" @@ -59,11 +53,6 @@ runs: run: | echo "Building dep from source..." - if [ "${{ runner.os }}" = "Windows" ]; then - echo "Windows source build not yet implemented, please use a released tag" - exit 1 - fi - cd "$GITHUB_ACTION_PATH" make clean || true make dep @@ -73,10 +62,7 @@ runs: - name: Make executable shell: bash - run: | - if [ "${{ runner.os }}" != "Windows" ]; then - chmod +x "${GITHUB_ACTION_PATH}/dist/dep" - fi + run: chmod +x "${GITHUB_ACTION_PATH}/dist/dep" - name: Extend executable path shell: bash diff --git a/src/command/add/main.c b/src/command/add/main.c @@ -7,10 +7,6 @@ #include <time.h> #include <unistd.h> -#ifndef LINE_MAX -#define LINE_MAX 4096 -#endif - #include "cofyc/argparse.h" #include "command/command.h" #include "common/fs-utils.h" diff --git a/src/command/install/main.c b/src/command/install/main.c @@ -5,10 +5,6 @@ #include <sys/stat.h> #include <unistd.h> -#ifndef LINE_MAX -#define LINE_MAX 4096 -#endif - #include "command/command.h" #include "common/github-utils.h" #include "common/net-utils.h" @@ -38,19 +34,11 @@ static int mkdir_recursive(const char *path) { for (p = tmp + 1; *p; p++) { if (*p == '/') { *p = '\0'; -#ifdef _WIN32 - mkdir(tmp); -#else mkdir(tmp, 0755); -#endif *p = '/'; } } -#ifdef _WIN32 - return mkdir(tmp); -#else return mkdir(tmp, 0755); -#endif } static char *trim_whitespace(char *str) { @@ -387,11 +375,7 @@ static int cmd_install(int argc, const char **argv) { } if (!dir_exists("lib")) { -#ifdef _WIN32 - if (mkdir("lib") != 0) { -#else if (mkdir("lib", 0755) != 0) { -#endif fprintf(stderr, "Error: could not create lib directory\n"); fclose(f); return 1; diff --git a/src/command/repository/main.c b/src/command/repository/main.c @@ -6,10 +6,6 @@ #include <sys/stat.h> #include <unistd.h> -#ifndef LINE_MAX -#define LINE_MAX 4096 -#endif - #include "../command.h" #include "cofyc/argparse.h" #include "common/fs-utils.h" diff --git a/src/common/fs-utils.c b/src/common/fs-utils.c @@ -53,19 +53,11 @@ int mkdir_recursive(const char *path) { for (p = tmp + 1; *p; p++) { if (*p == '/') { *p = '\0'; -#ifdef _WIN32 - mkdir(tmp); -#else mkdir(tmp, 0755); -#endif *p = '/'; } } -#ifdef _WIN32 - return mkdir(tmp); -#else return mkdir(tmp, 0755); -#endif } char *trim_whitespace(char *str) { diff --git a/src/common/net-utils.c b/src/common/net-utils.c @@ -41,19 +41,11 @@ static int mkdir_recursive(const char *path) { for (p = tmp + 1; *p; p++) { if (*p == '/') { *p = '\0'; -#ifdef _WIN32 - mkdir(tmp); -#else mkdir(tmp, 0755); -#endif *p = '/'; } } -#ifdef _WIN32 - return mkdir(tmp); -#else return mkdir(tmp, 0755); -#endif } /* Static helper for downloading with retries */