Skip to content

Commit

Permalink
aarch64 linux full support
Browse files Browse the repository at this point in the history
  • Loading branch information
ahqsoftwares committed Jan 18, 2025
1 parent f44babd commit d504aaf
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 40 deletions.
49 changes: 13 additions & 36 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: rust-src

- name: Publish
run: |
Expand Down Expand Up @@ -105,7 +106,7 @@ jobs:
runner: ubuntu-22.04

- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04
runner: ubuntu-22.04-arm

- target: x86_64-apple-darwin
runner: macos-latest
Expand Down Expand Up @@ -153,36 +154,17 @@ jobs:
pkg-config
target="${{ matrix.target }}"
if [[ $target == "aarch64-unknown-linux-gnu" ]]; then
echo "Installing aarch64 dependencies"
sudo dpkg --add-architecture arm64
sudo cat ubuntu | sudo tee /etc/apt/sources.list
sudo apt-get update
sudo apt install libxdo-dev:arm64 \
libayatana-appindicator3-dev:arm64 \
librsvg2-dev:arm64 \
libgtk-3-dev:arm64 \
libwebkit2gtk-4.1-dev:arm64 \
libssl-dev:arm64
else
echo "Installing x86_64 dependencies"
sudo apt update
sudo apt install libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libgtk-3-dev
fi
sudo apt update
sudo apt install libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libgtk-3-dev
- name: Build Lead Docs UI
run: pnpm install; pnpm build
Expand All @@ -192,11 +174,6 @@ jobs:
if: runner.os != 'Windows'
run: |
arch="${{ matrix.target }}"
if [[ $arch == "aarch64-unknown-linux-gnu" ]]; then
echo "Setting PKG CONFIG for aarch64 linux"
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/
fi
cargo +nightly run --release
env:
Expand Down
8 changes: 4 additions & 4 deletions macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ repository = "https://github.com/leadlang/lead"
proc-macro = true

[dependencies]
proc-macro2 = "1.0.89"
quote = "1.0.37"
syn = "2.0.87"
lead_lang_interpreter = { version = "0.0.0-dev-lead-lang" }
proc-macro2 = "1"
quote = "1"
syn = { version = "2", features = ["full"] }
lead_lang_interpreter = { path = "../interpreter", version = "0.0.0-dev-lead-lang" }

[patch.crates-io]
lead_lang_interpreter = { path = "../interpreter" }
69 changes: 69 additions & 0 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
extern crate proc_macro;

use proc_macro::TokenStream;
use quote::{ToTokens, quote};
use syn::{parse::{Parse, ParseStream}, Result, parse_macro_input, Attribute, FnArg, Ident, ItemFn, Token};

// Parses a unit struct with attributes.
//
// #[path = "s.tmpl"]
// struct S;
struct UnitStruct {
attrs: Vec<Attribute>,
struct_token: Token![struct],
name: Ident,
semi_token: Token![;],
}

impl Parse for UnitStruct {
fn parse(input: ParseStream) -> Result<Self> {
Ok(UnitStruct {
attrs: input.call(Attribute::parse_outer)?,
struct_token: input.parse()?,
name: input.parse()?,
semi_token: input.parse()?,
})
}
}

#[proc_macro_attribute]
pub fn define(args: TokenStream, input: TokenStream) -> TokenStream {
//let args = syn::parse(args).unwrap();

let input = parse_macro_input!(input as ItemFn);

let ItemFn {
// The function signature
sig,
// The visibility specifier of this function
vis,
// The function block or body
block,
// Other attributes applied to this function
attrs,
} = input;

sig.inputs.iter().for_each(|s| {
match s {
FnArg::Typed(s) => {
println!("{:?}", s.ty.to_token_stream());
}
_ => {}
}
});

let new = Ident::new(&format!("_call_{}", sig.ident), sig.ident.span());

let params = sig.inputs.to_token_stream();
println!("New {}", new.to_string());

let ident = sig.ident;

quote! {
fn #ident(args: &Vec<String>) {

}

#vis fn #new(#params) #block
}.into()
}
8 changes: 8 additions & 0 deletions macros/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "tests"
version = "0.1.0"
edition = "2021"

[dependencies]
lead_lang_macros = { path = ".." }
lead_lang_interpreter = { path = "../../interpreter" }
11 changes: 11 additions & 0 deletions macros/tests/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use lead_lang_macros::define;

fn main() {
println!("Hello, world!");
_call_call("".into(), "".into())
}

#[define]
fn call(a: String, b: String) {
println!("{a} {b}");
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fn main() {
if target.contains("windows")
|| target.contains("apple")
|| target.contains("x86_64-unknown-linux-gnu")
|| target.contains("aarch64-unknown-linux-gnu")
{
dir.push(PathBuf::from_str("./lead_docs").unwrap());
} else {
Expand Down

0 comments on commit d504aaf

Please sign in to comment.