From 2a5d9a05c6854d251afcbd2fa2f4819a3a0ba015 Mon Sep 17 00:00:00 2001 From: Ksenia Date: Sun, 22 Mar 2026 22:29:44 +0100 Subject: [PATCH 1/4] Move exe/so build to a separate workflow --- .github/workflows/exe.yml | 46 ++++++++++++++++++++++++++++++ .github/workflows/manual-build.yml | 2 ++ .github/workflows/release.yml | 32 +-------------------- 3 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/exe.yml diff --git a/.github/workflows/exe.yml b/.github/workflows/exe.yml new file mode 100644 index 0000000..db39c39 --- /dev/null +++ b/.github/workflows/exe.yml @@ -0,0 +1,46 @@ +name: Build exe and so + +on: + workflow_call: + inputs: + upload-artifact: + type: boolean + required: false + default: true + +jobs: + build_exe: + name: Build the executable file and shared library for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + steps: + + - name: Install X11 dependencies (macOS) + if: runner.os == 'macOS' + run: brew install libx11 libxpm pkg-config + + - name: install X11 dependencies (Linux) + if: ${{ runner.os == 'Linux' }} + run: | + sudo apt-get update + sudo apt install -y libx11-dev libxpm-dev x11proto-dev + + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - run: make v v.so + + - name: Upload wheels + if: ${{ inputs.upload-artifact }} + uses: actions/upload-artifact@v6 + with: + path: | + ./v + ./v.so + name: v.${{ matrix.os }}.exe + if-no-files-found: error diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml index da016eb..b32fbbc 100644 --- a/.github/workflows/manual-build.yml +++ b/.github/workflows/manual-build.yml @@ -6,3 +6,5 @@ on: jobs: wheels: uses: ./.github/workflows/wheels.yml + exe: + uses: ./.github/workflows/exe.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8c9808..d13935f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,38 +19,8 @@ jobs: ################################################################################################################################ build_exe: - name: Build the executable file and shared library for ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] + uses: ./.github/workflows/exe.yml - steps: - - - name: Install X11 dependencies (macOS) - if: runner.os == 'macOS' - run: brew install libx11 libxpm pkg-config - - - name: install X11 dependencies - if: ${{ runner.os == 'Linux' }} - run: | - sudo apt-get update - sudo apt install -y libx11-dev libxpm-dev x11proto-dev - - - uses: actions/checkout@v6 - with: - persist-credentials: false - - - run: make v v.so - - - uses: actions/upload-artifact@v6 - with: - path: | - ./v - ./v.so - name: v.${{ matrix.os }}.exe - if-no-files-found: error ################################################################################################################################ From 8a642caf399e4b3fbc2d49bede9c7874261a92c0 Mon Sep 17 00:00:00 2001 From: Ksenia Date: Sun, 22 Mar 2026 22:30:23 +0100 Subject: [PATCH 2/4] Add include and lib dirs --- makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 1578e53..33b83ef 100644 --- a/makefile +++ b/makefile @@ -37,8 +37,9 @@ export VERSION_FLAGS=-DGIT_HASH="\"$(shell git rev-parse HEAD 2> /dev/null || ec -DBUILD_USER="\"$(USER)@$(HOSTNAME)\""\ -DBUILD_DIRECTORY="\"$(PWD)\"" +X11DIR= $(shell pkg-config --libs-only-L x11 xpm) # for macOS CFLAGS= -c -std=gnu11 $(OPT) $(GPROF) $(W) $(GDB) -OFLAGS= -lm $(GPROF) -lX11 -lXpm +OFLAGS= -lm $(GPROF) -lX11 -lXpm $(X11DIR) SRCDIR=src OBJDIR=obj @@ -46,6 +47,7 @@ PICDIR=obj-pic SRCDIRS=$(shell find $(SRCDIR) -type d) INCL=$(SRCDIRS:%=-I./%) +INCL+=$(shell pkg-config --cflags-only-I x11 xpm) # for macOS allsrc=$(shell find $(SRCDIR) -type f -name '*.c') allobj=$(allsrc:$(SRCDIR)/%.c=$(OBJDIR)/%.o) From e047f60749048163841107d689cdd8acc2a14c36 Mon Sep 17 00:00:00 2001 From: Ksenia Date: Sun, 22 Mar 2026 22:59:01 +0100 Subject: [PATCH 3/4] Change soname to the mac linker option for macos --- makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 33b83ef..e134b76 100644 --- a/makefile +++ b/makefile @@ -37,6 +37,13 @@ export VERSION_FLAGS=-DGIT_HASH="\"$(shell git rev-parse HEAD 2> /dev/null || ec -DBUILD_USER="\"$(USER)@$(HOSTNAME)\""\ -DBUILD_DIRECTORY="\"$(PWD)\"" +OS := $(shell uname) +ifeq ($(OS),Darwin) + SONAME := install_name,@rpath/ +else + SONAME := soname, +endif + X11DIR= $(shell pkg-config --libs-only-L x11 xpm) # for macOS CFLAGS= -c -std=gnu11 $(OPT) $(GPROF) $(W) $(GDB) OFLAGS= -lm $(GPROF) -lX11 -lXpm $(X11DIR) @@ -66,7 +73,7 @@ v : $(allobj) $(CC) $^ -o $@ $(OFLAGS) v.so: $(allpic) - $(CC) $^ -shared -Wl,-soname,$@ $(OFLAGS) -o $@ + $(CC) $^ -shared -Wl,-$(SONAME)$@ $(OFLAGS) -o $@ $(OBJDIR)/%.o : $(SRCDIR)/%.c $(CC) $(CFLAGS) $< -o $@ $(INCL) $(VERSION_FLAGS) -MMD -MT "$@ $(patsubst $(OBJDIR)%,$(PICDIR)%,$@)" From 6e57d5df7354e947f15dbf5c2600f5510eaf7a3c Mon Sep 17 00:00:00 2001 From: Ksenia Date: Sun, 22 Mar 2026 22:47:33 +0100 Subject: [PATCH 4/4] Update brew install to avoid workflow warning --- .github/workflows/exe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/exe.yml b/.github/workflows/exe.yml index db39c39..d1b1f88 100644 --- a/.github/workflows/exe.yml +++ b/.github/workflows/exe.yml @@ -21,7 +21,7 @@ jobs: - name: Install X11 dependencies (macOS) if: runner.os == 'macOS' - run: brew install libx11 libxpm pkg-config + run: brew install libxpm # libx11 - name: install X11 dependencies (Linux) if: ${{ runner.os == 'Linux' }}