Skip to content

Commit

Permalink
Rearrange precompiled directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 19, 2023
1 parent a282927 commit b88052d
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 43 deletions.
2 changes: 1 addition & 1 deletion precompiled/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/x86_64-unknown-linux-gnu/serde_derive
/serde_derive/serde_derive-x86_64-unknown-linux-gnu
2 changes: 1 addition & 1 deletion precompiled/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["proc-macro2", "serde_derive"]
members = ["bin", "proc-macro2"]
resolver = "2"

[patch.crates-io]
Expand Down
17 changes: 17 additions & 0 deletions precompiled/bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "serde_derive"
version = "1.0.171"
authors = ["David Tolnay <dtolnay@gmail.com>"]
publish = false

[lib]
doctest = false

[[bin]]
name = "serde_derive"
path = "main.rs"

[dependencies]
proc-macro2 = "1"
quote = { version = "1", default-features = false }
syn = { version = "2.0.25", default-features = false, features = ["clone-impls", "derive", "parsing", "printing"] }
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions precompiled/build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/bin/bash

cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null
set -e -x

# TODO: Sanitize host filesystem paths. https://github.com/rust-lang/cargo/issues/12137

cargo +nightly build \
--manifest-path serde_derive/Cargo.toml \
--manifest-path bin/Cargo.toml \
--bin serde_derive \
--profile precompiled \
-Z unstable-options \
-Z build-std=std,panic_abort \
-Z build-std-features=panic_immediate_abort \
--target x86_64-unknown-linux-musl \
--out-dir x86_64-unknown-linux-gnu
--out-dir serde_derive

#upx --best --lzma x86_64-unknown-linux-gnu/serde_derive
rm -f serde_derive/serde_derive-x86_64-unknown-linux-gnu
mv serde_derive/serde_derive{,-x86_64-unknown-linux-gnu}

#upx --best --lzma serde_derive/serde_derive-x86_64-unknown-linux-gnu
31 changes: 20 additions & 11 deletions precompiled/serde_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
[package]
name = "serde_derive"
version = "1.0.171"
name = "serde_derive-x86_64-unknown-linux-gnu"
version = "1.0.171-alpha.3"
authors = ["David Tolnay <dtolnay@gmail.com>"]
publish = false
categories = ["no-std", "no-std::no-alloc"]
description = "Precompiled implementation of #[derive(Serialize, Deserialize)]"
documentation = "https://serde.rs/derive.html"
edition = "2015"
homepage = "https://serde.rs"
include = ["serde_derive", "src"]
keywords = ["serde", "serialization", "no_std", "derive"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/serde-rs/serde"

[lib]
doctest = false

[[bin]]
name = "serde_derive"
path = "main.rs"
proc-macro = true

[features]
default = []
deserialize_in_place = []

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
proc-macro2 = "1"
quote = { version = "1", default-features = false }
syn = { version = "2.0.25", default-features = false, features = ["clone-impls", "derive", "parsing", "printing"] }
[workspace]
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ fn derive(select: u8, input: TokenStream) -> TokenStream {
memory.linearize_token(token, &mut buf);
}

let mut child = Command::new(concat!(env!("CARGO_MANIFEST_DIR"), "/serde_derive"))
let path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/serde_derive-x86_64-unknown-linux-gnu",
);
let mut child = Command::new(path)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn()
Expand Down
26 changes: 0 additions & 26 deletions precompiled/x86_64-unknown-linux-gnu/Cargo.toml

This file was deleted.

0 comments on commit b88052d

Please sign in to comment.