From 0278ac85a04309c8777663afe733e984a44bbcc8 Mon Sep 17 00:00:00 2001 From: Al Hoang <3811822-hoanga@users.noreply.gitlab.com> Date: Tue, 8 Mar 2022 23:48:25 -0600 Subject: [PATCH] update to build for FreeBSD --- Makefile | 6 ++++++ core/os/os_freebsd.odin | 4 ++-- core/os/stat_unix.odin | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ceff3c207..b8bf26a88 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,12 @@ ifeq ($(OS), OpenBSD) CFLAGS:=$(CFLAGS) $(shell $(LLVM_CONFIG) --cxxflags --ldflags) LDFLAGS:=$(LDFLAGS) $(shell $(LLVM_CONFIG) --libs core native --system-libs) endif +ifeq ($(OS), FreeBSD) + LLVM_CONFIG=/usr/local/bin/llvm-config11 + + CFLAGS:=$(CFLAGS) $(shell $(LLVM_CONFIG) --cxxflags --ldflags) + LDFLAGS:=$(LDFLAGS) $(shell $(LLVM_CONFIG) --libs core native --system-libs) +endif all: debug demo diff --git a/core/os/os_freebsd.odin b/core/os/os_freebsd.odin index e31eb31bb..4f31b1492 100644 --- a/core/os/os_freebsd.odin +++ b/core/os/os_freebsd.odin @@ -232,10 +232,10 @@ foreign libc { @(link_name="close") _unix_close :: proc(fd: Handle) -> c.int --- @(link_name="read") _unix_read :: proc(fd: Handle, buf: rawptr, size: c.size_t) -> c.ssize_t --- @(link_name="write") _unix_write :: proc(fd: Handle, buf: rawptr, size: c.size_t) -> c.ssize_t --- - @(link_name="lseek64") _unix_seek :: proc(fd: Handle, offset: i64, whence: c.int) -> i64 --- + @(link_name="lseek") _unix_seek :: proc(fd: Handle, offset: i64, whence: c.int) -> i64 --- @(link_name="gettid") _unix_gettid :: proc() -> u64 --- @(link_name="getpagesize") _unix_getpagesize :: proc() -> c.int --- - @(link_name="stat64") _unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> c.int --- + @(link_name="stat") _unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> c.int --- @(link_name="fstat") _unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> c.int --- @(link_name="access") _unix_access :: proc(path: cstring, mask: c.int) -> c.int --- diff --git a/core/os/stat_unix.odin b/core/os/stat_unix.odin index 2aa9fc283..c82466b08 100644 --- a/core/os/stat_unix.odin +++ b/core/os/stat_unix.odin @@ -1,4 +1,4 @@ -//+build linux, darwin, freebsd, openbsd +//+build linux, darwin, openbsd package os import "core:time"