From cfcca90dfcbb726c9deab38643d7ae98468e8bff Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Wed, 12 Jan 2022 18:54:13 +0100 Subject: [PATCH] Fixed broken linking --- .gitignore | 3 ++- Makefile | 18 +++++++++++++++++- vieter/archive.v | 13 +++++++++++++ vieter/repo.v | 4 ---- 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 vieter/archive.v diff --git a/.gitignore b/.gitignore index b96b80c2..cd150cdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.c data/ -vieter/vieter +vieter.exe +vieter-prod.exe # Ignore testing files *.pkg* diff --git a/Makefile b/Makefile index 0f1db9dd..5c6f8da0 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,20 @@ LARCHIVE_DIR := libarchive-$(LARCHIVE_VER) LARCHIVE_LIB := $(LARCHIVE_DIR)/.libs/libarchive.a # Custom V command for linking libarchive -V := LD_FLAGS=$(PWD)/$(LARCHIVE_LIB) v -cflags -I$(PWD)/$(LARCHIVE_DIR) +V := LDFLAGS=$(PWD)/$(LARCHIVE_LIB) v -cflags -I$(PWD)/$(LARCHIVE_DIR) + +# =====COMPILATION===== +.PHONY: vieter +vieter: + $(V) -cg -o vieter.exe vieter + +.PHONY: prod +prod: + $(V) -o vieter-prod.exe -prod vieter + + +# =====EXECUTION===== # Run the server in the default 'data' directory .PHONY: run run: libarchive @@ -16,6 +28,8 @@ run: libarchive watch: libarchive API_KEY=test REPO_DIR=data LOG_LEVEL=DEBUG $(V) watch run vieter + +# =====OTHER===== # Format the V codebase .PHONY: fmt fmt: @@ -31,6 +45,8 @@ customv: https://github.com/ChewingBever/v jjr-v '$(MAKE)' -C jjr-v + +# =====LIBARCHIVE===== .PHONY: libarchive libarchive: $(LARCHIVE_LIB) $(LARCHIVE_LIB): diff --git a/vieter/archive.v b/vieter/archive.v new file mode 100644 index 00000000..4830c24e --- /dev/null +++ b/vieter/archive.v @@ -0,0 +1,13 @@ +module archive + +#include "libarchive/archive.h" +#include "libarchive/archive_entry.h" + +struct C.archive {} +struct C.archive_entry {} + +fn C.archive_read_new() &C.archive + +pub fn list_filenames() { + a := C.archive_read_new() +} diff --git a/vieter/repo.v b/vieter/repo.v index c7e52bfd..6b307e89 100644 --- a/vieter/repo.v +++ b/vieter/repo.v @@ -2,10 +2,6 @@ module repo import os -#include "libarchive/archive.h" - -struct C.archive {} - const pkgs_subpath = 'pkgs' // Dummy struct to work around the fact that you can only share structs, maps &