diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml deleted file mode 100644 index d2cf945..0000000 --- a/.github/workflows/check.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: check - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - check: - runs-on: ubuntu-latest - container: - image: rustlang/rust:nightly - steps: - - uses: actions/checkout@v3 - - name: Check formatting - run: cargo fmt --all -- --check - - name: Install Clippy - run: rustup component add clippy - - name: Run Clippy - run: cargo clippy --all-targets --all-features -- -D warnings - - name: Run check - run: cargo check - - name: Run check - run: cargo test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cba6c5c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: CI + +on: + pull_request: + push: + branches: + - 'main' + tags: + - "v[0-9]+.[0-9]+.[0-9]+**" + +env: + RUSTFLAGS: -D warnings + +jobs: + check: + name: Check + runs-on: ubuntu-latest + container: + image: ghcr.io/vita-rust/vitasdk-rs + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: "`cargo check`" + run: cargo check --all-targets --all-features + - name: "`cargo clippy`" + run: cargo clippy --all-targets --all-features + - name: Run cargo doc + run: DOCS_RS=1 RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --target armv7-sony-vita-newlibeabihf -Z build-std + - name: Upload docs + uses: actions/upload-artifact@v3 + with: + name: docs + path: target/armv7-sony-vita-newlibeabihf/doc + if-no-files-found: error + + release: + if: startsWith(github.ref, 'refs/tags/v') + name: GitHub Release + runs-on: ubuntu-latest + needs: check + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: GH Release + uses: softprops/action-gh-release@v1 + with: + body: ${{steps.github_release.outputs.changelog}} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + publish: + if: startsWith(github.ref, 'refs/tags/v') + name: Publish to crates.io + runs-on: ubuntu-latest + needs: check + container: + image: ghcr.io/vita-rust/vitasdk-rs + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: publish + run: cargo publish --token ${CRATES_TOKEN} + env: + CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 98dbb5b..64cb31d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,36 +1,3 @@ { - "cSpell.words": [ - "alloc", - "bufsz", - "clippy", - "Condvar", - "cvar", - "dealloc", - "direntry", - "direnv", - "envrc", - "fchown", - "getppid", - "lchown", - "libc", - "linkat", - "malloc", - "newdirfd", - "newlib", - "newpath", - "olddirfd", - "oldpath", - "POSIX", - "pthread", - "readlink", - "realloc", - "rustlang", - "rwlock", - "socketpair", - "ssize", - "structs", - "vitacompanion", - "VITASDK" - ], "rust-analyzer.cargo.target": "armv7-sony-vita-newlibeabihf" -} \ No newline at end of file +} diff --git a/Cargo.lock b/Cargo.lock index 05379de..596ad48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "libc" -version = "0.2.148" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "vita-newlib-shims" diff --git a/Cargo.toml b/Cargo.toml index 6f685a2..4245da5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,26 @@ -[workspace] -members = ["crates/*"] -resolver = "2" \ No newline at end of file +[package] +name = "vita-newlib-shims" +version = "0.2.1" +edition = "2021" + +license = "MIT OR Apache-2.0" +description = "Shims for libc functions not provided by Vita SDK newlib" +homepage = "https://github.com/vita-rust/std/tree/main/crates/vita-newlib-shims" +repository = "https://github.com/vita-rust/std" + +authors = ["vita-sdk", "Nikolay Arhipov "] +keywords = ["vita", "homebrew"] + +[features] +pipe2 = [] +socketpair = [] + +[dependencies] +libc = "0.2.149" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] +default-target = "armv7-sony-vita-newlibeabihf" +targets = [] +cargo-args = ["-Z", "build-std"] diff --git a/README.md b/README.md index a2dbcac..6bf623b 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,33 @@ -# std +# vita-newlib-shims -[![Rust](https://github.com/vita-rust/std/workflows/check/badge.svg)](https://github.com/vita-rust/std/actions) -This repository hosts source code for crates intended to improve Rust std support for PlayStation Vita. +[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/vita-rust/vita-newlib-shims#license) +[![Crates.io](https://img.shields.io/crates/v/vita-newlib-shims.svg)](https://crates.io/crates/vita-newlib-shims) +[![GitHub Actions Build Status](https://img.shields.io/github/actions/workflow/status/vita-rust/vita-newlib-shims/release.yml)](https://github.com/vita-rust/vita-newlib-shims/actions/workflows/release.yml) +[![Current Release](https://img.shields.io/github/release/vita-rust/vita-newlib-shims.svg)](https://github.com/vita-rust/vita-newlib-shims/releases) +[![Main Commits RSS Feed](https://img.shields.io/badge/rss-commits-ffa500?logo=rss)](https://github.com/vita-rust/vita-newlib-shims/commits/main.atom) -## [vita-newlib-shims](./crates/vita-newlib-shims/README.md) +Standard library support for PlayStation Vita in Rust relies on Vita SDK newlib. Unfortunately, [not all](https://github.com/vitasdk/newlib/issues/86) of the POSIX functions are implemented in it. -[![Crates.io](https://img.shields.io/crates/v/vita-newlib-shims.svg)](https://crates.io/crates/vita-newlib-shims) -[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/vita-rust/std#license) +This repository aims to temporarily fix that by providing shims for the missing functions. + +To use this crate: + +1. Add it as a dependency to your project + + ```bash + cargo add vita-newlib-shims + ``` +2. Import this crate in the root of your project: + + ```rust + #[cfg(target_os = "vita")] + use vita_newlib_shims as _; + ``` +3. `VITASDK` environment variable must be set to your [Vita SDK] location. + +During build this crate will check the exported symbols from the `libc.a` object file using `arm-vita-eabi-nm` of your [Vita SDK] installation, and will only provide shims for the missing functions. -Shims functions missing from Vita SDK newlib. ## License @@ -17,3 +35,5 @@ Except where noted (below and/or in individual files), all code in this reposito * MIT License ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)) * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)) + +[Vita SDK]: https://vitasdk.org diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..18bedc8 --- /dev/null +++ b/build.rs @@ -0,0 +1,46 @@ +use std::{collections::HashMap, path::Path, process::Command}; + +const FEATURES: &[&str] = &["socketpair", "pipe2"]; + +fn main() { + if std::env::var("DOCS_RS").is_ok() { + return; + } + + println!("cargo:rerun-if-env-changed=VITASDK"); + + let vitasdk = std::env::var("VITASDK").expect("VITASDK not set"); + let vitasdk = Path::new(&vitasdk); + + let libc_a = vitasdk.join("arm-vita-eabi").join("lib").join("libc.a"); + let nm = vitasdk.join("bin").join("arm-vita-eabi-nm"); + + println!("cargo:rerun-if-changed={}", libc_a.display()); + println!("cargo:rerun-if-changed={}", nm.display()); + + let nm_result = Command::new(nm) + .arg("-n") + .arg(libc_a) + .output() + .expect("nm failed") + .stdout; + let nm_result = String::from_utf8_lossy(&nm_result); + let nm_result = nm_result.lines(); + + let mut features = FEATURES + .iter() + .map(|f| (*f, false)) + .collect::>(); + + for line in nm_result { + for (feature, enabled) in &mut features { + if line == format!("00000000 T {}", feature) { + *enabled = true; + } + } + } + + for (feature, _) in features.iter().filter(|(_, enabled)| !**enabled) { + println!("cargo:rustc-cfg=feature=\"{}\"", feature); + } +} diff --git a/crates/vita-newlib-shims/Cargo.toml b/crates/vita-newlib-shims/Cargo.toml deleted file mode 100644 index a2fdbfc..0000000 --- a/crates/vita-newlib-shims/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "vita-newlib-shims" -version = "0.2.1" -edition = "2021" - -license = "MIT OR Apache-2.0" -description = "Shims for libc functions not provided by Vita SDK newlib" -homepage = "https://github.com/vita-rust/std/tree/main/crates/vita-newlib-shims" -repository = "https://github.com/vita-rust/std" - -authors = ["vita-sdk", "Nikolay Arhipov "] -keywords = ["vita", "homebrew"] - -[features] -default = ["socketpair", "pipe2"] -pipe2 = [] -socketpair = [] - -[dependencies] -libc = "0.2.148" diff --git a/crates/vita-newlib-shims/README.md b/crates/vita-newlib-shims/README.md deleted file mode 100644 index e809ca3..0000000 --- a/crates/vita-newlib-shims/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# vita-newlib-shims - -[![Crates.io](https://img.shields.io/crates/v/vita-newlib-shims.svg)](https://crates.io/crates/vita-newlib-shims) -[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/vita-rust/std#license) - -Standard library support for PlayStation Vita in Rust relies on Vita SDK newlib. Unfortunately, [not all](https://github.com/vitasdk/newlib/issues/86) of the POSIX functions are implemented in it, including those that Rust `std` relies on. - -This repository aims to fix that by providing shims for the missing functions. - -To use this crate you need to: - -1. Add it as a dependency to your project - ```bash - cargo add vita-newlib-shims - ``` -2. Use it somewhere in your lib/main, so that the code is actually compiled and linked - ```rust - #[cfg(target_os = "vita")] - use vita_newlib_shims as _; - ``` - -## License - -Except where noted (below and/or in individual files), all code in this repository is dual-licensed at your option under either: - -* MIT License ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)) -* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)) diff --git a/examples/.gitignore b/examples/.gitignore deleted file mode 100644 index 73b5926..0000000 --- a/examples/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.coredump \ No newline at end of file diff --git a/examples/0-std-tests/Cargo.toml b/examples/0-std-tests/Cargo.toml deleted file mode 100644 index 682e2c1..0000000 --- a/examples/0-std-tests/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "vita-std-tests" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow = "1.0.71" -libc = "0.2.147" -serde = { version = "1.0.160", features = ["derive"] } -serde_json = "1.0.96" -rand = "0.8.5" - -[package.metadata.vita] -title_id = "RUSTTESTS" -title_name = "Rust std tests" diff --git a/examples/0-std-tests/src/lib.rs b/examples/0-std-tests/src/lib.rs deleted file mode 100644 index dc3b9e2..0000000 --- a/examples/0-std-tests/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![feature(fs_try_exists)] - -mod tests_fs; -mod tests_pthread; -mod tests_tcp; -mod tests_unwind; diff --git a/examples/0-std-tests/src/tests_fs.rs b/examples/0-std-tests/src/tests_fs.rs deleted file mode 100644 index f7930a2..0000000 --- a/examples/0-std-tests/src/tests_fs.rs +++ /dev/null @@ -1,82 +0,0 @@ -#[cfg(test)] -mod tests { - use std::fs; - - #[test] - pub fn test_fs_read_dir() { - fs_cleanup(); - - let mut data_found = false; - - for file in fs::read_dir("ux0:/").expect("read_dir ux0 failed") { - let file = file.expect("unable to get dir entry of file"); - - if file.file_name().to_str() == Some("data") { - data_found = true; - let meta = file.metadata().expect("unable to stat ux0:/data"); - assert!(meta.is_dir(), "ux:0/data is not a directory"); - assert!(!meta.is_file(), "ux:0/data is a file"); - assert!(!meta.is_symlink(), "ux:0/data is a symlink"); - assert!(meta.created().is_ok(), "created time is error"); - assert!(meta.modified().is_ok(), "modified time is error"); - assert!(meta.accessed().is_ok(), "access time is error"); - break; - } - } - - assert!(data_found, "ux0:/data not found"); - } - - #[test] - pub fn test_fs_creation() { - fs_cleanup(); - - fs::create_dir("ux0:/data/.rust_test").expect("unable to create ux0:/data/.rust_test"); - let meta = - fs::metadata("ux0:/data/.rust_test").expect("ux0:/data/.rust_test does not exist"); - assert!(meta.is_dir(), "ux0:/data/.rust_test is not a directory"); - - fs::write("ux0:/data/.rust_test/file", "contents").expect("unable to create a test file"); - let data = fs::read("ux0:/data/.rust_test/file").expect("unable to read file"); - assert!(&data == "contents".as_bytes(), "invalid file contents"); - - let data = fs::read_to_string("ux0:/data/.rust_test/file").expect("unable to read file"); - assert!(&data == "contents", "invalid file contents"); - - assert!( - fs::try_exists("ux0:/data/.rust_test/file").unwrap(), - "file does not exist", - ); - - fs::copy( - "ux0:/data/.rust_test/file", - "ux0:/data/.rust_test/file_copy", - ) - .expect("unable to copy file to file_copy"); - let data = - fs::read_to_string("ux0:/data/.rust_test/file_copy").expect("unable to read file_copy"); - assert!(&data == "contents", "invalid file_copy contents"); - - fs::remove_file("ux0:/data/.rust_test/file").expect("unable to delete file"); - assert!( - !fs::try_exists("ux0:/data/.rust_test/file").unwrap(), - "file exists, but should not", - ); - - assert!( - fs::remove_dir("ux0:/data/.rust_test").is_err(), - "remove_dir should fail, because directory is not empty", - ); - - assert!( - fs::remove_dir_all("ux0:/data/.rust_test").is_ok(), - "remove_dir_all should succeed", - ); - } - - fn fs_cleanup() { - if fs::try_exists("ux0:/data/.rust_test").unwrap_or(false) { - fs::remove_dir_all("ux0:/data/.rust_test").expect("unable to cleanup"); - } - } -} diff --git a/examples/0-std-tests/src/tests_pthread.rs b/examples/0-std-tests/src/tests_pthread.rs deleted file mode 100644 index c9969bb..0000000 --- a/examples/0-std-tests/src/tests_pthread.rs +++ /dev/null @@ -1,159 +0,0 @@ -#[cfg(test)] -mod tests { - use anyhow::{anyhow, Result}; - use std::{ - collections::HashMap, - sync::{mpsc, Arc, Condvar, Mutex, RwLock}, - thread, - }; - - #[test] - pub fn test_thread_mutex() { - let map = Arc::new(Mutex::new(HashMap::::new())); - { - let map = map.lock().expect("Dirty mutex"); - assert!(map.len() == 0, "map is not empty"); - } - - let threads = (0..10) - .map(|_| { - let map = Arc::clone(&map); - thread::Builder::new() - .stack_size(128 * 1024) - .spawn(move || { - // Mutex contention - for i in 0..100 { - let v = rand::random::() % 1000; - let mut map = map.lock().expect("Dirty mutex"); - let old = map.get(&i).cloned().unwrap_or(0); - map.insert(i, v + old); - } - }) - .expect("Unable to spawn thread") - }) - .collect::>(); - - for t in threads { - t.join().expect("Unable to join thread"); - } - - let map = map.lock().expect("Dirty mutex!"); - - assert!(map.len() == 100, "map should have exactly 100 keys"); - } - - #[test] - pub fn test_drop_mutex_from_another_thread() -> Result<()> { - let mutex = Mutex::new(0u64); - { - let mut v = mutex.lock().expect("Dirty mutex"); - *v = 10; - } - - thread::Builder::new() - .stack_size(128 * 1024) - .spawn(move || -> Result<()> { - { - let mut v = mutex.lock().expect("Dirty mutex"); - *v += 1; - assert!(*v == 11, "Should be 10"); - } - drop(mutex); - Ok(()) - }) - .map_err(|_| anyhow!("Unable to spawn thread"))? - .join() - .map_err(|_| anyhow!("Unable to join thread"))??; - - Ok(()) - } - - #[test] - pub fn test_condvar() { - const NUM_THREADS: u32 = 10; - let pair = Arc::new((Mutex::new(0), Condvar::new())); - - let mut handles = vec![]; - - for _ in 0..NUM_THREADS { - let pair2 = pair.clone(); - let handle = thread::spawn(move || { - let (lock, condvar) = &*pair2; - let mut started = lock.lock().expect("dirty mutex"); - *started += 1; - condvar.notify_one(); - }); - handles.push(handle); - } - - { - let (lock, condvar) = &*pair; - let mut started = lock.lock().expect("dirty mutex"); - while *started < NUM_THREADS { - started = condvar.wait(started).expect("dirty condvar"); - } - } - - for handle in handles { - handle.join().expect("unable to join thread"); - } - - let (lock, _) = &*pair; - let final_val = lock.lock().unwrap(); - assert!(*final_val == NUM_THREADS, "final value muse be equal to 10"); - } - - #[test] - pub fn test_semaphore() { - const NUM_THREADS: usize = 10; - const NUM_RESOURCES: usize = 5; - - // Create a channel with a bounded capacity - let (tx, rx) = mpsc::sync_channel(NUM_RESOURCES); - let tx = Arc::new(Mutex::new(tx)); - - let handles = (0..NUM_THREADS) - .map(|_| { - let tx = Arc::clone(&tx); - thread::spawn(move || { - let tx = tx.lock().expect("Dirty mutex"); - tx.send(()).unwrap(); - }) - }) - .collect::>(); - for _ in 0..NUM_THREADS { - rx.recv().expect("recv error"); - } - - for handle in handles { - handle.join().expect("join error"); - } - - assert!(rx.try_recv().is_err(), "recv is not error"); - } - - #[test] - pub fn test_rwlock() { - let data = Arc::new(RwLock::new(0)); - { - let data = data.read().expect("Dirty mutex"); - assert!(*data == 0, "map is not empty"); - } - let threads = (0..10) - .map(|_| { - let data = Arc::clone(&data); - thread::spawn(move || { - let mut data = data.write().expect("Dirty RwLock"); - *data += 1; - }) - }) - .collect::>(); - - for t in threads { - t.join().expect("join error"); - } - - let data = data.read().unwrap(); - assert!(*data == 10, "counter is not 10"); - } -} diff --git a/examples/0-std-tests/src/tests_tcp.rs b/examples/0-std-tests/src/tests_tcp.rs deleted file mode 100644 index a1d304c..0000000 --- a/examples/0-std-tests/src/tests_tcp.rs +++ /dev/null @@ -1,115 +0,0 @@ -#[cfg(test)] -mod tests { - use std::{ - io::{Read, Write}, - time::Duration, - }; - use std::{ - net::{Shutdown, TcpListener, TcpStream}, - sync::atomic::{AtomicBool, Ordering}, - }; - use std::{ - sync::{mpsc, Arc, Mutex}, - thread, - }; - - fn handle_client(mut stream: TcpStream, counter: Arc>, should_end: Arc) { - let mut buffer = [0; 3]; - - while match stream.read(&mut buffer) { - Ok(size) => match &buffer[..size] { - b"ADD" => { - let mut counter = counter.lock().unwrap(); - *counter += 1; - true - } - b"END" => { - stream.shutdown(Shutdown::Both).unwrap(); - should_end.store(true, Ordering::SeqCst); - false - } - _ => true, - }, - Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => { - thread::sleep(Duration::from_millis(1000)); - true - } - Err(e) => { - println!( - "An error occurred, terminating connection with {}. {:?}", - stream.peer_addr().unwrap(), - e - ); - stream.shutdown(Shutdown::Both).unwrap(); - false - } - } {} - } - - #[test] - pub fn test_tcp() { - let counter = Arc::new(Mutex::new(0)); - let should_end = Arc::new(AtomicBool::new(false)); - let (tx, rx) = mpsc::channel(); - - let server_handle = { - let counter = Arc::clone(&counter); - let tx = tx.clone(); - - thread::spawn(move || { - let listener = - TcpListener::bind("localhost:12345").expect("Unable to bind to port"); - listener - .set_nonblocking(true) - .expect("unable to set non-blocking mode"); - - tx.send(()).unwrap(); - - loop { - if should_end.load(Ordering::SeqCst) { - break; - } - - match listener.accept() { - Ok((stream, _)) => { - let counter = Arc::clone(&counter); - let should_end = Arc::clone(&should_end); - thread::spawn(move || { - handle_client(stream, counter, should_end); - }); - } - Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => { - thread::sleep(Duration::from_millis(100)); - continue; - } - Err(e) => { - println!("Failed: {}", e); - } - } - } - }) - }; - - // Wait until server starts - rx.recv().unwrap(); - - { - let mut stream = - TcpStream::connect("localhost:12345").expect("unable to connect to server"); - for _ in 0..4 { - let _ = stream.write(b"ADD"); - let _ = stream.flush(); - thread::sleep(Duration::from_millis(100)); - } - - let _ = stream.write(b"END"); - let _ = stream.flush(); - } - - server_handle.join().expect("unable to join server thread"); - - let counter = counter.lock().unwrap(); - - assert!(*counter == 4, "counter should be 4"); - } -} diff --git a/examples/0-std-tests/src/tests_unwind.rs b/examples/0-std-tests/src/tests_unwind.rs deleted file mode 100644 index ab9d46f..0000000 --- a/examples/0-std-tests/src/tests_unwind.rs +++ /dev/null @@ -1,16 +0,0 @@ -#[cfg(test)] -mod tests { - use std::panic; - - #[test] - pub fn test_unwind() { - let result = panic::catch_unwind(|| std::hint::black_box(())); - assert!(result.is_ok(), "panic shouldn't happen"); - - let result = panic::catch_unwind(|| { - panic!("oh no!"); - }); - - assert!(result.is_err(), "panic should be handled"); - } -} diff --git a/examples/1-cross-isa/Cargo.lock b/examples/1-cross-isa/Cargo.lock deleted file mode 100644 index e7cecae..0000000 --- a/examples/1-cross-isa/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "hello-world" -version = "0.1.0" diff --git a/examples/1-cross-isa/Cargo.toml b/examples/1-cross-isa/Cargo.toml deleted file mode 100644 index c30c1dd..0000000 --- a/examples/1-cross-isa/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "vita-example-cross-isa" -version = "0.1.0" -edition = "2021" - -[dependencies] - -[package.metadata.vita] -title_id = "RUSTTEST1" -title_name = "Rust cross-isa test" diff --git a/examples/1-cross-isa/src/main.rs b/examples/1-cross-isa/src/main.rs deleted file mode 100644 index 3001259..0000000 --- a/examples/1-cross-isa/src/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -#[instruction_set(arm::a32)] -fn arm_fn(n: i32) { - println!("Hello from ARM!, {n}"); -} - -#[instruction_set(arm::t32)] -fn thumb_fn(n: i32) { - println!("Hello from Thumb!, {n}"); - arm_fn(n + 1); -} - -#[instruction_set(arm::a32)] -fn main() { - thumb_fn(0); -} diff --git a/examples/2-http-client/Cargo.lock b/examples/2-http-client/Cargo.lock deleted file mode 100644 index e7cecae..0000000 --- a/examples/2-http-client/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "hello-world" -version = "0.1.0" diff --git a/examples/2-http-client/Cargo.toml b/examples/2-http-client/Cargo.toml deleted file mode 100644 index 6e875ec..0000000 --- a/examples/2-http-client/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "vita-example-http" -version = "0.1.0" -edition = "2021" - -[features] -default = ["rustls"] -rustls = ["reqwest/rustls-tls"] -openssl = ["reqwest/native-tls"] - -[dependencies] -anyhow = "1.0" -vita-newlib-shims = "0.2" -reqwest = { version = "0.11", default-features = false, features = ["json"] } -tokio = { version = "1", features = ["macros", "rt", "net"] } -oxhttp = { version = "0.1.7" } -ureq = { version = "2.7.1", default-features = false, features = ["gzip"] } - -[package.metadata.vita] -title_id = "RUSTTEST2" -title_name = "Rust http test" - -# This disables safe mode (default -s flag) for reading openssl certs -vita_make_fself_flags = [] diff --git a/examples/2-http-client/src/main.rs b/examples/2-http-client/src/main.rs deleted file mode 100644 index ca6a89c..0000000 --- a/examples/2-http-client/src/main.rs +++ /dev/null @@ -1,40 +0,0 @@ -#[cfg(target_os = "vita")] -use vita_newlib_shims as _; - -fn main() -> anyhow::Result<()> { - std::env::set_var("RUST_BACKTRACE", "full"); - // For openssl instead of rustls you must provide cert files. - // The shared cert files are located on a vs0 partition which is only accessible with unsafe apps. - // If you want to use openssl, you must either make your app unsafe or provide your own certs. - std::env::set_var("SSL_CERT_FILE", "vs0:data/external/cert/CA_LIST.cer"); - - tokio::runtime::Builder::new_current_thread() - .enable_all() - .build()? - .block_on(async { - println!(">>> Trying oxhttp"); - let client = oxhttp::Client::new(); - let body = client - .request( - oxhttp::model::Request::builder( - oxhttp::model::Method::GET, - "http://example.com".parse()?, - ) - .build(), - )? - .into_body() - .to_string()?; - println!(">>> oxhttp response: {body}"); - - // Requires std to depend on the latest libc - // println!(">>> Trying ureq"); - // let body = ureq::get("http://example.com").call()?; - // println!(">>> Ureq response: {:?}", body); - - println!(">>> Trying reqwest"); - let body = reqwest::get("https://example.com").await?.text().await?; - println!(">>> Reqwest response: {:#?}", body); - - Ok(()) - }) -} diff --git a/examples/Cargo.lock b/examples/Cargo.lock deleted file mode 100644 index b2bb65e..0000000 --- a/examples/Cargo.lock +++ /dev/null @@ -1,1289 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "anyhow" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "errno" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "flate2" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-macro" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-core", - "futures-macro", - "futures-task", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" - -[[package]] -name = "h2" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.9", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" -dependencies = [ - "futures-util", - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "ipnet" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.148" -source = "git+https://github.com/vita-rust/libc?branch=nonblock#b10664902074f53b425d18272592df7eb9435737" - -[[package]] -name = "linux-raw-sys" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "memchr" -version = "2.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.8" -source = "git+https://github.com/vita-rust/mio?branch=vita#df7a1c3cbfd9aa952fa619f61d806603a2be9e8f" -dependencies = [ - "libc", - "wasi", - "windows-sys", -] - -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "openssl" -version = "0.10.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" -dependencies = [ - "bitflags 2.4.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "oxhttp" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f8f4b616372a7e657a05100d1389325fc2f7d3fee5c9de05166d979cb2b729" -dependencies = [ - "httparse", - "lazy_static", - "url", -] - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "proc-macro2" -version = "1.0.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "reqwest" -version = "0.11.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-native-tls", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "git+https://github.com/vita-rust/ring?branch=v0.16.20-vita#974dacbae00af1df3ec7b5a18ad2ae232ff2142a" -dependencies = [ - "cc", - "getrandom", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustix" -version = "0.38.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" -dependencies = [ - "bitflags 2.4.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "rustls" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" -dependencies = [ - "log", - "ring", - "rustls-webpki", - "sct", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" -dependencies = [ - "base64", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "schannel" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "security-framework" -version = "2.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "serde" -version = "1.0.188" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.188" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "socket2" -version = "0.4.9" -source = "git+https://github.com/vita-rust/socket2?branch=v0.4.9-vita#12c617dca2bd0017f2831afd5c6fc89459c76ed7" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.4" -source = "git+https://github.com/vita-rust/socket2?branch=v0.5.3-vita#1f4865f2b23a2478f52e6c9087a5ae485824388e" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "syn" -version = "2.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.32.0" -source = "git+https://github.com/vita-rust/tokio?branch=vita#79e084494b200d354b3352ff795c048efec65f44" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2 0.5.4", - "tokio-macros", - "windows-sys", -] - -[[package]] -name = "tokio-macros" -version = "2.1.0" -source = "git+https://github.com/vita-rust/tokio?branch=vita#79e084494b200d354b3352ff795c048efec65f44" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "ureq" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9" -dependencies = [ - "base64", - "flate2", - "log", - "once_cell", - "url", -] - -[[package]] -name = "url" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "vita-example-cross-isa" -version = "0.1.0" - -[[package]] -name = "vita-example-http" -version = "0.1.0" -dependencies = [ - "anyhow", - "oxhttp", - "reqwest", - "tokio", - "ureq", - "vita-newlib-shims", -] - -[[package]] -name = "vita-newlib-shims" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82410d11383c2cb16bf587fadcfec7a79229271264ee8093ede6186a7e0b1d59" -dependencies = [ - "libc", -] - -[[package]] -name = "vita-std-tests" -version = "0.1.0" -dependencies = [ - "anyhow", - "libc", - "rand", - "serde", - "serde_json", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys", -] diff --git a/examples/Cargo.toml b/examples/Cargo.toml deleted file mode 100644 index e00f2e0..0000000 --- a/examples/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[workspace] -members = ["./*"] -exclude = ["target", ".cargo", "static"] -resolver = "2" - -[profile.release] -panic = 'unwind' -lto = true - -[patch.crates-io] -libc = { git = "https://github.com/vita-rust/libc", branch = "nonblock" } -mio = { git = "https://github.com/vita-rust/mio", branch = "vita" } -tokio = { git = "https://github.com/vita-rust/tokio", branch = "vita" } -socket2053 = { git = "https://github.com/vita-rust/socket2", branch = "v0.5.3-vita", package = "socket2", version = "0.5.3" } -socket2049 = { git = "https://github.com/vita-rust/socket2", branch = "v0.4.9-vita", package = "socket2", version = "0.4.9" } - -ring = { git = "https://github.com/vita-rust/ring", branch = "v0.16.20-vita" } diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index ededb22..0000000 --- a/examples/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Examples - -These examples demonstrate how to build applications for Sony PlayStation Vita in Rut with various degrees of complexity. - -## Prerequisites - -- [Vita SDK](https://vitasdk.org/) must be installed, and `VITASDK` environment variable must be set to its location. You can add the environment variable to your `.bashrc` (or another configuration file if you are using a different shell), or you can use a tool like [direnv](https://direnv.net/), and put this in a `.envrc`. -- [cargo-vita](https://github.com/vita-rust/cargo-vita) tool is required for building `vpk`` files. Run this command to install it: - ```sh - cargo +nightly install cargo-vita - ``` -- [PrincessLog](https://github.com/CelesteBlue-dev/PSVita-RE-tools/tree/master/PrincessLog/build) is required for monitoring stdout/stderr from your Vita. -- [vitacompanion](https://github.com/devnoname120/vitacompanion) is required to upload `eboot.bin`/`vpk` files to Vita, and run commands. - - - -## Building - -To build the `vpk` for every example run the following from the `examples` folder: - -```sh -cargo vita build vpk --release -``` - -To build the `vpk` for `std-tests` run: - -```sh -cargo vita build vpk --release --package vita-std-tests --tests -``` - - -To build the `vpk` for any specific package: - -```sh -cargo vita build vpk --release --package {PACKAGE} -``` - - -## Running - -You can automate uploading of `vpk` to `ux0:/download/`, or update `eboot.bin` for already installed `vpk`. - -To upload all `vpk` artifacts, use `--upload` flag of `vpk` subcommand: - -```sh -cargo vita build vpk --upload --release -``` - -To update a specific `eboot.bin` and run it use `--update --run` flags of `eboot` subcommand. Keep in mind that `vpk` must be installed in order for that to work: - -```sh -cargo vita build eboot --update --run --release --package {PACKAGE} -``` diff --git a/examples/rust-toolchain.toml b/examples/rust-toolchain.toml deleted file mode 100644 index 271800c..0000000 --- a/examples/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "nightly" \ No newline at end of file diff --git a/crates/vita-newlib-shims/src/lib.rs b/src/lib.rs similarity index 100% rename from crates/vita-newlib-shims/src/lib.rs rename to src/lib.rs