From e214c81ae56a9cf7750fe5ef6dc7b0fe60d4d426 Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 10 Nov 2023 17:36:46 -0600 Subject: [PATCH] link with mold --- Cargo.lock | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 + flake.nix | 15 ++-- src/build.rs | 3 + 4 files changed, 217 insertions(+), 5 deletions(-) create mode 100644 src/build.rs diff --git a/Cargo.lock b/Cargo.lock index 5a366d5..a63c3be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -466,6 +466,43 @@ dependencies = [ "bytes", ] +[[package]] +name = "c-gull" +version = "0.15.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16db458286db3b6e1657f54edb6112122eb59d12e658be45e0ae164da82319c8" +dependencies = [ + "c-scape", + "errno", + "libc", + "printf-compat", + "rustix", + "tz-rs", +] + +[[package]] +name = "c-scape" +version = "0.15.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054a3095b1264c87499e52d2b87ffe260deec4d2298be4d00763ee71bb7aef41" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "libm", + "memoffset", + "origin", + "rand", + "rand_core", + "rand_pcg", + "realpath-ext", + "rustix", + "rustix-dlmalloc", + "rustix-futex-sync", + "rustix-openpty", + "unwinding", +] + [[package]] name = "cc" version = "1.0.83" @@ -690,6 +727,22 @@ dependencies = [ "typenum", ] +[[package]] +name = "cstr_core" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd98742e4fdca832d40cab219dc2e3048de17d873248f83f17df47c1bea70956" +dependencies = [ + "cty", + "memchr", +] + +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + [[package]] name = "dashmap" version = "5.5.3" @@ -843,6 +896,25 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "eyra" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c142c64e0117d284b72c30b126dce72bbb85b21a5b6d84e823a6b74c6f0723e" +dependencies = [ + "c-gull", +] + [[package]] name = "eyre" version = "0.6.8" @@ -1260,6 +1332,15 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.10.5" @@ -1311,12 +1392,24 @@ version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "linked-hash-map" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" + [[package]] name = "local-channel" version = "0.1.5" @@ -1652,6 +1745,20 @@ dependencies = [ "num-traits", ] +[[package]] +name = "origin" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5ec3dcf976d221ecd72070fc76a8a8bc7de6cef95559b7be77579697408c5e8" +dependencies = [ + "bitflags 2.4.1", + "linux-raw-sys", + "memoffset", + "rustix", + "rustix-futex-sync", + "unwinding", +] + [[package]] name = "overload" version = "0.1.1" @@ -1767,6 +1874,7 @@ dependencies = [ "diesel", "diesel-async", "diesel-derive-enum", + "eyra", "flume", "futures-core", "hex", @@ -1906,6 +2014,18 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "printf-compat" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b002af28ffe3d3d67202ae717810a28125a494d5396debc43de01ee136ac404" +dependencies = [ + "bitflags 1.3.2", + "cstr_core", + "cty", + "itertools 0.9.0", +] + [[package]] name = "proc-macro2" version = "1.0.69" @@ -2035,6 +2155,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_pcg" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" +dependencies = [ + "rand_core", +] + [[package]] name = "raw-cpuid" version = "10.7.0" @@ -2044,6 +2173,17 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "realpath-ext" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692f72862a0d532b44a0f4965fb10f17e7659eaedf24d2ce3c989ca778bd092f" +dependencies = [ + "bitflags 1.3.2", + "errno", + "libc", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -2281,6 +2421,52 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags 2.4.1", + "errno", + "itoa", + "libc", + "linux-raw-sys", + "once_cell", + "windows-sys", +] + +[[package]] +name = "rustix-dlmalloc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "730c0a5fbe9885450abcfca57da8c5d5a886492d01aa1a78b782fc5ddb2c0931" +dependencies = [ + "rustix", + "rustix-futex-sync", +] + +[[package]] +name = "rustix-futex-sync" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bebec5b686394f118236986b64350c06de4504a4dbe32f4e2e96c9f8adc15390" +dependencies = [ + "lock_api", + "rustix", +] + +[[package]] +name = "rustix-openpty" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25c3aad9fc1424eb82c88087789a7d938e1829724f3e4043163baf0d13cfc12" +dependencies = [ + "errno", + "libc", + "rustix", +] + [[package]] name = "rustls" version = "0.21.8" @@ -3163,6 +3349,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "tz-rs" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4" + [[package]] name = "unicase" version = "2.7.0" @@ -3199,6 +3391,16 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "unwinding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a19a21a537f635c16c7576f22d0f2f7d63353c1337ad4ce0d8001c7952a25b" +dependencies = [ + "gimli", + "libc", +] + [[package]] name = "url" version = "2.4.1" diff --git a/Cargo.toml b/Cargo.toml index e87bbe0..5f3c4b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ license = "AGPL-3.0" readme = "README.md" repository = "https://git.asonix.dog/asonix/pict-rs" edition = "2021" +build = "src/build.rs" [profile.release] strip = true @@ -81,6 +82,7 @@ tracing-subscriber = { version = "0.3.0", features = [ ] } url = { version = "2.2", features = ["serde"] } uuid = { version = "1", features = ["serde", "std", "v4", "v7"] } +std = { version = "0.16.3", package = "eyra" } [dependencies.tracing-actix-web] version = "0.7.8" diff --git a/flake.nix b/flake.nix index ee92350..75e8ba4 100644 --- a/flake.nix +++ b/flake.nix @@ -21,13 +21,16 @@ inherit system; overlays = [ fenix.overlays.default ]; }; + + systemMappings = { + "x86_64-linux" = ["x86_64" "unknown" "linux" "gnu"]; + "aarch64-linux" = ["aarch64" "unknown" "linux" "gnu"]; + }; + + hostCargoTarget = nixpkgs.lib.strings.concatMapStringsSep "_" (nixpkgs.lib.strings.toUpper) systemMappings.${system}; + makeRustCrossPackage = (crossSystem: let - systemMappings = { - "x86_64-linux" = ["x86_64" "unknown" "linux" "gnu"]; - "aarch64-linux" = ["aarch64" "unknown" "linux" "gnu"]; - }; - pkgsCross = import nixpkgs { inherit system; crossSystem.system = crossSystem; @@ -76,6 +79,8 @@ }; devShell = with pkgs; mkShell { + "CARGO_${hostCargoTarget}" = "${mold}/bin/mold"; + nativeBuildInputs = [ diesel-cli exiftool diff --git a/src/build.rs b/src/build.rs new file mode 100644 index 0000000..f127706 --- /dev/null +++ b/src/build.rs @@ -0,0 +1,3 @@ +fn main() { + println!("cargo:rustc-link-arg=-nostartfiles"); +}