diff --git a/.github/workflows/macos-13.yml b/.github/workflows/macos-13.yml new file mode 100644 index 0000000..3f38ca6 --- /dev/null +++ b/.github/workflows/macos-13.yml @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file is part of the Arm Disassembly Library + +name: "MacOS Ventura" + +on: [push, pull_request] + +jobs: + macos-13-ci: + uses: ./.github/workflows/main.yml + with: + os: macos-13 diff --git a/.github/workflows/macos-14.yml b/.github/workflows/macos-14.yml new file mode 100644 index 0000000..dd12b19 --- /dev/null +++ b/.github/workflows/macos-14.yml @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file is part of the Arm Disassembly Library + +name: "MacOS Sonoma" + +on: [push, pull_request] + +jobs: + macos-14-ci: + uses: ./.github/workflows/main.yml + with: + os: macos-14 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3f9d61a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,54 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file is part of the Arm Disassembly Library + +name: CI + +on: + workflow_call: + inputs: + os: + required: true + type: string + +jobs: + build_install_test: + name: "Build, test, install and run example on ${{ matrix.os }}." + runs-on: ${{ inputs.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup + run: | + python3 -m venv venv + source venv/bin/activate + python3 -m pip install --upgrade pip setuptools wheel + python3 -m pip install build Toml + - name: Build + run: | + source venv/bin/activate + ./build.sh + - name: Install + run: | + source venv/bin/activate + VERSION=$(python -c "import toml; print(toml.load('python/pyproject.toml')['project']['version'])") + python3 -m pip install python/dist/armdisasm-${VERSION}-py3-none-any.whl + - name: Test example + run: | + source venv/bin/activate + python3 examples/api_demo.py -i 0xb8607b21 diff --git a/.github/workflows/ubuntu-2004.yml b/.github/workflows/ubuntu-2004.yml new file mode 100644 index 0000000..3122ba5 --- /dev/null +++ b/.github/workflows/ubuntu-2004.yml @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file is part of the Arm Disassembly Library + +name: "Ubuntu 20.04" + +on: [push, pull_request] + +jobs: + ubuntu-2004-ci: + uses: ./.github/workflows/main.yml + with: + os: ubuntu-20.04 diff --git a/.github/workflows/ubuntu-2204.yml b/.github/workflows/ubuntu-2204.yml new file mode 100644 index 0000000..962ff55 --- /dev/null +++ b/.github/workflows/ubuntu-2204.yml @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file is part of the Arm Disassembly Library + +name: "Ubuntu 22.04" + +on: [push, pull_request] + +jobs: + ubuntu-2204-ci: + uses: ./.github/workflows/main.yml + with: + os: ubuntu-22.04 diff --git a/.github/workflows/ubuntu-2404.yml b/.github/workflows/ubuntu-2404.yml new file mode 100644 index 0000000..3a3d860 --- /dev/null +++ b/.github/workflows/ubuntu-2404.yml @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file is part of the Arm Disassembly Library + +name: "Ubuntu 24.04" + +on: [push, pull_request] + +jobs: + ubuntu-2004-ci: + uses: ./.github/workflows/main.yml + with: + os: ubuntu-24.04 diff --git a/README.md b/README.md index a4d2ee8..857d30e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +[![Ubuntu-2004 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2004.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2004.yml "Ubuntu 20.04 build status") +[![Ubuntu-2204 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2204.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2204.yml "Ubuntu 22.04 build status") +[![Ubuntu-2404 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2404.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2404.yml "Ubuntu 24.04 build status") +[![MacOS13 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-13.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-13.yml "MacOS Ventura build status") +[![MacOS14 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-14.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-14.yml "MacOS Sonoma build status") + # Arm Disassembly Library Arm Disassembly Library is a software library and API for decoding and disassembling AArch64 instructions. @@ -78,7 +84,7 @@ For more information and examples on how to use this tool, check out the [Arm Le ## Compatibility -This library can be built for any platform, however it has only been tested on AArch64 Linux and x86-64 Linux. Currently, only AArch64 instructions are supported. +This library can be built for any platform, however it has only been tested on AArch64 Linux and x86-64 Linux and MacOS. Currently, only AArch64 instructions are supported. Please consider raising a [GitHub issue](https://github.com/ArmDeveloperEcosystem/disassembly-library/issues/new) if this tool does not work as expected on your system. diff --git a/build.sh b/build.sh index 2c4bf81..20ca44d 100755 --- a/build.sh +++ b/build.sh @@ -46,15 +46,16 @@ set -e LLVM_GIT_TAG=llvmorg-18.1.8 LLVM_TEMP_DIR=llvm-temp LLVM_LIB_DIR=llvmlib -MAX_BUILD_JOBS=$(nproc --all) PLATFORM=$(uname -s) case $PLATFORM in Darwin) LIB_EXT=".dylib" + MAX_BUILD_JOBS=$(sysctl -n hw.logicalcpu) ;; *) LIB_EXT=".so" + MAX_BUILD_JOBS=$(nproc --all) ;; esac