From dffce57257b648873354af585855cc6cc8544422 Mon Sep 17 00:00:00 2001 From: Fenrir Date: Sat, 21 Jan 2017 21:11:02 -0700 Subject: [PATCH] Bring in all the crates --- README.md | 42 +++++------------------ build.rs | 36 -------------------- ctr-std/Cargo.toml | 4 +++ ctr-std/README.md | 4 +++ 3ds.json => ctru-rs/3ds.json | 2 -- Cargo.toml => ctru-rs/Cargo.toml | 4 +-- ctru-rs/README.md | 44 +++++++++++++++++++++++++ Xargo.toml => ctru-rs/Xargo.toml | 8 ++--- {src => ctru-rs/src}/console.rs | 0 {src => ctru-rs/src}/gfx.rs | 0 {src => ctru-rs/src}/lib.rs | 0 {src => ctru-rs/src}/sdmc.rs | 0 {src => ctru-rs/src}/services/apt.rs | 0 {src => ctru-rs/src}/services/fs.rs | 0 {src => ctru-rs/src}/services/gspgpu.rs | 0 {src => ctru-rs/src}/services/hid.rs | 0 {src => ctru-rs/src}/services/mod.rs | 0 {src => ctru-rs/src}/srv.rs | 0 18 files changed, 66 insertions(+), 78 deletions(-) delete mode 100644 build.rs rename 3ds.json => ctru-rs/3ds.json (96%) rename Cargo.toml => ctru-rs/Cargo.toml (87%) create mode 100644 ctru-rs/README.md rename Xargo.toml => ctru-rs/Xargo.toml (67%) rename {src => ctru-rs/src}/console.rs (100%) rename {src => ctru-rs/src}/gfx.rs (100%) rename {src => ctru-rs/src}/lib.rs (100%) rename {src => ctru-rs/src}/sdmc.rs (100%) rename {src => ctru-rs/src}/services/apt.rs (100%) rename {src => ctru-rs/src}/services/fs.rs (100%) rename {src => ctru-rs/src}/services/gspgpu.rs (100%) rename {src => ctru-rs/src}/services/hid.rs (100%) rename {src => ctru-rs/src}/services/mod.rs (100%) rename {src => ctru-rs/src}/srv.rs (100%) diff --git a/README.md b/README.md index 2ffc389..4c59d03 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,16 @@ # ctru-rs -A Rust wrapper library for smealum's -[ctrulib](https://github.com/smealum/ctrulib). Intended for use only when -targeting CTR. +A Rust wrapper library for smealum's [ctrulib](https://github.com/smealum/ctrulib). -## How to build +See the [3DS project template](https://github.com/rust3ds/rust3ds-template) for instructions on how to use this library. -1. Install the devkitARM toolchain for your system. Make sure `DEVKITPRO` is - set in your environment. -2. Modify ~/.cargo/config and add the following lines: +## Structure -```toml - [target.3ds] - ar = "/path/to/arm-none-eabi-ar" -``` - -3. Build with `cargo build --target 3ds.json`. -4. A dkA linkable .rlib (static library) will be generated. Read below for -instructions on using. - -## How to use - -You can build your homebrew projects through Cargo just as easily as any other -platform. Add this to your `Cargo.toml`: - -```toml - [dependencies.ctru-rs] - git="https://github.com/rust3ds/ctru-rs" -``` - -**It is highly recommended to use the [template -project.](https://github.com/rust3ds/rust3ds-template)** - -## Contributing - -PR's are welcome. Organization of rust specific features and wrapper -functionality has not been decided on yet. +This repository is organized as follows: +* `ctru-rs`: Safe, idiomatic wrapper around `ctru-sys`. +* `ctru-sys`: Low-level, unsafe bindings to ctrulib +* `ctr-std`: A partial implementation of the Rust standard library for the 3DS. +* `ctr-libc`: C types and functions used by ctru-sys and ctr-std. ## License @@ -66,3 +41,4 @@ applies to every file in the tree, unless otherwise noted. Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses. See [LICENSE-APACHE](https://github.com/rust-lang/rust/blob/master/LICENSE-APACHE), [LICENSE-MIT](https://github.com/rust-lang/rust/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/rust-lang/rust/blob/master/COPYRIGHT) for details. + diff --git a/build.rs b/build.rs deleted file mode 100644 index 57ff190..0000000 --- a/build.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::env; -use std::path::PathBuf; -use std::fs; - -use std::option::Option::{self, Some, None}; - -const ENV_DKP: &'static str = "DEVKITPRO"; - -fn find_libctru() -> Option { - if let Ok(value) = env::var(ENV_DKP) { - let mut path = PathBuf::from(value); - path.push("libctru/lib"); - // metadata returns Err if the dir does not exist - if let Ok(metadata) = fs::metadata(path.as_path()) { - if metadata.is_dir() { - return Some(path); - } - } - } - return None; -} - -fn main() { - if let Some(path) = find_libctru() { - if let Some(s) = path.to_str() { - println!("cargo:rustc-link-lib=static=ctru"); - println!("cargo:rustc-link-search=native={}", s); - } else { - println!("path is not a valid string"); - std::process::exit(1); - } - } else { - println!("could not find libctru"); - std::process::exit(1); - } -} diff --git a/ctr-std/Cargo.toml b/ctr-std/Cargo.toml index dfd5037..25193cc 100644 --- a/ctr-std/Cargo.toml +++ b/ctr-std/Cargo.toml @@ -6,6 +6,10 @@ license = "MIT/Apache 2.0" [dependencies.compiler_builtins] git = "https://github.com/rust-lang-nursery/compiler-builtins" +[dependencies.ctr-libc] +path = "../ctr-libc" +default-features = false + [dependencies.alloc_system] version = "0.1.1" diff --git a/ctr-std/README.md b/ctr-std/README.md index 604a43c..15ee4b9 100644 --- a/ctr-std/README.md +++ b/ctr-std/README.md @@ -1 +1,5 @@ A work-in-progress port of the Rust Standard Library for the Nintendo 3DS, based on [ctrulib](https://github.com/smealum/ctrulib/) and the [devkitARM](http://devkitPro.org) toolchain. + +## Structure + +This library aims to mimick the Rust standard library's public interface as closely as possible, exposing functionality that is common between the 3DS and other platforms. System-specific functionality such as control input, save file management, GPU features, and so forth are implemented in `ctru-rs`. diff --git a/3ds.json b/ctru-rs/3ds.json similarity index 96% rename from 3ds.json rename to ctru-rs/3ds.json index 1f2484b..bdd5caa 100644 --- a/3ds.json +++ b/ctru-rs/3ds.json @@ -26,8 +26,6 @@ "-lc", "-lm", "-lsysbase", - "-lc", - "-lgcc", "-lc" ] } diff --git a/Cargo.toml b/ctru-rs/Cargo.toml similarity index 87% rename from Cargo.toml rename to ctru-rs/Cargo.toml index 56c2a78..cf43e1b 100644 --- a/Cargo.toml +++ b/ctru-rs/Cargo.toml @@ -1,9 +1,7 @@ [package] authors = ["Ronald Kinard "] -build = "build.rs" description = "A safe wrapper around smealum's ctrulib." license = "https://en.wikipedia.org/wiki/Zlib_License" -links = "ctru" name = "ctru-rs" version = "0.5.0" @@ -18,4 +16,4 @@ path = "../ctru-sys" version = "0.7.0" [dependencies.widestring] -widestring = "0.2.2" +version = "0.2.2" diff --git a/ctru-rs/README.md b/ctru-rs/README.md new file mode 100644 index 0000000..215b574 --- /dev/null +++ b/ctru-rs/README.md @@ -0,0 +1,44 @@ +# ctru-rs + +A Rust wrapper library for smealum's +[ctrulib](https://github.com/smealum/ctrulib). + +See the [3DS project template](https://github.com/rust3ds/rust3ds-template) for instructions on how to use this library. + +## Structure + +This library is meant to expose 3DS-specific functionality. Common functionality is implemented in `ctr-std` when possible. + +## Contributing + +PR's are welcome. Organization of rust specific features and wrapper functionality are still being decided on. + +## License + +Copyright (C) Rust 3DS Project authors, 2015-2016 + +See AUTHORS.md. + +As with the original ctrulib, this library is licensed under zlib. This +applies to every file in the tree, unless otherwise noted. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any + damages arising from the use of this software. + + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and + redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you use + this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and + must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source + distribution. + +Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses. + +See [LICENSE-APACHE](https://github.com/rust-lang/rust/blob/master/LICENSE-APACHE), [LICENSE-MIT](https://github.com/rust-lang/rust/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/rust-lang/rust/blob/master/COPYRIGHT) for details. diff --git a/Xargo.toml b/ctru-rs/Xargo.toml similarity index 67% rename from Xargo.toml rename to ctru-rs/Xargo.toml index 05f1470..d7e415c 100644 --- a/Xargo.toml +++ b/ctru-rs/Xargo.toml @@ -1,10 +1,10 @@ [dependencies.collections] [dependencies.ctr-libc] -path = "ctr-libc" +path = "../ctr-libc" default-features = false -stage = 0 +stage = 1 [dependencies.std] -path = "ctr-std" -stage = 1 +path = "../ctr-std" +stage = 2 diff --git a/src/console.rs b/ctru-rs/src/console.rs similarity index 100% rename from src/console.rs rename to ctru-rs/src/console.rs diff --git a/src/gfx.rs b/ctru-rs/src/gfx.rs similarity index 100% rename from src/gfx.rs rename to ctru-rs/src/gfx.rs diff --git a/src/lib.rs b/ctru-rs/src/lib.rs similarity index 100% rename from src/lib.rs rename to ctru-rs/src/lib.rs diff --git a/src/sdmc.rs b/ctru-rs/src/sdmc.rs similarity index 100% rename from src/sdmc.rs rename to ctru-rs/src/sdmc.rs diff --git a/src/services/apt.rs b/ctru-rs/src/services/apt.rs similarity index 100% rename from src/services/apt.rs rename to ctru-rs/src/services/apt.rs diff --git a/src/services/fs.rs b/ctru-rs/src/services/fs.rs similarity index 100% rename from src/services/fs.rs rename to ctru-rs/src/services/fs.rs diff --git a/src/services/gspgpu.rs b/ctru-rs/src/services/gspgpu.rs similarity index 100% rename from src/services/gspgpu.rs rename to ctru-rs/src/services/gspgpu.rs diff --git a/src/services/hid.rs b/ctru-rs/src/services/hid.rs similarity index 100% rename from src/services/hid.rs rename to ctru-rs/src/services/hid.rs diff --git a/src/services/mod.rs b/ctru-rs/src/services/mod.rs similarity index 100% rename from src/services/mod.rs rename to ctru-rs/src/services/mod.rs diff --git a/src/srv.rs b/ctru-rs/src/srv.rs similarity index 100% rename from src/srv.rs rename to ctru-rs/src/srv.rs