mirror of
https://github.com/capstone-engine/capstone.git
synced 2026-10-12 02:11:43 +00:00
Build and upload cross compiled tar.gz packages (#2862)
This commit is contained in:
@@ -16,6 +16,8 @@ on:
|
||||
- "SPONSORS.TXT"
|
||||
- "TODO"
|
||||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
# Stop previous runs on the same branch on new push
|
||||
concurrency:
|
||||
@@ -42,7 +44,9 @@ jobs:
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_type: 'Release',
|
||||
upload_name: 'capstone_linux_s390x',
|
||||
build_exe: false,
|
||||
diet_build: false,
|
||||
packages: 'gcc-s390x-linux-gnu g++-s390x-linux-gnu binutils-s390x-linux-gnu libc6-dev-s390x-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_s390x_ubuntu24.cmake',
|
||||
@@ -53,7 +57,9 @@ jobs:
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_type: 'Release',
|
||||
upload_name: 'capstone_linux_mips32',
|
||||
build_exe: false,
|
||||
diet_build: false,
|
||||
packages: 'gcc-mips-linux-gnu g++-mips-linux-gnu binutils-mips-linux-gnu libc6-dev-mips-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_mips_ubuntu24.cmake',
|
||||
@@ -64,7 +70,9 @@ jobs:
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_type: 'Release',
|
||||
upload_name: 'capstone_linux_mips64el',
|
||||
build_exe: false,
|
||||
diet_build: false,
|
||||
packages: 'gcc-mips64el-linux-gnuabi64 g++-mips64el-linux-gnuabi64 binutils-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_mips64_ubuntu24.cmake',
|
||||
@@ -75,7 +83,9 @@ jobs:
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_type: 'Release',
|
||||
upload_name: 'capstone_linux_ppc64',
|
||||
build_exe: false,
|
||||
diet_build: false,
|
||||
packages: 'gcc-powerpc64-linux-gnu g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu libc6-dev-ppc64-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_ppc64_ubuntu24.cmake',
|
||||
@@ -86,7 +96,9 @@ jobs:
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_type: 'Release',
|
||||
upload_name: 'capstone_linux_arm_v7',
|
||||
build_exe: false,
|
||||
diet_build: false,
|
||||
packages: 'gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_arm_ubuntu24.cmake',
|
||||
@@ -97,10 +109,13 @@ jobs:
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_type: 'Release',
|
||||
upload_name: 'capstone_win_i686',
|
||||
build_exe: true,
|
||||
diet_build: false,
|
||||
# Tests are run via Python.
|
||||
skip_tests: true,
|
||||
packages: 'gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools',
|
||||
packages: 'gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools nsis',
|
||||
cross_file: 'cross_configs/windows_i686_ubuntu24.cmake',
|
||||
}
|
||||
- {
|
||||
@@ -110,10 +125,12 @@ jobs:
|
||||
build-system: 'cmake',
|
||||
build_option: '-DANDROID_NDK=ndk/ -DANDROID_PLATFORM=android-35 -DANDROID_ABI=arm64-v8a',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_type: 'Release',
|
||||
upload_name: 'capstone_android_35_arm64_v8a',
|
||||
build_exe: false,
|
||||
diet_build: false,
|
||||
# QEMU alone can't emulate the binaries, because the NDK doesn't
|
||||
# provide dynamic linker.
|
||||
# provide a dynamic linker.
|
||||
skip_tests: true,
|
||||
packages: 'qemu-user-static',
|
||||
ndk_version: 'r29',
|
||||
@@ -158,6 +175,7 @@ jobs:
|
||||
run: |
|
||||
cmake -DCMAKE_BUILD_TYPE=${build_type} \
|
||||
-DCAPSTONE_BUILD_STATIC_LIBS=ON \
|
||||
-DPROJECT_VERSION=${{ github.event.release.tag_name }} \
|
||||
-S . \
|
||||
-DCAPSTONE_BUILD_CSTEST=ON \
|
||||
-DCAPSTONE_BUILD_DIET=${diet_build} \
|
||||
@@ -200,3 +218,48 @@ jobs:
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R legacy*
|
||||
|
||||
- name: Package binary tar.gz
|
||||
if: ${{ matrix.config.build_exe == false }}
|
||||
run: |
|
||||
cd build
|
||||
cpack -G TGZ
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ matrix.config.build_exe == false }}
|
||||
with:
|
||||
name: ${{ matrix.config.upload_name }}
|
||||
path: ./build/*.tar.gz
|
||||
|
||||
- name: Upload binary package to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release' && matrix.config.build_exe == false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name }}
|
||||
files: |
|
||||
./build/*.tar.gz
|
||||
|
||||
- name: Package NSIS installer
|
||||
if: ${{ matrix.config.build_exe }}
|
||||
run: |
|
||||
makensis -VERSION
|
||||
cd build
|
||||
cpack -G NSIS
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ matrix.config.build_exe }}
|
||||
with:
|
||||
name: ${{ matrix.config.upload_name }}
|
||||
path: ./build/capstone-*.exe
|
||||
|
||||
- name: Upload NSIS installer to release
|
||||
uses: softprops/action-gh-release@v3
|
||||
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release' && matrix.config.build_exe
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name }}
|
||||
files: |
|
||||
./build/capstone-*.exe
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright © 2024 Andrew Quijano <[email protected]>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Used to dynamically set the package file name based on the generator
|
||||
foreach(generator ${CPACK_GENERATOR})
|
||||
if("${generator}" STREQUAL "DEB")
|
||||
@@ -8,6 +11,8 @@ foreach(generator ${CPACK_GENERATOR})
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_NSIS_PACKAGE_FILE_NAME})
|
||||
elseif("${generator}" STREQUAL "DragNDrop")
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_DMG_PACKAGE_FILE_NAME})
|
||||
elseif("${generator}" STREQUAL "TGZ")
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_TGZ_PACKAGE_FILE_NAME})
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-unknown")
|
||||
endif()
|
||||
|
||||
+6
-2
@@ -4,7 +4,7 @@
|
||||
# Set general CPack values
|
||||
set(CPACK_PACKAGE_NAME "capstone")
|
||||
set(CPACK_PACKAGE_VENDOR "Rot127")
|
||||
set(CPACK_PACKAGE_CONTACT "Rot127 <[email protected]>")
|
||||
set(CPACK_PACKAGE_CONTACT "Rot127 <[email protected]>")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "Capstone is a lightweight multi-platform, multi-architecture disassembly framework. These are the development headers and libraries.\n Features:\n - Support hardware architectures: AArch64, ARM, Alpha, BPF, EVM, HPPA, LongArch, M680X, M68K, MOS65XX, Mips, PowerPC, RISCV, SH, Sparc, SystemZ, TMS320C64x, TriCore, WASM, x86, XCore, Xtensa.\n - Clean/simple/lightweight/intuitive architecture-neutral API.\n - Provide details on disassembled instructions (called \\\"decomposer\\\" by some others).\n - Provide some semantics of the disassembled instruction, such as list of implicit registers read & written.\n - Thread-safe by design.\n - Special support for embedding into firmware or OS kernel.\n - Distributed under the open source BSD license.")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Lightweight multi-architecture disassembly framework - devel files")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.capstone-engine.org/")
|
||||
@@ -51,15 +51,19 @@ set(CPACK_RPM_CHANGELOG_FILE "${PROJECT_SOURCE_DIR}/ChangeLog")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "BSD3, LLVM")
|
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
|
||||
|
||||
# TGZ specific options
|
||||
set(CPACK_TGZ_PACKAGE_NAME "libcapstone-dev")
|
||||
|
||||
# Windows package settings
|
||||
if(WIN32)
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "capstone")
|
||||
set(CPACK_SYSTEM_NAME "Windows-x64")
|
||||
set(CPACK_NSIS_MODIFY_PATH ON)
|
||||
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
|
||||
endif()
|
||||
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
|
||||
# Set package file name based on the generator
|
||||
set(CPACK_TGZ_PACKAGE_FILE_NAME "${CPACK_TGZ_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_SYSTEM_NAME}")
|
||||
set(CPACK_DEBIAN_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
set(CPACK_RPM_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CPACK_DMG_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
|
||||
Reference in New Issue
Block a user