Skip to content

Commit

Permalink
Merge pull request #19 from Decompollaborate/develop
Browse files Browse the repository at this point in the history
1.5.5
  • Loading branch information
AngheloAlf authored Dec 19, 2022
2 parents bddd128 + f1ea6cb commit 230cb48
Show file tree
Hide file tree
Showing 18 changed files with 655 additions and 547 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish_crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Upload crate
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: cd rust && cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

- name: Build Rust bindings
run: cd rust && cargo build --release
run: cargo build --release
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,18 @@ cython_debug/

.vscode/

# Generated by Cargo
# will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk


# Added by cargo

/target
12 changes: 7 additions & 5 deletions rust/Cargo.toml → Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
[package]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.5.4"
version = "1.5.5"
edition = "2021"
authors = ["Anghelo Carvajal <[email protected]>"]
description = "MIPS instruction decoder"
readme = "../README.md"
readme = "README.md"
homepage = "https://github.com/Decompollaborate/rabbitizer"
repository = "https://github.com/Decompollaborate/rabbitizer"
license = "MIT"
keywords = ["MIPS", "decoder"]
build = "build.rs"
build = "rust/build.rs"
include = ["/rust/src", "/rust/build.rs", "/src", "/include"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
path = "rust/src/lib.rs"

[dependencies]
cty = "0.2.2"
libc = "0.2.138"
num_enum = "0.5.7"

[build-dependencies]
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
![GitHub](https://img.shields.io/github/license/Decompollaborate/rabbitizer)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/Decompollaborate/rabbitizer)
![PyPI](https://img.shields.io/pypi/v/rabbitizer)
![crate.io](https://img.shields.io/crates/dv/rabbitizer)
![GitHub contributors](https://img.shields.io/github/contributors/Decompollaborate/rabbitizer?logo=purple)

A MIPS instruction decoder API.
Expand All @@ -12,6 +13,8 @@ Currently supports all the CPU instructions for MIPS I, II, III and IV.

## Installing

### Python bindings

The recommended way to install is using from the PyPi release, via `pip`:

```bash
Expand All @@ -26,6 +29,19 @@ pip install git+https://github.com/Decompollaborate/rabbitizer.git@develop

NOTE: Installing the development version is not recommended. Proceed at your own risk.

See this package at <https://pypi.org/project/rabbitizer/>.

### Rust bindings

Add this crate to your `Cargo.toml` via:

```toml
[build]
rabbitizer = "1.5.5"
```

See this crate at <https://crates.io/crates/rabbitizer>.

## Features

- Should produces matching assembly.
Expand Down
2 changes: 1 addition & 1 deletion include/common/RabbitizerVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
// Header version
#define RAB_VERSION_MAJOR 1
#define RAB_VERSION_MINOR 5
#define RAB_VERSION_PATCH 4
#define RAB_VERSION_PATCH 5

#define RAB_VERSION_STR RAB_STRINGIFY(RAB_VERSION_MAJOR) "." RAB_STRINGIFY(RAB_VERSION_MINOR) "." RAB_STRINGIFY(RAB_VERSION_PATCH)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[project]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.5.4"
version = "1.5.5"
description = "MIPS instruction decoder"
# license = "MIT"
readme = "README.md"
Expand Down
15 changes: 0 additions & 15 deletions rust/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions rust/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# Build options can be changed by modifying the makefile or by building with 'make SETTING=value'.
DEBUG ?= 1


ifeq ($(DEBUG),0)
CARGO_ARGS += --release
endif


RS_TABLE_GEN := ../tools/rs_table_gen.sh


IINC := -I ../include

TABLE_DIRS := $(shell find src -type d)
Expand All @@ -20,8 +10,6 @@ TABLE_DEP_FILES := $(TABLE_GENERATED:%.rs=%.tablers.d)


all: $(TABLE_GENERATED)
make -C ..
cargo build $(CARGO_ARGS)

distclean:
$(RM) -rf $(TABLE_GENERATED)
Expand Down
14 changes: 3 additions & 11 deletions rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
fn main() {
let mut c_paths: Vec<std::path::PathBuf> = glob::glob("../src/**/*.c").unwrap().filter_map(|g| g.ok()).collect();
let mut h_paths: Vec<std::path::PathBuf> = glob::glob("../include/**/*.h").unwrap().filter_map(|g| g.ok()).collect();

// Needed because `cargo publish` is dumb
let mut c_paths_2: Vec<std::path::PathBuf> = glob::glob("../../../../src/**/*.c").unwrap().filter_map(|g| g.ok()).collect();
let mut h_paths_2: Vec<std::path::PathBuf> = glob::glob("../../../../include/**/*.h").unwrap().filter_map(|g| g.ok()).collect();

c_paths.append(&mut c_paths_2);
h_paths.append(&mut h_paths_2);
let c_paths: Vec<std::path::PathBuf> = glob::glob("src/**/*.c").unwrap().filter_map(|g| g.ok()).collect();
let h_paths: Vec<std::path::PathBuf> = glob::glob("include/**/*.h").unwrap().filter_map(|g| g.ok()).collect();

for path in c_paths.iter().chain(&h_paths) {
println!("cargo:rerun-if-changed={}", path.to_string_lossy());
Expand All @@ -17,8 +10,7 @@ fn main() {

cc::Build::new()
.files(c_paths)
.include("../include")
.include("../../../../include")
.include("include")
.warnings(false)
.compile("rabbitizer");
}
1 change: 0 additions & 1 deletion rust/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ pub struct Config {
extern "C" {
pub static mut RabbitizerConfig_Cfg: Config;
}

Loading

0 comments on commit 230cb48

Please sign in to comment.