aboutsummaryrefslogtreecommitdiff
path: root/src/os.cpp
AgeCommit message (Collapse)Author
2018-11-02support building static self hosted compiler on macosAndrew Kelley
* add a --system-linker-hack command line parameter to work around poor LLD macho code. See #1535 * build.zig correctly handles static as well as dynamic dependencies when building the self hosted compiler. - no more unnecessary libxml2 dependency - a static build on macos produces a completely static self-hosted compiler for macos (except for libSystem as intended).
2018-10-09stage1 os: workaround for macos not having environ variableAndrew Kelley
2018-10-09more efficient builtin library code generationAndrew Kelley
* introduce --disable-pic option which can generally be allowed to be the default. compiler_rt.a and builtin.a get this option when you build a static executable. * compiler_rt and builtin libraries are not built for build-lib --static * posix_spawn instead of fork/execv * disable the error limit on LLD. Fixes the blank lines printed
2018-10-06Merge pull request #1429 from shawnl/arm64Andrew Kelley
initial arm64 support
2018-10-06arm64: respond to code reviewShawn Landden
2018-09-22rm extraneous macroJeff Fowler
2018-09-18minor cleanups from 68c1d05917Andrew Kelley
2018-09-18compiling on mingw is now supported (#1542)emekoi
* compiles on mingw-w64 * fixed error in os_file_overwrite on windows * fixed windows hello_world example
2018-09-17remove `zig build --init`. add `zig init-lib` and `zig init-exe`Andrew Kelley
init-lib creates a working static library with tests, and init-exe creates a working hello world with a `run` target. both now have test coverage with the new "cli tests" file. closes #1035
2018-09-12windows os.cpp implementationsAndrew Kelley
2018-09-11darwin fixupsAndrew Kelley
2018-09-11Merge remote-tracking branch 'origin/master' into stage1-cachingAndrew Kelley
2018-09-10stage1 caching: zig no longer uses zig-cacheAndrew Kelley
2018-09-10caching is workingAndrew Kelley
* add almost all the input parameter state to the hash - missing items are the detected MSVC installation on Windows and detected libc installation on POSIX - also missing are C files and .h files that libclang finds * artifacts are created in global cache directory instead of zig-cache. - exception: builtin.zig is still in zig-cache * zig run uses the new cache correctly * zig run uses execv on posix systems
2018-09-09`zig id` commandAndrew Kelley
2018-09-09basic compiler id hash workingAndrew Kelley
2018-09-08Fixes a path corruption when compiling on windows.Sahnvour
2018-09-08use vfork in stage1 compiler to avoid OOMShawn Landden
2018-09-04port std.os.path.resolve to stage1Andrew Kelley
2018-07-20self-hosted: share C++ code for finding libc on windowsAndrew Kelley
2018-06-26Fix os_path_join for case where dirname is emptyIsaac Hier
2018-06-18stage1: update darwin code to workaround old libc bugAndrew Kelley
See #1128
2018-06-18adjust logic for finding the path to zig executable on darwinAndrew Kelley
2018-06-18Fix 1117: Revise realpath scratch logicBodie Solomon
2018-06-18Fix 1117: Tweak realpath logic to use out_path as scratch spaceBodie Solomon
2018-06-18Fix 1117: Use realpath in stage1 Darwin os_self_exe_pathBodie Solomon
Issue: https://github.com/ziglang/zig/issues/1117 The macOS stage1 Zig compiler should look in Zig's real absolute path for the Zig stdlib, but os_self_exe_path looks in its path as returned by _NSGetExecutablePath, which may be a symlink. This means that a symlinked Zig cannot find the Zig stdlib. This patch fixes the issue by resolving the _NSGetExecutablePath result to the real path using realpath() before copying the result to the output path.
2018-04-22exit(1) instead of abort() for file not foundAndrew Kelley
2018-04-22fix windows build broken by previous commitAndrew Kelley
fixes build failure from 1c41f1ca6252faaa7750936c67562f1866a48075
2018-04-22better error reporting for missing libc on windowsAndrew Kelley
closes #931
2018-04-15fix linux implementation of self exe pathAndrew Kelley
closes #894
2018-04-01Add run compiler commandMarc Tiehuis
'zig run file.zig' builds a file and stores the artifacts in the global cache. On successful compilation the binary is executed. 'zig run file.zig -- a b c' does the same, but passes the arguments a, b and c as runtime arguments to the program. Everything after an '--' are treated as runtime arguments. On a posix system, a shebang can be used to run a zig file directly. An example shebang would be '#!/usr/bin/zig run'. You may not be able pass extra compile arguments currently as part of the shebang. Linux for example treats all arguments after the first as a single argument which will result in an 'invalid command'. Currently there is no customisability for the cache path as a compile argument. For a posix system you can use `TMPDIR=. zig run file.zig` to override, in this case using the current directory for the run cache. The input file is always recompiled, even if it has changed. This is intended to be cached but further discussion/thought needs to go into this. Closes #466.
2018-03-31implement os_self_exe_path in the c++ compiler for darwinAndrew Kelley
ported from the zig std lib this fixes looking for zig std lib at runtime on darwin
2018-03-30find libc and zig std lib at runtimeAndrew Kelley
this removes the following configure options: * ZIG_LIBC_LIB_DIR * ZIG_LIBC_STATIC_LIB_DIR * ZIG_LIBC_INCLUDE_DIR * ZIG_DYNAMIC_LINKER * ZIG_EACH_LIB_RPATH * zig's reliance on CMAKE_INSTALL_PREFIX these options are still available as command line options, however, the default will attempt to execute the system's C compiler to collect system defaults for these values. closes #870
2018-01-20remove unused function, fixes mingw buildAndrew Kelley
2018-01-19fix docgen on windowsAndrew Kelley
2018-01-19os_rename uses MoveFileEx on windowsAndrew Kelley
2018-01-19windows-compatible os_rename functionAndrew Kelley
windows libc rename() requires destination file path to not exist
2018-01-05workaround for microsoft releasing windows SDK with wrong versionAndrew Kelley
2017-12-04Fix the color of compiler messages for light-themed terminal.MIURA Masahiro
2017-11-01windows: use the same libc search within a compilation unitAndrew Kelley
2017-11-01WIN32: Linking with the CRT at runtime. (#570)Dimenus
Disclaimer: Forgive me if my format sucks, I've never submitted a PR before! Fixes: #517 I added a few things to allow zig to link with the CRT properly both statically and dynamically. In Visual Studio 2017, Microsoft changed how the c-runtime is factored again. With this change, they also added a COM interface to allow you to query the respective Visual Studio instance for two of them. This does that and also falls back on a registry query for 2015 support. If you're using a Visual Studio instance older than 2015, you'll have to use the existing options available with the zig compiler. Changes are listed below along with a general description of the changes. all_types.cpp: The separate variables for msvc/kern32 have been removed and all win32 libc directory paths have been combined into a ZigList since we're querying more than two directories and differentiating one from another doesn't matter to lld. analyze.cpp: The existing functions were extended to support querying libc libs & libc headers at runtime. codegen.cpp/hpp: Microsoft uses the new 'Universal C Runtime' name now. Doesn't matter from a functionality standpoint. I left the compiler switches as is to not introduce any breaking changes. link.cpp: We're linking 4 libs and generating another in order to support the UCRT. Dynamic: msvcrt/d, vcruntime/d, ucrt/d, legacy_stdio_definitions.lib Static: libcmt/d, libvcruntime/d libucrt/d, legacy_stdio_definitions.lib main.cpp: Update function call names. os.cpp/hpp: COM/Registry interface for querying Windows UCRT/SDK. Sources: [Windows CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features) [VS 2015 Breaking Changes](https://msdn.microsoft.com/en-us/library/bb531344.aspx)
2017-10-15fix windows argument parsingAndrew Kelley
2017-10-15set stdout and stderr to binary mode on windowsAndrew Kelley
2017-10-15mingw build: delete unused variableAndrew Kelley
2017-10-15only SetConsoleTextAttribute to do console colors on windowsAndrew Kelley
2017-10-14try harder to emit console colorsAndrew Kelley
2017-10-03fix mingw buildAndrew Kelley
2017-10-02support terminal colors for cmd.exe and msys ptyAndrew Kelley
See #302
2017-10-01implement standard library path searchAndrew Kelley
closes #463 See #302
2017-09-30better implementation of os_spawn_process for windowsAndrew Kelley
See #302