build: fix build on macos
This commit is contained in:
parent
9fe4bc0c1f
commit
3b80a36537
5 changed files with 34 additions and 13 deletions
|
@ -8,6 +8,8 @@ const cppflags = [_][]const u8{
|
|||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
"-Wpedantic",
|
||||
"-Wno-deprecated-declarations",
|
||||
"-Wno-unqualified-std-cast-call",
|
||||
"-Wno-bitwise-instead-of-logical", //for notcurses
|
||||
"-fno-sanitize=undefined",
|
||||
|
@ -24,12 +26,7 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const options_mod = options.createModule();
|
||||
|
||||
const target = b.standardTargetOptions(.{
|
||||
.default_target = if (tracy_enabled)
|
||||
CrossTarget.parse(.{ .arch_os_abi = "native-native-gnu" }) catch unreachable
|
||||
else
|
||||
CrossTarget.parse(.{ .arch_os_abi = "native-native-musl" }) catch unreachable,
|
||||
});
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const mode = .{ .target = target, .optimize = optimize };
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
.dependencies = .{
|
||||
.asio = .{
|
||||
.url = "https://github.com/kassane/asio/archive/5fc70d29f458f5b596a20bdf3d638294eef91478.tar.gz",
|
||||
.url = "https://github.com/kassane/asio/archive/cfec4608112abd44462afbad427d0f2ca3e30199.tar.gz",
|
||||
.hash = "1220926d7e934fcb9e4e55f25e24d17613fbe9b145798581e0ae7ea3679b37f4e44d",
|
||||
},
|
||||
.tracy = .{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#ifndef __APPLE__
|
||||
|
||||
#include <csignal>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
@ -99,4 +101,12 @@ extern "C" void install_jitdebugger() {
|
|||
install_debugger();
|
||||
else
|
||||
install_backtrace();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
extern "C" void install_debugger() {}
|
||||
extern "C" void install_backtrace() {}
|
||||
extern "C" void install_jitdebugger() {}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const c = @cImport({
|
||||
@cInclude("tests.h");
|
||||
});
|
||||
|
@ -17,7 +18,9 @@ test "debug" {
|
|||
}
|
||||
|
||||
test "endpoint_unx" {
|
||||
try testcase("endpoint_unx");
|
||||
if (builtin.os.tag == .linux) {
|
||||
try testcase("endpoint_unx");
|
||||
}
|
||||
}
|
||||
|
||||
test "endpoint_tcp" {
|
||||
|
|
19
zig
19
zig
|
@ -6,7 +6,17 @@ ARCH=$(uname -m)
|
|||
BASEDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ZIGDIR=$BASEDIR/.cache/zig
|
||||
VERSION=$(< build.zig.version)
|
||||
ZIGVER="zig-linux-$ARCH-$VERSION"
|
||||
|
||||
OS=$(uname)
|
||||
|
||||
if [ "$OS" == "Linux" ] ; then
|
||||
OS=linux
|
||||
elif [ "$OS" == "Darwin" ] ; then
|
||||
OS=macos
|
||||
fi
|
||||
|
||||
|
||||
ZIGVER="zig-$OS-$ARCH-$VERSION"
|
||||
ZIG=$ZIGDIR/$ZIGVER/zig
|
||||
|
||||
if [ "$1" == "update" ] ; then
|
||||
|
@ -14,13 +24,15 @@ if [ "$1" == "update" ] ; then
|
|||
NEWVERSION=$(< build.zig.version)
|
||||
|
||||
if [ "$VERSION" != "$NEWVERSION" ] ; then
|
||||
echo zig version updated from $VERSION to $NEWVERSION
|
||||
echo rebuilding to update cdb...
|
||||
$0 cdb
|
||||
exec $0
|
||||
exit 0
|
||||
fi
|
||||
echo zig version $VERSION is up-to-date
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
get_zig() {
|
||||
(
|
||||
mkdir -p "$ZIGDIR"
|
||||
|
@ -36,7 +48,6 @@ get_zig
|
|||
|
||||
if [ "$1" == "cdb" ] ; then
|
||||
rm -rf zig-cache
|
||||
rm -rf zig-bin
|
||||
rm -rf .cache/cdb
|
||||
|
||||
$ZIG build
|
||||
|
|
Loading…
Add table
Reference in a new issue