authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-29 18:25:49-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-29 18:25:49-04:00
log75d42ace31e8965a6bce04965dfc4a9a7b322b4f
treed81aaf04ab871e33e162a7b3c6cc02d5621352c1
parenta4e506510b202685d859e366feeeb76e09252ba0
parent360ab8310ba55586611c1b97d34782f85049c329
signaturelock-open Commit is signed but in an unrecognized format.

Merge branch 'squeek502-readme-std-lib'


1 files changed, 95 insertions(+), 4 deletions(-)

README.md+95-4
......@@ -135,7 +135,7 @@ Zig is an open-source programming language designed for **robustness**,
135135 * Reddit: [/r/zig](https://www.reddit.com/r/zig)
136136 * Email list: [~andrewrk/ziglang@lists.sr.ht](https://lists.sr.ht/%7Eandrewrk/ziglang)
137137
138## Building
138## Building from Source
139139
140140[![Build Status](https://dev.azure.com/ziglang/zig/_apis/build/status/ziglang.zig?branchName=master)](https://dev.azure.com/ziglang/zig/_build/latest?definitionId=1&branchName=master)
141141
......@@ -151,12 +151,14 @@ Note that you can
151151 * cmake >= 2.8.5
152152 * gcc >= 5.0.0 or clang >= 3.6.0
153153 * LLVM, Clang, LLD development libraries == 8.x, compiled with the same gcc or clang version above
154 - Use the system package manager, or [build from source](https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#posix).
154155
155156##### Windows
156157
157158 * cmake >= 2.8.5
158159 * Microsoft Visual Studio 2017 (version 15.8)
159160 * LLVM, Clang, LLD development libraries == 8.x, compiled with the same MSVC version above
161 - Use the [pre-built binaries](https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#pre-built-binaries) or [build from source](https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#windows).
160162
161163#### Instructions
162164
......@@ -166,9 +168,7 @@ Note that you can
166168mkdir build
167169cd build
168170cmake ..
169make
170171make install
171bin/zig build --build-file ../build.zig test
172172```
173173
174174##### MacOS
......@@ -180,7 +180,6 @@ mkdir build
180180cd build
181181cmake .. -DCMAKE_PREFIX_PATH=/usr/local/Cellar/llvm/8.0.0
182182make install
183bin/zig build --build-file ../build.zig test
184183```
185184
186185##### Windows
......@@ -223,3 +222,95 @@ use stage 1.
223222```
224223./stage2/bin/zig build --build-file ../build.zig install -Drelease-fast
225224```
225
226## Contributing
227
228### Start a Project Using Zig
229
230One of the best ways you can contribute to Zig is to start using it for a
231personal project. Here are some great examples:
232
233 * [Oxid](https://github.com/dbandstra/oxid) - arcade style game
234 * [TM35-Metronome](https://github.com/TM35-Metronome) - tools for modifying and randomizing Pokémon games
235 * [trOS](https://github.com/sjdh02/trOS) - tiny aarch64 baremetal OS thingy
236
237Without fail, these projects lead to discovering bugs and helping flesh out use
238cases, which lead to further design iterations of Zig. Importantly, each issue
239found this way comes with a real world motivations, so it is easy to explain
240your reasoning behind proposals and feature requests.
241
242Ideally, such a project will help you to learn new skills and add something
243to your personal portfolio at the same time.
244
245### Spread the Word
246
247Another way to contribute is to write about Zig, or speak about Zig at a
248conference, or do either of those things for your project which uses Zig.
249Here are some examples:
250
251 * [Iterative Replacement of C with Zig](http://tiehuis.github.io/blog/zig1.html)
252 * [The Right Tool for the Right Job: Redis Modules & Zig](https://www.youtube.com/watch?v=eCHM8-_poZY)
253
254Zig is a brand new language, with no advertising budget. Word of mouth is the
255only way people find out about the project, and the more people hear about it,
256the more people will use it, and the better chance we have to take over the
257world.
258
259### Finding Contributor Friendly Issues
260
261Please note that issues labeled
262[Proposal](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aproposal)
263but do not also have the
264[Accepted](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aaccepted)
265label are still under consideration, and efforts to implement such a proposal
266have a high risk of being wasted. If you are interested in a proposal which is
267still under consideration, please express your interest in the issue tracker,
268providing extra insights and considerations that others have not yet expressed.
269The most highly regarded argument in such a discussion is a real world use case.
270
271The issue label
272[Contributor Friendly](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3A%22contributor+friendly%22)
273exists to help contributors find issues that are "limited in scope and/or
274knowledge of Zig internals."
275
276### Editing Source Code
277
278First, build the Stage 1 compiler as described in [the Building section](#building).
279
280When making changes to the standard library, be sure to edit the files in the
281`std` directory and not the installed copy in the build directory. If you add a
282new file to the standard library, you must also add the file path in
283CMakeLists.txt.
284
285To test changes, do the following from the build directory:
286
2871. Run `make install` (on POSIX) or
288 `msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows).
2892. `bin/zig build --build-file ../build.zig test` (on POSIX) or
290 `bin\zig.exe build --build-file ..\build.zig test` (on Windows).
291
292That runs the whole test suite, which does a lot of extra testing that you
293likely won't always need, and can take upwards of 2 hours. This is what the
294CI server runs when you make a pull request.
295
296To save time, you can add the `--help` option to the `zig build` command and
297see what options are available. One of the most helpful ones is
298`-Dskip-release`. Adding this option to the command in step 2 above will take
299the time down from around 2 hours to about 6 minutes, and this is a good
300enough amount of testing before making a pull request.
301
302Another example is choosing a different set of things to test. For example,
303`test-std` instead of `test` will only run the standard library tests, and
304not the other ones. Combining this suggestion with the previous one, you could
305do this:
306
307`bin/zig build --build-file ../build.zig test-std -Dskip-release` (on POSIX) or
308`bin\zig.exe build --build-file ..\build.zig test-std -Dskip-release` (on Windows).
309
310This will run only the standard library tests, in debug mode only, for all
311targets (it will cross-compile the tests for non-native targets but not run
312them).
313
314When making changes to the compiler source code, the most helpful test step to
315run is `test-behavior`. When editing documentation it is `docs`. You can find
316this information and more in the `--help` menu.