Skip to content

Commit 8174f97

Browse files
authored
Merge pull request #2 from ziglang/master
sync with ziglang
2 parents 8c18725 + 15302e8 commit 8174f97

File tree

198 files changed

+15364
-9347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+15364
-9347
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ else()
196196
if(MSVC)
197197
set(ZIG_LLD_COMPILE_FLAGS "-std=c++11 -D_CRT_SECURE_NO_WARNINGS /w")
198198
else()
199-
set(ZIG_LLD_COMPILE_FLAGS "-std=c++11 -fno-exceptions -fno-rtti -Wno-comment")
199+
set(ZIG_LLD_COMPILE_FLAGS "-std=c++11 -fno-exceptions -fno-rtti -Wno-comment -Wno-class-memaccess -Wno-unknown-warning-option")
200200
endif()
201201
set_target_properties(embedded_lld_lib PROPERTIES
202202
COMPILE_FLAGS ${ZIG_LLD_COMPILE_FLAGS}

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
![ZIG](http://ziglang.org/zig-logo.svg)
1+
![ZIG](https://ziglang.org/zig-logo.svg)
22

33
A programming language designed for robustness, optimality, and
44
clarity.
55

6-
[ziglang.org](http://ziglang.org)
6+
[ziglang.org](https://ziglang.org)
77

88
## Feature Highlights
99

@@ -114,7 +114,7 @@ libc. Create demo games using Zig.
114114

115115
## Building
116116

117-
[![Build Status](https://travis-ci.org/zig-lang/zig.svg?branch=master)](https://travis-ci.org/zig-lang/zig)
117+
[![Build Status](https://travis-ci.org/ziglang/zig.svg?branch=master)](https://travis-ci.org/ziglang/zig)
118118
[![Build status](https://ci.appveyor.com/api/projects/status/4t80mk2dmucrc38i/branch/master?svg=true)](https://ci.appveyor.com/project/andrewrk/zig-d3l86/branch/master)
119119

120120
### Stage 1: Build Zig from C++ Source Code
@@ -161,7 +161,7 @@ bin/zig build --build-file ../build.zig test
161161

162162
##### Windows
163163

164-
See https://github.com/zig-lang/zig/wiki/Building-Zig-on-Windows
164+
See https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows
165165

166166
### Stage 2: Build Self-Hosted Zig from Zig Source Code
167167

@@ -182,6 +182,9 @@ binary.
182182

183183
This is the actual compiler binary that we will install to the system.
184184

185+
*Note: Stage 2 compiler is not yet able to build Stage 3. Building Stage 3 is
186+
not yet supported.*
187+
185188
#### Debug / Development Build
186189

187190
```

build.zig

+34-25
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn build(b: &Builder) !void {
1616
var docgen_exe = b.addExecutable("docgen", "doc/docgen.zig");
1717

1818
const rel_zig_exe = try os.path.relative(b.allocator, b.build_root, b.zig_exe);
19-
var docgen_cmd = b.addCommand(null, b.env_map, [][]const u8 {
19+
var docgen_cmd = b.addCommand(null, b.env_map, [][]const u8{
2020
docgen_exe.getOutputPath(),
2121
rel_zig_exe,
2222
"doc/langref.html.in",
@@ -30,7 +30,10 @@ pub fn build(b: &Builder) !void {
3030
const test_step = b.step("test", "Run all the tests");
3131

3232
// find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
33-
const build_info = try b.exec([][]const u8{b.zig_exe, "BUILD_INFO"});
33+
const build_info = try b.exec([][]const u8{
34+
b.zig_exe,
35+
"BUILD_INFO",
36+
});
3437
var index: usize = 0;
3538
const cmake_binary_dir = nextValue(&index, build_info);
3639
const cxx_compiler = nextValue(&index, build_info);
@@ -67,7 +70,10 @@ pub fn build(b: &Builder) !void {
6770
dependOnLib(exe, llvm);
6871

6972
if (exe.target.getOs() == builtin.Os.linux) {
70-
const libstdcxx_path_padded = try b.exec([][]const u8{cxx_compiler, "-print-file-name=libstdc++.a"});
73+
const libstdcxx_path_padded = try b.exec([][]const u8{
74+
cxx_compiler,
75+
"-print-file-name=libstdc++.a",
76+
});
7177
const libstdcxx_path = ??mem.split(libstdcxx_path_padded, "\r\n").next();
7278
if (mem.eql(u8, libstdcxx_path, "libstdc++.a")) {
7379
warn(
@@ -111,17 +117,11 @@ pub fn build(b: &Builder) !void {
111117

112118
test_step.dependOn(docs_step);
113119

114-
test_step.dependOn(tests.addPkgTests(b, test_filter,
115-
"test/behavior.zig", "behavior", "Run the behavior tests",
116-
with_lldb));
120+
test_step.dependOn(tests.addPkgTests(b, test_filter, "test/behavior.zig", "behavior", "Run the behavior tests", with_lldb));
117121

118-
test_step.dependOn(tests.addPkgTests(b, test_filter,
119-
"std/index.zig", "std", "Run the standard library tests",
120-
with_lldb));
122+
test_step.dependOn(tests.addPkgTests(b, test_filter, "std/index.zig", "std", "Run the standard library tests", with_lldb));
121123

122-
test_step.dependOn(tests.addPkgTests(b, test_filter,
123-
"std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests",
124-
with_lldb));
124+
test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", with_lldb));
125125

126126
test_step.dependOn(tests.addCompareOutputTests(b, test_filter));
127127
test_step.dependOn(tests.addBuildExampleTests(b, test_filter));
@@ -149,8 +149,7 @@ fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) vo
149149

150150
fn addCppLib(b: &Builder, lib_exe_obj: &std.build.LibExeObjStep, cmake_binary_dir: []const u8, lib_name: []const u8) void {
151151
const lib_prefix = if (lib_exe_obj.target.isWindows()) "" else "lib";
152-
lib_exe_obj.addObjectFile(os.path.join(b.allocator, cmake_binary_dir, "zig_cpp",
153-
b.fmt("{}{}{}", lib_prefix, lib_name, lib_exe_obj.target.libFileExt())) catch unreachable);
152+
lib_exe_obj.addObjectFile(os.path.join(b.allocator, cmake_binary_dir, "zig_cpp", b.fmt("{}{}{}", lib_prefix, lib_name, lib_exe_obj.target.libFileExt())) catch unreachable);
154153
}
155154

156155
const LibraryDep = struct {
@@ -161,11 +160,21 @@ const LibraryDep = struct {
161160
};
162161

163162
fn findLLVM(b: &Builder, llvm_config_exe: []const u8) !LibraryDep {
164-
const libs_output = try b.exec([][]const u8{llvm_config_exe, "--libs", "--system-libs"});
165-
const includes_output = try b.exec([][]const u8{llvm_config_exe, "--includedir"});
166-
const libdir_output = try b.exec([][]const u8{llvm_config_exe, "--libdir"});
163+
const libs_output = try b.exec([][]const u8{
164+
llvm_config_exe,
165+
"--libs",
166+
"--system-libs",
167+
});
168+
const includes_output = try b.exec([][]const u8{
169+
llvm_config_exe,
170+
"--includedir",
171+
});
172+
const libdir_output = try b.exec([][]const u8{
173+
llvm_config_exe,
174+
"--libdir",
175+
});
167176

168-
var result = LibraryDep {
177+
var result = LibraryDep{
169178
.libs = ArrayList([]const u8).init(b.allocator),
170179
.system_libs = ArrayList([]const u8).init(b.allocator),
171180
.includes = ArrayList([]const u8).init(b.allocator),
@@ -227,17 +236,17 @@ pub fn installCHeaders(b: &Builder, c_header_files: []const u8) void {
227236
}
228237

229238
fn nextValue(index: &usize, build_info: []const u8) []const u8 {
230-
const start = *index;
231-
while (true) : (*index += 1) {
232-
switch (build_info[*index]) {
239+
const start = index.*;
240+
while (true) : (index.* += 1) {
241+
switch (build_info[index.*]) {
233242
'\n' => {
234-
const result = build_info[start..*index];
235-
*index += 1;
243+
const result = build_info[start..index.*];
244+
index.* += 1;
236245
return result;
237246
},
238247
'\r' => {
239-
const result = build_info[start..*index];
240-
*index += 2;
248+
const result = build_info[start..index.*];
249+
index.* += 2;
241250
return result;
242251
},
243252
else => continue,

0 commit comments

Comments
 (0)