Skip to content

Commit

Permalink
Merge branch 'master' into mergify/configuration-deprecated-update
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif authored Nov 30, 2024
2 parents c7fb945 + 7a72632 commit 704166b
Show file tree
Hide file tree
Showing 63 changed files with 717 additions and 853 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/niv-updater-rare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: knl/niv-updater-action@v15
with:
# might be too noisy
whitelist: 'ic-ref,musl-wasi,ic-wasm'
whitelist: 'ic-ref,ic-wasm'
labels: |
automerge-squash
keep_updating: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/niv-updater-trial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: niv-updater-action
uses: knl/niv-updater-action@v15
with:
whitelist: 'nixpkgs,musl-wasi,ic'
whitelist: 'nixpkgs,ic'
labels: |
autoclose
keep_updating: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/niv-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: knl/niv-updater-action@v15
with:
# might be too noisy
blacklist: 'nixpkgs,ic-ref,musl-wasi,ic'
blacklist: 'nixpkgs,ic-ref,ic'
labels: |
automerge-squash
keep_updating: true
Expand Down
18 changes: 17 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Motoko compiler changelog

## 0.13.4 (2024-11-29)

* motoko (`moc`)

* refactoring: Updating and simplifying the runtime system dependencies (#4677).

* motoko-base

* Breaking change (minor): `Float.format(#hex)` is no longer supported.
This is because newer versions of Motoko (such as with enhanced orthogonal persistence)
rely on the Rust-native formatter that does not offer this functionality.
It is expected that this formatter is very rarely used in practice (dfinity/motoko-base⁠#589).

* Formatter change (minor): The text formatting of `NaN`, positive or negative,
will be `NaN` in newer Motoko versions, while it was `nan` or `-nan` in older versions (dfinity/motoko-base⁠#589).

## 0.13.3 (2024-11-13)

* motoko (`moc`)
Expand All @@ -10,7 +26,7 @@
* motoko-base

* Add modules `OrderedMap` and `OrderedSet` to replace `RBTree` with improved functionality, performance
and ergonomics avoiding the need for preupgrade hooks (thanks to Serokell) (#662).
and ergonomics avoiding the need for preupgrade hooks (thanks to Serokell) (dfinity/motoko-base⁠#662).

## 0.13.2 (2024-10-18)

Expand Down
33 changes: 8 additions & 25 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,31 @@ in

let
rtsBuildInputs = with nixpkgs; [
# pulls in clang (wrapped) and clang-13 (unwrapped)
llvmPackages_13.clang
# pulls in wasm-ld
llvmPackages_13.lld
llvmPackages_13.bintools
llvmPackages_18.clang
llvmPackages_18.bintools
rustc-nightly
cargo-nightly
wasmtime
rust-bindgen
python3
emscripten
] ++ pkgs.lib.optional pkgs.stdenv.isDarwin [
libiconv
];

llvmEnv = ''
# When compiling to wasm, we want to have more control over the flags,
# so we do not use the nix-provided wrapper in clang
export WASM_CLANG="clang-13"
export WASM_CLANG="clang-18"
export WASM_LD=wasm-ld
# because we use the unwrapped clang, we have to pass in some flags/paths
# that otherwise the wrapped clang would take care for us
export WASM_CLANG_LIB="${nixpkgs.llvmPackages_13.clang-unwrapped.lib}"
export WASM_CLANG_LIB="${nixpkgs.llvmPackages_18.clang-unwrapped.lib}"
# When compiling natively, we want to use `clang` (which is a nixpkgs
# provided wrapper that sets various include paths etc).
# But for some reason it does not handle building for Wasm well, so
# there we use plain clang-13. There is no stdlib there anyways.
export CLANG="${nixpkgs.clang_13}/bin/clang"
# there we use plain clang-18. There is no stdlib there anyways.
export CLANG="${nixpkgs.clang_18}/bin/clang"
'';
in

Expand Down Expand Up @@ -153,15 +149,6 @@ let ocaml_exe = name: bin: rts:
$out/bin/* --help >/dev/null
'';
};

musl-wasi-sysroot = stdenv.mkDerivation {
name = "musl-wasi-sysroot";
src = nixpkgs.sources.musl-wasi;
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
make SYSROOT="$out" include_dirs
'';
};
in

rec {
Expand All @@ -178,7 +165,7 @@ rec {
vendorRustStdDeps = "${cargoVendorTools}/bin/vendor-rust-std-deps";

# SHA256 of Rust std deps
rustStdDepsHash = "sha256-A3WPIx+weu4wIYV7cweGkRxYGAPt7srxBAtMEyPOkhI=";
rustStdDepsHash = "sha256-U4BTr1CzFuOMdyLuhw5ry3/u8bkRiPmnMr4pLo3IdOQ=";

# Vendor directory for Rust std deps
rustStdDeps = nixpkgs.stdenvNoCC.mkDerivation {
Expand Down Expand Up @@ -255,8 +242,6 @@ rec {
${llvmEnv}
export TOMMATHSRC=${nixpkgs.sources.libtommath}
export MUSLSRC=${nixpkgs.sources.musl-wasi}/libc-top-half/musl
export MUSL_WASI_SYSROOT=${musl-wasi-sysroot}
'';

doCheck = true;
Expand Down Expand Up @@ -343,7 +328,7 @@ rec {

# extra deps for test/ld
ldTestDeps =
with nixpkgs; [ llvmPackages_13.bintools llvmPackages_13.clang ];
with nixpkgs; [ llvmPackages_18.lld llvmPackages_18.clang ];

testDerivation = args:
stdenv.mkDerivation (testDerivationArgs // args);
Expand Down Expand Up @@ -865,8 +850,6 @@ EOF
'';
ESM=nixpkgs.sources.esm;
TOMMATHSRC = nixpkgs.sources.libtommath;
MUSLSRC = "${nixpkgs.sources.musl-wasi}/libc-top-half/musl";
MUSL_WASI_SYSROOT = musl-wasi-sysroot;
LOCALE_ARCHIVE = nixpkgs.lib.optionalString stdenv.isLinux "${nixpkgs.glibcLocales}/lib/locale/locale-archive";
MOTOKO_BASE = base-src;
CANDID_TESTS = "${nixpkgs.sources.candid}/test";
Expand Down
12 changes: 7 additions & 5 deletions doc/md/base/Float.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ Float.log(Float.e) // => 1.0

## Function `format`
``` motoko no-repl
func format(fmt : {#fix : Nat8; #exp : Nat8; #gen : Nat8; #hex : Nat8; #exact}, x : Float) : Text
func format(fmt : {#fix : Nat8; #exp : Nat8; #gen : Nat8; #exact}, x : Float) : Text
```

Formatting. `format(fmt, x)` formats `x` to `Text` according to the
Expand All @@ -489,13 +489,15 @@ formatting directive `fmt`, which can take one of the following forms:
* `#fix prec` as fixed-point format with `prec` digits
* `#exp prec` as exponential format with `prec` digits
* `#gen prec` as generic format with `prec` digits
* `#hex prec` as hexadecimal format with `prec` digits
* `#exact` as exact format that can be decoded without loss.

`-0.0` is formatted with negative sign bit.
Positive infinity is formatted as `inf`.
Negative infinity is formatted as `-inf`.
`NaN` is formatted as `NaN` or `-NaN` depending on its sign bit.
Positive infinity is formatted as "inf".
Negative infinity is formatted as "-inf".

Note: The numerical precision and the text format can vary between
Motoko versions and runtime configuration. Moreover, `NaN` can be printed
differently, i.e. "NaN" or "nan", potentially omitting the `NaN` sign.

Example:
```motoko
Expand Down
4 changes: 1 addition & 3 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ let

# Rust nightly
(self: super: let
rust-channel = self.moz_overlay.rustChannelOf { date = "2023-04-21"; channel = "nightly"; };
rust-channel = self.moz_overlay.rustChannelOf { date = "2024-07-28"; channel = "nightly"; };
in rec {
rustc-nightly = rust-channel.rust.override {
targets = [
"wasm32-unknown-emscripten"
"wasm32-wasi"
"i686-unknown-linux-gnu"
];
extensions = ["rust-src"];
};
Expand Down
8 changes: 4 additions & 4 deletions nix/drun.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ EOF

buildInputs = with pkgs; [
openssl
llvm_13
llvmPackages_13.libclang
llvm_18
llvmPackages_18.libclang
lmdb
libunwind
libiconv
] ++ pkgs.lib.optional pkgs.stdenv.isDarwin
pkgs.darwin.apple_sdk.frameworks.Security;

# needed for bindgen
LIBCLANG_PATH = "${pkgs.llvmPackages_13.libclang.lib}/lib";
CLANG_PATH = "${pkgs.llvmPackages_13.clang}/bin/clang";
LIBCLANG_PATH = "${pkgs.llvmPackages_18.libclang.lib}/lib";
CLANG_PATH = "${pkgs.llvmPackages_18.clang}/bin/clang";

# needed for ic-protobuf
PROTOC="${pkgs.protobuf}/bin/protoc";
Expand Down
30 changes: 8 additions & 22 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
"homepage": "",
"owner": "dfinity",
"repo": "motoko-base",
"rev": "cf840985f48736d22e52db26147c9f9a2dcd19b1",
"sha256": "11y0nql11w9x1crg6szy0w1pa42nixld91gvn2sbiqxgpbrw02r8",
"rev": "2d4135ff07470802b39e94017ebb7e46e671c59b",
"sha256": "0ffxacbdakkhbrnchdxrlz62c8yd1jfy77krsf0vd1ihbf48svdr",
"type": "tarball",
"url": "https://github.com/dfinity/motoko-base/archive/cf840985f48736d22e52db26147c9f9a2dcd19b1.tar.gz",
"url": "https://github.com/dfinity/motoko-base/archive/2d4135ff07470802b39e94017ebb7e46e671c59b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"motoko-matchers": {
Expand All @@ -94,30 +94,16 @@
"url": "https://github.com/kritzcreek/motoko-matchers/archive/cb838c192df3328ff9ae172e2dc7338cf55e74bf.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"musl-wasi": {
"branch": "main",
"builtin": false,
"description": "WASI libc implementation for WebAssembly",
"homepage": "https://wasi.dev",
"owner": "WebAssembly",
"repo": "wasi-libc",
"rev": "c5264e2bbe532994d06b039005f2af91bedcc1a6",
"sha256": "1skw2jqzaidr2zbzbjw32b36xvqniwf4if8cr4kbpp8vjvh7j2lr",
"type": "tarball",
"url": "https://github.com/WebAssembly/wasi-libc/archive/c5264e2bbe532994d06b039005f2af91bedcc1a6.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "release-24.05",
"builtin": true,
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels",
"homepage": null,
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb8c2cf7ea0dd2e18a52746b2c3a5b0c73b93c22",
"sha256": "03kvrs5ai4y09hcjkbzwlxx0gv5sggqi0m82cxdqikkyriwlg97b",
"rev": "404f983f8c1da3ed403c95df9bd18d7c3b23399d",
"sha256": "025alb35qf1iwmz45615ahp400q54582kqzc0238a51ai2w88pxc",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/bb8c2cf7ea0dd2e18a52746b2c3a5b0c73b93c22.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/404f983f8c1da3ed403c95df9bd18d7c3b23399d.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-mozilla": {
Expand Down
Loading

0 comments on commit 704166b

Please sign in to comment.