mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-09 18:16:38 +01:00
Compare commits
63 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0ba8b728f | ||
|
|
404a057f77 | ||
|
|
7a29161e8e | ||
|
|
236fb915cc | ||
|
|
e9388fde64 | ||
|
|
46a28175b3 | ||
|
|
59dd7a0fbd | ||
|
|
0aeeff0d94 | ||
|
|
ce9d2eda73 | ||
|
|
d6eac43a5b | ||
|
|
0039cb7ef2 | ||
|
|
88146ea704 | ||
|
|
6e469bc44d | ||
|
|
2d4b264527 | ||
|
|
95845ba2ac | ||
|
|
4a09703f62 | ||
|
|
82908b525d | ||
|
|
aba1dbc954 | ||
|
|
6ce3c2423e | ||
|
|
52150b701c | ||
|
|
869880adac | ||
|
|
511aa28983 | ||
|
|
e57c9c0931 | ||
|
|
d37182383d | ||
|
|
1216050520 | ||
|
|
8832314acf | ||
|
|
4616fb0937 | ||
|
|
fa4a626fac | ||
|
|
33c3bf0631 | ||
|
|
2563d32425 | ||
|
|
33809a0c53 | ||
|
|
2648e3651e | ||
|
|
d09afc08da | ||
|
|
ddde99bdfa | ||
|
|
f2110b0c0d | ||
|
|
7ce03acb9d | ||
|
|
c3aa32e984 | ||
|
|
efe06c5f31 | ||
|
|
7b908cb024 | ||
|
|
16d3f7b2fa | ||
|
|
fa5011aa31 | ||
|
|
595a7f8b08 | ||
|
|
6c482b8033 | ||
|
|
ad63be7eb9 | ||
|
|
704f8f4013 | ||
|
|
ef9fb428b7 | ||
|
|
600b652825 | ||
|
|
e36bf2baff | ||
|
|
4babedf1be | ||
|
|
0dc64d9064 | ||
|
|
5d29b9fad6 | ||
|
|
6de152ec7c | ||
|
|
cc25f75478 | ||
|
|
eb28c8aa35 | ||
|
|
f6773232ac | ||
|
|
9deea9b1d8 | ||
|
|
8e0a802ea1 | ||
|
|
eb5d67b146 | ||
|
|
082e5091af | ||
|
|
3b1f9b476c | ||
|
|
2478b5bb0e | ||
|
|
7974576967 | ||
|
|
011a78325e |
16979 changed files with 1032414 additions and 2261831 deletions
|
|
@ -1,13 +0,0 @@
|
|||
contact_links:
|
||||
- name: Language Proposal
|
||||
about: "Please do not submit a proposal to change the language"
|
||||
url: https://ziglang.org/code-of-conduct/#no-language-proposals
|
||||
- name: Question
|
||||
about: "Please use one of the community spaces instead for questions or general discussions."
|
||||
url: https://ziglang.org/community
|
||||
- name: C Translation
|
||||
about: "Issues related to `zig translate-c` and `@cImport` are tracked separately."
|
||||
url: https://codeberg.org/ziglang/translate-c
|
||||
- name: Copilot and Other LLMs
|
||||
about: "Please do not use GitHub Copilot or any other LLM to write an issue."
|
||||
url: https://ziglang.org/code-of-conduct/#strict-no-llm-no-ai-policy
|
||||
|
|
@ -1,303 +0,0 @@
|
|||
name: ci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
# This cancels older workflow runs on pull requests while ensuring that there
|
||||
# are no concurrency limits on pushes and manual workflow dispatches.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
aarch64-freebsd-debug:
|
||||
runs-on: [self-hosted, aarch64-freebsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-freebsd-debug.sh
|
||||
timeout-minutes: 300
|
||||
aarch64-freebsd-release:
|
||||
runs-on: [self-hosted, aarch64-freebsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-freebsd-release.sh
|
||||
timeout-minutes: 240
|
||||
|
||||
aarch64-linux-debug:
|
||||
runs-on: [self-hosted, aarch64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-linux-debug.sh
|
||||
timeout-minutes: 180
|
||||
aarch64-linux-release:
|
||||
runs-on: [self-hosted, aarch64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-linux-release.sh
|
||||
timeout-minutes: 120
|
||||
|
||||
aarch64-netbsd-debug:
|
||||
runs-on: [self-hosted, aarch64-netbsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-netbsd-debug.sh
|
||||
timeout-minutes: 300
|
||||
aarch64-netbsd-release:
|
||||
runs-on: [self-hosted, aarch64-netbsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-netbsd-release.sh
|
||||
timeout-minutes: 240
|
||||
|
||||
aarch64-macos-debug:
|
||||
runs-on: [self-hosted, aarch64-macos]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-macos-debug.sh
|
||||
timeout-minutes: 180
|
||||
aarch64-macos-release:
|
||||
runs-on: [self-hosted, aarch64-macos]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-macos-release.sh
|
||||
timeout-minutes: 120
|
||||
|
||||
loongarch64-linux-debug:
|
||||
runs-on: [self-hosted, loongarch64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/loongarch64-linux-debug.sh
|
||||
timeout-minutes: 240
|
||||
loongarch64-linux-release:
|
||||
runs-on: [self-hosted, loongarch64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/loongarch64-linux-release.sh
|
||||
timeout-minutes: 180
|
||||
|
||||
powerpc64le-linux-debug:
|
||||
runs-on: [self-hosted, powerpc64le-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/powerpc64le-linux-debug.sh
|
||||
timeout-minutes: 360
|
||||
powerpc64le-linux-release:
|
||||
runs-on: [self-hosted, powerpc64le-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/powerpc64le-linux-release.sh
|
||||
timeout-minutes: 240
|
||||
|
||||
riscv64-linux-debug:
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: [self-hosted, riscv64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/riscv64-linux-debug.sh
|
||||
timeout-minutes: 660
|
||||
riscv64-linux-release:
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: [self-hosted, riscv64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/riscv64-linux-release.sh
|
||||
timeout-minutes: 540
|
||||
|
||||
s390x-linux-debug:
|
||||
runs-on: [self-hosted, s390x-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/s390x-linux-debug.sh
|
||||
timeout-minutes: 360
|
||||
s390x-linux-release:
|
||||
runs-on: [self-hosted, s390x-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/s390x-linux-release.sh
|
||||
timeout-minutes: 300
|
||||
|
||||
x86_64-freebsd-debug:
|
||||
runs-on: [self-hosted, x86_64-freebsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-freebsd-debug.sh
|
||||
timeout-minutes: 120
|
||||
x86_64-freebsd-release:
|
||||
runs-on: [self-hosted, x86_64-freebsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-freebsd-release.sh
|
||||
timeout-minutes: 120
|
||||
|
||||
x86_64-linux-debug:
|
||||
runs-on: [self-hosted, x86_64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-linux-debug.sh
|
||||
timeout-minutes: 180
|
||||
x86_64-linux-debug-llvm:
|
||||
runs-on: [self-hosted, x86_64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-linux-debug-llvm.sh
|
||||
timeout-minutes: 360
|
||||
x86_64-linux-release:
|
||||
runs-on: [self-hosted, x86_64-linux]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-linux-release.sh
|
||||
timeout-minutes: 360
|
||||
|
||||
x86_64-netbsd-debug:
|
||||
runs-on: [self-hosted, x86_64-netbsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-netbsd-debug.sh
|
||||
timeout-minutes: 120
|
||||
x86_64-netbsd-release:
|
||||
runs-on: [self-hosted, x86_64-netbsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-netbsd-release.sh
|
||||
timeout-minutes: 120
|
||||
|
||||
x86_64-openbsd-debug:
|
||||
runs-on: [self-hosted, x86_64-openbsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-openbsd-debug.sh
|
||||
timeout-minutes: 120
|
||||
x86_64-openbsd-release:
|
||||
runs-on: [self-hosted, x86_64-openbsd]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-openbsd-release.sh
|
||||
timeout-minutes: 120
|
||||
|
||||
x86_64-windows-debug:
|
||||
runs-on: [self-hosted, x86_64-windows]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: ci/x86_64-windows-debug.ps1
|
||||
timeout-minutes: 180
|
||||
x86_64-windows-release:
|
||||
runs-on: [self-hosted, x86_64-windows]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build and Test
|
||||
run: ci/x86_64-windows-release.ps1
|
||||
timeout-minutes: 180
|
||||
16
.gitattributes
vendored
16
.gitattributes
vendored
|
|
@ -2,24 +2,14 @@
|
|||
*.zon text eol=lf
|
||||
*.txt text eol=lf
|
||||
langref.html.in text eol=lf
|
||||
|
||||
lib/libc/*/abilists binary
|
||||
|
||||
lib/std/compress/testdata/** binary
|
||||
lib/std/compress/deflate/testdata/** binary
|
||||
lib/std/compress/flate/testdata/** binary
|
||||
lib/std/compress/lzma/testdata/** binary
|
||||
lib/std/compress/xz/testdata/** binary
|
||||
lib/std/crypto/codecs/asn1/der/testdata/** binary
|
||||
lib/std/tar/testdata/** binary
|
||||
src/Package/Fetch/testdata/** binary
|
||||
src/Package/Fetch/git/testdata/** binary
|
||||
|
||||
lib/compiler/aro/** linguist-vendored
|
||||
lib/compiler/resinator/** linguist-vendored
|
||||
lib/compiler/translate-c/** linguist-vendored
|
||||
lib/include/** linguist-vendored
|
||||
lib/libc/** linguist-vendored
|
||||
lib/libcxx/** linguist-vendored
|
||||
lib/libcxxabi/** linguist-vendored
|
||||
lib/libtsan/** linguist-vendored
|
||||
lib/libunwind/** linguist-vendored
|
||||
lib/tsan/** linguist-vendored
|
||||
lib/compiler/aro/** linguist-vendored
|
||||
|
|
|
|||
11
.github/CODEOWNERS
vendored
Normal file
11
.github/CODEOWNERS
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# std.json
|
||||
/lib/std/json* @thejoshwolfe
|
||||
|
||||
# std.Thread
|
||||
/lib/std/Thread* @kprotty
|
||||
|
||||
# resinator
|
||||
/lib/compiler/resinator/* @squeek502
|
||||
|
||||
# SPIR-V selfhosted backend
|
||||
/src/codegen/spirv* @Snektron
|
||||
75
.github/CODE_OF_CONDUCT.md
vendored
Normal file
75
.github/CODE_OF_CONDUCT.md
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# Code of Conduct
|
||||
|
||||
Hello, and welcome! 👋
|
||||
|
||||
The Zig community is decentralized. Anyone is free to start and maintain their
|
||||
own space for people to gather, and edit
|
||||
[the Community wiki page](https://github.com/ziglang/zig/wiki/Community) to add
|
||||
a link. There is no concept of "official" or "unofficial", however, each
|
||||
gathering place has its own moderators and rules.
|
||||
|
||||
This is Andrew Kelley speaking. At least for now, I'm the moderator of the
|
||||
ziglang organization GitHub repositories and the #zig IRC channel on Libera.chat.
|
||||
**This document contains the rules that govern these two spaces only**.
|
||||
|
||||
The rules here are strict. This space is for focused, on topic, technical work
|
||||
on the Zig project only. It is everyone's responsibility to maintain a positive
|
||||
environment, especially when disagreements occur.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contribute to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language.
|
||||
* Being respectful of differing viewpoints and experiences.
|
||||
* Gracefully accepting constructive criticism.
|
||||
* Helping another person accomplish their own goals.
|
||||
* Showing empathy towards others.
|
||||
* Showing appreciation for others' work.
|
||||
* Validating someone else's experience, skills, insight, and use cases.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* Unwelcome sexual attention or advances, or use of sexualized language or
|
||||
imagery that causes discomfort.
|
||||
* Trolling, insulting/derogatory comments, and personal attacks. Anything
|
||||
antagonistic towards someone else.
|
||||
* Off-topic discussion of any kind - especially offensive or sensitive issues.
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission.
|
||||
* Discussing this Code of Conduct or publicly accusing someone of violating it.
|
||||
* Making someone else feel like an outsider or implying a lack of technical
|
||||
abilities.
|
||||
* Destructive behavior. Anything that harms Zig or another open-source project.
|
||||
|
||||
## Enforcement
|
||||
|
||||
If you need to report an issue you can contact me or Loris Cro, who are both
|
||||
paid by the Zig Software Foundation, and so moderation of this space is part of
|
||||
our job. We will swiftly remove anyone who is antagonizing others or being
|
||||
generally destructive.
|
||||
|
||||
This includes Private Harassment. If person A is directly harassed or
|
||||
antagonized by person B, person B will be blocked from participating in this
|
||||
space even if the harassment didn't take place on one of the mediums directly
|
||||
under rule of this Code of Conduct.
|
||||
|
||||
As noted, discussing this Code of Conduct should not take place on GitHub or IRC
|
||||
because these spaces are for directly working on code, not for meta-discussion.
|
||||
If you have any issues with it, you can contact me directly, or you can join one
|
||||
of the community spaces that has different rules.
|
||||
|
||||
* Andrew Kelley <andrew@ziglang.org>
|
||||
* Loris Cro <loris@ziglang.org>
|
||||
|
||||
## Conclusion
|
||||
|
||||
Thanks for reading the rules. Together, we can make this space welcoming and
|
||||
inclusive for everyone, regardless of age, body size, disability, ethnicity,
|
||||
sex characteristics, gender identity and expression, level of experience,
|
||||
education, socio-economic status, nationality, personal appearance, race,
|
||||
religion, or sexual identity and orientation.
|
||||
|
||||
Sincerely,
|
||||
|
||||
Andrew ✌️
|
||||
3
.github/CONTRIBUTING.md
vendored
Normal file
3
.github/CONTRIBUTING.md
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Please see the
|
||||
[Contributing](https://github.com/ziglang/zig/wiki/Contributing)
|
||||
page on the wiki.
|
||||
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
github: [ziglang]
|
||||
7
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
7
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
contact_links:
|
||||
- name: Language Proposal
|
||||
about: Propose to improve the Zig language
|
||||
url: https://github.com/ziglang/zig/wiki/Language-Proposals
|
||||
- name: Question
|
||||
about: Please use one of the community spaces for questions or general discussions.
|
||||
url: https://github.com/ziglang/zig/wiki/Community
|
||||
98
.github/workflows/ci.yaml
vendored
Normal file
98
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
name: ci
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 0.12.x
|
||||
concurrency:
|
||||
# Cancels pending runs when a PR gets updated.
|
||||
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
x86_64-linux-debug:
|
||||
timeout-minutes: 420
|
||||
runs-on: [self-hosted, Linux, x86_64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-linux-debug.sh
|
||||
x86_64-linux-release:
|
||||
timeout-minutes: 420
|
||||
runs-on: [self-hosted, Linux, x86_64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: sh ci/x86_64-linux-release.sh
|
||||
aarch64-linux-debug:
|
||||
timeout-minutes: 480
|
||||
runs-on: [self-hosted, Linux, aarch64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-linux-debug.sh
|
||||
aarch64-linux-release:
|
||||
timeout-minutes: 480
|
||||
runs-on: [self-hosted, Linux, aarch64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: sh ci/aarch64-linux-release.sh
|
||||
x86_64-macos-release:
|
||||
runs-on: "macos-11"
|
||||
env:
|
||||
ARCH: "x86_64"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: ci/x86_64-macos-release.sh
|
||||
aarch64-macos-debug:
|
||||
runs-on: [self-hosted, macOS, aarch64]
|
||||
env:
|
||||
ARCH: "aarch64"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: ci/aarch64-macos-debug.sh
|
||||
aarch64-macos-release:
|
||||
runs-on: [self-hosted, macOS, aarch64]
|
||||
env:
|
||||
ARCH: "aarch64"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: ci/aarch64-macos-release.sh
|
||||
x86_64-windows-debug:
|
||||
runs-on: [self-hosted, Windows, x86_64]
|
||||
env:
|
||||
ARCH: "x86_64"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: ci/x86_64-windows-debug.ps1
|
||||
x86_64-windows-release:
|
||||
runs-on: [self-hosted, Windows, x86_64]
|
||||
env:
|
||||
ARCH: "x86_64"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: ci/x86_64-windows-release.ps1
|
||||
aarch64-windows:
|
||||
runs-on: [self-hosted, Windows, aarch64]
|
||||
env:
|
||||
ARCH: "aarch64"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test
|
||||
run: ci/aarch64-windows.ps1
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -9,7 +9,7 @@
|
|||
# Cheers!
|
||||
# -andrewrk
|
||||
|
||||
.zig-cache/
|
||||
zig-cache/
|
||||
zig-out/
|
||||
/release/
|
||||
/debug/
|
||||
|
|
|
|||
32
.mailmap
32
.mailmap
|
|
@ -2,41 +2,27 @@ Adam Goertz <adambgoertz@gmail.com>
|
|||
Ali Chraghi <alichraghi@proton.me> <alichraghi@pm.me>
|
||||
Andrea Orru <andrea@orru.io> <andreaorru1991@gmail.com>
|
||||
Andrew Kelley <andrew@ziglang.org> <superjoe30@gmail.com>
|
||||
Andrew Kelley <andrew@ziglang.org> <andrewrk@noreply.codeberg.org>
|
||||
Bogdan Romanyuk <wrongnull@gmail.com> <65823030+wrongnull@users.noreply.github.com>
|
||||
Casey Banner <kcbanner@gmail.com>
|
||||
Dacheng Gao <successgdc@gmail.com>
|
||||
Daniel Kongsgaard <dakongsgaard@gmail.com>
|
||||
David Carlier <devnexen@gmail.com>
|
||||
David Rubin <david@vortan.dev>
|
||||
David Rubin <david@vortan.dev> <daviru007@icloud.com>
|
||||
David Rubin <david@vortan.dev> <87927264+Rexicon226@users.noreply.github.com>
|
||||
David Senoner <seda18@rolmail.net>
|
||||
David Rubin <daviru007@icloud.com> <87927264+Rexicon226@users.noreply.github.com>
|
||||
Dominic <4678790+dweiller@users.noreply.github.com>
|
||||
Dominic <4678790+dweiller@users.noreply.github.com> <4678790+dweiller@users.noreplay.github.com>
|
||||
Eric Eastwood <madlittlemods@gmail.com> <contact@ericeastwood.com>
|
||||
Eric Joldasov <bratishkaerik@landless-city.net>
|
||||
Eric Joldasov <bratishkaerik@landless-city.net> <bratishkaerik@landless-city.net>
|
||||
Felix "xq" Queißner <xq@random-projects.net>
|
||||
Felix "xq" Queißner <xq@random-projects.net> <felix@ib-queissner.de>
|
||||
Felix "xq" Queißner <xq@random-projects.net> <git@masterq32.de>
|
||||
Felix "xq" Queißner <xq@random-projects.net> <git@mq32.de>
|
||||
Felix "xq" Queißner <xq@random-projects.net> <git@random-projects.net>
|
||||
Frank Denis <124872+jedisct1@users.noreply.github.com> <github@pureftpd.org>
|
||||
Frank Denis <124872+jedisct1@users.noreply.github.com> <jedisct1@noreply.codeberg.org>
|
||||
Garrett Beck <garrettlennoxbeck@gmail.com> <138411610+garrettlennoxbeck@users.noreply.github.com>
|
||||
Gaëtan S <blaxoujunior@gmail.com>
|
||||
GalaxyShard <dominic.adragna@byteroach.com>
|
||||
GalaxyShard <dominic.adragna@byteroach.com> <76917584+GalaxyShard@users.noreply.github.com>
|
||||
HydroH <iodizon@163.com> <ixlesis@gmail.com>
|
||||
Igor Anić <igor.anic@gmail.com>
|
||||
IntegratedQuantum <jahe788@gmail.com> <43880493+IntegratedQuantum@users.noreply.github.com>
|
||||
Isaac Freund <mail@isaacfreund.com> <ifreund@ifreund.xyz>
|
||||
Isaac Freund <mail@isaacfreund.com> <isaac.freund@coil.com>
|
||||
Ivan Stepanov <ivanstepanovftw@gmail.com>
|
||||
Jacob Young <amazingjacob@gmail.com>
|
||||
Jacob Young <amazingjacob@gmail.com> <jacobly0@users.noreply.github.com>
|
||||
Jacob Young <amazingjacob@gmail.com> <15544577+jacobly0@users.noreply.github.com>
|
||||
Jacob Young <jacobly0@users.noreply.github.com>
|
||||
Jan Philipp Hafer <jan.hafer@rwth-aachen.de> <anon_1plus1equals3@mailbox.org>
|
||||
Jeremy Volkman <jeremy@jvolkman.com> <jeremy@cedarai.com>
|
||||
Jimmi Holst Christensen <jhc@dismail.de> <jhc@dismail.de>
|
||||
|
|
@ -46,20 +32,13 @@ Jimmi Holst Christensen <jhc@dismail.de> <jimmiholstchristensen@gmail.com>
|
|||
Jimmi Holst Christensen <jhc@dismail.de> <rainbowhejsil@gmail.com>
|
||||
Joachim Schmidt <joachim.schmidt557@outlook.com>
|
||||
Jonathan Marler <johnnymarler@gmail.com> <jonathan.j.marler@hp.com>
|
||||
Kendall Condon <goon.pri.low@gmail.com> <149842806+gooncreeper@users.noreply.github.com>
|
||||
Krzysztof Wolicki <der.teufel.mail@gmail.com>
|
||||
Krzysztof Wolicki <der.teufel.mail@gmail.com> <46651553+der-teufel-programming@users.noreply.github.com>
|
||||
LemonBoy <thatlemon@gmail.com> <LemonBoy@users.noreply.github.com>
|
||||
Lucas Santos <lucascarvalhosantos91@gmail.com>
|
||||
Lucas Santos <lucascarvalhosantos91@gmail.com> <117400842+LucasSantos91@users.noreply.github.com>
|
||||
Luuk de Gram <luuk@degram.dev> <Luukdegram@users.noreply.github.com>
|
||||
Marc Tiehuis <marc@tiehu.is> <marctiehuis@gmail.com>
|
||||
Mason Remaley <mason@anthropicstudios.com>
|
||||
Mason Remaley <mason@anthropicstudios.com> <MasonRemaley@users.noreply.github.com>
|
||||
Matthew Lugg <mlugg@mlugg.co.uk>
|
||||
Matthew Lugg <mlugg@mlugg.co.uk> <mlugg@noreply.codeberg.org>
|
||||
Meghan Denny <hello@nektro.net>
|
||||
Meghan Denny <hello@nektro.net> <meghan@bun.sh>
|
||||
Michael Bartnett <michael.bartnett@gmail.com> <michaelbartnett@users.noreply.github.com>
|
||||
Motiejus Jakštys <motiejus@jakstys.lt> <motiejus@uber.com>
|
||||
Niles Salter <Validark@pm.me>
|
||||
|
|
@ -79,16 +58,9 @@ Travis Staloch <twostepted@gmail.com>
|
|||
Travis Staloch <twostepted@gmail.com> <1562827+travisstaloch@users.noreply.github.com>
|
||||
Veikka Tuominen <git@vexu.eu>
|
||||
Veikka Tuominen <git@vexu.eu> <15308111+Vexu@users.noreply.github.com>
|
||||
Veikka Tuominen <git@vexu.eu> <veikka@ziglang.org>
|
||||
Will Lillis <will.lillis24@gmail.com>
|
||||
Will Lillis <will.lillis24@gmail.com> <wlillis@umass.edu>
|
||||
Wooster <r00ster91@proton.me>
|
||||
Wooster <r00ster91@proton.me> <wooster0@proton.me>
|
||||
antlilja <liljaanton2001@gmail.com> <12533691+antlilja@users.noreply.github.com>
|
||||
february cozzocrea <february.cozzocrea@gmail.com> <91439207+f-cozzocrea@users.noreply.github.com>
|
||||
garrisonhh <garrisonhh@pm.me> <71951273+garrisonhh@users.noreply.github.com>
|
||||
kj4tmp <kj4tmp@gmail.com>
|
||||
kj4tmp <kj4tmp@gmail.com> <56497124+kj4tmp@users.noreply.github.com>
|
||||
saurabh <saurabhm@proton.me>
|
||||
saurabh <tech@saurabh.mozmail.com> <saurabhm@proton.me>
|
||||
xEgoist <egoist@egoistic.dev> <101279047+xEgoist@users.noreply.github.com>
|
||||
|
|
|
|||
1122
CMakeLists.txt
1122
CMakeLists.txt
File diff suppressed because it is too large
Load diff
743
README.md
743
README.md
|
|
@ -13,15 +13,17 @@ Documentation** corresponding to the version of Zig that you are using by
|
|||
following the appropriate link on the
|
||||
[download page](https://ziglang.org/download).
|
||||
|
||||
Otherwise, you're looking at a release of Zig, so you can find the language
|
||||
reference at `doc/langref.html`, and the standard library documentation by
|
||||
running `zig std`, which will open a browser tab.
|
||||
Otherwise, you're looking at a release of Zig, and you can find documentation
|
||||
here:
|
||||
|
||||
* doc/langref.html
|
||||
* doc/std/index.html
|
||||
|
||||
## Installation
|
||||
|
||||
* [download a pre-built binary](https://ziglang.org/download/)
|
||||
* [install from a package manager](https://ziglang.org/learn/getting-started/#managers)
|
||||
* [bootstrap zig for any target](https://codeberg.org/ziglang/zig-bootstrap)
|
||||
* [install from a package manager](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)
|
||||
* [bootstrap zig for any target](https://github.com/ziglang/zig-bootstrap)
|
||||
|
||||
A Zig installation is composed of two things:
|
||||
|
||||
|
|
@ -45,12 +47,9 @@ mechanism supports that use case too (i.e. `/usr/bin/zig` and `/usr/lib/zig/`).
|
|||
|
||||
Ensure you have the required dependencies:
|
||||
|
||||
* CMake >= 3.15
|
||||
* CMake >= 3.5
|
||||
* System C/C++ Toolchain
|
||||
* LLVM, Clang, LLD development libraries, version 21.x, compiled with the
|
||||
same system C/C++ toolchain.
|
||||
- If the system package manager lacks these libraries, or has them misconfigured,
|
||||
see below for how to build them from source.
|
||||
* LLVM, Clang, LLD development libraries == 17.x
|
||||
|
||||
Then it is the standard CMake build process:
|
||||
|
||||
|
|
@ -61,9 +60,9 @@ cmake ..
|
|||
make install
|
||||
```
|
||||
|
||||
Use `CMAKE_PREFIX_PATH` if needed to help CMake find LLVM.
|
||||
|
||||
This produces `stage3/bin/zig` which is the Zig compiler built by itself.
|
||||
For more options, tips, and troubleshooting, please see the
|
||||
[Building Zig From Source](https://github.com/ziglang/zig/wiki/Building-Zig-From-Source)
|
||||
page on the wiki.
|
||||
|
||||
## Building from Source without LLVM
|
||||
|
||||
|
|
@ -79,377 +78,31 @@ This produces a `zig2` executable in the current working directory. This is a
|
|||
[without LLVM extensions](https://github.com/ziglang/zig/issues/16270), and is
|
||||
therefore lacking these features:
|
||||
- Release mode optimizations
|
||||
- aarch64 machine code backend
|
||||
- `@cImport` / `zig translate-c`
|
||||
- Ability to compile C files
|
||||
- Ability to compile assembly files
|
||||
- [Some ELF linking features](https://github.com/ziglang/zig/issues/17749)
|
||||
- [Some COFF/PE linking features](https://github.com/ziglang/zig/issues/17751)
|
||||
- [Most COFF/PE linking features](https://github.com/ziglang/zig/issues/17751)
|
||||
- [Some WebAssembly linking features](https://github.com/ziglang/zig/issues/17750)
|
||||
- [Ability to create import libs from def files](https://github.com/ziglang/zig/issues/17807)
|
||||
- [Automatic importlib file generation for Windows DLLs](https://github.com/ziglang/zig/issues/17753)
|
||||
- [Ability to create static archives from object files](https://github.com/ziglang/zig/issues/9828)
|
||||
- [Ability to compile assembly files](https://github.com/ziglang/zig/issues/21169)
|
||||
- Ability to compile C, C++, Objective-C, and Objective-C++ files
|
||||
|
||||
Even when built this way, Zig provides an LLVM backend that produces bitcode
|
||||
files, which may be optimized and compiled into object files via a system Clang
|
||||
package. This can be used to produce system packages of Zig applications
|
||||
without the Zig package dependency on LLVM.
|
||||
|
||||
## Building from Source Using Prebuilt Zig
|
||||
|
||||
Dependencies:
|
||||
|
||||
* A recent prior build of Zig. The exact version required depends on how
|
||||
recently breaking changes occurred. If the language or std lib changed too
|
||||
much since this version, then this method of building from source will fail.
|
||||
* LLVM, Clang, and LLD libraries built using Zig.
|
||||
|
||||
The easiest way to obtain both of these artifacts is to use
|
||||
[zig-bootstrap](https://codeberg.org/ziglang/zig-bootstrap), which creates the
|
||||
directory `out/zig-$target-$cpu` and `out/$target-$cpu`, to be used as
|
||||
`$ZIG_PREFIX` and `$LLVM_PREFIX`, respectively, in the following command:
|
||||
|
||||
```
|
||||
"$ZIG_PREFIX/zig" build \
|
||||
-p stage3 \
|
||||
--search-prefix "$LLVM_PREFIX" \
|
||||
--zig-lib-dir "lib" \
|
||||
-Dstatic-llvm
|
||||
```
|
||||
|
||||
Where `$LLVM_PREFIX` is the path that contains, for example,
|
||||
`include/llvm/Pass.h` and `lib/libLLVMCore.a`.
|
||||
|
||||
This produces `stage3/bin/zig`. See `zig build -h` to learn about the options
|
||||
that can be passed such as `-Drelease`.
|
||||
|
||||
## Building from Source on Windows
|
||||
|
||||
### Option 1: Use the Windows Zig Compiler Dev Kit
|
||||
|
||||
This one has the benefit that LLVM, LLD, and Clang are built in Release mode,
|
||||
while your Zig build has the option to be a Debug build. It also works
|
||||
completely independently from MSVC so you don't need it to be installed.
|
||||
|
||||
Determine the URL by
|
||||
[looking at the CI script](https://codeberg.org/ziglang/zig/src/branch/master/ci/x86_64-windows-debug.ps1#L1-L4).
|
||||
It will look something like this (replace `$VERSION` with the one you see by
|
||||
following the above link):
|
||||
|
||||
```
|
||||
https://ziglang.org/deps/zig+llvm+lld+clang-x86_64-windows-gnu-$VERSION.zip
|
||||
```
|
||||
|
||||
This zip file contains:
|
||||
|
||||
* An older Zig installation.
|
||||
* LLVM, LLD, and Clang libraries (.lib and .h files), version 16.0.1, built in Release mode.
|
||||
* zlib (.lib and .h files), v1.2.13, built in Release mode
|
||||
* zstd (.lib and .h files), v1.5.2, built in Release mode
|
||||
|
||||
#### Option 1a: CMake + [Ninja](https://ninja-build.org/)
|
||||
|
||||
Unzip the dev kit and then in cmd.exe in your Zig source checkout:
|
||||
|
||||
```bat
|
||||
mkdir build
|
||||
cd build
|
||||
set DEVKIT=$DEVKIT
|
||||
```
|
||||
|
||||
Replace `$DEVKIT` with the path to the folder that you unzipped after
|
||||
downloading it from the link above. Make sure to use forward slashes (`/`) for
|
||||
all path separators (otherwise CMake will try to interpret backslashes as
|
||||
escapes and fail).
|
||||
|
||||
Then run:
|
||||
|
||||
```bat
|
||||
cmake .. -GNinja -DCMAKE_PREFIX_PATH="%DEVKIT%" -DCMAKE_C_COMPILER="%DEVKIT%/bin/zig.exe;cc" -DCMAKE_CXX_COMPILER="%DEVKIT%/bin/zig.exe;c++" -DCMAKE_AR="%DEVKIT%/bin/zig.exe" -DZIG_AR_WORKAROUND=ON -DZIG_STATIC=ON -DZIG_USE_LLVM_CONFIG=OFF
|
||||
```
|
||||
|
||||
* Append `-DCMAKE_BUILD_TYPE=Release` for a Release build.
|
||||
* Append `-DZIG_NO_LIB=ON` to avoid having multiple copies of the lib/ folder.
|
||||
|
||||
Finally, run:
|
||||
|
||||
```bat
|
||||
ninja install
|
||||
```
|
||||
|
||||
You now have the `zig.exe` binary at `stage3\bin\zig.exe`.
|
||||
|
||||
#### Option 1b: zig build
|
||||
|
||||
Unzip the dev kit and then in cmd.exe in your Zig source checkout:
|
||||
|
||||
```bat
|
||||
$DEVKIT\bin\zig.exe build -p stage3 --search-prefix $DEVKIT --zig-lib-dir lib -Dstatic-llvm -Duse-zig-libcxx -Dtarget=x86_64-windows-gnu
|
||||
```
|
||||
|
||||
Replace `$DEVKIT` with the path to the folder that you unzipped after
|
||||
downloading it from the link above.
|
||||
|
||||
Append `-Doptimize=ReleaseSafe` for a Release build.
|
||||
|
||||
**If you get an error building at this step**, it is most likely that the Zig
|
||||
installation inside the dev kit is too old, and the dev kit needs to be
|
||||
updated. In this case one more step is required:
|
||||
|
||||
1. [Download the latest master branch zip file](https://ziglang.org/download/#release-master).
|
||||
2. Unzip, and try the above command again, replacing the path to zig.exe with
|
||||
the path to the zig.exe you just extracted, and also replace the lib\zig
|
||||
folder with the new contents.
|
||||
|
||||
You now have the `zig.exe` binary at `stage3\bin\zig.exe`.
|
||||
|
||||
### Option 2: Using CMake and Microsoft Visual Studio
|
||||
|
||||
This one has the benefit that changes to the language or build system won't
|
||||
break your dev kit. This option can be used to upgrade a dev kit.
|
||||
|
||||
First, build LLVM, LLD, and Clang from source using CMake and Microsoft Visual
|
||||
Studio (see below for detailed instructions).
|
||||
|
||||
Install [Build Tools for Visual Studio
|
||||
2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019).
|
||||
Be sure to select "Desktop development with C++" when prompted.
|
||||
* You must additionally check the optional component labeled **C++ ATL for
|
||||
v142 build tools**.
|
||||
|
||||
Install [CMake](http://cmake.org).
|
||||
|
||||
Use [git](https://git-scm.com/) to clone the zig repository to a path with no spaces, e.g. `C:\Users\Andy\zig`.
|
||||
|
||||
Using the start menu, run **x64 Native Tools Command Prompt for VS 2019** and execute these commands, replacing `C:\Users\Andy` with the correct value.
|
||||
|
||||
```bat
|
||||
mkdir C:\Users\Andy\zig\build-release
|
||||
cd C:\Users\Andy\zig\build-release
|
||||
"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-20.0.0-x86_64-windows-msvc-release-mt -DCMAKE_BUILD_TYPE=Release
|
||||
msbuild -p:Configuration=Release INSTALL.vcxproj
|
||||
```
|
||||
|
||||
You now have the `zig.exe` binary at `bin\zig.exe` and you can run the tests:
|
||||
|
||||
```bat
|
||||
bin\zig.exe build test
|
||||
```
|
||||
|
||||
This can take a long time.
|
||||
|
||||
Note: In case you get the error "llvm-config not found" (or similar), make sure
|
||||
that you have **no** trailing slash (`/` or `\`) at the end of the
|
||||
`-DCMAKE_PREFIX_PATH` value.
|
||||
|
||||
## Building LLVM, LLD, and Clang from Source
|
||||
|
||||
### Windows
|
||||
|
||||
Install [CMake](https://cmake.org/), version 3.20.0 or newer.
|
||||
|
||||
[Download LLVM, Clang, and LLD sources](https://releases.llvm.org/download.html#21.0.0)
|
||||
The downloads from llvm lead to the github release pages, where the source's
|
||||
will be listed as : `llvm-21.X.X.src.tar.xz`, `clang-21.X.X.src.tar.xz`,
|
||||
`lld-21.X.X.src.tar.xz`. Unzip each to their own directory. Ensure no
|
||||
directories have spaces in them. For example:
|
||||
|
||||
* `C:\Users\Andy\llvm-21.0.0.src`
|
||||
* `C:\Users\Andy\clang-21.0.0.src`
|
||||
* `C:\Users\Andy\lld-21.0.0.src`
|
||||
|
||||
Install [Build Tools for Visual Studio
|
||||
2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019).
|
||||
Be sure to select "C++ build tools" when prompted.
|
||||
* You **must** additionally check the optional component labeled **C++ ATL for
|
||||
v142 build tools**. As this won't be supplied by a default installation of
|
||||
Visual Studio.
|
||||
* Full list of supported MSVC versions:
|
||||
- 2017 (version 15.8) (unverified)
|
||||
- 2019 (version 16.7)
|
||||
|
||||
Install [Python 3.9.4](https://www.python.org). Tick the box to add python to
|
||||
your PATH environment variable.
|
||||
|
||||
#### LLVM
|
||||
|
||||
Using the start menu, run **x64 Native Tools Command Prompt for VS 2019** and execute these commands, replacing `C:\Users\Andy` with the correct value. Here is listed a brief explanation of each of the CMake parameters we pass when configuring the build
|
||||
|
||||
- `-Thost=x64` : Sets the windows toolset to use 64 bit mode.
|
||||
- `-A x64` : Make the build target 64 bit .
|
||||
- `-G "Visual Studio 16 2019"` : Specifies to generate a 2019 Visual Studio project, the best supported version.
|
||||
- `-DCMAKE_INSTALL_PREFIX=""` : Path that llvm components will being installed into by the install project.
|
||||
- `-DCMAKE_PREFIX_PATH=""` : Path that CMake will look into first when trying to locate dependencies, should be the same place as the install prefix. This will ensure that clang and lld will use your newly built llvm libraries.
|
||||
- `-DLLVM_ENABLE_ZLIB=OFF` : Don't build llvm with ZLib support as it's not required and will disrupt the target dependencies for components linking against llvm. This only has to be passed when building llvm, as this option will be saved into the config headers.
|
||||
- `-DCMAKE_BUILD_TYPE=Release` : Build llvm and components in release mode.
|
||||
- `-DCMAKE_BUILD_TYPE=Debug` : Build llvm and components in debug mode.
|
||||
- `-DLLVM_USE_CRT_RELEASE=MT` : Which C runtime should llvm use during release builds.
|
||||
- `-DLLVM_USE_CRT_DEBUG=MTd` : Make llvm use the debug version of the runtime in debug builds.
|
||||
|
||||
##### Release Mode
|
||||
|
||||
```bat
|
||||
mkdir C:\Users\Andy\llvm-21.0.0.src\build-release
|
||||
cd C:\Users\Andy\llvm-21.0.0.src\build-release
|
||||
"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-release-mt -
|
||||
DLLVM_ENABLE_ZLIB=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_USE_CRT_RELEASE=MT
|
||||
msbuild /m -p:Configuration=Release INSTALL.vcxproj
|
||||
```
|
||||
|
||||
##### Debug Mode
|
||||
|
||||
```bat
|
||||
mkdir C:\Users\Andy\llvm-21.0.0.src\build-debug
|
||||
cd C:\Users\Andy\llvm-21.0.0.src\build-debug
|
||||
"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-debug -
|
||||
DLLVM_ENABLE_ZLIB=OFF -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_USE_CRT_DEBUG=MTd
|
||||
msbuild /m INSTALL.vcxproj
|
||||
```
|
||||
|
||||
#### LLD
|
||||
|
||||
Using the start menu, run **x64 Native Tools Command Prompt for VS 2019** and execute these commands, replacing `C:\Users\Andy` with the correct value.
|
||||
|
||||
##### Release Mode
|
||||
|
||||
```bat
|
||||
mkdir C:\Users\Andy\lld-21.0.0.src\build-release
|
||||
cd C:\Users\Andy\lld-21.0.0.src\build-release
|
||||
"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-14.0.6-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-release-mt -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT
|
||||
msbuild /m -p:Configuration=Release INSTALL.vcxproj
|
||||
```
|
||||
|
||||
##### Debug Mode
|
||||
|
||||
```bat
|
||||
mkdir C:\Users\Andy\lld-21.0.0.src\build-debug
|
||||
cd C:\Users\Andy\lld-21.0.0.src\build-debug
|
||||
"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-debug -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_CRT_DEBUG=MTd
|
||||
msbuild /m INSTALL.vcxproj
|
||||
```
|
||||
|
||||
#### Clang
|
||||
|
||||
Using the start menu, run **x64 Native Tools Command Prompt for VS 2019** and execute these commands, replacing `C:\Users\Andy` with the correct value.
|
||||
|
||||
##### Release Mode
|
||||
|
||||
```bat
|
||||
mkdir C:\Users\Andy\clang-21.0.0.src\build-release
|
||||
cd C:\Users\Andy\clang-21.0.0.src\build-release
|
||||
"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-release-mt -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT
|
||||
msbuild /m -p:Configuration=Release INSTALL.vcxproj
|
||||
```
|
||||
|
||||
##### Debug Mode
|
||||
|
||||
```bat
|
||||
mkdir C:\Users\Andy\clang-21.0.0.src\build-debug
|
||||
cd C:\Users\Andy\clang-21.0.0.src\build-debug
|
||||
"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-debug -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-21.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_CRT_DEBUG=MTd
|
||||
msbuild /m INSTALL.vcxproj
|
||||
```
|
||||
|
||||
### POSIX Systems
|
||||
|
||||
This guide will get you both a Debug build of LLVM, and/or a Release build of LLVM.
|
||||
It intentionally does not require privileged access, using a prefix inside your home
|
||||
directory instead of a global installation.
|
||||
|
||||
#### Release
|
||||
|
||||
This is the generally recommended approach.
|
||||
|
||||
```
|
||||
cd ~/Downloads
|
||||
git clone --depth 1 --branch release/21.x https://github.com/llvm/llvm-project llvm-project-21
|
||||
cd llvm-project-21
|
||||
git checkout release/21.x
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
cmake ../llvm \
|
||||
-DCMAKE_INSTALL_PREFIX=$HOME/local/llvm21-assert \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_ENABLE_PROJECTS="lld;clang" \
|
||||
-DLLVM_ENABLE_LIBXML2=OFF \
|
||||
-DLLVM_ENABLE_TERMINFO=OFF \
|
||||
-DLLVM_ENABLE_LIBEDIT=OFF \
|
||||
-DLLVM_ENABLE_ASSERTIONS=ON \
|
||||
-DLLVM_PARALLEL_LINK_JOBS=1 \
|
||||
-G Ninja
|
||||
ninja install
|
||||
```
|
||||
|
||||
#### Debug
|
||||
|
||||
This is occasionally needed when debugging Zig's LLVM backend. Here we build
|
||||
the three projects separately so that LLVM can be in Debug mode while the
|
||||
others are in Release mode.
|
||||
|
||||
```
|
||||
cd ~/Downloads
|
||||
git clone --depth 1 --branch release/21.x https://github.com/llvm/llvm-project llvm-project-21
|
||||
cd llvm-project-21
|
||||
git checkout release/21.x
|
||||
|
||||
# LLVM
|
||||
mkdir llvm/build-debug
|
||||
cd llvm/build-debug
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=$HOME/local/llvm21-debug \
|
||||
-DCMAKE_PREFIX_PATH=$HOME/local/llvm21-debug \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DLLVM_ENABLE_LIBXML2=OFF \
|
||||
-DLLVM_ENABLE_TERMINFO=OFF \
|
||||
-DLLVM_ENABLE_LIBEDIT=OFF \
|
||||
-DLLVM_PARALLEL_LINK_JOBS=1 \
|
||||
-G Ninja
|
||||
ninja install
|
||||
cd ../..
|
||||
|
||||
# LLD
|
||||
mkdir lld/build-debug
|
||||
cd lld/build-debug
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=$HOME/local/llvm21-debug \
|
||||
-DCMAKE_PREFIX_PATH=$HOME/local/llvm21-debug \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_PARALLEL_LINK_JOBS=1 \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-G Ninja
|
||||
ninja install
|
||||
cd ../..
|
||||
|
||||
# Clang
|
||||
mkdir clang/build-debug
|
||||
cd clang/build-debug
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=$HOME/local/llvm21-debug \
|
||||
-DCMAKE_PREFIX_PATH=$HOME/local/llvm21-debug \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_PARALLEL_LINK_JOBS=1 \
|
||||
-DLLVM_INCLUDE_TESTS=OFF \
|
||||
-G Ninja
|
||||
ninja install
|
||||
cd ../..
|
||||
```
|
||||
|
||||
Then add to your Zig CMake line that you got from the README.md:
|
||||
`-DCMAKE_PREFIX_PATH=$HOME/local/llvm21-debug` or
|
||||
`-DCMAKE_PREFIX_PATH=$HOME/local/llvm21-assert` depending on whether you want
|
||||
Debug or Release LLVM.
|
||||
- Ability to compile C++, Objective-C, and Objective-C++ files
|
||||
|
||||
However, a compiler built this way does provide a C backend, which may be
|
||||
useful for creating system packages of Zig projects using the system C
|
||||
toolchain. In such case, LLVM is not needed!
|
||||
|
||||
## Contributing
|
||||
|
||||
[Donate monthly](https://ziglang.org/zsf/).
|
||||
|
||||
[Join a community](https://ziglang.org/community/).
|
||||
|
||||
Zig is Free and Open Source Software. We welcome bug reports and patches from
|
||||
everyone. However, keep in mind that Zig governance is BDFN (Benevolent
|
||||
Dictator For Now) which means that Andrew Kelley has final say on the design
|
||||
and implementation of everything.
|
||||
|
||||
### Make Software With Zig
|
||||
|
||||
One of the best ways you can contribute to Zig is to start using it for an
|
||||
open-source personal project.
|
||||
|
||||
|
|
@ -458,343 +111,35 @@ further design iterations of Zig. Importantly, each issue found this way comes
|
|||
with real world motivations, making it straightforward to explain the reasoning
|
||||
behind proposals and feature requests.
|
||||
|
||||
Ideally, such a project will help you to learn new skills and add something
|
||||
to your personal portfolio at the same time.
|
||||
|
||||
### Talk About Zig
|
||||
|
||||
Another way to contribute is to write about Zig, speak about Zig at a
|
||||
conference, or do either of those things for your project which uses Zig.
|
||||
|
||||
Programming languages live and die based on the pulse of their ecosystems. The
|
||||
more people involved, the more we can build great things upon each other's
|
||||
abstractions.
|
||||
|
||||
### Strict No LLM / No AI Policy
|
||||
|
||||
No LLMs for issues.
|
||||
|
||||
No LLMs for patches / pull requests.
|
||||
|
||||
No LLMs for comments on the bug tracker, including translation.
|
||||
|
||||
English is encouraged, but not required. You are welcome to post in your native
|
||||
language and rely on others to have their own translation tools of choice to
|
||||
interpret your words.
|
||||
|
||||
### Find a Contributor Friendly Issue
|
||||
You will be taken much more seriously on the issue tracker if you have a
|
||||
personal project that uses Zig.
|
||||
|
||||
The issue label
|
||||
[Contributor Friendly](https://codeberg.org/ziglang/zig/issues?labels=741726&state=open)
|
||||
exists to help you find issues that are **limited in scope and/or
|
||||
knowledge of Zig internals.**
|
||||
[Contributor Friendly](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3A%22contributor+friendly%22)
|
||||
exists to help you find issues that are **limited in scope and/or knowledge of
|
||||
Zig internals.**
|
||||
|
||||
Please note that issues labeled
|
||||
[Proposal: Proposed](https://codeberg.org/ziglang/zig/issues?labels=746937&state=open)
|
||||
are still under consideration, and efforts to implement such a proposal have
|
||||
a high risk of being wasted. If you are interested in a proposal which is
|
||||
[Proposal](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aproposal)
|
||||
but do not also have the
|
||||
[Accepted](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aaccepted)
|
||||
label are still under consideration, and efforts to implement such a proposal
|
||||
have a high risk of being wasted. If you are interested in a proposal which is
|
||||
still under consideration, please express your interest in the issue tracker,
|
||||
providing extra insights and considerations that others have not yet expressed.
|
||||
The most highly regarded argument in such a discussion is a real world use case.
|
||||
|
||||
Language proposals are not accepted. Please do not open an issue proposing to
|
||||
change the Zig language or syntax.
|
||||
For more tips, please see the
|
||||
[Contributing](https://github.com/ziglang/zig/wiki/Contributing) page on the
|
||||
wiki.
|
||||
|
||||
### Editing Source Code
|
||||
## Community
|
||||
|
||||
For a smooth workflow, when building from source, it is recommended to use
|
||||
CMake with the following settings:
|
||||
|
||||
* `-DCMAKE_BUILD_TYPE=Release` - to recompile zig faster.
|
||||
* `-GNinja` - Ninja is faster and simpler to use than Make.
|
||||
* `-DZIG_NO_LIB=ON` - Prevents the build system from copying the lib/
|
||||
directory to the installation prefix, causing zig use lib/ directly from the
|
||||
source tree instead. Effectively, this makes it so that changes to lib/ do
|
||||
not require re-running the install command to become active.
|
||||
|
||||
After configuration, there are two scenarios:
|
||||
|
||||
1. Pulling upstream changes and rebuilding.
|
||||
- In this case use `git pull` and then `ninja install`. Expected wait:
|
||||
about 10 minutes.
|
||||
2. Building from source after making local changes.
|
||||
- In this case use `stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib`.
|
||||
Expected wait: about 20 seconds.
|
||||
|
||||
This leaves you with two builds of Zig:
|
||||
|
||||
* `stage3/bin/zig` - an optimized master branch build. Useful for
|
||||
miscellaneous activities such as `zig fmt`, as well as for building the
|
||||
compiler itself after changing the source code.
|
||||
* `stage4/bin/zig` - a debug build that includes your local changes; useful
|
||||
for testing and eliminating bugs before submitting a patch.
|
||||
|
||||
To reduce time spent waiting for the compiler to build, try these techniques:
|
||||
|
||||
* Omit `-Denable-llvm` if you don't need the LLVM backend.
|
||||
* Use `-Ddev=foo` to build with a reduced feature set for development of
|
||||
specific features. See `zig build -h` for a list of options.
|
||||
* Use `--watch -fincremental` to enable incremental compilation. This offers
|
||||
**near instant rebuilds**.
|
||||
|
||||
### Testing
|
||||
|
||||
```
|
||||
stage4/bin/zig build test
|
||||
```
|
||||
|
||||
This command runs the whole test suite, which does a lot of extra testing that
|
||||
you likely won't always need, and can take upwards of 1 hour. This is what the
|
||||
CI server runs when you make a pull request.
|
||||
|
||||
To save time, you can add the `--help` option to the `zig build` command and
|
||||
see what options are available. One of the most helpful ones is
|
||||
`-Dskip-release`. Adding this option to the command above, along with
|
||||
`-Dskip-non-native`, will take the time down from around 2 hours to about 30
|
||||
minutes, and this is a good enough amount of testing before making a pull
|
||||
request.
|
||||
|
||||
Another example is choosing a different set of things to test. For example,
|
||||
`test-std` instead of `test` will only run the standard library tests, and
|
||||
not the other ones. Combining this suggestion with the previous one, you could
|
||||
do this:
|
||||
|
||||
```
|
||||
stage4/bin/zig build test-std -Dskip-release
|
||||
```
|
||||
|
||||
This will run only the standard library tests in debug mode for all targets.
|
||||
It will cross-compile the tests for non-native targets but not run them.
|
||||
|
||||
When making changes to the compiler source code, the most helpful test step to
|
||||
run is `test-behavior`. When editing documentation it is `docs`. You can find
|
||||
this information and more in the `zig build --help` menu.
|
||||
|
||||
#### Directly Testing the Standard Library with `zig test`
|
||||
|
||||
This command will run the standard library tests with only the native target
|
||||
configuration and is estimated to complete in 3 minutes:
|
||||
|
||||
```
|
||||
zig build test-std -Dno-matrix
|
||||
```
|
||||
|
||||
However, one may also use `zig test` directly. From inside the `ziglang/zig` repo root:
|
||||
|
||||
```
|
||||
zig test lib/std/std.zig --zig-lib-dir lib
|
||||
```
|
||||
|
||||
You can add `--test-filter "some test name"` to run a specific test or a subset of tests.
|
||||
(Running exactly 1 test is not reliably possible, because the test filter does not
|
||||
exclude anonymous test blocks, but that shouldn't interfere with whatever
|
||||
you're trying to test in practice.)
|
||||
|
||||
Note that `--test-filter` filters on fully qualified names, so e.g. it's possible to run only the `std.json` tests with:
|
||||
|
||||
```
|
||||
zig test lib/std/std.zig --zig-lib-dir lib --test-filter "json."
|
||||
```
|
||||
|
||||
If you used `-Dno-lib` and you are in a `build/` subdirectory, you can omit the
|
||||
`--zig-lib-dir` argument:
|
||||
|
||||
```
|
||||
stage3/bin/zig test ../lib/std/std.zig
|
||||
```
|
||||
|
||||
#### Testing Non-Native Architectures with QEMU
|
||||
|
||||
The Linux CI server additionally has qemu installed and sets `-fqemu`.
|
||||
This provides test coverage for, e.g. aarch64 even on x86_64 machines. It's
|
||||
recommended for Linux users to install qemu and enable this testing option
|
||||
when editing the standard library or anything related to a non-native
|
||||
architecture.
|
||||
|
||||
QEMU packages provided by some system package managers (such as Debian) may be
|
||||
a few releases old, or may be missing newer targets such as aarch64 and RISC-V.
|
||||
[ziglang/qemu-static](https://codeberg.org/ziglang/qemu-static) offers static
|
||||
binaries of the latest QEMU version.
|
||||
|
||||
##### Testing Non-Native libc Targets
|
||||
|
||||
Testing foreign architectures with dynamically linked libc is one step trickier.
|
||||
This requires enabling `--libc-runtimes /path/to/libcs`. This path is obtained
|
||||
by building glibc and musl for multiple architectures. This process for me took
|
||||
an entire day to complete and takes up 65 GiB on my hard drive.
|
||||
|
||||
[Instructions for producing this path.](https://codeberg.org/ziglang/infra/src/branch/master/building-libcs.md)
|
||||
|
||||
It is understood that most contributors will not have these tests enabled. The
|
||||
CI machines provide coverage for these.
|
||||
|
||||
#### Testing Windows from a Linux Machine with Wine
|
||||
|
||||
When developing on Linux, another option is available to you: `-fwine`.
|
||||
This will enable running behavior tests and std lib tests with Wine. It's
|
||||
recommended for Linux users to install Wine and enable this testing option
|
||||
when editing the standard library or anything Windows-related.
|
||||
|
||||
#### Testing WebAssembly using wasmtime
|
||||
|
||||
If you have [wasmtime](https://wasmtime.dev/) installed, take advantage of the
|
||||
`-fwasmtime` flag which will enable running WASI behavior tests and std
|
||||
lib tests. It's recommended for all users to install wasmtime and enable this
|
||||
testing option when editing the standard library and especially anything
|
||||
WebAssembly-related.
|
||||
|
||||
### Improving Translate-C
|
||||
|
||||
`translate-c` is a feature provided by Zig that converts C source code into
|
||||
Zig source code. It powers the `zig translate-c` command as well as
|
||||
[@cImport](https://ziglang.org/documentation/master/#cImport), allowing Zig
|
||||
code to not only take advantage of function prototypes defined in .h files,
|
||||
but also `static inline` functions written in C, and even some macros.
|
||||
|
||||
This feature used to work by using libclang API to parse and semantically
|
||||
analyze C/C++ files, and then based on the provided AST and type information,
|
||||
generating Zig AST, and finally using the mechanisms of `zig fmt` to render the
|
||||
Zig AST to a file.
|
||||
|
||||
However, C translation is in a transitional period right now. It used to be
|
||||
based on Clang, but is now based on Aro:
|
||||
|
||||
[Pull Request: update aro and translate-c to latest; delete clang translate-c](https://github.com/ziglang/zig/pull/24497)
|
||||
|
||||
Test coverage as well as bug reports have been moved to this repository:
|
||||
|
||||
[ziglang/translate-c](https://codeberg.org/ziglang/translate-c/)
|
||||
|
||||
In the future, [@cImport will move to the build system](https://github.com/ziglang/zig/issues/20630),
|
||||
but for now, the translate-c logic is copy-pasted from that project into
|
||||
[ziglang/zig](https://codeberg.org/ziglang/zig/), powering both `zig translate-c`
|
||||
and `@cImport`.
|
||||
|
||||
Please see the readme of the translate-c project for how to contribute. Once an
|
||||
issue is resolved (and test coverage added) there, the changes can be
|
||||
immediately backported to the zig compiler.
|
||||
|
||||
Once we fix the problems people are facing from this transition from Clang to
|
||||
Aro, we can move on to enhancing the translate-c package such that `@cImport`
|
||||
becomes redundant and can therefore be eliminated from the language.
|
||||
|
||||
### Autodoc
|
||||
|
||||
Autodoc is an interactive, searchable, single-page web application for browsing
|
||||
Zig codebases.
|
||||
|
||||
An autodoc deployment looks like this:
|
||||
|
||||
```
|
||||
index.html
|
||||
main.js
|
||||
main.wasm
|
||||
sources.tar
|
||||
```
|
||||
|
||||
* `main.js` and `index.html` are static files which live in a Zig installation
|
||||
at `lib/docs/`.
|
||||
* `main.wasm` is compiled from the Zig files inside `lib/docs/wasm/`.
|
||||
* `sources.tar` is all the zig source files of the project.
|
||||
|
||||
These artifacts are produced by the compiler when `-femit-docs` is passed.
|
||||
|
||||
#### Making Changes
|
||||
|
||||
The command `zig std` spawns an HTTP server that provides all the assets
|
||||
mentioned above specifically for the standard library.
|
||||
|
||||
The server creates the requested files on the fly, including rebuilding
|
||||
`main.wasm` if any of its source files changed, and constructing `sources.tar`,
|
||||
meaning that any source changes to the documented files, or to the autodoc
|
||||
system itself are immediately reflected when viewing docs.
|
||||
|
||||
This means you can test changes to Zig standard library documentation, as well
|
||||
as autodocs functionality, by pressing refresh in the browser.
|
||||
|
||||
Prefixing the URL with `/debug` results in a debug build of `main.wasm`.
|
||||
|
||||
#### Debugging the Zig Code
|
||||
|
||||
While Firefox and Safari support are obviously required, I recommend Chromium
|
||||
for development for one reason in particular:
|
||||
|
||||
[C/C++ DevTools Support (DWARF)](https://chromewebstore.google.com/detail/cc++-devtools-support-dwa/pdcpmagijalfljmkmjngeonclgbbannb)
|
||||
|
||||
This makes debugging Zig WebAssembly code a breeze.
|
||||
|
||||
#### The Sources Tarball
|
||||
|
||||
The system expects the top level of `sources.tar` to be the set of modules
|
||||
documented. So for the Zig standard library you would do this:
|
||||
`tar cf std.tar std/`. Don't compress it; the idea is to rely on HTTP
|
||||
compression.
|
||||
|
||||
Any files that are not `.zig` source files will be ignored by `main.wasm`,
|
||||
however, those files will take up wasted space in the tar file. For the
|
||||
standard library, use the set of files that zig installs to when running `zig
|
||||
build`, which is the same as the set of files that are provided on
|
||||
ziglang.org/download.
|
||||
|
||||
If the system doesn't find a file named "foo/root.zig" or "foo/foo.zig", it
|
||||
will use the first file in the tar as the module root.
|
||||
|
||||
You don't typically need to create `sources.tar` yourself, since it is lazily
|
||||
provided by the `zig std` HTTP server as well as produced by `-femit-docs`.
|
||||
|
||||
|
||||
## Testing Zig Code With LLDB
|
||||
|
||||
[@jacobly0](https://github.com/jacobly0) maintains a fork of LLDB with Zig support:
|
||||
|
||||
https://github.com/jacobly0/llvm-project/tree/lldb-zig
|
||||
|
||||
This fork only contains changes for debugging programs compiled by Zig's
|
||||
self-hosted backends, i.e. `zig build-exe -fno-llvm ...`.
|
||||
|
||||
### Building
|
||||
|
||||
To build the LLDB fork, make sure you have
|
||||
[prerequisites](https://lldb.llvm.org/resources/build.html#preliminaries)
|
||||
installed, and then do something like:
|
||||
|
||||
```
|
||||
$ cmake llvm -G Ninja -B build -DLLVM_ENABLE_PROJECTS="clang;lldb" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=ON -DLLDB_ENABLE_LIBEDIT=ON -DLLDB_ENABLE_PYTHON=ON
|
||||
$ cmake --build build --target lldb --target lldb-server
|
||||
```
|
||||
|
||||
(You may need to manually [configure
|
||||
dependencies](https://lldb.llvm.org/resources/build.html#optional-dependencies)
|
||||
if CMake can't find them.)
|
||||
|
||||
Once built, you can run `./build/bin/lldb` and so on.
|
||||
|
||||
### Pretty Printers
|
||||
|
||||
If you will be debugging the Zig compiler itself, or if you will be debugging
|
||||
any project compiled with Zig's LLVM backend (not recommended with the LLDB
|
||||
fork, prefer vanilla LLDB with a version that matches the version of LLVM that
|
||||
Zig is using), you can get a better debugging experience by using
|
||||
[`lldb_pretty_printers.py`](https://codeberg.org/ziglang/zig/src/branch/master/tools/lldb_pretty_printers.py).
|
||||
|
||||
Put this line in `~/.lldbinit`:
|
||||
|
||||
```
|
||||
command script import /path/to/zig/tools/lldb_pretty_printers.py
|
||||
```
|
||||
|
||||
If you will be using Zig's LLVM backend (again, not recommended with the LLDB
|
||||
fork), you will also want these lines:
|
||||
|
||||
```
|
||||
type category enable zig.lang
|
||||
type category enable zig.std
|
||||
```
|
||||
|
||||
If you will be debugging a Zig compiler built using Zig's LLVM backend (again,
|
||||
not recommended with the LLDB fork), you will also want this line:
|
||||
|
||||
```
|
||||
type category enable zig.stage2
|
||||
```
|
||||
The Zig community is decentralized. Anyone is free to start and maintain their
|
||||
own space for Zig users to gather. There is no concept of "official" or
|
||||
"unofficial". Each gathering place has its own moderators and rules. Users are
|
||||
encouraged to be aware of the social structures of the spaces they inhabit, and
|
||||
work purposefully to facilitate spaces that align with their values.
|
||||
|
||||
Please see the [Community](https://github.com/ziglang/zig/wiki/Community) wiki
|
||||
page for a public listing of social spaces.
|
||||
|
|
|
|||
21
bootstrap.c
21
bootstrap.c
|
|
@ -64,8 +64,6 @@ static const char *get_host_os(void) {
|
|||
return "linux";
|
||||
#elif defined(__FreeBSD__)
|
||||
return "freebsd";
|
||||
#elif defined(__DragonFly__)
|
||||
return "dragonfly";
|
||||
#elif defined(__HAIKU__)
|
||||
return "haiku";
|
||||
#else
|
||||
|
|
@ -125,7 +123,7 @@ int main(int argc, char **argv) {
|
|||
if (f == NULL)
|
||||
panic("unable to open config.zig for writing");
|
||||
|
||||
const char *zig_version = "0.14.0-dev.bootstrap";
|
||||
const char *zig_version = "0.12.0-dev.bootstrap";
|
||||
|
||||
int written = fprintf(f,
|
||||
"pub const have_llvm = false;\n"
|
||||
|
|
@ -141,10 +139,9 @@ int main(int argc, char **argv) {
|
|||
"pub const enable_tracy = false;\n"
|
||||
"pub const value_tracing = false;\n"
|
||||
"pub const skip_non_native = false;\n"
|
||||
"pub const debug_gpa = false;\n"
|
||||
"pub const dev = .core;\n"
|
||||
"pub const io_mode: enum { threaded, evented } = .threaded;\n"
|
||||
"pub const value_interpret_mode = .direct;\n"
|
||||
"pub const force_gpa = false;\n"
|
||||
"pub const only_c = false;\n"
|
||||
"pub const only_core_functionality = true;\n"
|
||||
, zig_version);
|
||||
if (written < 100)
|
||||
panic("unable to write to config.zig file");
|
||||
|
|
@ -160,9 +157,9 @@ int main(int argc, char **argv) {
|
|||
"-target", host_triple,
|
||||
"--dep", "build_options",
|
||||
"--dep", "aro",
|
||||
"-Mroot=src/main.zig",
|
||||
"-Mbuild_options=config.zig",
|
||||
"-Maro=lib/compiler/aro/aro.zig",
|
||||
"--mod", "root", "src/main.zig",
|
||||
"--mod", "build_options", "config.zig",
|
||||
"--mod", "aro", "lib/compiler/aro/aro.zig",
|
||||
NULL,
|
||||
};
|
||||
print_and_run(child_argv);
|
||||
|
|
@ -174,7 +171,9 @@ int main(int argc, char **argv) {
|
|||
"-ofmt=c", "-OReleaseSmall",
|
||||
"--name", "compiler_rt", "-femit-bin=compiler_rt.c",
|
||||
"-target", host_triple,
|
||||
"-Mroot=lib/compiler_rt.zig",
|
||||
"--dep", "build_options",
|
||||
"--mod", "root", "lib/compiler_rt.zig",
|
||||
"--mod", "build_options", "config.zig",
|
||||
NULL,
|
||||
};
|
||||
print_and_run(child_argv);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// The Zig compiler is not intended to be consumed as a package.
|
||||
// The sole purpose of this manifest file is to test the compiler.
|
||||
.{
|
||||
.name = .zig,
|
||||
.name = "zig",
|
||||
.version = "0.0.0",
|
||||
.dependencies = .{
|
||||
.standalone_test_cases = .{
|
||||
|
|
@ -12,5 +12,4 @@
|
|||
},
|
||||
},
|
||||
.paths = .{""},
|
||||
.fingerprint = 0xc1ce108124179e16,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="aarch64-freebsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="aarch64-freebsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
92
ci/aarch64-linux-debug.sh
Executable file → Normal file
92
ci/aarch64-linux-debug.sh
Executable file → Normal file
|
|
@ -5,13 +5,26 @@
|
|||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="aarch64-linux-musl"
|
||||
ARCH="$(uname -m)"
|
||||
TARGET="$ARCH-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.203+d3bc1cfc4"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
export PATH="$HOME/local/bin:$PATH"
|
||||
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$PATH"
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
rm -rf build-debug
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
|
|
@ -19,12 +32,6 @@ export PATH="$HOME/local/bin:$PATH"
|
|||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
|
|
@ -42,24 +49,61 @@ unset CXX
|
|||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
# TODO: move this to a build.zig step (check-fmt)
|
||||
echo "Looking for non-conforming code formatting..."
|
||||
stage3-debug/bin/zig fmt --check .. \
|
||||
--exclude ../test/cases/ \
|
||||
--exclude ../build-debug
|
||||
|
||||
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||
stage3-debug/bin/zig build \
|
||||
-Dtarget=arm-linux-musleabihf \
|
||||
-Dno-lib
|
||||
|
||||
# TODO: add -fqemu back to this line
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
--maxrss 24696061952 \
|
||||
-fwasmtime \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-superhtml \
|
||||
--test-timeout 3m
|
||||
--zig-lib-dir "$PWD/../lib"
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
# Look for HTML errors.
|
||||
# TODO: move this to a build.zig flag (-Denable-tidy)
|
||||
tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html"
|
||||
|
||||
# Ensure that updating the wasm binary from this commit will result in a viable build.
|
||||
stage3-debug/bin/zig build update-zig1
|
||||
|
||||
rm -rf ../build-new
|
||||
mkdir ../build-new
|
||||
cd ../build-new
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3/bin/zig test ../test/behavior.zig
|
||||
stage3/bin/zig build -p stage4 \
|
||||
-Dstatic-llvm \
|
||||
-Dtarget=native-native-musl \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib"
|
||||
stage4/bin/zig test ../test/behavior.zig
|
||||
|
|
|
|||
98
ci/aarch64-linux-release.sh
Executable file → Normal file
98
ci/aarch64-linux-release.sh
Executable file → Normal file
|
|
@ -5,13 +5,26 @@
|
|||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="aarch64-linux-musl"
|
||||
ARCH="$(uname -m)"
|
||||
TARGET="$ARCH-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.203+d3bc1cfc4"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
export PATH="$HOME/local/bin:$PATH"
|
||||
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$PATH"
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
rm -rf build-release
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
|
|
@ -19,12 +32,6 @@ export PATH="$HOME/local/bin:$PATH"
|
|||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
|
|
@ -42,30 +49,61 @@ unset CXX
|
|||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
# TODO: move this to a build.zig step (check-fmt)
|
||||
echo "Looking for non-conforming code formatting..."
|
||||
stage3-release/bin/zig fmt --check .. \
|
||||
--exclude ../test/cases/ \
|
||||
--exclude ../build-release
|
||||
|
||||
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||
stage3-release/bin/zig build \
|
||||
-Dtarget=arm-linux-musleabihf \
|
||||
-Dno-lib
|
||||
|
||||
# TODO: add -fqemu back to this line
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
--maxrss 24696061952 \
|
||||
-fwasmtime \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-superhtml \
|
||||
--test-timeout 3m
|
||||
--zig-lib-dir "$PWD/../lib"
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
# Look for HTML errors.
|
||||
# TODO: move this to a build.zig flag (-Denable-tidy)
|
||||
tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html"
|
||||
|
||||
# Ensure that updating the wasm binary from this commit will result in a viable build.
|
||||
stage3-release/bin/zig build update-zig1
|
||||
|
||||
rm -rf ../build-new
|
||||
mkdir ../build-new
|
||||
cd ../build-new
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3/bin/zig test ../test/behavior.zig
|
||||
stage3/bin/zig build -p stage4 \
|
||||
-Dstatic-llvm \
|
||||
-Dtarget=native-native-musl \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib"
|
||||
stage4/bin/zig test ../test/behavior.zig
|
||||
|
|
|
|||
|
|
@ -3,31 +3,33 @@
|
|||
set -x
|
||||
set -e
|
||||
|
||||
# Script assumes the presence of the following:
|
||||
# s3cmd
|
||||
|
||||
ZIGDIR="$PWD"
|
||||
TARGET="aarch64-macos-none"
|
||||
TARGET="$ARCH-macos-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
|
||||
PREFIX="$HOME/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
if [ ! -d "$PREFIX" ]; then
|
||||
cd $HOME
|
||||
curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
||||
tar xf "$CACHE_BASENAME.tar.xz"
|
||||
fi
|
||||
|
||||
cd $ZIGDIR
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
cmake .. \
|
||||
PATH="$HOME/local/bin:$PATH" cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
|
|
@ -39,24 +41,11 @@ cmake .. \
|
|||
-DZIG_NO_LIB=ON \
|
||||
-GNinja
|
||||
|
||||
ninja install
|
||||
$HOME/local/bin/ninja install
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-macos-sdk \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--test-timeout 2m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
--search-prefix "$PREFIX"
|
||||
|
|
|
|||
|
|
@ -3,31 +3,33 @@
|
|||
set -x
|
||||
set -e
|
||||
|
||||
# Script assumes the presence of the following:
|
||||
# s3cmd
|
||||
|
||||
ZIGDIR="$PWD"
|
||||
TARGET="aarch64-macos-none"
|
||||
TARGET="$ARCH-macos-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
|
||||
PREFIX="$HOME/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
if [ ! -d "$PREFIX" ]; then
|
||||
cd $HOME
|
||||
curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
||||
tar xf "$CACHE_BASENAME.tar.xz"
|
||||
fi
|
||||
|
||||
cd $ZIGDIR
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
cmake .. \
|
||||
PATH="$HOME/local/bin:$PATH" cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
|
|
@ -39,20 +41,17 @@ cmake .. \
|
|||
-DZIG_NO_LIB=ON \
|
||||
-GNinja
|
||||
|
||||
ninja install
|
||||
$HOME/local/bin/ninja install
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-macos-sdk \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--test-timeout 2m
|
||||
--search-prefix "$PREFIX"
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
|
|
@ -63,7 +62,6 @@ stage3-release/bin/zig build \
|
|||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
# https://codeberg.org/ziglang/zig/issues/30687
|
||||
#echo "If the following command fails, it means nondeterminism has been"
|
||||
#echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
#diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="aarch64-netbsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="aarch64-netbsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
$TARGET = "aarch64-windows-gnu"
|
||||
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
$TARGET = "$($Env:ARCH)-windows-gnu"
|
||||
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2087+e9a18010b"
|
||||
$MCPU = "baseline"
|
||||
$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
|
||||
$PREFIX_PATH = "$(Get-Location)\..\$ZIG_LLVM_CLANG_LLD_NAME"
|
||||
$ZIG = "$PREFIX_PATH\bin\zig.exe"
|
||||
$ZIG_LIB_DIR = "$(Get-Location)\lib"
|
||||
$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
|
||||
|
||||
if (!(Test-Path "..\$ZIG_LLVM_CLANG_LLD_NAME.zip")) {
|
||||
Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
|
||||
|
|
@ -23,16 +22,25 @@ function CheckLastExitCode {
|
|||
return 0
|
||||
}
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the `zig build` command below which uses `git describe`.
|
||||
git fetch --tags
|
||||
|
||||
if ((git rev-parse --is-shallow-repository) -eq "true") {
|
||||
git fetch --unshallow # `git describe` won't work on a shallow repo
|
||||
}
|
||||
|
||||
Write-Output "Building from source..."
|
||||
Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore
|
||||
New-Item -Path 'build-release' -ItemType Directory
|
||||
Set-Location -Path 'build-release'
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
$Env:ZIG_GLOBAL_CACHE_DIR="$(Get-Location)\zig-global-cache"
|
||||
$Env:ZIG_LOCAL_CACHE_DIR="$(Get-Location)\zig-local-cache"
|
||||
|
||||
Write-Output "Building from source..."
|
||||
New-Item -Path 'build-release' -ItemType Directory
|
||||
Set-Location -Path 'build-release'
|
||||
|
||||
# CMake gives a syntax error when file paths with backward slashes are used.
|
||||
# Here, we use forward slashes only to work around this.
|
||||
& cmake .. `
|
||||
|
|
@ -55,31 +63,9 @@ CheckLastExitCode
|
|||
|
||||
Write-Output "Main test suite..."
|
||||
& "stage3-release\bin\zig.exe" build test docs `
|
||||
--maxrss $ZSF_MAX_RSS `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
--search-prefix "$PREFIX_PATH" `
|
||||
-Dstatic-llvm `
|
||||
-Dskip-non-native `
|
||||
-Dskip-test-incremental `
|
||||
-Denable-symlinks-windows `
|
||||
--test-timeout 30m
|
||||
CheckLastExitCode
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
Write-Output "Build and compare stage4..."
|
||||
& "stage3-release\bin\zig.exe" build `
|
||||
--prefix stage4-release `
|
||||
-Denable-llvm `
|
||||
-Dno-lib `
|
||||
-Doptimize=ReleaseFast `
|
||||
-Dstrip `
|
||||
-Dtarget="$TARGET" `
|
||||
-Duse-zig-libcxx `
|
||||
-Dversion-string="$(stage3-release\bin\zig version)"
|
||||
CheckLastExitCode
|
||||
|
||||
# Compare-Object returns an error code if the files differ.
|
||||
Write-Output "If the following command fails, it means nondeterminism has been"
|
||||
Write-Output "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
Compare-Object (Get-Content stage3-release\bin\zig.exe) (Get-Content stage4-release\bin\zig.exe)
|
||||
-Denable-symlinks-windows
|
||||
CheckLastExitCode
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="loongarch64-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.157+7fdd60df1"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="loongarch64-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.157+7fdd60df1"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="powerpc64le-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1594+9fa433d71"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
-Dcpu=native+longcall \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Dcpu=$MCPU \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="powerpc64le-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1594+9fa433d71"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
-Dcpu=native+longcall \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Dcpu=$MCPU \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="riscv64-linux-musl"
|
||||
MCPU="spacemit_x60"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-riscv64-linux-musl-0.16.0-dev.104+689461e31"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
export PATH="$HOME/local/bin:$PATH"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-debug/bin/zig build test-modules test-c-abi \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-single-threaded \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="riscv64-linux-musl"
|
||||
MCPU="spacemit_x60"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-riscv64-linux-musl-0.16.0-dev.104+689461e31"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
export PATH="$HOME/local/bin:$PATH"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-release/bin/zig build test-modules test-c-abi \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-single-threaded \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="s390x-linux-musl"
|
||||
MCPU="z15"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1354+94e98bfe8"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Dcpu=$MCPU \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="s390x-linux-musl"
|
||||
MCPU="z15"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1354+94e98bfe8"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 4m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Dcpu=$MCPU \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-freebsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.312+164c598cd"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-spirv \
|
||||
-Dskip-wasm \
|
||||
-Dskip-linux \
|
||||
-Dskip-netbsd \
|
||||
-Dskip-openbsd \
|
||||
-Dskip-windows \
|
||||
-Dskip-darwin \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-freebsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.312+164c598cd"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-spirv \
|
||||
-Dskip-wasm \
|
||||
-Dskip-linux \
|
||||
-Dskip-netbsd \
|
||||
-Dskip-openbsd \
|
||||
-Dskip-windows \
|
||||
-Dskip-darwin \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
export PATH="$HOME/deps/wasmtime-v42.0.1-x86_64-linux:$HOME/deps/qemu-linux-x86_64-10.2.1.1/bin:$HOME/local/bin:$PATH"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug-llvm
|
||||
cd build-debug-llvm
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-DZIG_EXTRA_BUILD_ARGS="-Duse-llvm=true" \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||
stage3-debug/bin/zig build \
|
||||
-Dtarget=arm-linux-musleabihf \
|
||||
-Dno-lib
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dlldb=$HOME/deps/lldb-zig/Debug-e0a42bb34/bin/lldb \
|
||||
-Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \
|
||||
-fqemu \
|
||||
--libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \
|
||||
-fwasmtime \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-freebsd \
|
||||
-Dskip-netbsd \
|
||||
-Dskip-openbsd \
|
||||
-Dskip-windows \
|
||||
-Dskip-darwin \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-superhtml \
|
||||
--test-timeout 12m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Duse-llvm \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -5,13 +5,34 @@
|
|||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-linux-musl"
|
||||
ARCH="$(uname -m)"
|
||||
TARGET="$ARCH-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.203+d3bc1cfc4"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
export PATH="$HOME/deps/wasmtime-v42.0.1-x86_64-linux:$HOME/deps/qemu-linux-x86_64-10.2.1.1/bin:$HOME/local/bin:$PATH"
|
||||
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-8.2.1/bin:$PATH"
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
# Test building from source without LLVM.
|
||||
git clean -fd
|
||||
rm -rf zig-out
|
||||
cc -o bootstrap bootstrap.c
|
||||
./bootstrap
|
||||
./zig2 build -Dno-lib
|
||||
./zig-out/bin/zig test test/behavior.zig
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
rm -rf build-debug
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
|
|
@ -19,12 +40,6 @@ export PATH="$HOME/deps/wasmtime-v42.0.1-x86_64-linux:$HOME/deps/qemu-linux-x86_
|
|||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
|
|
@ -33,10 +48,7 @@ cmake .. \
|
|||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
-GNinja
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
|
|
@ -45,37 +57,61 @@ unset CXX
|
|||
|
||||
ninja install
|
||||
|
||||
# TODO: move this to a build.zig step (check-fmt)
|
||||
echo "Looking for non-conforming code formatting..."
|
||||
stage3-debug/bin/zig fmt --check .. \
|
||||
--exclude ../test/cases/ \
|
||||
--exclude ../build-debug
|
||||
|
||||
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||
stage3-debug/bin/zig build \
|
||||
-Dtarget=arm-linux-musleabihf \
|
||||
-Dno-lib
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dlldb=$HOME/deps/lldb-zig/Debug-e0a42bb34/bin/lldb \
|
||||
--maxrss 21000000000 \
|
||||
-fqemu \
|
||||
--libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \
|
||||
-fwasmtime \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-freebsd \
|
||||
-Dskip-netbsd \
|
||||
-Dskip-openbsd \
|
||||
-Dskip-windows \
|
||||
-Dskip-darwin \
|
||||
-Dskip-llvm \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-superhtml \
|
||||
--test-timeout 10m
|
||||
--zig-lib-dir "$PWD/../lib"
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
# Look for HTML errors.
|
||||
# TODO: move this to a build.zig flag (-Denable-tidy)
|
||||
tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html"
|
||||
|
||||
# Ensure that updating the wasm binary from this commit will result in a viable build.
|
||||
stage3-debug/bin/zig build update-zig1
|
||||
|
||||
rm -rf ../build-new
|
||||
mkdir ../build-new
|
||||
cd ../build-new
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3/bin/zig test ../test/behavior.zig
|
||||
stage3/bin/zig build -p stage4 \
|
||||
-Dstatic-llvm \
|
||||
-Dtarget=native-native-musl \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib"
|
||||
stage4/bin/zig test ../test/behavior.zig
|
||||
|
|
|
|||
|
|
@ -5,13 +5,34 @@
|
|||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-linux-musl"
|
||||
ARCH="$(uname -m)"
|
||||
TARGET="$ARCH-linux-musl"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.203+d3bc1cfc4"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
export PATH="$HOME/deps/wasmtime-v42.0.1-x86_64-linux:$HOME/deps/qemu-linux-x86_64-10.2.1.1/bin:$HOME/local/bin:$PATH"
|
||||
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-8.2.1/bin:$PATH"
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
# Test building from source without LLVM.
|
||||
git clean -fd
|
||||
rm -rf zig-out
|
||||
cc -o bootstrap bootstrap.c
|
||||
./bootstrap
|
||||
./zig2 build -Dno-lib
|
||||
./zig-out/bin/zig test test/behavior.zig
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
rm -rf build-release
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
|
|
@ -19,18 +40,6 @@ export PATH="$HOME/deps/wasmtime-v42.0.1-x86_64-linux:$HOME/deps/qemu-linux-x86_
|
|||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
# Test building from source without LLVM.
|
||||
cc -o bootstrap bootstrap.c
|
||||
./bootstrap
|
||||
./zig2 build -Dno-lib
|
||||
./zig-out/bin/zig test test/behavior.zig
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
|
|
@ -39,10 +48,7 @@ cmake .. \
|
|||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
-GNinja
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
|
|
@ -51,25 +57,30 @@ unset CXX
|
|||
|
||||
ninja install
|
||||
|
||||
# TODO: move this to a build.zig step (check-fmt)
|
||||
echo "Looking for non-conforming code formatting..."
|
||||
stage3-release/bin/zig fmt --check .. \
|
||||
--exclude ../test/cases/ \
|
||||
--exclude ../build-debug \
|
||||
--exclude ../build-release
|
||||
|
||||
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||
stage3-release/bin/zig build \
|
||||
-Dtarget=arm-linux-musleabihf \
|
||||
-Dno-lib
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dlldb=$HOME/deps/lldb-zig/Release-e0a42bb34/bin/lldb \
|
||||
-Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \
|
||||
--maxrss 21000000000 \
|
||||
-fqemu \
|
||||
--libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \
|
||||
-fwasmtime \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-test-incremental \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-superhtml \
|
||||
--test-timeout 12m
|
||||
--zig-lib-dir "$PWD/../lib"
|
||||
|
||||
# Look for HTML errors.
|
||||
# TODO: move this to a build.zig flag (-Denable-tidy)
|
||||
tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html"
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
|
|
@ -90,9 +101,12 @@ diff stage3-release/bin/zig stage4-release/bin/zig
|
|||
# Ensure that updating the wasm binary from this commit will result in a viable build.
|
||||
stage3-release/bin/zig build update-zig1
|
||||
|
||||
rm -rf ../build-new
|
||||
mkdir ../build-new
|
||||
cd ../build-new
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
|
|
@ -103,10 +117,7 @@ cmake .. \
|
|||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
-GNinja
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
|
|
|||
79
ci/x86_64-macos-release.sh
Executable file
79
ci/x86_64-macos-release.sh
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ZIGDIR="$PWD"
|
||||
TARGET="$ARCH-macos-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
|
||||
PREFIX="$HOME/$CACHE_BASENAME"
|
||||
JOBS="-j3"
|
||||
|
||||
rm -rf $PREFIX
|
||||
cd $HOME
|
||||
|
||||
curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
||||
tar xf "$CACHE_BASENAME.tar.xz"
|
||||
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
cd $ZIGDIR
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
# Test building from source without LLVM.
|
||||
git clean -fd
|
||||
rm -rf zig-out
|
||||
cc -o bootstrap bootstrap.c
|
||||
./bootstrap
|
||||
./zig2 build -Dno-lib
|
||||
./zig-out/bin/zig test test/behavior.zig
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \
|
||||
-DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON
|
||||
|
||||
make $JOBS install
|
||||
|
||||
stage3/bin/zig build test docs \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
-Denable-macos-sdk \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
--search-prefix "$PREFIX"
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3/bin/zig build \
|
||||
--prefix stage4 \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3/bin/zig stage4/bin/zig
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-netbsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-netbsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-openbsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2051+28b83e3b0"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-debug/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
stage3-debug/bin/zig build \
|
||||
--prefix stage4-debug \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-debug/bin/zig version)"
|
||||
|
||||
stage4-debug/bin/zig test ../test/behavior.zig
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Requires cmake ninja-build
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TARGET="x86_64-openbsd-none"
|
||||
MCPU="baseline"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2051+28b83e3b0"
|
||||
PREFIX="$HOME/deps/$CACHE_BASENAME"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
|
||||
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_NO_LIB=ON \
|
||||
-GNinja \
|
||||
-DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
|
||||
-DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
|
||||
# https://github.com/ziglang/zig/issues/22213
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
--maxrss ${ZSF_MAX_RSS:-0} \
|
||||
-Dstatic-llvm \
|
||||
-Dskip-non-native \
|
||||
-Dskip-test-incremental \
|
||||
--search-prefix "$PREFIX" \
|
||||
--zig-lib-dir "$PWD/../lib" \
|
||||
--test-timeout 2m
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
stage3-release/bin/zig build \
|
||||
--prefix stage4-release \
|
||||
-Denable-llvm \
|
||||
-Dno-lib \
|
||||
-Doptimize=ReleaseFast \
|
||||
-Dstrip \
|
||||
-Dtarget=$TARGET \
|
||||
-Duse-zig-libcxx \
|
||||
-Dversion-string="$(stage3-release/bin/zig version)"
|
||||
|
||||
# diff returns an error code if the files differ.
|
||||
echo "If the following command fails, it means nondeterminism has been"
|
||||
echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
diff stage3-release/bin/zig stage4-release/bin/zig
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
$TARGET = "x86_64-windows-gnu"
|
||||
$TARGET = "$($Env:ARCH)-windows-gnu"
|
||||
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
|
||||
$MCPU = "baseline"
|
||||
$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
$PREFIX_PATH = "$($Env:USERPROFILE)\$ZIG_LLVM_CLANG_LLD_NAME"
|
||||
$ZIG = "$PREFIX_PATH\bin\zig.exe"
|
||||
$ZIG_LIB_DIR = "$(Get-Location)\lib"
|
||||
$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
|
||||
|
||||
function CheckLastExitCode {
|
||||
if (!$?) {
|
||||
|
|
@ -12,19 +12,22 @@ function CheckLastExitCode {
|
|||
return 0
|
||||
}
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
$Env:ZIG_GLOBAL_CACHE_DIR="$(Get-Location)\zig-global-cache"
|
||||
$Env:ZIG_LOCAL_CACHE_DIR="$(Get-Location)\zig-local-cache"
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the `zig build` command below which uses `git describe`.
|
||||
git fetch --tags
|
||||
|
||||
if ((git rev-parse --is-shallow-repository) -eq "true") {
|
||||
git fetch --unshallow # `git describe` won't work on a shallow repo
|
||||
}
|
||||
|
||||
Write-Output "Building from source..."
|
||||
Remove-Item -Path 'build-debug' -Recurse -Force -ErrorAction Ignore
|
||||
New-Item -Path 'build-debug' -ItemType Directory
|
||||
Set-Location -Path 'build-debug'
|
||||
|
||||
# CMake gives a syntax error when file paths with backward slashes are used.
|
||||
# Here, we use forward slashes only to work around this.
|
||||
cmake .. `
|
||||
& cmake .. `
|
||||
-GNinja `
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-debug" `
|
||||
-DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" `
|
||||
|
|
@ -43,50 +46,49 @@ ninja install
|
|||
CheckLastExitCode
|
||||
|
||||
Write-Output "Main test suite..."
|
||||
stage3-debug\bin\zig build test docs `
|
||||
--maxrss $ZSF_MAX_RSS `
|
||||
& "stage3-debug\bin\zig.exe" build test docs `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
--search-prefix "$PREFIX_PATH" `
|
||||
-Dstatic-llvm `
|
||||
-Dskip-non-native `
|
||||
-Dskip-test-incremental `
|
||||
-Denable-symlinks-windows `
|
||||
--test-timeout 30m
|
||||
-Dskip-release `
|
||||
-Denable-symlinks-windows
|
||||
CheckLastExitCode
|
||||
|
||||
Write-Output "Build x86_64-windows-msvc behavior tests using the C backend..."
|
||||
stage3-debug\bin\zig build-obj `
|
||||
& "stage3-debug\bin\zig.exe" test `
|
||||
..\test\behavior.zig `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
-ofmt=c `
|
||||
-femit-bin="test-x86_64-windows-msvc.c" `
|
||||
--test-no-exec `
|
||||
-target x86_64-windows-msvc `
|
||||
-lc
|
||||
CheckLastExitCode
|
||||
|
||||
& "stage3-debug\bin\zig.exe" build-obj `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
-ofmt=c `
|
||||
-OReleaseSmall `
|
||||
--name compiler_rt `
|
||||
-femit-bin="compiler_rt-x86_64-windows-msvc.c" `
|
||||
--dep build_options `
|
||||
-target x86_64-windows-msvc `
|
||||
-lc `
|
||||
..\lib\compiler_rt.zig
|
||||
--mod root ..\lib\compiler_rt.zig `
|
||||
--mod build_options config.zig
|
||||
CheckLastExitCode
|
||||
|
||||
stage3-debug\bin\zig test `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
-ofmt=c `
|
||||
-femit-bin="behavior-x86_64-windows-msvc.c" `
|
||||
--test-no-exec `
|
||||
-target x86_64-windows-msvc `
|
||||
-lc `
|
||||
..\test\behavior.zig
|
||||
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
|
||||
CheckLastExitCode
|
||||
|
||||
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
|
||||
CheckLastExitCode
|
||||
|
||||
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools" `
|
||||
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
|
||||
-DevCmdArguments '-arch=x64 -no_logo' `
|
||||
-StartInPath $(Get-Location)
|
||||
CheckLastExitCode
|
||||
|
||||
Write-Output "Build and run behavior tests with msvc..."
|
||||
cl /I..\lib /W3 /Z7 behavior-x86_64-windows-msvc.c compiler_rt-x86_64-windows-msvc.c /link /nologo /debug /subsystem:console kernel32.lib ntdll.lib libcmt.lib ws2_32.lib
|
||||
& cl.exe -I..\lib test-x86_64-windows-msvc.c compiler_rt-x86_64-windows-msvc.c /W3 /Z7 -link -nologo -debug -subsystem:console kernel32.lib ntdll.lib libcmt.lib
|
||||
CheckLastExitCode
|
||||
|
||||
.\behavior-x86_64-windows-msvc
|
||||
& .\test-x86_64-windows-msvc.exe
|
||||
CheckLastExitCode
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
$TARGET = "x86_64-windows-gnu"
|
||||
$TARGET = "$($Env:ARCH)-windows-gnu"
|
||||
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
|
||||
$MCPU = "baseline"
|
||||
$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
|
||||
$PREFIX_PATH = "$($Env:USERPROFILE)\$ZIG_LLVM_CLANG_LLD_NAME"
|
||||
$ZIG = "$PREFIX_PATH\bin\zig.exe"
|
||||
$ZIG_LIB_DIR = "$(Get-Location)\lib"
|
||||
$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
|
||||
|
||||
function CheckLastExitCode {
|
||||
if (!$?) {
|
||||
|
|
@ -12,19 +12,22 @@ function CheckLastExitCode {
|
|||
return 0
|
||||
}
|
||||
|
||||
# Override the cache directories because they won't actually help other CI runs
|
||||
# which will be testing alternate versions of zig, and ultimately would just
|
||||
# fill up space on the hard drive for no reason.
|
||||
$Env:ZIG_GLOBAL_CACHE_DIR="$(Get-Location)\zig-global-cache"
|
||||
$Env:ZIG_LOCAL_CACHE_DIR="$(Get-Location)\zig-local-cache"
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the `zig build` command below which uses `git describe`.
|
||||
git fetch --tags
|
||||
|
||||
if ((git rev-parse --is-shallow-repository) -eq "true") {
|
||||
git fetch --unshallow # `git describe` won't work on a shallow repo
|
||||
}
|
||||
|
||||
Write-Output "Building from source..."
|
||||
Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore
|
||||
New-Item -Path 'build-release' -ItemType Directory
|
||||
Set-Location -Path 'build-release'
|
||||
|
||||
# CMake gives a syntax error when file paths with backward slashes are used.
|
||||
# Here, we use forward slashes only to work around this.
|
||||
cmake .. `
|
||||
& cmake .. `
|
||||
-GNinja `
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" `
|
||||
-DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" `
|
||||
|
|
@ -43,69 +46,48 @@ ninja install
|
|||
CheckLastExitCode
|
||||
|
||||
Write-Output "Main test suite..."
|
||||
stage3-release\bin\zig.exe build test docs `
|
||||
--maxrss $ZSF_MAX_RSS `
|
||||
& "stage3-release\bin\zig.exe" build test docs `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
--search-prefix "$PREFIX_PATH" `
|
||||
-Dstatic-llvm `
|
||||
-Dskip-non-native `
|
||||
-Dskip-test-incremental `
|
||||
-Denable-symlinks-windows `
|
||||
--test-timeout 30m
|
||||
CheckLastExitCode
|
||||
|
||||
# Ensure that stage3 and stage4 are byte-for-byte identical.
|
||||
Write-Output "Build and compare stage4..."
|
||||
stage3-release\bin\zig.exe build `
|
||||
--prefix stage4-release `
|
||||
-Denable-llvm `
|
||||
-Dno-lib `
|
||||
-Doptimize=ReleaseFast `
|
||||
-Dstrip `
|
||||
-Dtarget="$TARGET" `
|
||||
-Duse-zig-libcxx `
|
||||
-Dversion-string="$(stage3-release\bin\zig version)"
|
||||
CheckLastExitCode
|
||||
|
||||
# Compare-Object returns an error code if the files differ.
|
||||
Write-Output "If the following command fails, it means nondeterminism has been"
|
||||
Write-Output "introduced, making stage3 and stage4 no longer byte-for-byte identical."
|
||||
Compare-Object (Get-Content stage3-release\bin\zig.exe) (Get-Content stage4-release\bin\zig.exe)
|
||||
-Denable-symlinks-windows
|
||||
CheckLastExitCode
|
||||
|
||||
Write-Output "Build x86_64-windows-msvc behavior tests using the C backend..."
|
||||
stage3-release\bin\zig.exe build-obj `
|
||||
& "stage3-release\bin\zig.exe" test `
|
||||
..\test\behavior.zig `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
-ofmt=c `
|
||||
-femit-bin="test-x86_64-windows-msvc.c" `
|
||||
--test-no-exec `
|
||||
-target x86_64-windows-msvc `
|
||||
-lc
|
||||
CheckLastExitCode
|
||||
|
||||
& "stage3-release\bin\zig.exe" build-obj `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
-ofmt=c `
|
||||
-OReleaseSmall `
|
||||
--name compiler_rt `
|
||||
-femit-bin="compiler_rt-x86_64-windows-msvc.c" `
|
||||
--dep build_options `
|
||||
-target x86_64-windows-msvc `
|
||||
-lc `
|
||||
..\lib\compiler_rt.zig
|
||||
--mod root ..\lib\compiler_rt.zig `
|
||||
--mod build_options config.zig
|
||||
CheckLastExitCode
|
||||
|
||||
stage3-release\bin\zig.exe test `
|
||||
--zig-lib-dir "$ZIG_LIB_DIR" `
|
||||
-ofmt=c `
|
||||
-femit-bin="behavior-x86_64-windows-msvc.c" `
|
||||
--test-no-exec `
|
||||
-target x86_64-windows-msvc `
|
||||
-lc `
|
||||
..\test\behavior.zig
|
||||
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
|
||||
CheckLastExitCode
|
||||
|
||||
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
|
||||
CheckLastExitCode
|
||||
|
||||
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools" `
|
||||
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
|
||||
-DevCmdArguments '-arch=x64 -no_logo' `
|
||||
-StartInPath $(Get-Location)
|
||||
CheckLastExitCode
|
||||
|
||||
Write-Output "Build and run behavior tests with msvc..."
|
||||
cl /I..\lib /W3 /Z7 behavior-x86_64-windows-msvc.c compiler_rt-x86_64-windows-msvc.c /link /nologo /debug /subsystem:console kernel32.lib ntdll.lib libcmt.lib ws2_32.lib
|
||||
& cl.exe -I..\lib test-x86_64-windows-msvc.c compiler_rt-x86_64-windows-msvc.c /W3 /Z7 -link -nologo -debug -subsystem:console kernel32.lib ntdll.lib libcmt.lib
|
||||
CheckLastExitCode
|
||||
|
||||
.\behavior-x86_64-windows-msvc
|
||||
& .\test-x86_64-windows-msvc.exe
|
||||
CheckLastExitCode
|
||||
|
|
|
|||
|
|
@ -17,10 +17,9 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
|
|||
if(${LLVM_LINK_MODE} STREQUAL "shared")
|
||||
find_library(CLANG_LIBRARIES
|
||||
NAMES
|
||||
libclang-cpp.so.21
|
||||
libclang-cpp.so.21.1
|
||||
clang-cpp-21.0
|
||||
clang-cpp210
|
||||
libclang-cpp.so.17
|
||||
clang-cpp-17.0
|
||||
clang-cpp170
|
||||
clang-cpp
|
||||
NAMES_PER_DIR
|
||||
HINTS "${LLVM_LIBDIRS}"
|
||||
|
|
@ -56,10 +55,10 @@ else()
|
|||
FIND_AND_ADD_CLANG_LIB(clangAST)
|
||||
FIND_AND_ADD_CLANG_LIB(clangParse)
|
||||
FIND_AND_ADD_CLANG_LIB(clangSema)
|
||||
FIND_AND_ADD_CLANG_LIB(clangAPINotes)
|
||||
FIND_AND_ADD_CLANG_LIB(clangBasic)
|
||||
FIND_AND_ADD_CLANG_LIB(clangEdit)
|
||||
FIND_AND_ADD_CLANG_LIB(clangLex)
|
||||
FIND_AND_ADD_CLANG_LIB(clangARCMigrate)
|
||||
FIND_AND_ADD_CLANG_LIB(clangRewriteFrontend)
|
||||
FIND_AND_ADD_CLANG_LIB(clangRewrite)
|
||||
FIND_AND_ADD_CLANG_LIB(clangCrossTU)
|
||||
|
|
@ -67,8 +66,6 @@ else()
|
|||
FIND_AND_ADD_CLANG_LIB(clangToolingCore)
|
||||
FIND_AND_ADD_CLANG_LIB(clangExtractAPI)
|
||||
FIND_AND_ADD_CLANG_LIB(clangSupport)
|
||||
FIND_AND_ADD_CLANG_LIB(clangInstallAPI)
|
||||
FIND_AND_ADD_CLANG_LIB(clangAST)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
|
|
|
|||
|
|
@ -9,23 +9,21 @@
|
|||
find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
|
||||
HINTS ${LLVM_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/lib/llvm-21/include
|
||||
/usr/local/llvm210/include
|
||||
/usr/local/llvm21/include
|
||||
/usr/local/opt/lld@21/include
|
||||
/opt/homebrew/opt/lld@21/include
|
||||
/home/linuxbrew/.linuxbrew/opt/lld@21/include
|
||||
/usr/lib/llvm-17/include
|
||||
/usr/local/llvm170/include
|
||||
/usr/local/llvm17/include
|
||||
/usr/local/opt/llvm@17/include
|
||||
/opt/homebrew/opt/llvm@17/include
|
||||
/mingw64/include)
|
||||
|
||||
find_library(LLD_LIBRARY NAMES lld-21.0 lld210 lld NAMES_PER_DIR
|
||||
find_library(LLD_LIBRARY NAMES lld-17.0 lld170 lld NAMES_PER_DIR
|
||||
HINTS ${LLVM_LIBDIRS}
|
||||
PATHS
|
||||
/usr/lib/llvm-21/lib
|
||||
/usr/local/llvm210/lib
|
||||
/usr/local/llvm21/lib
|
||||
/usr/local/opt/lld@21/lib
|
||||
/opt/homebrew/opt/lld@21/lib
|
||||
/home/linuxbrew/.linuxbrew/opt/lld@21/lib
|
||||
/usr/lib/llvm-17/lib
|
||||
/usr/local/llvm170/lib
|
||||
/usr/local/llvm17/lib
|
||||
/usr/local/opt/llvm@17/lib
|
||||
/opt/homebrew/opt/llvm@17/lib
|
||||
)
|
||||
if(EXISTS ${LLD_LIBRARY})
|
||||
set(LLD_LIBRARIES ${LLD_LIBRARY})
|
||||
|
|
@ -36,12 +34,11 @@ else()
|
|||
HINTS ${LLVM_LIBDIRS}
|
||||
PATHS
|
||||
${LLD_LIBDIRS}
|
||||
/usr/lib/llvm-21/lib
|
||||
/usr/local/llvm210/lib
|
||||
/usr/local/llvm21/lib
|
||||
/usr/local/opt/lld@21/lib
|
||||
/opt/homebrew/opt/lld@21/lib
|
||||
/home/linuxbrew/.linuxbrew/opt/lld@21/lib
|
||||
/usr/lib/llvm-17/lib
|
||||
/usr/local/llvm170/lib
|
||||
/usr/local/llvm17/lib
|
||||
/usr/local/opt/llvm@17/lib
|
||||
/opt/homebrew/opt/llvm@17/lib
|
||||
/mingw64/lib
|
||||
/c/msys64/mingw64/lib
|
||||
c:/msys64/mingw64/lib)
|
||||
|
|
|
|||
|
|
@ -12,17 +12,14 @@
|
|||
if(ZIG_USE_LLVM_CONFIG)
|
||||
set(LLVM_CONFIG_ERROR_MESSAGES "")
|
||||
while(1)
|
||||
# If this variable is not unset, the same result is returned even though
|
||||
# the ignore list has changed, causing the configure process to not
|
||||
# terminate when the right LLVM version is not found.
|
||||
unset(LLVM_CONFIG_EXE CACHE)
|
||||
find_program(LLVM_CONFIG_EXE
|
||||
NAMES llvm-config-21 llvm-config-21.0 llvm-config210 llvm-config21 llvm-config NAMES_PER_DIR
|
||||
NAMES llvm-config-17 llvm-config-17.0 llvm-config170 llvm-config17 llvm-config NAMES_PER_DIR
|
||||
PATHS
|
||||
"/mingw64/bin"
|
||||
"/c/msys64/mingw64/bin"
|
||||
"c:/msys64/mingw64/bin"
|
||||
"C:/Libraries/llvm-21.0.0/bin")
|
||||
"C:/Libraries/llvm-17.0.0/bin")
|
||||
|
||||
if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
|
||||
if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "")
|
||||
|
|
@ -40,9 +37,9 @@ if(ZIG_USE_LLVM_CONFIG)
|
|||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY)
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 21 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 22 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 22)
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 17 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 18 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 18)
|
||||
# Save the error message, in case this is the last llvm-config we find
|
||||
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 21.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 17.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
|
||||
# Ignore this directory and try the search again
|
||||
list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}")
|
||||
|
|
@ -63,12 +60,12 @@ if(ZIG_USE_LLVM_CONFIG)
|
|||
ERROR_VARIABLE LLVM_CONFIG_ERROR
|
||||
ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if (LLVM_CONFIG_ERROR)
|
||||
if (LLVM_CONFIG_ERROR)
|
||||
# Save the error message, in case this is the last llvm-config we find
|
||||
if (ZIG_SHARED_LLVM)
|
||||
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 21.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
|
||||
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 17.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
|
||||
else()
|
||||
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 21.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
|
||||
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 17.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
|
||||
endif()
|
||||
|
||||
# Ignore this directory and try the search again
|
||||
|
|
@ -83,7 +80,7 @@ if(ZIG_USE_LLVM_CONFIG)
|
|||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_TARGETS_BUILT "${LLVM_TARGETS_BUILT_SPACES}")
|
||||
|
||||
set(ZIG_LLVM_REQUIRED_TARGETS "AArch64;AMDGPU;ARM;AVR;BPF;Hexagon;Lanai;LoongArch;Mips;MSP430;NVPTX;PowerPC;RISCV;SPIRV;Sparc;SystemZ;VE;WebAssembly;X86;XCore")
|
||||
set(ZIG_LLVM_REQUIRED_TARGETS "AArch64;AMDGPU;ARM;AVR;BPF;Hexagon;Lanai;Mips;MSP430;NVPTX;PowerPC;RISCV;Sparc;SystemZ;VE;WebAssembly;X86;XCore")
|
||||
|
||||
set(ZIG_LLVM_REQUIRED_TARGETS_ENABLED TRUE)
|
||||
foreach(TARGET_NAME IN LISTS ZIG_LLVM_REQUIRED_TARGETS)
|
||||
|
|
@ -176,6 +173,7 @@ if(ZIG_USE_LLVM_CONFIG)
|
|||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_INCLUDE_DIRS "${LLVM_INCLUDE_DIRS_SPACES}")
|
||||
|
||||
link_directories("${CMAKE_PREFIX_PATH}/lib")
|
||||
link_directories("${LLVM_LIBDIRS}")
|
||||
else()
|
||||
# Here we assume that we're cross compiling with Zig, of course. No reason
|
||||
|
|
@ -197,8 +195,6 @@ else()
|
|||
FIND_AND_ADD_LLVM_LIB(LLVMXRay)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLibDriver)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDlltoolDriver)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMTelemetry)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMTextAPIBinaryReader)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCoverage)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLineEditor)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMXCoreDisassembler)
|
||||
|
|
@ -227,10 +223,6 @@ else()
|
|||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVAnalysis)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcCodeGen)
|
||||
|
|
@ -304,7 +296,6 @@ else()
|
|||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Desc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Utils)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Info)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcDebugging)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcJIT)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWindowsDriver)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCJIT)
|
||||
|
|
@ -315,33 +306,26 @@ else()
|
|||
FIND_AND_ADD_LLVM_LIB(LLVMOrcTargetProcess)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcShared)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDWP)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDWARFCFIChecker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoLogicalView)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoGSYM)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOption)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjectYAML)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjCopy)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCA)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLTO)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPasses)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCFGuard)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCoroutines)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMipo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMVectorize)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLinker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInstrumentation)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenMP)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenACC)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendHLSL)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendDriver)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMExtensions)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPasses)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMHipStdPar)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCoroutines)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCFGuard)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMipo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInstrumentation)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMVectorize)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSandboxIR)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLinker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenMP)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendDirective)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendAtomic)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendOffloading)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjectYAML)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDWARFLinkerParallel)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDWARFLinkerClassic)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDWARFLinker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMGlobalISel)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMIRParser)
|
||||
|
|
@ -351,7 +335,6 @@ else()
|
|||
FIND_AND_ADD_LLVM_LIB(LLVMTarget)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjCARCOpts)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCodeGenTypes)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCGData)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMIRPrinter)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInterfaceStub)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFileCheck)
|
||||
|
|
@ -367,16 +350,14 @@ else()
|
|||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoBTF)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoPDB)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoMSF)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoCodeView)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoGSYM)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoDWARF)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoDWARFLowLevel)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObject)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMTextAPI)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMIRReader)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMC)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoCodeView)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBitReader)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFuzzerCLI)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCore)
|
||||
|
|
|
|||
13
cmake/c_flag_overrides.cmake
Normal file
13
cmake/c_flag_overrides.cmake
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
if(MSVC)
|
||||
set(CMAKE_C_FLAGS_DEBUG_INIT
|
||||
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL_INIT
|
||||
"/MT /O1 /Ob1 /D NDEBUG")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE_INIT
|
||||
"/MT /O2 /Ob1 /D NDEBUG")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT
|
||||
"/MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||
endif()
|
||||
13
cmake/cxx_flag_overrides.cmake
Normal file
13
cmake/cxx_flag_overrides.cmake
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG_INIT
|
||||
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT
|
||||
"/MT /O1 /Ob1 /D NDEBUG")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE_INIT
|
||||
"/MT /O2 /Ob1 /D NDEBUG")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT
|
||||
"/MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||
endif()
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
set(ZIG_INSTALL_ARGS build --prefix "${CMAKE_INSTALL_PREFIX}" ${ZIG_BUILD_ARGS})
|
||||
set(ZIG_INSTALL_ARGS build ${ZIG_BUILD_ARGS} --prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
execute_process(
|
||||
COMMAND "${ZIG_EXECUTABLE}" ${ZIG_INSTALL_ARGS}
|
||||
WORKING_DIRECTORY "${ZIG2_WORKING_DIR}"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE _result)
|
||||
|
||||
if(_result)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ build.zig.
|
|||
|
||||
### `name`
|
||||
|
||||
Enum literal. Required.
|
||||
String. Required.
|
||||
|
||||
This is the default name used by packages depending on this one. For example,
|
||||
when a user runs `zig fetch --save <url>`, this field is used as the key in the
|
||||
|
|
@ -20,42 +20,12 @@ will stick with this provided value.
|
|||
It is redundant to include "zig" in this name because it is already within the
|
||||
Zig package namespace.
|
||||
|
||||
Must be a valid bare Zig identifier (don't `@` me), limited to 32 bytes.
|
||||
|
||||
Together with `fingerprint`, this represents a globally unique package identifier.
|
||||
|
||||
### `fingerprint`
|
||||
|
||||
Together with `name`, this represents a globally unique package identifier. This
|
||||
field is auto-initialized by the toolchain when the package is first created,
|
||||
and then *never changes*. This allows Zig to unambiguously detect when one
|
||||
package is an updated version of another.
|
||||
|
||||
When forking a Zig project, this fingerprint should be regenerated if the upstream
|
||||
project is still maintained. Otherwise, the fork is *hostile*, attempting to
|
||||
take control over the original project's identity. The fingerprint can be regenerated
|
||||
by deleting the field and running `zig build`.
|
||||
|
||||
This 64-bit integer is the combination of a 32-bit id component and a 32-bit
|
||||
checksum.
|
||||
|
||||
The id component within the fingerprint has these restrictions:
|
||||
|
||||
`0x00000000` is reserved for legacy packages.
|
||||
|
||||
`0xffffffff` is reserved to represent "naked" packages.
|
||||
|
||||
The checksum is computed from `name` and serves to protect Zig users from
|
||||
accidental id collisions.
|
||||
|
||||
### `version`
|
||||
|
||||
String. Required.
|
||||
|
||||
[semver](https://semver.org/)
|
||||
|
||||
Limited to 32 bytes.
|
||||
|
||||
### `minimum_zig_version`
|
||||
|
||||
String. Optional.
|
||||
|
|
@ -77,8 +47,7 @@ String.
|
|||
|
||||
When updating this field to a new URL, be sure to delete the corresponding
|
||||
`hash`, otherwise you are communicating that you expect to find the old hash at
|
||||
the new URL. If the contents of a URL change this will result in a hash mismatch
|
||||
which will prevent zig from using it.
|
||||
the new URL.
|
||||
|
||||
#### `hash`
|
||||
|
||||
|
|
|
|||
6607
doc/langref.html.in
6607
doc/langref.html.in
File diff suppressed because it is too large
Load diff
|
|
@ -1,59 +0,0 @@
|
|||
pub fn syscall1(number: usize, arg1: usize) usize {
|
||||
// Inline assembly is an expression which returns a value.
|
||||
// the `asm` keyword begins the expression.
|
||||
return asm
|
||||
// `volatile` is an optional modifier that tells Zig this
|
||||
// inline assembly expression has side-effects. Without
|
||||
// `volatile`, Zig is allowed to delete the inline assembly
|
||||
// code if the result is unused.
|
||||
volatile (
|
||||
// Next is a comptime string which is the assembly code.
|
||||
// Inside this string one may use `%[ret]`, `%[number]`,
|
||||
// or `%[arg1]` where a register is expected, to specify
|
||||
// the register that Zig uses for the argument or return value,
|
||||
// if the register constraint strings are used. However in
|
||||
// the below code, this is not used. A literal `%` can be
|
||||
// obtained by escaping it with a double percent: `%%`.
|
||||
// Often multiline string syntax comes in handy here.
|
||||
\\syscall
|
||||
// Next is the output. It is possible in the future Zig will
|
||||
// support multiple outputs, depending on how
|
||||
// https://github.com/ziglang/zig/issues/215 is resolved.
|
||||
// It is allowed for there to be no outputs, in which case
|
||||
// this colon would be directly followed by the colon for the inputs.
|
||||
:
|
||||
// This specifies the name to be used in `%[ret]` syntax in
|
||||
// the above assembly string. This example does not use it,
|
||||
// but the syntax is mandatory.
|
||||
[ret]
|
||||
// Next is the output constraint string. This feature is still
|
||||
// considered unstable in Zig, and so LLVM/GCC documentation
|
||||
// must be used to understand the semantics.
|
||||
// http://releases.llvm.org/10.0.0/docs/LangRef.html#inline-asm-constraint-string
|
||||
// https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
|
||||
// In this example, the constraint string means "the result value of
|
||||
// this inline assembly instruction is whatever is in $rax".
|
||||
"={rax}"
|
||||
// Next is either a value binding, or `->` and then a type. The
|
||||
// type is the result type of the inline assembly expression.
|
||||
// If it is a value binding, then `%[ret]` syntax would be used
|
||||
// to refer to the register bound to the value.
|
||||
(-> usize),
|
||||
// Next is the list of inputs.
|
||||
// The constraint for these inputs means, "when the assembly code is
|
||||
// executed, $rax shall have the value of `number` and $rdi shall have
|
||||
// the value of `arg1`". Any number of input parameters is allowed,
|
||||
// including none.
|
||||
: [number] "{rax}" (number),
|
||||
[arg1] "{rdi}" (arg1),
|
||||
// Next is the list of clobbers. These declare a set of registers whose
|
||||
// values will not be preserved by the execution of this assembly code.
|
||||
// These do not include output or input registers. The special clobber
|
||||
// value of "memory" means that the assembly writes to arbitrary undeclared
|
||||
// memory locations - not only the memory pointed to by a declared indirect
|
||||
// output. In this example we list $rcx and $r11 because it is known the
|
||||
// kernel syscall does not preserve these registers.
|
||||
: .{ .rcx = true, .r11 = true });
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
//! Because this file contains fields, it is a type which is intended to be instantiated, and so
|
||||
//! is named in TitleCase instead of snake_case by convention.
|
||||
|
||||
foo: u32,
|
||||
bar: u64,
|
||||
|
||||
/// `@This()` can be used to refer to this struct type. In files with fields, it is quite common to
|
||||
/// name the type here, so it can be easily referenced by other declarations in this file.
|
||||
const TopLevelFields = @This();
|
||||
|
||||
pub fn init(val: u32) TopLevelFields {
|
||||
return .{
|
||||
.foo = val,
|
||||
.bar = val * 10,
|
||||
};
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
pub fn main() void {
|
||||
const byte: u8 = 255;
|
||||
|
||||
const ov = @addWithOverflow(byte, 10);
|
||||
if (ov[1] != 0) {
|
||||
print("overflowed result: {}\n", .{ov[0]});
|
||||
} else {
|
||||
print("result: {}\n", .{ov[0]});
|
||||
}
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
const Node = struct {
|
||||
next: ?*Node,
|
||||
name: []const u8,
|
||||
};
|
||||
|
||||
var node_a = Node{
|
||||
.next = null,
|
||||
.name = "Node A",
|
||||
};
|
||||
|
||||
var node_b = Node{
|
||||
.next = &node_a,
|
||||
.name = "Node B",
|
||||
};
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
pub fn main() void {
|
||||
var x: i32 = undefined;
|
||||
x = 1;
|
||||
print("{d}", .{x});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
const Threshold = struct {
|
||||
minimum: f32 = 0.25,
|
||||
maximum: f32 = 0.75,
|
||||
|
||||
const Category = enum { low, medium, high };
|
||||
|
||||
fn categorize(t: Threshold, value: f32) Category {
|
||||
assert(t.maximum >= t.minimum);
|
||||
if (value < t.minimum) return .low;
|
||||
if (value > t.maximum) return .high;
|
||||
return .medium;
|
||||
}
|
||||
};
|
||||
|
||||
pub fn main() !void {
|
||||
var threshold: Threshold = .{
|
||||
.maximum = 0.20,
|
||||
};
|
||||
const category = threshold.categorize(0.90);
|
||||
std.log.info("category: {t}", .{category});
|
||||
}
|
||||
|
||||
const std = @import("std");
|
||||
const assert = std.debug.assert;
|
||||
|
||||
// exe=fail
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
const base64 = @import("std").base64;
|
||||
|
||||
export fn decode_base_64(
|
||||
dest_ptr: [*]u8,
|
||||
dest_len: usize,
|
||||
source_ptr: [*]const u8,
|
||||
source_len: usize,
|
||||
) usize {
|
||||
const src = source_ptr[0..source_len];
|
||||
const dest = dest_ptr[0..dest_len];
|
||||
const base64_decoder = base64.standard.Decoder;
|
||||
const decoded_size = base64_decoder.calcSizeForSlice(src) catch unreachable;
|
||||
base64_decoder.decode(dest[0..decoded_size], src) catch unreachable;
|
||||
return decoded_size;
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "example",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("example.zig"),
|
||||
.optimize = optimize,
|
||||
}),
|
||||
});
|
||||
b.default_step.dependOn(&exe.step);
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const lib = b.addLibrary(.{
|
||||
.linkage = .dynamic,
|
||||
.name = "mathtest",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("mathtest.zig"),
|
||||
}),
|
||||
.version = .{ .major = 1, .minor = 0, .patch = 0 },
|
||||
});
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "test",
|
||||
.root_module = b.createModule(.{
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
exe.root_module.addCSourceFile(.{ .file = b.path("test.c"), .flags = &.{"-std=c99"} });
|
||||
exe.root_module.linkLibrary(lib);
|
||||
|
||||
b.default_step.dependOn(&exe.step);
|
||||
|
||||
const run_cmd = exe.run();
|
||||
|
||||
const test_step = b.step("test", "Test the program");
|
||||
test_step.dependOn(&run_cmd.step);
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const obj = b.addObject(.{
|
||||
.name = "base64",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("base64.zig"),
|
||||
}),
|
||||
});
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "test",
|
||||
.root_module = b.createModule(.{
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
exe.root_module.addCSourceFile(.{ .file = b.path("test.c"), .flags = &.{"-std=c99"} });
|
||||
exe.root_module.addObject(obj);
|
||||
b.installArtifact(exe);
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
pub const CallModifier = enum {
|
||||
/// Equivalent to function call syntax.
|
||||
auto,
|
||||
|
||||
/// Prevents tail call optimization. This guarantees that the return
|
||||
/// address will point to the callsite, as opposed to the callsite's
|
||||
/// callsite. If the call is otherwise required to be tail-called
|
||||
/// or inlined, a compile error is emitted instead.
|
||||
never_tail,
|
||||
|
||||
/// Guarantees that the call will not be inlined. If the call is
|
||||
/// otherwise required to be inlined, a compile error is emitted instead.
|
||||
never_inline,
|
||||
|
||||
/// Asserts that the function call will not suspend. This allows a
|
||||
/// non-async function to call an async function.
|
||||
no_suspend,
|
||||
|
||||
/// Guarantees that the call will be generated with tail call optimization.
|
||||
/// If this is not possible, a compile error is emitted instead.
|
||||
always_tail,
|
||||
|
||||
/// Guarantees that the call will be inlined at the callsite.
|
||||
/// If this is not possible, a compile error is emitted instead.
|
||||
always_inline,
|
||||
|
||||
/// Evaluates the call at compile-time. If the call cannot be completed at
|
||||
/// compile-time, a compile error is emitted instead.
|
||||
compile_time,
|
||||
};
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
const c = @cImport({
|
||||
// See https://github.com/ziglang/zig/issues/515
|
||||
@cDefine("_NO_CRT_STDIO_INLINE", "1");
|
||||
@cInclude("stdio.h");
|
||||
});
|
||||
pub fn main() void {
|
||||
if (@import("builtin").os.tag == .netbsd) return; // https://github.com/Vexu/arocc/issues/960
|
||||
_ = c.printf("hello\n");
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
// link_libc
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
const parseU64 = @import("error_union_parsing_u64.zig").parseU64;
|
||||
|
||||
fn doAThing(str: []u8) void {
|
||||
const number = parseU64(str, 10) catch 13;
|
||||
_ = number; // ...
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
const parseU64 = @import("error_union_parsing_u64.zig").parseU64;
|
||||
|
||||
fn doAThing(str: []u8) !void {
|
||||
const number = parseU64(str, 10) catch |err| return err;
|
||||
_ = number; // ...
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
const std = @import("std");
|
||||
|
||||
const Foo = union {
|
||||
float: f32,
|
||||
int: u32,
|
||||
};
|
||||
|
||||
pub fn main() void {
|
||||
var f = Foo{ .int = 42 };
|
||||
bar(&f);
|
||||
}
|
||||
|
||||
fn bar(f: *Foo) void {
|
||||
f.* = Foo{ .float = 12.34 };
|
||||
std.debug.print("value: {}\n", .{f.float});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
const Foo = struct {};
|
||||
fn doSomethingWithFoo(foo: *Foo) void {
|
||||
_ = foo;
|
||||
}
|
||||
|
||||
fn doAThing(optional_foo: ?*Foo) void {
|
||||
// do some stuff
|
||||
|
||||
if (optional_foo) |foo| {
|
||||
doSomethingWithFoo(foo);
|
||||
}
|
||||
|
||||
// do some stuff
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||
defer arena.deinit();
|
||||
|
||||
const allocator = arena.allocator();
|
||||
|
||||
const ptr = try allocator.create(i32);
|
||||
std.debug.print("ptr={*}\n", .{ptr});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
pub fn main() void {
|
||||
// Comments in Zig start with "//" and end at the next LF byte (end of line).
|
||||
// The line below is a comment and won't be executed.
|
||||
|
||||
//print("Hello?", .{});
|
||||
|
||||
print("Hello, world!\n", .{}); // another comment
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fn max(comptime T: type, a: T, b: T) T {
|
||||
return if (a > b) a else b;
|
||||
}
|
||||
fn gimmeTheBiggerFloat(a: f32, b: f32) f32 {
|
||||
return max(f32, a, b);
|
||||
}
|
||||
fn gimmeTheBiggerInteger(a: u64, b: u64) u64 {
|
||||
return max(u64, a, b);
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
const builtin = @import("builtin");
|
||||
const separator = if (builtin.os.tag == .windows) '\\' else '/';
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
fn max(a: bool, b: bool) bool {
|
||||
{
|
||||
return a or b;
|
||||
}
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
const x = 1234;
|
||||
|
||||
fn foo() void {
|
||||
// It works at file scope as well as inside functions.
|
||||
const y = 5678;
|
||||
|
||||
// Once assigned, an identifier cannot be changed.
|
||||
y += 1;
|
||||
}
|
||||
|
||||
pub fn main() void {
|
||||
foo();
|
||||
}
|
||||
|
||||
// exe=build_fail
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
const std = @import("std");
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() void {
|
||||
print("\n", .{});
|
||||
|
||||
defer {
|
||||
print("1 ", .{});
|
||||
}
|
||||
defer {
|
||||
print("2 ", .{});
|
||||
}
|
||||
if (false) {
|
||||
// defers are not run if they are never executed.
|
||||
defer {
|
||||
print("3 ", .{});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
fn swizzleRgbaToBgra(rgba: [4]u8) [4]u8 {
|
||||
// readable swizzling by destructuring
|
||||
const r, const g, const b, const a = rgba;
|
||||
return .{ b, g, r, a };
|
||||
}
|
||||
|
||||
pub fn main() void {
|
||||
const pos = [_]i32{ 1, 2 };
|
||||
const x, const y = pos;
|
||||
print("x = {}, y = {}\n", .{x, y});
|
||||
|
||||
const orange: [4]u8 = .{ 255, 165, 0, 255 };
|
||||
print("{any}\n", .{swizzleRgbaToBgra(orange)});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
pub fn main() void {
|
||||
const digits = [_]i8 { 3, 8, 9, 0, 7, 4, 1 };
|
||||
|
||||
const min, const max = blk: {
|
||||
var min: i8 = 127;
|
||||
var max: i8 = -128;
|
||||
|
||||
for (digits) |digit| {
|
||||
if (digit < min) min = digit;
|
||||
if (digit > max) max = digit;
|
||||
}
|
||||
|
||||
break :blk .{ min, max };
|
||||
};
|
||||
|
||||
print("min = {}\n", .{ min });
|
||||
print("max = {}\n", .{ max });
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
pub fn main() void {
|
||||
var x: u32 = undefined;
|
||||
|
||||
const tuple = .{ 1, 2, 3 };
|
||||
|
||||
x, var y : u32, const z = tuple;
|
||||
|
||||
print("x = {}, y = {}, z = {}\n", .{x, y, z});
|
||||
|
||||
// y is mutable
|
||||
y = 100;
|
||||
|
||||
// You can use _ to throw away unwanted values.
|
||||
_, x, _ = tuple;
|
||||
|
||||
print("x = {}", .{x});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
fn divmod(numerator: u32, denominator: u32) struct { u32, u32 } {
|
||||
return .{ numerator / denominator, numerator % denominator };
|
||||
}
|
||||
|
||||
pub fn main() void {
|
||||
const div, const mod = divmod(10, 3);
|
||||
|
||||
print("10 / 3 = {}\n", .{div});
|
||||
print("10 % 3 = {}\n", .{mod});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
pub fn main() void {
|
||||
var x: u32 = undefined;
|
||||
var y: u32 = undefined;
|
||||
var z: u32 = undefined;
|
||||
|
||||
const tuple = .{ 1, 2, 3 };
|
||||
|
||||
x, y, z = tuple;
|
||||
|
||||
print("tuple: x = {}, y = {}, z = {}\n", .{x, y, z});
|
||||
|
||||
const array = [_]u32{ 4, 5, 6 };
|
||||
|
||||
x, y, z = array;
|
||||
|
||||
print("array: x = {}, y = {}, z = {}\n", .{x, y, z});
|
||||
|
||||
const vector: @Vector(3, u32) = .{ 7, 8, 9 };
|
||||
|
||||
x, y, z = vector;
|
||||
|
||||
print("vector: x = {}, y = {}, z = {}\n", .{x, y, z});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
// emulate punpckldq
|
||||
pub fn unpack(x: @Vector(4, f32), y: @Vector(4, f32)) @Vector(4, f32) {
|
||||
const a, const c, _, _ = x;
|
||||
const b, const d, _, _ = y;
|
||||
return .{ a, b, c, d };
|
||||
}
|
||||
|
||||
pub fn main() void {
|
||||
const x: @Vector(4, f32) = .{ 1.0, 2.0, 3.0, 4.0 };
|
||||
const y: @Vector(4, f32) = .{ 5.0, 6.0, 7.0, 8.0 };
|
||||
print("{}", .{unpack(x, y)});
|
||||
}
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
/// A structure for storing a timestamp, with nanosecond precision (this is a
|
||||
/// multiline doc comment).
|
||||
const Timestamp = struct {
|
||||
/// The number of seconds since the epoch (this is also a doc comment).
|
||||
seconds: i64, // signed so we can represent pre-1970 (not a doc comment)
|
||||
/// The number of nanoseconds past the second (doc comment again).
|
||||
nanos: u32,
|
||||
|
||||
/// Returns a `Timestamp` struct representing the Unix epoch; that is, the
|
||||
/// moment of 1970 Jan 1 00:00:00 UTC (this is a doc comment too).
|
||||
pub fn unixEpoch() Timestamp {
|
||||
return Timestamp{
|
||||
.seconds = 0,
|
||||
.nanos = 0,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/// `std.start` imports this file using `@import("root")`, and uses this declaration as the program's
|
||||
/// user-provided entry point. It can return any of the following types:
|
||||
/// * `void`
|
||||
/// * `E!void`, for any error set `E`
|
||||
/// * `u8`
|
||||
/// * `E!u8`, for any error set `E`
|
||||
/// Returning a `void` value from this function will exit with code 0.
|
||||
/// Returning a `u8` value from this function will exit with the given status code.
|
||||
/// Returning an error value from this function will print an Error Return Trace and exit with code 1.
|
||||
pub fn main() void {
|
||||
std.debug.print("Hello, World!\n", .{});
|
||||
}
|
||||
|
||||
// If uncommented, this declaration would suppress the usual std.start logic, causing
|
||||
// the `main` declaration above to be ignored.
|
||||
//pub const _start = {};
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
// exe=succeed
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
const Foo = enum(c_int) { a, b, c };
|
||||
export fn entry(foo: Foo) void {
|
||||
_ = foo;
|
||||
}
|
||||
|
||||
// obj
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
const Foo = enum { a, b, c };
|
||||
export fn entry(foo: Foo) void {
|
||||
_ = foo;
|
||||
}
|
||||
|
||||
// obj=parameter of type 'enum_export_error.Foo' not allowed in function with calling convention 'x86_64_sysv'
|
||||
// target=x86_64-linux
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
pub fn main() !void {
|
||||
try foo(12);
|
||||
}
|
||||
|
||||
fn foo(x: i32) !void {
|
||||
if (x >= 5) {
|
||||
try bar();
|
||||
} else {
|
||||
try bang2();
|
||||
}
|
||||
}
|
||||
|
||||
fn bar() !void {
|
||||
if (baz()) {
|
||||
try quux();
|
||||
} else |err| switch (err) {
|
||||
error.FileNotFound => try hello(),
|
||||
}
|
||||
}
|
||||
|
||||
fn baz() !void {
|
||||
try bang1();
|
||||
}
|
||||
|
||||
fn quux() !void {
|
||||
try bang2();
|
||||
}
|
||||
|
||||
fn hello() !void {
|
||||
try bang2();
|
||||
}
|
||||
|
||||
fn bang1() !void {
|
||||
return error.FileNotFound;
|
||||
}
|
||||
|
||||
fn bang2() !void {
|
||||
return error.PermissionDenied;
|
||||
}
|
||||
|
||||
// exe=fail
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
const std = @import("std");
|
||||
const maxInt = std.math.maxInt;
|
||||
|
||||
pub fn parseU64(buf: []const u8, radix: u8) !u64 {
|
||||
var x: u64 = 0;
|
||||
|
||||
for (buf) |c| {
|
||||
const digit = charToDigit(c);
|
||||
|
||||
if (digit >= radix) {
|
||||
return error.InvalidChar;
|
||||
}
|
||||
|
||||
// x *= radix
|
||||
var ov = @mulWithOverflow(x, radix);
|
||||
if (ov[1] != 0) return error.OverFlow;
|
||||
|
||||
// x += digit
|
||||
ov = @addWithOverflow(ov[0], digit);
|
||||
if (ov[1] != 0) return error.OverFlow;
|
||||
x = ov[0];
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
fn charToDigit(c: u8) u8 {
|
||||
return switch (c) {
|
||||
'0'...'9' => c - '0',
|
||||
'A'...'Z' => c - 'A' + 10,
|
||||
'a'...'z' => c - 'a' + 10,
|
||||
else => maxInt(u8),
|
||||
};
|
||||
}
|
||||
|
||||
test "parse u64" {
|
||||
const result = try parseU64("1234", 10);
|
||||
try std.testing.expectEqual(1234, result);
|
||||
}
|
||||
|
||||
// test
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export fn @"A function name that is a complete sentence."() void {}
|
||||
|
||||
// obj
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
comptime {
|
||||
@export(&internalName, .{ .name = "foo", .linkage = .strong });
|
||||
}
|
||||
|
||||
fn internalName() callconv(.c) void {}
|
||||
|
||||
// obj
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export fn foo() void {}
|
||||
|
||||
// obj
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
const assert = @import("std").debug.assert;
|
||||
|
||||
fn fibonacci(index: i32) i32 {
|
||||
//if (index < 2) return index;
|
||||
return fibonacci(index - 1) + fibonacci(index - 2);
|
||||
}
|
||||
|
||||
test "fibonacci" {
|
||||
try comptime assert(fibonacci(7) == 13);
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
const floating_point = 123.0E+77;
|
||||
const another_float = 123.0;
|
||||
const yet_another = 123.0e+77;
|
||||
|
||||
const hex_floating_point = 0x103.70p-5;
|
||||
const another_hex_float = 0x103.70;
|
||||
const yet_another_hex_float = 0x103.70P-5;
|
||||
|
||||
// underscores may be placed between two digits as a visual separator
|
||||
const lightspeed = 299_792_458.000_000;
|
||||
const nanosecond = 0.000_000_001;
|
||||
const more_hex = 0x1234_5678.9ABC_CDEFp-10;
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
const print = @import("std").debug.print;
|
||||
|
||||
extern fn foo_strict(x: f64) f64;
|
||||
extern fn foo_optimized(x: f64) f64;
|
||||
|
||||
pub fn main() void {
|
||||
const x = 0.001;
|
||||
print("optimized = {}\n", .{foo_optimized(x)});
|
||||
print("strict = {}\n", .{foo_strict(x)});
|
||||
}
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
const std = @import("std");
|
||||
const big = @as(f64, 1 << 40);
|
||||
|
||||
export fn foo_strict(x: f64) f64 {
|
||||
return x + big - big;
|
||||
}
|
||||
|
||||
export fn foo_optimized(x: f64) f64 {
|
||||
@setFloatMode(.optimized);
|
||||
return x + big - big;
|
||||
}
|
||||
|
||||
// obj
|
||||
// optimize=ReleaseFast
|
||||
// disable_cache
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
const std = @import("std");
|
||||
|
||||
const inf = std.math.inf(f32);
|
||||
const negative_inf = -std.math.inf(f64);
|
||||
const nan = std.math.nan(f128);
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
fn List(comptime T: type) type {
|
||||
return struct {
|
||||
items: []T,
|
||||
len: usize,
|
||||
};
|
||||
}
|
||||
|
||||
// The generic List data structure can be instantiated by passing in a type:
|
||||
var buffer: [10]i32 = undefined;
|
||||
var list = List(i32){
|
||||
.items = &buffer,
|
||||
.len = 0,
|
||||
};
|
||||
|
||||
// syntax
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
const parseU64 = @import("error_union_parsing_u64.zig").parseU64;
|
||||
|
||||
fn doAThing(str: []u8) void {
|
||||
const number = parseU64(str, 10) catch blk: {
|
||||
// do things
|
||||
break :blk 13;
|
||||
};
|
||||
_ = number; // number is now initialized
|
||||
}
|
||||
|
||||
// syntax
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue