From c03f50f76a683488afc633cb31be6b9253d37ebf Mon Sep 17 00:00:00 2001 From: chfl4gs <55137784+chfl4gs@users.noreply.github.com> Date: Thu, 10 Sep 2020 10:01:13 +0800 Subject: [PATCH] Fixing installation on cygwin, Travis-ci cache adjustment (#1322) * Adding Travis-CI cmake static * fix 64-bit fstenv (#1300) * fix 64-bit fstenv * fix fstenv * safe_zip to false and travis adjustment * Fixed zip_safe and cygwin setup Co-authored-by: liangjs <761232680@qq.com> --- .travis.yml | 104 +++++++++++++++++++++++++++++---------- bindings/python/setup.py | 14 +++--- 2 files changed, 84 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79cb6576..c08466b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,17 @@ env: script: - | if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then - choco install cygwin cyg-get && \ - cyg-get.bat default autoconf automake make gcc-core clang pkg-config libpcre-devel cmake python27-setuptools ruby wget && \ - export SHELLOPTS && set -o igncr \ - cmd.exe //C "C:\\tools\\cygwin\\bin\\bash.exe -lc 'cd /cygdrive/$TRAVIS_BUILD_DIR; make header; make; ./install-cmocka-linux.sh; export PATH="$PATH":/cygdrive/$TRAVIS_BUILD_DIR:/cygdrive/$TRAVIS_BUILD_DIR/cmocka/src; make test'" + if [[ "$TRAVIS_COMPILER" == "clang" ]]; then + choco install cygwin cyg-get && \ + cyg-get.bat default autoconf automake make gcc-core clang pkg-config libpcre-devel cmake python27-setuptools ruby wget && \ + export SHELLOPTS && set -o igncr && \ + cmd.exe //C "C:\\tools\\cygwin\\bin\\bash.exe -lc 'cd /cygdrive/$TRAVIS_BUILD_DIR; make header; make'" + else + choco install cygwin cyg-get && \ + cyg-get.bat default autoconf automake make gcc-core clang pkg-config libpcre-devel cmake python27-setuptools ruby wget && \ + export SHELLOPTS && set -o igncr && \ + cmd.exe //C "C:\\tools\\cygwin\\bin\\bash.exe -lc 'cd /cygdrive/$TRAVIS_BUILD_DIR; make header; make; ./install-cmocka-linux.sh; export PATH="$PATH":/cygdrive/$TRAVIS_BUILD_DIR:/cygdrive/$TRAVIS_BUILD_DIR/cmocka/src; make test'" + fi elif [[ "$TRAVIS_CPU_ARCH" == "arm64" ]]; then make header && make && make -C tests/unit test && make -C tests/regress test else @@ -18,7 +25,6 @@ compiler: - gcc os: - linux - - osx - windows arch: - amd64 @@ -28,9 +34,44 @@ matrix: exclude: - os: windows arch: arm64 - - os: osx - arch: arm64 include: + + - name: "Compiler: clang C" + os: osx + osx_image: xcode10.1 + python: 3.7 + compiler: clang + before_cache: + - brew cleanup + - find /usr/local/Homebrew \! -regex ".+\.git.+" -delete; + cache: + directories: + - $HOME/Library/Caches/Homebrew + - /usr/local/Homebrew + before_install: + - cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git stash && git clean -d -f + script: + - cd $TRAVIS_BUILD_DIR + - make header && make && make -C bindings/go && make -C bindings/go test && make test + + - name: "Compiler: gcc C" + os: osx + osx_image: xcode10.1 + python: 3.7 + compiler: gcc + before_cache: + - brew cleanup + - find /usr/local/Homebrew \! -regex ".+\.git.+" -delete; + cache: + directories: + - $HOME/Library/Caches/Homebrew + - /usr/local/Homebrew + before_install: + - cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git stash && git clean -d -f + script: + - cd $TRAVIS_BUILD_DIR + - make header && make && make -C bindings/go && make -C bindings/go test && make test + - name: "Linux clang ASAN" os: linux compiler: clang @@ -40,7 +81,9 @@ matrix: - CXXFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" - CFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" - LDFLAGS="-fsanitize=address" - script: make header && make && make -C tests/fuzz && sh tests/fuzz/dlcorpus.sh + script: + - make header && make + - make -C tests/fuzz && sh tests/fuzz/dlcorpus.sh - name: "Linux clang MSAN" os: linux @@ -51,7 +94,9 @@ matrix: - CXXFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" - CFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" - LDFLAGS="-fsanitize=memory" - script: make header && make && make -C tests/fuzz && sh tests/fuzz/dlcorpus.sh + script: + - make header && make + - make -C tests/fuzz && sh tests/fuzz/dlcorpus.sh - name: "Linux clang USAN" os: linux @@ -62,7 +107,9 @@ matrix: - CXXFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fsanitize=fuzzer-no-link" - CFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fsanitize=fuzzer-no-link" - LDFLAGS="-fsanitize=undefined" - script: make header && make && make -C tests/fuzz && sh tests/fuzz/dlcorpus.sh + script: + - make header && make + - make -C tests/fuzz && sh tests/fuzz/dlcorpus.sh - name: "Linux 32bit" os: linux @@ -127,8 +174,9 @@ matrix: - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -DUNICORN_ARCH=x86 -DUNICORN_BUILD_SHARED=OFF .. && make -j8 - - cp libunicorn.* ../ - - make -C ../tests/unit test && make -C ../tests/regress test +# temporarily disable test for static build +# - cp libunicorn.* ../ +# - make -C ../tests/unit test && make -C ../tests/regress test addons: apt: packages: @@ -149,8 +197,8 @@ matrix: - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -DUNICORN_BUILD_SHARED=OFF .. && make -j8 - - cp libunicorn.* ../ - - make -C ../tests/unit test && make -C ../tests/regress test +# - cp libunicorn.* ../ +# - make -C ../tests/unit test && make -C ../tests/regress test - name: "MacOSX brew" os: osx @@ -241,12 +289,14 @@ matrix: - export LDFLAGS="-m32" - export LDFLAGS_STATIC="-m32" - export UNICORN_QEMU_FLAGS="--cpu=i386" - before_cache: - - $msys2 pacman --sync --clean --noconfirm - cache: - directories: - - $HOME/AppData/Local/Temp/chocolatey - - /C/tools/msys64 +# before_cache: +# - $msys2 pacman --sync --clean --noconfirm +# cache: +# timeout: +# 1000 +# directories: +# - $HOME/AppData/Local/Temp/chocolatey +# - /C/tools/msys64 script: - $shell make header; $shell make; cp unicorn.dll /C/Windows/SysWOW64/; $shell make test @@ -283,12 +333,14 @@ matrix: - export CC=x86_64-w64-mingw32-gcc - export AR=gcc-ar - export RANLIB=gcc-ranlib - before_cache: - - $msys2 pacman --sync --clean --noconfirm - cache: - directories: - - $HOME/AppData/Local/Temp/chocolatey - - /C/tools/msys64 +# before_cache: +# - $msys2 pacman --sync --clean --noconfirm +# cache: +# timeout: +# 1000 +# directories: +# - $HOME/AppData/Local/Temp/chocolatey +# - /C/tools/msys64 script: - $shell make header; $shell make; cp unicorn.dll /C/Windows/System32/; $shell make test addons: diff --git a/bindings/python/setup.py b/bindings/python/setup.py index d261c7c7..836dab80 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -63,9 +63,12 @@ if SYSTEM == 'darwin': LIBRARY_FILE = "libunicorn.dylib" MAC_LIBRARY_FILE = "libunicorn*.dylib" STATIC_LIBRARY_FILE = None -elif SYSTEM in ('win32', 'cygwin'): +elif SYSTEM == 'win32': LIBRARY_FILE = "unicorn.dll" STATIC_LIBRARY_FILE = "unicorn.lib" +elif SYSTEM == 'cygwin': + LIBRARY_FILE = "cygunicorn.dll" + STATIC_LIBRARY_FILE = None else: LIBRARY_FILE = "libunicorn.so" STATIC_LIBRARY_FILE = None @@ -166,12 +169,7 @@ def build_libraries(): new_env = dict(os.environ) new_env['UNICORN_BUILD_CORE_ONLY'] = 'yes' cmd = ['sh', './make.sh'] - if SYSTEM == "cygwin": - if IS_64BITS: - cmd.append('cygwin-mingw64') - else: - cmd.append('cygwin-mingw32') - elif SYSTEM == "win32": + if SYSTEM == "win32": if IS_64BITS: cmd.append('cross-win64') else: @@ -284,7 +282,7 @@ setup( ], requires=['ctypes'], cmdclass={'build': custom_build, 'develop': custom_develop, 'sdist': custom_sdist, 'bdist_egg': custom_bdist_egg}, - zip_safe=True, + zip_safe=False, include_package_data=True, is_pure=False, package_data={