forked from kiss-community/repo
rust: move to extra
This commit is contained in:
parent
d22a099dac
commit
ad94869807
@ -1,48 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
patch -p1 < musl-libressl.patch
|
||||
|
||||
# 'rust' checksums files in vendor/, but we patch a few files.
|
||||
for vendor in libc openssl-sys; do
|
||||
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/$vendor/.cargo-checksum.json"
|
||||
done
|
||||
|
||||
cat > config.toml <<EOF
|
||||
[llvm]
|
||||
link-shared = true
|
||||
|
||||
[build]
|
||||
build = "x86_64-unknown-linux-musl"
|
||||
host = [ "x86_64-unknown-linux-musl" ]
|
||||
target = [ "x86_64-unknown-linux-musl" ]
|
||||
docs = false
|
||||
extended = true
|
||||
submodules = false
|
||||
python = "python3"
|
||||
locked-deps = true
|
||||
vendor = true
|
||||
|
||||
[install]
|
||||
prefix = "/usr"
|
||||
|
||||
[rust]
|
||||
channel = "stable"
|
||||
rpath = false
|
||||
codegen-units = 1
|
||||
debuginfo-level = 0
|
||||
backtrace = false
|
||||
jemalloc = false
|
||||
codegen-tests = false
|
||||
|
||||
[target.x86_64-unknown-linux-musl]
|
||||
llvm-config = "/usr/bin/llvm-config"
|
||||
crt-static = false
|
||||
EOF
|
||||
|
||||
python3 ./x.py build -j "$(nproc)"
|
||||
DESTDIR="$1" python3 ./x.py install
|
||||
|
||||
# Remove junk.
|
||||
rm -rf "$1/etc/bash_completion.d"
|
||||
rm -rf "$1/usr/share/zsh"
|
||||
rm -rf "$1/usr/share/doc"
|
@ -1,2 +0,0 @@
|
||||
120e7020d065499cc6b28759ff04153bfdc2ac9b5adeb252331a4eb87cbe38c3 rustc-1.37.0-src.tar.gz
|
||||
0341881feff659cf705671d663157113fdc752d9bfb0cdfd5fc75daa65bdf1d5 musl-libressl.patch
|
@ -1,4 +0,0 @@
|
||||
cmake make
|
||||
curl make
|
||||
llvm make
|
||||
python make
|
@ -1,174 +0,0 @@
|
||||
diff -ruN rustc-1.37.0-src-orig/src/bootstrap/compile.rs rustc-1.37.0-src/src/bootstrap/compile.rs
|
||||
--- rustc-1.37.0-src-orig/src/bootstrap/compile.rs 2019-08-12 23:27:22.000000000 -0700
|
||||
+++ rustc-1.37.0-src/src/bootstrap/compile.rs 2019-08-17 02:56:03.893753627 -0700
|
||||
@@ -116,28 +116,6 @@
|
||||
fn copy_third_party_objects(builder: &Builder<'_>, compiler: &Compiler, target: Interned<String>) {
|
||||
let libdir = builder.sysroot_libdir(*compiler, target);
|
||||
|
||||
- // Copies the crt(1,i,n).o startup objects
|
||||
- //
|
||||
- // Since musl supports fully static linking, we can cross link for it even
|
||||
- // with a glibc-targeting toolchain, given we have the appropriate startup
|
||||
- // files. As those shipped with glibc won't work, copy the ones provided by
|
||||
- // musl so we have them on linux-gnu hosts.
|
||||
- if target.contains("musl") {
|
||||
- for &obj in &["crt1.o", "crti.o", "crtn.o"] {
|
||||
- builder.copy(
|
||||
- &builder.musl_root(target).unwrap().join("lib").join(obj),
|
||||
- &libdir.join(obj),
|
||||
- );
|
||||
- }
|
||||
- } else if target.ends_with("-wasi") {
|
||||
- for &obj in &["crt1.o"] {
|
||||
- builder.copy(
|
||||
- &builder.wasi_root(target).unwrap().join("lib/wasm32-wasi").join(obj),
|
||||
- &libdir.join(obj),
|
||||
- );
|
||||
- }
|
||||
- }
|
||||
-
|
||||
// Copies libunwind.a compiled to be linked wit x86_64-fortanix-unknown-sgx.
|
||||
//
|
||||
// This target needs to be linked to Fortanix's port of llvm's libunwind.
|
||||
diff -ruN rustc-1.37.0-src-orig/src/bootstrap/sanity.rs rustc-1.37.0-src/src/bootstrap/sanity.rs
|
||||
--- rustc-1.37.0-src-orig/src/bootstrap/sanity.rs 2019-08-12 23:27:22.000000000 -0700
|
||||
+++ rustc-1.37.0-src/src/bootstrap/sanity.rs 2019-08-17 03:06:51.725807452 -0700
|
||||
@@ -176,34 +176,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- // Make sure musl-root is valid
|
||||
- if target.contains("musl") {
|
||||
- // If this is a native target (host is also musl) and no musl-root is given,
|
||||
- // fall back to the system toolchain in /usr before giving up
|
||||
- if build.musl_root(*target).is_none() && build.config.build == *target {
|
||||
- let target = build.config.target_config.entry(target.clone())
|
||||
- .or_default();
|
||||
- target.musl_root = Some("/usr".into());
|
||||
- }
|
||||
- match build.musl_root(*target) {
|
||||
- Some(root) => {
|
||||
- if fs::metadata(root.join("lib/libc.a")).is_err() {
|
||||
- panic!("couldn't find libc.a in musl dir: {}",
|
||||
- root.join("lib").display());
|
||||
- }
|
||||
- if fs::metadata(root.join("lib/libunwind.a")).is_err() {
|
||||
- panic!("couldn't find libunwind.a in musl dir: {}",
|
||||
- root.join("lib").display());
|
||||
- }
|
||||
- }
|
||||
- None => {
|
||||
- panic!("when targeting MUSL either the rust.musl-root \
|
||||
- option or the target.$TARGET.musl-root option must \
|
||||
- be specified in config.toml")
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if target.contains("msvc") {
|
||||
// There are three builds of cmake on windows: MSVC, MinGW, and
|
||||
// Cygwin. The Cygwin build does not have generators for Visual
|
||||
diff -ruN rustc-1.37.0-src-orig/src/librustc_target/spec/linux_musl_base.rs rustc-1.37.0-src/src/librustc_target/spec/linux_musl_base.rs
|
||||
--- rustc-1.37.0-src-orig/src/librustc_target/spec/linux_musl_base.rs 2019-08-12 23:27:22.000000000 -0700
|
||||
+++ rustc-1.37.0-src/src/librustc_target/spec/linux_musl_base.rs 2019-08-17 02:56:53.553119774 -0700
|
||||
@@ -26,7 +26,7 @@
|
||||
base.post_link_objects_crt.push("crtn.o".to_string());
|
||||
|
||||
// These targets statically link libc by default
|
||||
- base.crt_static_default = true;
|
||||
+ base.crt_static_default = false;
|
||||
// These targets allow the user to choose between static and dynamic linking.
|
||||
base.crt_static_respected = true;
|
||||
|
||||
diff -ruN rustc-1.37.0-src-orig/src/libunwind/build.rs rustc-1.37.0-src/src/libunwind/build.rs
|
||||
--- rustc-1.37.0-src-orig/src/libunwind/build.rs 2019-08-12 23:27:22.000000000 -0700
|
||||
+++ rustc-1.37.0-src/src/libunwind/build.rs 2019-08-17 03:07:40.245230990 -0700
|
||||
@@ -11,9 +11,7 @@
|
||||
#[cfg(feature = "llvm-libunwind")]
|
||||
llvm_libunwind::compile();
|
||||
} else if target.contains("linux") {
|
||||
- if target.contains("musl") {
|
||||
- // musl is handled in lib.rs
|
||||
- } else if !target.contains("android") {
|
||||
+ if !target.contains("android") {
|
||||
println!("cargo:rustc-link-lib=gcc_s");
|
||||
}
|
||||
} else if target.contains("freebsd") {
|
||||
diff -ruN rustc-1.37.0-src-orig/src/libunwind/lib.rs rustc-1.37.0-src/src/libunwind/lib.rs
|
||||
--- rustc-1.37.0-src-orig/src/libunwind/lib.rs 2019-08-12 23:27:22.000000000 -0700
|
||||
+++ rustc-1.37.0-src/src/libunwind/lib.rs 2019-08-17 03:06:59.005720850 -0700
|
||||
@@ -21,8 +21,3 @@
|
||||
pub use libunwind::*;
|
||||
}
|
||||
}
|
||||
-
|
||||
-#[cfg(target_env = "musl")]
|
||||
-#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
|
||||
-#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
|
||||
-extern {}
|
||||
diff -ruN rustc-1.37.0-src-orig/vendor/libc/src/unix/mod.rs rustc-1.37.0-src/vendor/libc/src/unix/mod.rs
|
||||
--- rustc-1.37.0-src-orig/vendor/libc/src/unix/mod.rs 2019-08-13 01:30:01.000000000 -0700
|
||||
+++ rustc-1.37.0-src/vendor/libc/src/unix/mod.rs 2019-08-17 02:56:21.273531120 -0700
|
||||
@@ -306,13 +306,6 @@
|
||||
} else if #[cfg(feature = "use_std")] {
|
||||
// cargo build, don't pull in anything extra as the libstd dep
|
||||
// already pulls in all libs.
|
||||
- } else if #[cfg(target_env = "musl")] {
|
||||
- #[cfg_attr(feature = "rustc-dep-of-std",
|
||||
- link(name = "c", kind = "static",
|
||||
- cfg(target_feature = "crt-static")))]
|
||||
- #[cfg_attr(feature = "rustc-dep-of-std",
|
||||
- link(name = "c", cfg(not(target_feature = "crt-static"))))]
|
||||
- extern {}
|
||||
} else if #[cfg(target_os = "emscripten")] {
|
||||
#[link(name = "c")]
|
||||
extern {}
|
||||
diff -ruN rustc-1.37.0-src-orig/vendor/openssl-sys/build/main.rs rustc-1.37.0-src/vendor/openssl-sys/build/main.rs
|
||||
--- rustc-1.37.0-src-orig/vendor/openssl-sys/build/main.rs 2019-08-13 01:30:02.000000000 -0700
|
||||
+++ rustc-1.37.0-src/vendor/openssl-sys/build/main.rs 2019-08-17 02:55:12.634414453 -0700
|
||||
@@ -183,27 +183,30 @@
|
||||
if let Some(libressl_version) = libressl_version {
|
||||
println!("cargo:libressl_version_number={:x}", libressl_version);
|
||||
|
||||
+ let major = (libressl_version >> 28) as u8;
|
||||
let minor = (libressl_version >> 20) as u8;
|
||||
let fix = (libressl_version >> 12) as u8;
|
||||
- let (minor, fix) = match (minor, fix) {
|
||||
- (5, 0) => ('5', '0'),
|
||||
- (5, 1) => ('5', '1'),
|
||||
- (5, 2) => ('5', '2'),
|
||||
- (5, _) => ('5', 'x'),
|
||||
- (6, 0) => ('6', '0'),
|
||||
- (6, 1) => ('6', '1'),
|
||||
- (6, 2) => ('6', '2'),
|
||||
- (6, _) => ('6', 'x'),
|
||||
- (7, _) => ('7', 'x'),
|
||||
- (8, 0) => ('8', '0'),
|
||||
- (8, 1) => ('8', '1'),
|
||||
- (8, _) => ('8', 'x'),
|
||||
- (9, 0) => ('9', '0'),
|
||||
+ let (major, minor, fix) = match (major, minor, fix) {
|
||||
+ (2, 5, 0) => ('2', '5', '0'),
|
||||
+ (2, 5, 1) => ('2', '5', '1'),
|
||||
+ (2, 5, 2) => ('2', '5', '2'),
|
||||
+ (2, 5, _) => ('2', '5', 'x'),
|
||||
+ (2, 6, 0) => ('2', '6', '0'),
|
||||
+ (2, 6, 1) => ('2', '6', '1'),
|
||||
+ (2, 6, 2) => ('2', '6', '2'),
|
||||
+ (2, 6, _) => ('2', '6', 'x'),
|
||||
+ (2, 7, _) => ('2', '7', 'x'),
|
||||
+ (2, 8, 0) => ('2', '8', '0'),
|
||||
+ (2, 8, 1) => ('2', '8', '1'),
|
||||
+ (2, 8, _) => ('2', '8', 'x'),
|
||||
+ (2, 9, 0) => ('2', '9', '0'),
|
||||
+ (2, 9, _) => ('2', '9', 'x'),
|
||||
+ (3, 0, 0) => ('3', '0', '0'),
|
||||
_ => version_error(),
|
||||
};
|
||||
|
||||
println!("cargo:libressl=true");
|
||||
- println!("cargo:libressl_version=2{}{}", minor, fix);
|
||||
+ println!("cargo:libressl_version={}{}{}", major, minor, fix);
|
||||
println!("cargo:version=101");
|
||||
Version::Libressl
|
||||
} else {
|
@ -1,2 +0,0 @@
|
||||
https://static.rust-lang.org/dist/rustc-1.37.0-src.tar.gz
|
||||
patches/musl-libressl.patch
|
@ -1 +0,0 @@
|
||||
1.37.0 1
|
Loading…
Reference in New Issue
Block a user