diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b43dca5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/rustix-0.37.23.crate diff --git a/0001-Unconditionally-compile-C-Assembly-code-from-source.patch b/0001-Unconditionally-compile-C-Assembly-code-from-source.patch new file mode 100644 index 0000000..5cadd32 --- /dev/null +++ b/0001-Unconditionally-compile-C-Assembly-code-from-source.patch @@ -0,0 +1,79 @@ +From 939406285b517ea2e61a62040a85c2676e786476 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Tue, 4 Apr 2023 15:56:58 +0200 +Subject: [PATCH] Unconditionally compile C / Assembly code from source + +--- + build.rs | 51 ++------------------------------------------------- + 1 file changed, 2 insertions(+), 49 deletions(-) + +diff --git a/build.rs b/build.rs +index 1ccf0cc..ce34090 100644 +--- a/build.rs ++++ b/build.rs +@@ -1,4 +1,3 @@ +-#[cfg(feature = "cc")] + use cc::Build; + use std::env::var; + use std::io::Write; +@@ -156,55 +155,9 @@ fn main() { + /// outline assembly code for making syscalls. + fn link_in_librustix_outline(arch: &str, asm_name: &str) { + let name = format!("rustix_outline_{}", arch); +- let profile = var("PROFILE").unwrap(); +- let to = format!("{}/{}/lib{}.a", OUTLINE_PATH, profile, name); +- println!("cargo:rerun-if-changed={}", to); + +- // If "cc" is not enabled, use a pre-built library. +- #[cfg(not(feature = "cc"))] +- { +- let _ = asm_name; +- println!("cargo:rustc-link-search={}/{}", OUTLINE_PATH, profile); +- println!("cargo:rustc-link-lib=static={}", name); +- } +- +- // If "cc" is enabled, build the library from source, update the pre-built +- // version, and assert that the pre-built version is checked in. +- #[cfg(feature = "cc")] +- { +- let out_dir = var("OUT_DIR").unwrap(); +- // Add `-gdwarf-3` so that we always get the same output, regardless of +- // the Rust version we're using. DWARF3 is the version used in +- // Rust 1.48 and is entirely adequate for our simple needs here. +- let mut build = Build::new(); +- if profile == "debug" { +- build.flag("-gdwarf-3"); +- } +- build.file(&asm_name); +- build.compile(&name); +- println!("cargo:rerun-if-changed={}", asm_name); +- if std::fs::metadata(".git").is_ok() { +- let from = format!("{}/lib{}.a", out_dir, name); +- let prev_metadata = std::fs::metadata(&to); +- std::fs::copy(&from, &to).unwrap(); +- assert!( +- prev_metadata.is_ok(), +- "{} didn't previously exist; please inspect the new file and `git add` it", +- to +- ); +- assert!( +- std::process::Command::new("git") +- .arg("diff") +- .arg("--quiet") +- .arg(&to) +- .status() +- .unwrap() +- .success(), +- "{} changed; please inspect the change and `git commit` it", +- to +- ); +- } +- } ++ let out_dir = var("OUT_DIR").unwrap(); ++ Build::new().file(&asm_name).compile(&name); + } + + fn use_thumb_mode() -> bool { +-- +2.40.0 + diff --git a/README.md b/README.md deleted file mode 100644 index fb77cf3..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# rust-rustix0.37 - -The rust-rustix0.37 package diff --git a/rust-rustix0.37.spec b/rust-rustix0.37.spec new file mode 100644 index 0000000..032559f --- /dev/null +++ b/rust-rustix0.37.spec @@ -0,0 +1,422 @@ +# Generated by rust2rpm 24 +%bcond_without check +%global debug_package %{nil} + +%global crate rustix + +Name: rust-rustix0.37 +Version: 0.37.23 +Release: %autorelease +Summary: Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls + +License: Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT +URL: https://crates.io/crates/rustix +Source: %{crates_source} +# Automatically generated patch to strip foreign dependencies +Patch: rustix-fix-metadata-auto.diff +# Manually created patch for downstream crate metadata changes +# * drop dependencies on compiler internals +# * make cc build-dependency non-optional +Patch: rustix-fix-metadata.diff +# * unconditionally rebuild static objects from Assembly +Patch: 0001-Unconditionally-compile-C-Assembly-code-from-source.patch + +BuildRequires: rust-packaging >= 21 + +%global _description %{expand: +Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/COPYRIGHT +%license %{crate_instdir}/LICENSE-APACHE +%license %{crate_instdir}/LICENSE-Apache-2.0_WITH_LLVM-exception +%license %{crate_instdir}/LICENSE-MIT +%doc %{crate_instdir}/CODE_OF_CONDUCT.md +%doc %{crate_instdir}/CONTRIBUTING.md +%doc %{crate_instdir}/ORG_CODE_OF_CONDUCT.md +%doc %{crate_instdir}/README.md +%doc %{crate_instdir}/SECURITY.md +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+all-apis-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+all-apis-devel %{_description} + +This package contains library source intended for building other packages which +use the "all-apis" feature of the "%{crate}" crate. + +%files -n %{name}+all-apis-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+all-impls-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+all-impls-devel %{_description} + +This package contains library source intended for building other packages which +use the "all-impls" feature of the "%{crate}" crate. + +%files -n %{name}+all-impls-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+cc-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+cc-devel %{_description} + +This package contains library source intended for building other packages which +use the "cc" feature of the "%{crate}" crate. + +%files -n %{name}+cc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-err-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+fs-err-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs-err" feature of the "%{crate}" crate. + +%files -n %{name}+fs-err-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-lifetimes-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+io-lifetimes-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-lifetimes" feature of the "%{crate}" crate. + +%files -n %{name}+io-lifetimes-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io_uring-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+io_uring-devel %{_description} + +This package contains library source intended for building other packages which +use the "io_uring" feature of the "%{crate}" crate. + +%files -n %{name}+io_uring-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+itoa-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+itoa-devel %{_description} + +This package contains library source intended for building other packages which +use the "itoa" feature of the "%{crate}" crate. + +%files -n %{name}+itoa-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+libc-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+libc-devel %{_description} + +This package contains library source intended for building other packages which +use the "libc" feature of the "%{crate}" crate. + +%files -n %{name}+libc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+libc_errno-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+libc_errno-devel %{_description} + +This package contains library source intended for building other packages which +use the "libc_errno" feature of the "%{crate}" crate. + +%files -n %{name}+libc_errno-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+linux_4_11-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+linux_4_11-devel %{_description} + +This package contains library source intended for building other packages which +use the "linux_4_11" feature of the "%{crate}" crate. + +%files -n %{name}+linux_4_11-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+linux_latest-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+linux_latest-devel %{_description} + +This package contains library source intended for building other packages which +use the "linux_latest" feature of the "%{crate}" crate. + +%files -n %{name}+linux_latest-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mm-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+mm-devel %{_description} + +This package contains library source intended for building other packages which +use the "mm" feature of the "%{crate}" crate. + +%files -n %{name}+mm-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+once_cell-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+once_cell-devel %{_description} + +This package contains library source intended for building other packages which +use the "once_cell" feature of the "%{crate}" crate. + +%files -n %{name}+once_cell-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+os_pipe-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+os_pipe-devel %{_description} + +This package contains library source intended for building other packages which +use the "os_pipe" feature of the "%{crate}" crate. + +%files -n %{name}+os_pipe-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+param-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+param-devel %{_description} + +This package contains library source intended for building other packages which +use the "param" feature of the "%{crate}" crate. + +%files -n %{name}+param-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+procfs-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+procfs-devel %{_description} + +This package contains library source intended for building other packages which +use the "procfs" feature of the "%{crate}" crate. + +%files -n %{name}+procfs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+pty-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+pty-devel %{_description} + +This package contains library source intended for building other packages which +use the "pty" feature of the "%{crate}" crate. + +%files -n %{name}+pty-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rand-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+rand-devel %{_description} + +This package contains library source intended for building other packages which +use the "rand" feature of the "%{crate}" crate. + +%files -n %{name}+rand-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+runtime-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+runtime-devel %{_description} + +This package contains library source intended for building other packages which +use the "runtime" feature of the "%{crate}" crate. + +%files -n %{name}+runtime-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+std-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+std-devel %{_description} + +This package contains library source intended for building other packages which +use the "std" feature of the "%{crate}" crate. + +%files -n %{name}+std-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+termios-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+termios-devel %{_description} + +This package contains library source intended for building other packages which +use the "termios" feature of the "%{crate}" crate. + +%files -n %{name}+termios-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+thread-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+thread-devel %{_description} + +This package contains library source intended for building other packages which +use the "thread" feature of the "%{crate}" crate. + +%files -n %{name}+thread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+use-libc-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+use-libc-devel %{_description} + +This package contains library source intended for building other packages which +use the "use-libc" feature of the "%{crate}" crate. + +%files -n %{name}+use-libc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+use-libc-auxv-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+use-libc-auxv-devel %{_description} + +This package contains library source intended for building other packages which +use the "use-libc-auxv" feature of the "%{crate}" crate. + +%files -n %{name}+use-libc-auxv-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +%cargo_prep +# Remove pre-built binaries +rm -r src/backend/linux_raw/arch/outline/debug/ +rm -r src/backend/linux_raw/arch/outline/release/ + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/rustix-fix-metadata-auto.diff b/rustix-fix-metadata-auto.diff new file mode 100644 index 0000000..623fde6 --- /dev/null +++ b/rustix-fix-metadata-auto.diff @@ -0,0 +1,32 @@ +--- rustix-0.37.23/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ rustix-0.37.23/Cargo.toml 2023-07-05T19:13:57.600367+00:00 +@@ -203,9 +203,6 @@ + ] + default-features = false + +-[target."cfg(all(criterion, not(any(target_os = \"emscripten\", target_os = \"wasi\"))))".dev-dependencies.criterion] +-version = "0.4" +- + [target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))".dependencies.libc] + version = "0.2.144" + features = ["extra_traits"] +@@ -240,19 +237,3 @@ + version = "1.5.2" + optional = true + +-[target."cfg(windows)".dependencies.libc_errno] +-version = "0.3.1" +-default-features = false +-package = "errno" +- +-[target."cfg(windows)".dependencies.windows-sys] +-version = "0.48.0" +-features = [ +- "Win32_Foundation", +- "Win32_Networking_WinSock", +- "Win32_NetworkManagement_IpHelper", +- "Win32_System_Threading", +-] +- +-[target."cfg(windows)".dev-dependencies.ctor] +-version = "0.2.0" diff --git a/rustix-fix-metadata.diff b/rustix-fix-metadata.diff new file mode 100644 index 0000000..541b2cd --- /dev/null +++ b/rustix-fix-metadata.diff @@ -0,0 +1,59 @@ +--- rustix-0.37.23/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ rustix-0.37.23/Cargo.toml 2023-07-05T19:14:54.852609+00:00 +@@ -68,26 +68,8 @@ + "wasm32-wasi", + ] + +-[[bench]] +-name = "mod" +-harness = false +- +-[dependencies.alloc] +-version = "1.0.0" +-optional = true +-package = "rustc-std-workspace-alloc" +- + [dependencies.bitflags] + version = "1.3.2" +- +-[dependencies.compiler_builtins] +-version = "0.1.49" +-optional = true +- +-[dependencies.core] +-version = "1.0.0" +-optional = true +-package = "rustc-std-workspace-core" + + [dependencies.io-lifetimes] + version = "1.0.10" +@@ -127,7 +109,6 @@ + + [build-dependencies.cc] + version = "1.0.68" +-optional = true + + [features] + all-apis = [ +@@ -149,6 +130,7 @@ + "os_pipe", + "fs-err", + ] ++cc = [] + default = [ + "std", + "use-libc-auxv", +@@ -177,13 +159,6 @@ + ] + rand = [] + runtime = [] +-rustc-dep-of-std = [ +- "core", +- "alloc", +- "compiler_builtins", +- "linux-raw-sys/rustc-dep-of-std", +- "bitflags/rustc-dep-of-std", +-] + std = ["io-lifetimes"] + termios = [] + thread = [] diff --git a/sources b/sources new file mode 100644 index 0000000..a7c887e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (rustix-0.37.23.crate) = 9dcc915b753b0ae9ea4d92d33f3a7c73e889ca0dc22abb95ec3d375e4188449d1bd6835c122598beb947fc8aaf884c59cc2cf55ab77f32480f5c17e789664988