mirror of
https://github.com/arabianq/build_msp.git
synced 2026-04-27 22:11:23 +00:00
remove rust project
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
name: Release Build
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install build dependencies (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install -y autoconf automake libtool
|
||||
|
||||
- name: Install build dependencies (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install autoconf automake libtool
|
||||
|
||||
- name: Install build dependencies (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: autoconf automake libtool make m4 perl autotools
|
||||
run: whereis aclocal
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Cache Cargo dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-
|
||||
|
||||
- name: Build (Linux/macOS)
|
||||
if: runner.os != 'Windows'
|
||||
run: cargo build --release
|
||||
|
||||
- name: Build (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
# ensure cargo is in PATH
|
||||
export PATH=/c/Users/runneradmin/.cargo/bin:$PATH
|
||||
# ensure mingw64 bin is in PATH
|
||||
export PATH=/mingw64/bin:/usr/bin:$PATH
|
||||
cargo build --release
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-${{ matrix.os }}
|
||||
path: target/release/build_msp*
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
[submodule "switch-tools"]
|
||||
path = switch-tools
|
||||
url = https://github.com/switchbrew/switch-tools
|
||||
url = https://github.com/arabianq/switch-tools
|
||||
|
||||
Generated
-95
@@ -1,95 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
|
||||
|
||||
[[package]]
|
||||
name = "build_msp"
|
||||
version = "0.1.7"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.110"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
[package]
|
||||
name = "build_msp"
|
||||
version = "0.1.7"
|
||||
edition = "2024"
|
||||
authors = ["arabian"]
|
||||
description = "A tool that helps to build .msp file mod"
|
||||
readme = "README.md"
|
||||
license = "MIT"
|
||||
homepage = "https://github.com/arabianq/build_msp"
|
||||
repository = "https://github.com/arabianq/build_msp"
|
||||
keywords = ["switch", "nintendo", "mod", "mods", "msp"]
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
"clap" = {version = "4.5.51", default-features = false, features = ["derive", "std", "help"]}
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
opt-level = "z"
|
||||
panic = "abort"
|
||||
@@ -1,54 +0,0 @@
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let switch_tools_dir = Path::new("switch-tools");
|
||||
|
||||
let aclocal_status = Command::new("aclocal")
|
||||
.current_dir(switch_tools_dir)
|
||||
.status()
|
||||
.expect("Couldn't run aclocal");
|
||||
|
||||
let autoconf_status = Command::new("autoconf")
|
||||
.current_dir(switch_tools_dir)
|
||||
.status()
|
||||
.expect("Couldn't run autoconf");
|
||||
|
||||
let automake_status = Command::new("automake")
|
||||
.current_dir(switch_tools_dir)
|
||||
.arg("--add-missing")
|
||||
.arg("-c")
|
||||
.status()
|
||||
.expect("Couldn't run automake");
|
||||
|
||||
let conf_status = Command::new("./configure")
|
||||
.current_dir(switch_tools_dir)
|
||||
.status()
|
||||
.expect("Couldn't run configure");
|
||||
|
||||
let make_status = Command::new("make")
|
||||
.current_dir(switch_tools_dir)
|
||||
.status()
|
||||
.expect("Couldn't run make");
|
||||
|
||||
assert!(
|
||||
aclocal_status.success(),
|
||||
"Something went wrong while building switch-tools"
|
||||
);
|
||||
assert!(
|
||||
autoconf_status.success(),
|
||||
"Something went wrong while building switch-tools"
|
||||
);
|
||||
assert!(
|
||||
automake_status.success(),
|
||||
"Something went wrong while building switch-tools"
|
||||
);
|
||||
assert!(
|
||||
conf_status.success(),
|
||||
"Something went wrong while building switch-tools"
|
||||
);
|
||||
assert!(
|
||||
make_status.success(),
|
||||
"Something went wrong while building switch-tools"
|
||||
);
|
||||
}
|
||||
-178
@@ -1,178 +0,0 @@
|
||||
use clap::{Error, Parser};
|
||||
|
||||
use std::fs::{
|
||||
File, ReadDir, copy, create_dir, read_dir, remove_dir_all, remove_file, set_permissions,
|
||||
};
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf, absolute};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
const BUILD_ROMFS_BIN: &[u8] = include_bytes!("../switch-tools/build_romfs.exe");
|
||||
#[cfg(target_os = "windows")]
|
||||
const BUILD_PFS0_BIN: &[u8] = include_bytes!("../switch-tools/build_pfs0.exe");
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
const BUILD_ROMFS_BIN: &[u8] = include_bytes!("../switch-tools/build_romfs");
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
const BUILD_PFS0_BIN: &[u8] = include_bytes!("../switch-tools/build_pfs0");
|
||||
|
||||
const FILES_TO_COPY: [&str; 28] = [
|
||||
"romfs.bin",
|
||||
"exefs.nsp",
|
||||
"rtld",
|
||||
"main",
|
||||
"main.npdm",
|
||||
"compat0",
|
||||
"compat1",
|
||||
"compat2",
|
||||
"compat3",
|
||||
"compat4",
|
||||
"compat5",
|
||||
"compat6",
|
||||
"compat7",
|
||||
"compat8",
|
||||
"compat9",
|
||||
"subsdk0",
|
||||
"subsdk1",
|
||||
"subsdk2",
|
||||
"subsdk3",
|
||||
"subsdk4",
|
||||
"subsdk5",
|
||||
"subsdk6",
|
||||
"subsdk7",
|
||||
"subsdk8",
|
||||
"subsdk9",
|
||||
"sdk",
|
||||
"config.ini",
|
||||
"icon.jpg",
|
||||
];
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Args {
|
||||
#[arg(short = 'i', long = "input", default_value = ".")]
|
||||
input: PathBuf,
|
||||
|
||||
#[arg(short = 'o', long = "output", default_value = "mod.msp")]
|
||||
output: PathBuf,
|
||||
|
||||
#[arg(short = 'm', long = "manifest", default_value = "manifest")]
|
||||
manifest: PathBuf,
|
||||
}
|
||||
|
||||
fn list_items(path: &Path) -> Result<Vec<PathBuf>, Error> {
|
||||
let mut items: Vec<PathBuf> = Vec::new();
|
||||
let entries: ReadDir = read_dir(path)?;
|
||||
|
||||
for entry in entries {
|
||||
let path: PathBuf = entry?.path();
|
||||
if path.is_dir() {
|
||||
items.extend(list_items(&path)?);
|
||||
items.push(path);
|
||||
} else if path.is_file() {
|
||||
items.push(path);
|
||||
}
|
||||
}
|
||||
Ok(items)
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
let args = Args::parse();
|
||||
|
||||
let input_path: PathBuf = absolute(args.input)?;
|
||||
let output_path: PathBuf = absolute(args.output)?;
|
||||
let manifest_path: PathBuf = absolute(args.manifest)?;
|
||||
|
||||
assert!(input_path.exists(), "Input path does not exist");
|
||||
assert!(!output_path.exists(), "Output path already exists");
|
||||
assert!(manifest_path.exists(), "Manifest path does not exist");
|
||||
|
||||
let current_dir: PathBuf = absolute(Path::new("."))?;
|
||||
let temp_path: PathBuf = current_dir.join("temp");
|
||||
let mod_path: PathBuf = temp_path.join("mod");
|
||||
|
||||
if temp_path.exists() {
|
||||
remove_dir_all(&temp_path)?;
|
||||
}
|
||||
create_dir(&temp_path)?;
|
||||
create_dir(&mod_path)?;
|
||||
|
||||
copy(&manifest_path, mod_path.join("manifest"))?;
|
||||
|
||||
let build_romfs_path: PathBuf;
|
||||
let build_pfs0_path: PathBuf;
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
build_romfs_path = temp_path.join("build_romfs.exe");
|
||||
build_pfs0_path = temp_path.join("build_pfs0.exe");
|
||||
}
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
{
|
||||
build_romfs_path = temp_path.join("build_romfs");
|
||||
build_pfs0_path = temp_path.join("build_pfs0");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let mut build_romfs_file: File = File::create(&build_romfs_path)?;
|
||||
let mut build_pfs0_file: File = File::create(&build_pfs0_path)?;
|
||||
build_romfs_file.write_all(BUILD_ROMFS_BIN)?;
|
||||
build_pfs0_file.write_all(BUILD_PFS0_BIN)?;
|
||||
}
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
{
|
||||
let mut build_romfs_file: File = File::create(&build_romfs_path)?;
|
||||
build_romfs_file.write_all(BUILD_ROMFS_BIN)?;
|
||||
set_permissions(
|
||||
&build_romfs_path,
|
||||
std::os::unix::fs::PermissionsExt::from_mode(0o755),
|
||||
)?;
|
||||
|
||||
let mut build_pfs0_file: File = File::create(&build_pfs0_path)?;
|
||||
build_pfs0_file.write_all(BUILD_PFS0_BIN)?;
|
||||
set_permissions(
|
||||
&build_pfs0_path,
|
||||
std::os::unix::fs::PermissionsExt::from_mode(0o755),
|
||||
)?;
|
||||
}
|
||||
|
||||
let all_items: Vec<PathBuf> = list_items(&input_path)?;
|
||||
for item in all_items {
|
||||
let name: &str = item.file_name().unwrap().to_str().unwrap();
|
||||
|
||||
if item.is_dir() && name.to_lowercase() == "romfs" {
|
||||
println!("Found romfs directory. Building romfs.bin...");
|
||||
std::process::Command::new(&build_romfs_path)
|
||||
.current_dir(&mod_path)
|
||||
.arg(&item)
|
||||
.arg(&mod_path.join("romfs.bin"))
|
||||
.status()?;
|
||||
continue;
|
||||
}
|
||||
|
||||
if FILES_TO_COPY.contains(&name) {
|
||||
println!("Found {}, copying...", name);
|
||||
copy(&item, &mod_path.join(name))?;
|
||||
continue;
|
||||
}
|
||||
|
||||
if name.ends_with(".ips") {
|
||||
println!("Found {}, copying...", name);
|
||||
copy(&item, &mod_path.join(name))?;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
println!("Building {}...", output_path.display());
|
||||
std::process::Command::new(&build_pfs0_path)
|
||||
.current_dir(&mod_path)
|
||||
.arg(&mod_path)
|
||||
.arg(&output_path)
|
||||
.status()?;
|
||||
|
||||
remove_file(&build_romfs_path)?;
|
||||
remove_file(&build_pfs0_path)?;
|
||||
remove_dir_all(&temp_path)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+1
-1
Submodule switch-tools updated: 22756068dd...4f5db7c932
Reference in New Issue
Block a user