-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1338 from rzezeski/zig-0.11.0-squash
zig: update to 0.11.0
- Loading branch information
Showing
19 changed files
with
432 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set name=pkg.fmri value=pkg://$(PKGPUBLISHER)/ooce/developer/[email protected],$(SUNOSVER)-$(PVER) | ||
set name=pkg.renamed value=true | ||
depend fmri=pkg:/ooce/developer/zig-09 type=require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#!/usr/bin/bash | ||
# | ||
# {{{ CDDL HEADER | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# }}} | ||
|
||
# Copyright 2023 OmniOS Community Edition (OmniOSce) Association. | ||
|
||
. ../../lib/build.sh | ||
|
||
PROG=zig | ||
VER=0.11.0 | ||
MAJVER=${VER%%.*} | ||
MINVER=${VER%.*} | ||
MINVER=${MINVER#*.} | ||
PKG=ooce/developer/zig-011 | ||
SUMMARY="$PROG programming language" | ||
DESC="$PROG is a general-purpose programming language and toolchain for " | ||
DESC+="maintaining robust, optimal, and reusable software." | ||
|
||
# | ||
# Zig 0.11.x requires LLVM 16, which requires rel 151045 or later. | ||
# | ||
min_rel 151045 | ||
set_clangver 16 | ||
set_arch 64 | ||
|
||
CLANGFVER=`pkg_ver clang build-$CLANGVER.sh` | ||
|
||
set_patchdir patches-$MAJVER.$MINVER | ||
OPREFIX=$PREFIX | ||
PREFIX+=/$PROG-$MAJVER.$MINVER | ||
|
||
XFORM_ARGS=" | ||
-DOPREFIX=${OPREFIX#/} | ||
-DPREFIX=${PREFIX#/} | ||
-DPROG=$PROG | ||
-DPKGROOT=$PROG-$MAJVER.$MINVER | ||
-DMEDIATOR=$PROG -DMEDIATOR_VERSION=$MAJVER.$MINVER | ||
" | ||
|
||
# | ||
# CMAKE_BUILD_TYPE=RelWithDebInfo | ||
# | ||
# Keep debug info so symbols are available to the various | ||
# debugging tools. | ||
# | ||
# ZIG_STATIC_LLVM=on | ||
# | ||
# Embed the LLVM toolchain in the zig executable. This is | ||
# the preferred way to ship zig. | ||
# | ||
# ZIG_HOST_TARGET_ARCH=x86_64 | ||
# ZIG_HOST_TARGET_OS=solaris | ||
# ZIG_HOST_TARGET_TRIPLE=x86_64-solaris | ||
# | ||
# Manually set the triple. Otherwise it falls back to uname and | ||
# we get a bogus target. | ||
# | ||
# ZIG_TARGET_MCPU=baseline | ||
# | ||
# Target the compiler to pentium4-era CPU features so it can | ||
# work on the maximum set of hosts. This only effects the | ||
# compiler executable, applications built with this compiler | ||
# can set their own CPU features. | ||
# | ||
CONFIGURE_OPTS[amd64]=" | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo | ||
-DCMAKE_INSTALL_PREFIX=$PREFIX | ||
-DLLVM_INCLUDE_DIRS=$OPREFIX/llvm-$CLANGVER/include | ||
-DCLANG_INCLUDE_DIRS=$OPREFIX/llvm-$CLANGVER/include | ||
-DLLVM_LIBDIRS=$OPREFIX/llvm-$CLANGVER/lib | ||
-DCLANG_LIBDIRS=$OPREFIX/llvm-$CLANGVER/lib | ||
-DZIG_STATIC_LLVM=on | ||
-DZIG_HOST_TARGET_ARCH:STRING="x86_64" | ||
-DZIG_HOST_TARGET_OS:STRING="solaris" | ||
-DZIG_HOST_TARGET_TRIPLE:STRING="x86_64-solaris" | ||
-DZIG_TARGET_MCPU="baseline" | ||
" | ||
|
||
init | ||
|
||
######################################################################### | ||
# Download and build lld | ||
|
||
save_buildenv | ||
|
||
set_builddir llvm-project-$CLANGFVER.src/lld | ||
prep_build cmake+ninja | ||
|
||
CONFIGURE_OPTS[amd64]=" | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DLLVM_MAIN_SRC_DIR=$TMPDIR/llvm-project-$CLANGFVER.src/llvm | ||
" | ||
|
||
build_dependency -noctf lld-$CLANGVER llvm-project-$CLANGFVER.src/lld \ | ||
llvm llvm-project $CLANGFVER.src | ||
|
||
restore_buildenv | ||
|
||
CONFIGURE_OPTS[amd64]+=" | ||
-DLLD_INCLUDE_DIRS=$DEPROOT/usr/local/include | ||
-DLLD_LIBDIRS=$DEPROOT/usr/local/lib | ||
" | ||
|
||
######################################################################### | ||
|
||
note -n "Building $PROG" | ||
|
||
set_builddir $PROG-$VER | ||
|
||
CXXFLAGS+=" -fPIC" | ||
|
||
download_source $PROG $PROG $VER | ||
patch_source | ||
prep_build cmake+ninja | ||
build -noctf # C++ | ||
strip_install | ||
make_package | ||
clean_up | ||
|
||
# Vim hints | ||
# vim:ts=4:sw=4:et:fdm=marker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git a/lib/std/crypto/Certificate/Bundle.zig b/lib/std/crypto/Certificate/Bundle.zig | ||
index 3e28d12d0..ad08f9ad1 100644 | ||
--- a/lib/std/crypto/Certificate/Bundle.zig | ||
+++ b/lib/std/crypto/Certificate/Bundle.zig | ||
@@ -64,6 +64,7 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void { | ||
.netbsd => return rescanBSD(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"), | ||
.dragonfly => return rescanBSD(cb, gpa, "/usr/local/etc/ssl/cert.pem"), | ||
.windows => return rescanWindows(cb, gpa), | ||
+ .solaris => return rescanSolaris(cb, gpa, "/etc/ssl/cacert.pem"), | ||
else => {}, | ||
} | ||
} | ||
@@ -151,6 +152,15 @@ fn rescanWindows(cb: *Bundle, gpa: Allocator) RescanWindowsError!void { | ||
cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len); | ||
} | ||
|
||
+const RescanSolarisError = AddCertsFromFilePathError; | ||
+ | ||
+fn rescanSolaris(cb: *Bundle, gpa: Allocator, cert_file_path: []const u8) RescanSolarisError!void { | ||
+ cb.bytes.clearRetainingCapacity(); | ||
+ cb.map.clearRetainingCapacity(); | ||
+ try addCertsFromFilePathAbsolute(cb, gpa, cert_file_path); | ||
+ cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len); | ||
+} | ||
+ | ||
pub const AddCertsFromDirPathError = fs.File.OpenError || AddCertsFromDirError; | ||
|
||
pub fn addCertsFromDirPath( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
diff --git a/lib/std/c/solaris.zig b/lib/std/c/solaris.zig | ||
index 58d02416c..b7549e444 100644 | ||
--- a/lib/std/c/solaris.zig | ||
+++ b/lib/std/c/solaris.zig | ||
@@ -1069,7 +1069,21 @@ pub const mcontext_t = extern struct { | ||
}; | ||
|
||
pub const REG = struct { | ||
+ pub const R15 = 0; | ||
+ pub const R14 = 1; | ||
+ pub const R13 = 2; | ||
+ pub const R12 = 3; | ||
+ pub const R11 = 4; | ||
+ pub const R10 = 5; | ||
+ pub const R9 = 6; | ||
+ pub const R8 = 7; | ||
+ pub const RDI = 8; | ||
+ pub const RSI = 9; | ||
pub const RBP = 10; | ||
+ pub const RBX = 11; | ||
+ pub const RDX = 12; | ||
+ pub const RCX = 13; | ||
+ pub const RAX = 14; | ||
pub const RIP = 17; | ||
pub const RSP = 20; | ||
}; | ||
diff --git a/lib/std/dwarf/abi.zig b/lib/std/dwarf/abi.zig | ||
index 6fbd1fba4..3525b9cb4 100644 | ||
--- a/lib/std/dwarf/abi.zig | ||
+++ b/lib/std/dwarf/abi.zig | ||
@@ -247,7 +247,10 @@ pub fn regBytes( | ||
14 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R14]), | ||
15 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.R15]), | ||
16 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RIP]), | ||
- 17...32 => |i| mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]), | ||
+ 17...32 => |i| if (builtin.os.tag == .solaris) | ||
+ mem.asBytes(&ucontext_ptr.mcontext.fpregs.chip_state.xmm[i - 17]) | ||
+ else | ||
+ mem.asBytes(&ucontext_ptr.mcontext.fpregs.xmm[i - 17]), | ||
else => error.InvalidRegister, | ||
}, | ||
.freebsd => switch (reg_number) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
diff --git a/lib/std/target.zig b/lib/std/target.zig | ||
index c3d12b275..34e04f9aa 100644 | ||
--- a/lib/std/target.zig | ||
+++ b/lib/std/target.zig | ||
@@ -523,7 +523,6 @@ pub const Target = struct { | ||
.cloudabi, | ||
.dragonfly, | ||
.lv2, | ||
- .solaris, | ||
.zos, | ||
.minix, | ||
.rtems, | ||
@@ -565,6 +564,7 @@ pub const Target = struct { | ||
.watchos, | ||
.driverkit, | ||
.shadermodel, | ||
+ .solaris, | ||
=> return .none, | ||
} | ||
} | ||
@@ -1572,7 +1572,7 @@ pub const Target = struct { | ||
.netbsd => return copy(&result, "/libexec/ld.elf_so"), | ||
.openbsd => return copy(&result, "/usr/libexec/ld.so"), | ||
.dragonfly => return copy(&result, "/libexec/ld-elf.so.2"), | ||
- .solaris => return copy(&result, "/lib/64/ld.so.1"), | ||
+ .solaris => return copy(&result, "/usr/lib/amd64/ld.so.1"), | ||
.linux => switch (self.cpu.arch) { | ||
.x86, | ||
.sparc, | ||
diff --git a/lib/std/zig/system/NativeTargetInfo.zig b/lib/std/zig/system/NativeTargetInfo.zig | ||
index 97e9c31db..e87702ee2 100644 | ||
--- a/lib/std/zig/system/NativeTargetInfo.zig | ||
+++ b/lib/std/zig/system/NativeTargetInfo.zig | ||
@@ -257,10 +257,12 @@ fn detectAbiAndDynamicLinker( | ||
) DetectError!NativeTargetInfo { | ||
const native_target_has_ld = comptime builtin.target.hasDynamicLinker(); | ||
const is_linux = builtin.target.os.tag == .linux; | ||
+ const is_solaris = builtin.target.os.tag == .solaris; | ||
const have_all_info = cross_target.dynamic_linker.get() != null and | ||
cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu()); | ||
const os_is_non_native = cross_target.os_tag != null; | ||
- if (!native_target_has_ld or have_all_info or os_is_non_native) { | ||
+ // The Solaris/illumos environment is always the same. | ||
+ if (!native_target_has_ld or have_all_info or os_is_non_native or is_solaris) { | ||
return defaultAbiAndDynamicLinker(cpu, os, cross_target); | ||
} | ||
if (cross_target.abi) |abi| { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/build.zig b/build.zig | ||
index 87da0e695..e1bdc45ca 100644 | ||
--- a/build.zig | ||
+++ b/build.zig | ||
@@ -197,6 +197,11 @@ pub fn build(b: *std.Build) !void { | ||
exe.sanitize_thread = sanitize_thread; | ||
exe.entitlements = entitlements; | ||
|
||
+ // | ||
+ // We prefer to have the frame pointer in illumos. | ||
+ // | ||
+ exe.omit_frame_pointer = false; | ||
+ | ||
exe.build_id = b.option( | ||
std.Build.Step.Compile.BuildId, | ||
"build-id", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/build.zig b/build.zig | ||
index cb62d64da..87da0e695 100644 | ||
--- a/build.zig | ||
+++ b/build.zig | ||
@@ -666,6 +666,10 @@ fn addCmakeCfgOptionsToExe( | ||
try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); | ||
} | ||
}, | ||
+ .solaris => { | ||
+ try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); | ||
+ try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); | ||
+ }, | ||
else => {}, | ||
} | ||
} |
Oops, something went wrong.