Skip to content

Commit 10b11be

Browse files
committed
Squashed commit of the following: commit 3cd0fbb Merge: fb92f32 667cce9 Author: Jordan Moore <lockbox.06@protonmail.com> Date: Tue Jun 3 05:53:14 2025 +0800 Merge 667cce9 into fb92f32 commit 667cce9 Author: Jordan Moore <lockbox@struct.foo> Date: Mon Jun 2 17:50:50 2025 -0400 feat: basic CI commit bf3b00f Author: Jordan Moore <lockbox@struct.foo> Date: Mon Jun 2 17:50:07 2025 -0400 fix: only attempt to publish bindings on master commit 4e2fcaa Author: Jordan Moore <lockbox@struct.foo> Date: Mon Jun 2 17:49:30 2025 -0400 fix: bindings: rust: moderize and format commit f3f792c Author: Jordan Moore <lockbox@struct.foo> Date: Mon Jun 2 16:58:31 2025 -0400 fix: build with modern cmake commit 41197bc Author: Jordan Moore <lockbox@struct.foo> Date: Mon Jun 2 16:36:27 2025 -0400 fix: cstdint explicitly included when used * fixes error in gcc15 where this header is no longer implicitly included
1 parent fb92f32 commit 10b11be

File tree

12 files changed

+76
-48
lines changed

12 files changed

+76
-48
lines changed

.github/workflows/cmake-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Builds the codebase with cmake
2+
3+
name: CMake CI
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
linux-build:
12+
name: Linux
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- name: Checkout source code
16+
uses: actions/checkout@v4
17+
- name: Install prerequisites
18+
shell: bash
19+
run: |
20+
sudo apt-get -y update
21+
sudo apt-get install -y \
22+
cmake \
23+
gcc
24+
- name: Configure
25+
shell: bash
26+
run: |
27+
cmake -B build
28+
- name: Bulid
29+
shell: bash
30+
run: |
31+
cmake --build build

.github/workflows/python-publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: PyPI 📦 Distribution
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
47

58
jobs:
69
build:

.github/workflows/rust-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Builds the codebase with cmake on ubuntu, windows and macos.
2+
#
3+
name: Rust CI
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
linux-test:
12+
name: Linux
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: dtolnay/rust-toolchain@stable
17+
18+
- name: Install prerequisites
19+
shell: bash
20+
run: |
21+
sudo apt-get -y update
22+
sudo apt-get install -y \
23+
cmake \
24+
libclang-dev \
25+
pkg-config \
26+
gcc
27+
- name: Build and test rust
28+
shell: bash
29+
run: |
30+
cd bindings/rust
31+
cargo test

CMakeLists.txt

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Keystone Assembler Engine (www.keystone-engine.org)
22
# By Nguyen Anh Quynh, 2016
33

4-
cmake_minimum_required(VERSION 2.8.7)
4+
cmake_minimum_required(VERSION 3.10.0)
55
project(keystone)
66

77
set(KEYSTONE_VERSION_MAJOR 0)
@@ -15,23 +15,6 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
1515
set(CMAKE_BUILD_TYPE "Debug")
1616
endif()
1717

18-
if (POLICY CMP0022)
19-
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
20-
endif()
21-
22-
if (POLICY CMP0051)
23-
# CMake 3.1 and higher include generator expressions of the form
24-
# $<TARGETLIB:obj> in the SOURCES property. These need to be
25-
# stripped everywhere that access the SOURCES property, so we just
26-
# defer to the OLD behavior of not including generator expressions
27-
# in the output for now.
28-
cmake_policy(SET CMP0051 OLD)
29-
endif()
30-
31-
if (POLICY CMP0063)
32-
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) # automatic when 3.3.2 is required
33-
endif()
34-
3518
if (CMAKE_VERSION VERSION_LESS 3.1.20141117)
3619
set(cmake_3_2_USES_TERMINAL)
3720
else()

bindings/rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "keystone"
33
version = "0.9.2"
4+
edition = "2018"
45
authors = [
56
"Remco Verhoef <remco.verhoef@dutchcoders.io>",
67
"Tasuku SUENAGA a.k.a. gunyarakun <tasuku-s-github@titech.ac>"

bindings/rust/keystone-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "keystone-sys"
33
version = "0.9.2"
4+
edition = "2018"
45
authors = [
56
"Remco Verhoef <remco.verhoef@dutchcoders.io>",
67
"Tasuku SUENAGA a.k.a. gunyarakun <tasuku-s-github@titech.ac>"

bindings/rust/keystone-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn build_with_cmake() {
1717
// This only happens when using the crate via a `git` reference as the
1818
// published version already embeds keystone's source.
1919
let pwd = std::env::current_dir().unwrap();
20-
let keystone_dir = pwd.ancestors().skip(3).next().unwrap();
20+
let keystone_dir = pwd.ancestors().nth(3).unwrap();
2121
symlink(keystone_dir, "keystone").expect("failed to symlink keystone");
2222
}
2323

bindings/rust/keystone-sys/src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,9 @@ extern crate libc;
1010

1111
pub mod keystone_const;
1212

13+
use ::libc::{c_char, c_int, c_uchar, c_uint, size_t};
14+
use ::std::{ffi::CStr, fmt, ptr};
1315
use keystone_const::{Arch, Error, Mode, OptionType, OptionValue};
14-
use ::std::{
15-
ffi::CStr,
16-
fmt,
17-
ptr,
18-
};
19-
use ::libc::{
20-
c_char,
21-
c_uchar,
22-
c_int,
23-
c_uint,
24-
size_t,
25-
};
2616

2717
/// Opaque type representing the Keystone engine
2818
#[repr(C)]

bindings/rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Keystone {
9090
let err = unsafe { ffi::ks_open(arch, mode, &mut handle) };
9191
if err == Error::OK {
9292
Ok(Keystone {
93-
handle: handle.expect("Got NULL engine from ks_open()")
93+
handle: handle.expect("Got NULL engine from ks_open()"),
9494
})
9595
} else {
9696
Err(err)

kstool/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Kstool for Keystone assembler engine.
22
# By Nguyen Anh Quynh, 2016
33

4-
cmake_minimum_required(VERSION 2.8)
4+
cmake_minimum_required(VERSION 3.10.0)
55

66
project(kstool)
77

0 commit comments

Comments
 (0)