diff --git a/.github/workflows/build-wheels-publish.yml b/.github/workflows/build-wheels-publish.yml index 924c20aa6b..a4b68426b0 100644 --- a/.github/workflows/build-wheels-publish.yml +++ b/.github/workflows/build-wheels-publish.yml @@ -264,6 +264,15 @@ jobs: name: sdist-archive path: bindings/python/dist/*.tar.gz + - name: Test build with sdist + run: | + TMP_DIR=$(mktemp -d) + mkdir $TMP_DIR/ + tar -xf bindings/python/dist/*.tar.gz -C $TMP_DIR/ + cd $TMP_DIR/capstone-*/src + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCAPSTONE_BUILD_CSTEST=OFF -DCAPSTONE_BUILD_CSTOOL=OFF -B build + cmake --build build + publish: needs: [ build_wheels_always, build_wheels_all, make_sdist ] environment: pypi diff --git a/BUILDING.md b/BUILDING.md index e57a1c4825..9b80ebecc3 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -82,6 +82,7 @@ Capstone allows some more customization via the following options: - `CAPSTONE_BUILD_STATIC_LIBS`: Build static libraries (`ON` by default). - `CAPSTONE_BUILD_STATIC_MSVC_RUNTIME`: (Windows only) - Build with static MSVC runtime. Always set if `CAPSTONE_BUILD_SHARED_LIBS=ON`. - `CAPSTONE_BUILD_CSTOOL`: Enable/disable build of `cstool`. Default is enabled if build runs from the repository root. +- `CAPSTONE_BUILD_FUZZER`: Build the fuzzer in `suite/fuzz`. - `CAPSTONE_USE_SYS_DYN_MEM`: change this to OFF to use your own dynamic memory management. - `CAPSTONE_BUILD_MACOS_THIN`: MacOS only. Disables universal2 build. So you only get the binary for you processor architecture. - `CAPSTONE_BUILD_DIET`: change this to ON to make the binaries more compact. diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bc1fda225..56ee05c0cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,7 @@ option(CAPSTONE_BUILD_DIET "Build diet library" OFF) option(CAPSTONE_BUILD_LEGACY_TESTS "Build legacy tests" ${PROJECT_IS_TOP_LEVEL}) option(CAPSTONE_BUILD_CSTOOL "Build cstool" ${PROJECT_IS_TOP_LEVEL}) option(CAPSTONE_BUILD_CSTEST "Build cstest" OFF) +option(CAPSTONE_BUILD_FUZZER "Build the fuzzer" OFF) option(CAPSTONE_USE_DEFAULT_ALLOC "Use default memory allocation functions" ON) option(CAPSTONE_USE_ARCH_REGISTRATION "Use explicit architecture registration" OFF) option(CAPSTONE_ARCHITECTURE_DEFAULT "Whether architectures are enabled by default" ON) @@ -832,8 +833,12 @@ endif() # Simply because it builds the fuzzer there again with hard-coded paths. # See: https://github.com/google/oss-fuzz/blob/master/projects/capstone/build.sh # and: https://github.com/capstone-engine/capstone/issues/2454 -add_executable(fuzz_disasm ${PROJECT_SOURCE_DIR}/suite/fuzz/onefile.c ${PROJECT_SOURCE_DIR}/suite/fuzz/fuzz_disasm.c ${PROJECT_SOURCE_DIR}/suite/fuzz/platform.c) -target_link_libraries(fuzz_disasm PRIVATE capstone) +# +# CAPSTONE_BUILD_TESTS check for v5 compatibility. +if (CAPSTONE_BUILD_TESTS OR CAPSTONE_BUILD_FUZZER) + add_executable(fuzz_disasm ${PROJECT_SOURCE_DIR}/suite/fuzz/onefile.c ${PROJECT_SOURCE_DIR}/suite/fuzz/fuzz_disasm.c ${PROJECT_SOURCE_DIR}/suite/fuzz/platform.c) + target_link_libraries(fuzz_disasm PRIVATE capstone) +endif() source_group("Source\\Engine" FILES ${SOURCES_ENGINE}) source_group("Source\\ARM" FILES ${SOURCES_ARM}) @@ -989,4 +994,4 @@ endif() # Include CPack set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/CPackConfig.cmake") -include(CPackConfig.txt) \ No newline at end of file +include(CPackConfig.txt) diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000000..2071b23b0e --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/bindings/python/setup.py b/bindings/python/setup.py index f3e4593f41..b98dfbef81 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -82,14 +82,17 @@ def copy_sources(): shutil.copytree(os.path.join(BUILD_DIR, "arch"), os.path.join(SRC_DIR, "arch")) shutil.copytree(os.path.join(BUILD_DIR, "include"), os.path.join(SRC_DIR, "include")) + shutil.copytree(os.path.join(BUILD_DIR, "LICENSES"), os.path.join(SRC_DIR, "LICENSES")) src.extend(glob.glob(os.path.join(BUILD_DIR, "*.[ch]"))) src.extend(glob.glob(os.path.join(BUILD_DIR, "*.m[dk]"))) src.extend(glob.glob(os.path.join(BUILD_DIR, "*.in"))) - src.extend(glob.glob(os.path.join(BUILD_DIR, "LICENSES/*"))) - src.extend(glob.glob(os.path.join(BUILD_DIR, "*.TXT"))) + src.extend(glob.glob(os.path.join(BUILD_DIR, "SPONSORS.TXT"))) + src.extend(glob.glob(os.path.join(BUILD_DIR, "CREDITS.TXT"))) src.extend(glob.glob(os.path.join(BUILD_DIR, "ChangeLog"))) src.extend(glob.glob(os.path.join(BUILD_DIR, "CMakeLists.txt"))) + src.extend(glob.glob(os.path.join(BUILD_DIR, "CPackConfig.txt"))) + src.extend(glob.glob(os.path.join(BUILD_DIR, "CPackConfig.cmake"))) for filename in src: outpath = os.path.join(SRC_DIR, os.path.basename(filename))