diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acda7faebc..522cb67e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,311 +1,28 @@ name: CI +on: push -on: - push: - branches: - - '*' - schedule: - - cron: '0 18 * * 1,3,5' # Three-weekly at 18:00 UTC on Monday, Wednesday, and Friday - pull_request: - branches: - - master - - 'release-*' +# python sys\meson.py --release --backend vs2019 --shared --install --prefix="%cd%\radar e2_dist" --webui jobs: - # TODO: build r2-bindings - - build-and-test: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.ignore_error }} - timeout-minutes: ${{ matrix.timeout }} - strategy: - fail-fast: false - matrix: - name: [linux-acr-gcc-tests, linux-acr-clang-build, linux-acr-clang-tests, linux-meson-gcc-build, linux-meson-gcc-tests, linux-meson-gcc-newshell-tests, macos-acr-clang-tests, macos-meson-clang-tests, linux-gcc-tests-asan, capstone-v3, capstone-v5] - ignore_error: [false] - include: - - name: linux-acr-gcc-tests - os: ubuntu-latest - build_system: acr - compiler: gcc - run_tests: true - enabled: true - timeout: 45 - - name: linux-acr-clang-tests - os: ubuntu-latest - build_system: acr - compiler: clang - run_tests: true - enabled: ${{ github.event_name != 'pull_request' }} - timeout: 45 - - name: linux-meson-gcc-tests - os: ubuntu-latest - build_system: meson - compiler: gcc - run_tests: true - meson_options: -Duse_webui=true - enabled: ${{ github.event_name != 'pull_request' }} - timeout: 45 - cflags: '-Werror -Wno-cpp' - - name: linux-acr-clang-build - os: ubuntu-latest - build_system: acr - compiler: clang - enabled: ${{ github.event_name == 'pull_request' }} - timeout: 45 - - name: linux-meson-gcc-build - os: ubuntu-latest - build_system: meson - compiler: gcc - enabled: ${{ github.event_name == 'pull_request' }} - timeout: 45 - cflags: '-Werror -Wno-cpp' - - name: linux-meson-gcc-newshell-tests - os: ubuntu-latest - build_system: meson - compiler: gcc - newshell: true - run_tests: true - meson_options: -Db_coverage=true -Duse_webui=true - coverage: true - enabled: true - timeout: 60 - cflags: '-Werror -Wno-cpp' - - name: macos-acr-clang-tests - os: macos-latest - build_system: acr - compiler: clang - run_tests: true - enabled: true - timeout: 60 - - name: macos-meson-clang-tests - os: macos-latest - build_system: meson - compiler: clang - run_tests: true - meson_options: -Duse_webui=true - enabled: true - timeout: 60 - - name: linux-gcc-tests-asan - os: ubuntu-20.04 - build_system: meson - compiler: gcc - cflags: '-DR2_ASSERT_STDOUT=1 -Werror -Wno-cpp' - meson_options: -Db_sanitize=address,undefined -Duse_webui=true - asan: true - asan_options: 'detect_leaks=0,detect_odr_violation=0,allocator_may_return_null=1' - run_tests: true - enabled: ${{ github.event_name != 'pull_request' || contains(github.head_ref, 'asan') }} - timeout: 100 - # NOTE: asan errors ignored for release- branch for now, because there are too many issues that would block the release - ignore_error: ${{ github.event_name == 'push' && contains(github.ref, 'release-') }} - - name: capstone-v3 - os: ubuntu-latest - build_system: meson - compiler: gcc - meson_options: -Duse_capstone_version=v3 - run_tests: false - enabled: ${{ github.event_name != 'pull_request' || contains(github.head_ref, 'capstone') }} - timeout: 45 - cflags: '-Werror -Wno-cpp' - - name: capstone-v5 - os: ubuntu-latest - build_system: meson - compiler: gcc - meson_options: -Duse_capstone_version=v5 - run_tests: false - enabled: ${{ github.event_name != 'pull_request' || contains(github.head_ref, 'capstone') }} - timeout: 45 - cflags: '-Werror -Wno-cpp' - - steps: - - uses: actions/checkout@v2 - if: matrix.enabled - - name: Install pkg-config with Homebrew - if: matrix.os == 'macos-latest' && matrix.enabled - run: brew install pkg-config - - name: Install python - if: (matrix.run_tests || matrix.build_system == 'meson') && matrix.os != 'macos-latest' && matrix.enabled - run: sudo apt-get --assume-yes install python3-wheel python3-setuptools - - name: Install meson and ninja - if: matrix.build_system == 'meson' && matrix.enabled - run: pip3 install --user meson==0.55.3 ninja==1.10.0 - - name: Install test dependencies - if: matrix.run_tests && matrix.enabled - run: pip3 install --user 'git+https://github.com/radareorg/radare2-r2pipe#egg=r2pipe&subdirectory=python' - - name: Install clang - if: matrix.compiler == 'clang' && matrix.os == 'ubuntu-latest' && matrix.enabled - run: sudo apt-get --assume-yes install clang - - name: Checkout our Testsuite Binaries - if: matrix.enabled - uses: actions/checkout@v2 - with: - repository: radareorg/radare2-testbins - path: test/bins - - name: Configure with ACR and build - if: matrix.build_system == 'acr' && matrix.enabled - run: ./configure --prefix=${HOME} && make - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - - name: Build with Meson - if: matrix.build_system == 'meson' && matrix.enabled - run: | - export PATH=${HOME}/.local/bin:${HOME}/Library/Python/3.9/bin:${PATH} - if [ "$ASAN" == "true" ]; then - export CFLAGS="-DASAN=1 ${CFLAGS}" - fi - meson --prefix=${HOME} ${{ matrix.meson_options }} build && ninja -C build - env: - ASAN: ${{ matrix.asan }} - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - - name: Install with make - if: matrix.build_system == 'acr' && matrix.enabled - run: | - # Install the radare2 - export PATH=${HOME}/bin:${HOME}/.local/bin:${PATH} - export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH} - export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH} - make install - - name: Install with meson - if: matrix.build_system == 'meson' && matrix.enabled - run: | - # Install the radare2 - export PATH=${HOME}/bin:${HOME}/.local/bin:${HOME}/Library/Python/3.9/bin:${PATH} - export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH} - export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH} - ninja -C build install - - name: Run tests - if: matrix.run_tests && matrix.enabled - run: | - # Running the test suite - export PATH=${HOME}/bin:${HOME}/.local/bin:${PATH} - export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH} - export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH} - if [ "$NEWSHELL" == "true" ]; then - export R2_CFG_NEWSHELL=1 - fi - if [ "$ASAN" == "true" ]; then - export ASAN=1 - fi - cd test - radare2 -N -Qc 'e cfg.newshell' - - make - env: - NEWSHELL: ${{ matrix.newshell }} - ASAN: ${{ matrix.asan }} - ASAN_OPTIONS: ${{ matrix.asan_options }} - - name: Upload coverage info - uses: codecov/codecov-action@v1 - if: matrix.coverage == '1' && matrix.enabled - - name: Run fuzz tests - if: matrix.run_tests && matrix.enabled && (github.event_name != 'pull_request' || contains(github.event.pull_request.head.ref, 'fuzz')) - run: | - export PATH=${HOME}/bin:${HOME}/.local/bin:${PATH} - export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH} - export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH} - if [ "$NEWSHELL" == "true" ]; then - export R2_CFG_NEWSHELL=1 - fi - cd test - make fuzz-tests - env: - NEWSHELL: ${{ matrix.newshell }} - ASAN_OPTIONS: ${{ matrix.asan_options }} - - name: Upload test results - if: matrix.run_tests && matrix.enabled - uses: actions/upload-artifact@v2 - with: - name: test-results-${{ matrix.name }} - path: test/results.json - - build-centos6: - name: Build on CentOS 6 - runs-on: ubuntu-latest - if: contains(github.head_ref, 'centos') || contains(github.ref, 'release-') || github.event_name == 'schedule' - container: centos:6 - steps: - - name: Install tools - run: yum install -y patch unzip git gcc make - - name: Checkout r2 - run: | - git clone https://github.com/${{ github.repository }} - cd radare2 - git fetch origin ${{ github.ref }} - git checkout -b local_branch FETCH_HEAD - - name: Configure with ACR and build - run: ./configure --prefix=/usr && make CS_RELEASE=1 - working-directory: radare2 - - name: Install with make - run: make install - working-directory: radare2 - - name: Run tests - run: cd test/unit && make - working-directory: radare2 - env: - # `make install` installs, for some unknown reasons, pkgconfig files in - # /usr/lib and not in /usr/lib64, thus pkg-config cannot find the right - # .pc files if the right path is not specified - PKG_CONFIG_PATH: /usr/lib/pkgconfig - - build-debian: - name: Build on old Debian ${{ matrix.container }} - if: contains(github.head_ref, 'debian') || contains(github.ref, 'release-') || github.event_name == 'schedule' - strategy: - matrix: - container: - - debian:wheezy - - debian:jessie - - runs-on: ubuntu-latest - container: ${{ matrix.container }} - - steps: - - name: Fix containers (Wheezy) - if: matrix.container == 'debian:wheezy' - run: | - sed -i '/deb http:\/\/deb.debian.org\/debian wheezy-updates main/d' /etc/apt/sources.list - echo "deb http://archive.debian.org/debian wheezy main" > /etc/apt/sources.list - echo "deb http://archive.debian.org/debian-security wheezy/updates main" >> /etc/apt/sources.list - echo "Acquire::Check-Valid-Until no;" > /etc/apt/apt.conf.d/99no-check-valid-until - - - name: Install tools - run: apt-get update && apt-get install --yes patch unzip git gcc make curl pkg-config libc6-i386 build-essential - - name: Install Python source build dependcies - run: apt-get install --yes checkinstall libbz2-dev libc6-dev libgdbm-dev libncursesw5-dev libreadline-gplv2-dev libssl-dev libsqlite3-dev tk-dev - - name: Install Python from source - run: | - curl -o Python-3.6.11.tgz https://www.python.org/ftp/python/3.6.11/Python-3.6.11.tgz - tar -zxvf Python-3.6.11.tgz - cd Python-3.6.11/ - ./configure - make install - - name: Checkout r2 - run: | - git clone https://github.com/${{ github.repository }} - cd radare2 - git fetch origin ${{ github.ref }} - git checkout -b local_branch FETCH_HEAD - - name: Checkout our Testsuite Binaries - run: git clone https://github.com/radareorg/radare2-testbins test/bins - - name: Configure with ACR and build - run: ./configure --prefix=/usr && make - working-directory: radare2 - - name: Install with make - run: make install - working-directory: radare2 - - name: Install test dependencies - run: python3 -m pip install --user 'git+https://github.com/radareorg/radare2-r2pipe#egg=r2pipe&subdirectory=python' - - name: Run tests - # FIXME: debug tests fail on debian for now, let's ignore all tests for the moment - run: cd test && make || exit 0 - working-directory: radare2 - env: - PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig - + # Windows + # windows-mingw: + # runs-on: windows-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # - name: Windows Dependencies + # run: | + # pip install meson ninja r2pipe + # - name: Building Radare2 + # run: | + # meson --buildtype=release --prefix=$PWD\radare2_dist build + # ninja -C build + # ninja -C build install + # - name: Pub + # uses: actions/upload-artifact@v2 + # with: + # path: radare2_dist/* build-spaces: name: Build spaces continue-on-error: true @@ -340,130 +57,10 @@ jobs: find "/tmp/r 2" LD_LIBRARY_PATH="/tmp/r 2/lib/x86_64-linux-gnu/" "/tmp/r 2/bin/r2" -v - build-static: - name: Build static - # FIXME: ignore error until all tests properly pass - continue-on-error: true - if: contains(github.head_ref, 'static') || contains(github.ref, 'release-') || github.event_name == 'schedule' - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Checkout our Testsuite Binaries - uses: actions/checkout@v2 - with: - repository: radareorg/radare2-testbins - path: test/bins - - name: Install static - run: | - ./sys/static.sh - sudo make symstall - - name: Run tests - run: | - r2 -v - r2r -v - cd test - make - - name: Upload test results - uses: actions/upload-artifact@v2 - with: - name: test-results-static - path: test/results.json - - - create-tarball: - name: Create source tarball - if: contains(github.head_ref, 'extras') || contains(github.ref, 'release-') - needs: [build-and-test] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Extract r2 version - shell: bash - run: echo "##[set-output name=branch;]$(python sys/version.py)" - id: extract_version - - name: Download capstone - run: | - ./configure - make -C shlr capstone - rm -rf shlr/capstone/.git - git clean -dxf . - rm -rf .git - - name: Create archive - run: | - cd .. - cp -r radare2 radare2-${{ steps.extract_version.outputs.branch}} - tar cvzf radare2-src.tar.gz radare2-${{ steps.extract_version.outputs.branch}} - mv radare2-src.tar.gz radare2/ - - uses: actions/upload-artifact@v2 - with: - name: radare2-src - path: radare2-src.tar.gz - - build-deb: - name: Build deb package for ${{ matrix.container }} - if: github.event_name == 'push' && contains(github.ref, 'release-') - needs: [build-and-test] - runs-on: ubuntu-latest - container: ${{ matrix.container }} - strategy: - fail-fast: false - matrix: - name: [debian-buster, ubuntu-1804] - include: - - name: debian-buster - container: debian:buster - - name: ubuntu-1804 - container: ubuntu:18.04 - steps: - - name: Install tools - run: apt-get update && apt-get install --yes patch unzip git gcc make curl pkg-config xz-utils - - name: Checkout r2 - run: | - git clone https://github.com/${{ github.repository }} - cd radare2 - git fetch origin ${{ github.ref }} - git checkout -b local_branch FETCH_HEAD - - name: Preparing the deb package - run: | - sys/debian.sh - mv radare2_*_amd64.deb radare2_amd64.deb - mv radare2-dev_*_amd64.deb radare2-dev_amd64.deb - working-directory: radare2 - - name: Upload deb file - uses: actions/upload-artifact@v2 - with: - name: radare2-${{ matrix.name }}-deb - path: radare2/radare2_amd64.deb - - name: Upload -dev deb file - uses: actions/upload-artifact@v2 - with: - name: radare2-dev-${{ matrix.name }}-deb - path: radare2/radare2-dev_amd64.deb - - build-osx-pkg: - name: Build OSX package - runs-on: macos-latest - if: contains(github.head_ref, 'osx') || (contains(github.ref, 'release-') && github.event_name == 'push') || github.event_name == 'schedule' - needs: [build-and-test] - steps: - - uses: actions/checkout@v2 - - name: Install pkg-config with Homebrew - run: brew install pkg-config - - name: Create OSX package - run: | - ./sys/osx-pkg.sh - mv sys/osx-pkg/radare2-*.pkg sys/osx-pkg/radare2.pkg - - name: Upload .pkg file - uses: actions/upload-artifact@v2 - with: - name: radare2.pkg - path: sys/osx-pkg/radare2.pkg - - build-windows: - name: Build Windows zip/installer ${{ matrix.name }} + windows-dist: + name: windows-${{ matrix.name }} + if: contains(github.ref, 'release-') runs-on: windows-latest - if: contains(github.head_ref, 'windows') || (github.event_name == 'push' && contains(github.ref, 'release-')) - needs: [build-and-test] strategy: fail-fast: false matrix: @@ -481,7 +78,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install meson ninja + pip install meson ninja r2pipe - name: Extract r2 version shell: pwsh run: echo "##[set-output name=branch;]$( python sys\\version.py )" @@ -495,11 +92,11 @@ jobs: ninja -C build install - name: Create zip artifact shell: pwsh - run: 7z a radare2-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip $PWD\radare2-install + run: 7z a radare2-git.zip $PWD\radare2-install - uses: actions/upload-artifact@v2 with: - name: radare2-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip - path: .\radare2-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip + name: radare2-git.zip + path: .\radare2-git.zip - uses: actions/checkout@v2 with: repository: radareorg/radare2-win-installer @@ -509,14 +106,143 @@ jobs: run: iscc radare2-win-installer\radare2.iss /DRadare2Location=..\radare2-install\* /DLicenseLocation=..\COPYING.LESSER /DIcoLocation=radare2.ico /DMyAppVersion=${{ steps.extract_version.outputs.branch }} - uses: actions/upload-artifact@v2 with: - name: radare2_installer-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }} + name: radare2_installer-git path: radare2-win-installer\Output\radare2.exe - build-ios-cydia: - name: Build iOS Cydia packages + # LINUX + linux-static: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Building static r2 + run: | + cp -f dist/plugins-cfg/plugins.static.nogpl.cfg plugins.cfg + NOLTO=1 sys/static.sh + make -C binr/blob + xz binr/blob/radare2 + - name: Pub + uses: actions/upload-artifact@v2 + with: + name: radare2-static.xz + path: binr/blob/radare2.xz + linux-acr-deb: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Packaging for Debian + cflags: '-Werror -Wno-cpp' + run: sys/debian.sh + - name: Pub + uses: actions/upload-artifact@v2 + with: + path: dist/debian/*/*.deb +## RPM PACKAGES DISABLED +# linux-meson-rpm: +# runs-on: ubuntu-18.04 +# container: centos:8 +# steps: +# - name: Checkout +# uses: actions/checkout@v2 +# - name: Prepare Skeleton +# run: | +# mkdir -p SOURCES SPECS +# cp -f dist/rpm/*spec SPECS +# wget -O https://github.com/radareorg/radare2/archive/master/radare2-5.1.0-git.tar.gz +# - name: rpmbuild +# uses: robertdebock/rpmbuild-action@1.1.1 +# - name: Pub +# uses: actions/upload-artifact@v2 +# with: +# path: RPMS/*/*.rpm *.rpm dist/rpm/*.rpm +# centos-meson-rpm: +# runs-on: ubuntu-18.04 +# container: centos:8 +# steps: +# - name: Checkout +# uses: actions/checkout@v2 +# - name: Install tools for CentOS:8 +# run: | +# yum install -y patch unzip git gcc make python38 python38-pip rpm-build rpmdevtools wget +# pip3.8 install meson ninja r2pipe +# - name: Building with Meson +# run: | +# meson build +# ninja -C build +# ninja -C build install +# - name: RPM Packaging +# run: | +# cp -f dist/rpm/radare2.spec . +# rpmdev-setuptree +# mkdir -p rpmbuild/SOURCES +# cd rpmbuild/SOURCES +# wget https://github.com/radareorg/radare2/archive/5860c3efc12d4b75e72bdce4b1d3834599620913/radare2-5.1.0-git.tar.gz +# cd - +# rpmbuild -ba radare2.spec +# - name: Pub +# uses: actions/upload-artifact@v2 +# with: +# path: rpmbuild/RPMS/*/*.rpm + linux-asan: + runs-on: ubuntu-latest + if: contains(github.ref, 'release-') + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Building Radare2 + run: | + pip install r2pipe + sys/sanitize.sh + - name: Running tests + run: make tests + - name: Run fuzz tests + run: make -C test fuzz-tests + linux-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Building Radare2 + run: | + pip install r2pipe + sys/install.sh + - name: Running tests + run: make tests + + # Apple + macos-acr: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Packaging + run: dist/macos/build-pkg.sh + - name: Building Radare2 + run: sys/install.sh > /dev/null + - name: Pub + uses: actions/upload-artifact@v2 + with: + path: dist/macos/*.pkg + macos-test: + runs-on: macos-latest + if: contains(github.ref, 'mac-') + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Building Radare2 + cflags: '-Werror -Wno-cpp' + run: sys/install.sh > /dev/null + - name: Running tests + run: make tests + - name: Pub + uses: actions/upload-artifact@v2 + with: + path: dist/macos/*.pkg + + # Mobile + ios-cydia: runs-on: macos-latest - if: contains(github.head_ref, 'ios') || (contains(github.ref, 'release-') && github.event_name == 'push') || github.event_name == 'schedule' - needs: [build-and-test] steps: - uses: actions/checkout@v2 - name: Extract r2 version @@ -525,30 +251,34 @@ jobs: id: extract_version - name: Install pkg-config/ldid2 with Homebrew run: brew install pkg-config ldid - - name: Create cydia32 package - run: ./sys/ios-cydia32.sh - - name: List sys/cydia - run: ls -lahR ./sys/cydia - - uses: actions/upload-artifact@v2 - with: - name: radare2-arm32_${{ steps.extract_version.outputs.branch }}_iphoneos-arm - path: ./sys/cydia/radare2/radare2-arm32_${{ steps.extract_version.outputs.branch }}_iphoneos-arm.deb +# - name: Create cydia32 package +# run: ./sys/ios-cydia32.sh +# - name: List sys/cydia +# run: ls -lahR ./sys/cydia +# - uses: actions/upload-artifact@v2 +# with: +# name: radare2-arm32_${{ steps.extract_version.outputs.branch }}_iphoneos-arm +# path: ./sys/cydia/radare2/radare2-arm32_${{ steps.extract_version.outputs.branch }}_iphoneos-arm.deb - name: Create cydia package run: ./sys/ios-cydia.sh + - name: Create iOS SDK + run: | + ./sys/ios-sdk.sh + cd /tmp/r2ios + zip -r /tmp/r2ios-sdk.zip * - uses: actions/upload-artifact@v2 with: - name: radare2_${{ steps.extract_version.outputs.branch }}_iphoneos-arm - path: ./sys/cydia/radare2/radare2_${{ steps.extract_version.outputs.branch }}_iphoneos-arm.deb + name: radare2_iphoneos-arm + path: ./sys/cydia/radare2/*.deb - build-android: - name: Build Android ${{ matrix.name }} package + android-build: runs-on: ubuntu-latest - if: contains(github.head_ref, 'android') || (contains(github.ref, 'release-') && github.event_name == 'push') || github.event_name == 'schedule' - needs: [build-and-test] + if: contains(github.ref, 'release-') strategy: fail-fast: false matrix: - name: [x86_64, arm, aarch64] + # name: [x86_64, arm, aarch64] + name: [aarch64] steps: - uses: actions/checkout@v2 - name: Install dependencies @@ -567,308 +297,3 @@ jobs: with: name: radare2-android-${{ matrix.name }} path: /tmp/radare2-android-${{ matrix.name }}.tar.gz - - build-extras: - name: Build radare2 extras and r2pipe - if: contains(github.head_ref, 'extras') || contains(github.ref, 'release-') || github.event_name == 'schedule' - needs: [create-tarball] - runs-on: ubuntu-latest - env: - TESTS: 'armthumb baleful bcl ba2 blackfin blessr2 keystone-lib keystone lang-duktape mc6809 microblaze msil pcap ppcdisasm psosvm swf unicorn-lib unicorn vc4 x86udis x86bea x86tab x86olly x86zyan z80-nc' - R2PIPE_TESTS: 'r2pipe-go r2pipe-js r2pipe-py' - steps: - - uses: actions/download-artifact@v2 - with: - name: radare2-src - path: ./ - - name: Extract source tarball - run: mkdir radare2 && tar -C radare2 --strip-components=1 -xvf radare2-src.tar.gz - - name: Install dependencies - run: sudo apt-get --assume-yes install wget unzip python3-wheel python3-setuptools build-essential python3-pip && sudo pip3 install meson ninja - - name: Install radare2 - run: | - export PATH=$PATH:/usr/local/bin - meson --prefix=/usr --buildtype=release build && ninja -C build && sudo ninja -C build install - sudo ln -s radare2 /usr/bin/r2 - working-directory: radare2 - - name: Init r2pm - run: r2pm init && r2pm update - - name: Compile and install plugins - run: | - set -e - for p in $TESTS ; do - echo $p - r2pm -i $p - done - set +e - - name: Compile and install r2pipe - run: | - set -e - for p in $R2PIPE_TESTS ; do - echo $p - r2pm -i $p - done - set +e - - test-deb: - name: Test deb packages for ${{ matrix.container }} - runs-on: ubuntu-latest - needs: [build-deb] - container: ${{ matrix.container }} - strategy: - fail-fast: false - matrix: - name: [debian-buster, ubuntu-1804] - include: - - name: debian-buster - container: debian:buster - - name: ubuntu-1804 - container: ubuntu:18.04 - steps: - - name: Install tools - run: apt-get update && apt-get install --yes gcc pkg-config - - uses: actions/download-artifact@v2 - with: - name: radare2-${{ matrix.name }}-deb - path: ./ - - uses: actions/download-artifact@v2 - with: - name: radare2-dev-${{ matrix.name }}-deb - path: ./ - - name: Install radare2 debs - run: apt-get update && apt-get install ./radare2*.deb - - name: Check that installed radare2 runs - run: radare2 -qcq /bin/ls - - name: Check that libraries can be used - shell: bash - run: | - echo -e "#include \nint main(int argc, char **argv) { return r_str_newf (\"%s\", argv[0]) != NULL? 0: 1; }" > test.c - gcc -o test test.c $(pkg-config --libs --cflags r_util) - ./test - - test-osx-pkg: - name: Test OSX pkg - runs-on: macos-latest - needs: [build-osx-pkg] - steps: - - name: Install pkg-config with Homebrew - run: brew install pkg-config - - uses: actions/download-artifact@v2 - with: - name: radare2.pkg - path: ./ - - name: Install radare2.pkg - run: sudo installer -pkg ./radare2.pkg -target / - - name: Check that installed radare2 runs - run: radare2 -qcq /bin/ls - - name: Check that libraries can be used - run: | - echo -e "#include \nint main(int argc, char **argv) { return r_str_newf (\"%s\", argv[0]) != NULL? 0: 1; }" > test.c - clang -o test test.c $(pkg-config --libs --cflags r_util) - ./test - - test-windows-clang_cl: - name: Test Windows installer built with clang_cl - runs-on: windows-latest - needs: [build-windows] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - name: Install pkg-config - shell: pwsh - run: choco install -y pkgconfiglite - - name: Extract r2 version - shell: pwsh - run: echo "##[set-output name=branch;]$( python sys\\version.py )" - id: extract_version - - uses: actions/download-artifact@v2 - with: - name: radare2_installer-clang_cl-${{ steps.extract_version.outputs.branch }} - path: ./ - - name: Install radare.exe - shell: pwsh - run: Start-Process -Wait -FilePath .\radare2.exe -ArgumentList "/SP- /SILENT" -PassThru - - name: Check that installed radare2 runs - shell: pwsh - run: ~\AppData\Local\Programs\radare2\bin\radare2.exe -qcq .\radare2.exe - - name: Check that libraries can be used - shell: pwsh - run: | - .github\vsdevenv.ps1 - $env:PATH = "$env:PATH;C:$env:HOMEPATH\AppData\Local\Programs\radare2\bin" - $env:PKG_CONFIG_PATH = "C:$env:HOMEPATH\AppData\Local\Programs\radare2\lib\pkgconfig" - $env:PKG_CONFIG_PATH - pkg-config --list-all - echo "#include `nint main(int argc, char **argv) { return r_str_newf (`"%s`", argv[0]) != NULL? 0: 1; }" > test.c - cl -IC:$env:HOMEPATH\AppData\Local\Programs\radare2\include\libr -IC:$env:HOMEPATH\AppData\Local\Programs\radare2\include\libr\sdb /Fetest.exe test.c /link /libpath:C:$env:HOMEPATH\AppData\Local\Programs\radare2\lib r_util.lib - .\test.exe - - create-release: - name: Create draft release and upload artifacts - runs-on: ubuntu-latest - if: github.event_name == 'push' && contains(github.ref, 'release-') - needs: [ - build-and-test, - build-centos6, - build-debian, - build-static, - test-deb, - build-android, - test-osx-pkg, - test-windows-clang_cl, - build-ios-cydia, - build-extras - ] - steps: - - uses: actions/checkout@v2 - - name: Extract r2 version - shell: bash - run: echo "##[set-output name=branch;]$(python sys/version.py)" - id: extract_version - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.extract_version.outputs.branch }} - release_name: Release ${{ steps.extract_version.outputs.branch }} - draft: true - prerelease: false - - uses: actions/download-artifact@v2 - - name: Display structure of downloaded files - run: ls -R - - name: Upload radare2 src tarball - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-src/radare2-src.tar.gz - asset_name: radare2-src-${{ steps.extract_version.outputs.branch }}.tar.gz - asset_content_type: application/zip - - name: Upload radare2 debian:buster package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-debian-buster-deb/radare2_amd64.deb - asset_name: radare2-debian-buster_${{ steps.extract_version.outputs.branch }}_amd64.deb - asset_content_type: application/zip - - name: Upload radare2-dev debian:buster package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-dev-debian-buster-deb/radare2-dev_amd64.deb - asset_name: radare2-dev-debian-buster_${{ steps.extract_version.outputs.branch }}_amd64.deb - asset_content_type: application/zip - - name: Upload radare2 ubuntu:18.04 package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-ubuntu-1804-deb/radare2_amd64.deb - asset_name: radare2-ubuntu-1804_${{ steps.extract_version.outputs.branch }}_amd64.deb - asset_content_type: application/zip - - name: Upload radare2-dev ubuntu:18.04 package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-dev-ubuntu-1804-deb/radare2-dev_amd64.deb - asset_name: radare2-dev-ubuntu-1804_${{ steps.extract_version.outputs.branch }}_amd64.deb - asset_content_type: application/zip - - name: Upload radare2 android x86_64 tar.gz - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-android-x86_64/radare2-android-x86_64.tar.gz - asset_name: radare2-${{ steps.extract_version.outputs.branch }}-android-x86_64.tar.gz - asset_content_type: application/zip - - name: Upload radare2 android arm tar.gz - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-android-arm/radare2-android-arm.tar.gz - asset_name: radare2-${{ steps.extract_version.outputs.branch }}-android-arm.tar.gz - asset_content_type: application/zip - - name: Upload radare2 android aarch64 tar.gz - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-android-aarch64/radare2-android-aarch64.tar.gz - asset_name: radare2-${{ steps.extract_version.outputs.branch }}-android-aarch64.tar.gz - asset_content_type: application/zip - - name: Upload radare2 OSX pkg - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2.pkg/radare2.pkg - asset_name: radare2-macos-${{ steps.extract_version.outputs.branch }}.pkg - asset_content_type: application/zip - - name: Upload radare2 windows archive - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-vs2019_static-${{ steps.extract_version.outputs.branch }}.zip/radare2-vs2019_static-${{ steps.extract_version.outputs.branch }}.zip - asset_name: radare2-windows-static-${{ steps.extract_version.outputs.branch }}.zip - asset_content_type: application/zip - - name: Upload radare2 windows installer - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2_installer-clang_cl-${{ steps.extract_version.outputs.branch }}/radare2.exe - asset_name: radare2_installer-${{ steps.extract_version.outputs.branch }}.exe - asset_content_type: application/zip - - name: Upload radare2 iOS arm32 cydia package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2-arm32_${{ steps.extract_version.outputs.branch }}_iphoneos-arm/radare2-arm32_${{ steps.extract_version.outputs.branch }}_iphoneos-arm.deb - asset_name: radare2-arm32_${{ steps.extract_version.outputs.branch }}_iphoneos-arm.deb - asset_content_type: application/zip - - name: Upload radare2 iOS aarch64 cydia package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./radare2_${{ steps.extract_version.outputs.branch }}_iphoneos-arm/radare2_${{ steps.extract_version.outputs.branch }}_iphoneos-arm.deb - asset_name: radare2-aarch64_${{ steps.extract_version.outputs.branch }}_iphoneos-arm.deb - asset_content_type: application/zip - - publish-docker-image: - name: Publish Docker image on Docker Hub - needs: [build-and-test] - runs-on: ubuntu-latest - if: github.event_name == 'push' - steps: - - uses: actions/checkout@v2 - - name: Moving the Dockerfile to the root - run: cp -f dist/docker/Dockerfile . - - name: Publish to Registry - uses: docker/build-push-action@v1 - with: - repository: ${{ secrets.DOCKER_USERNAME }}/radare2 - tag_with_ref: true - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml deleted file mode 100644 index 0fe60a6d8a..0000000000 --- a/.github/workflows/continuous.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Continuous build -on: - push: - branches: - - master - -jobs: - build-continuous-deb: - name: Continuous deb build - runs-on: ubuntu-latest - container: debian:buster - steps: - - name: Install tools - run: apt-get update && apt-get install --yes patch unzip git gcc make curl pkg-config xz-utils wget file python - - name: Checkout r2 - run: | - git clone https://github.com/${{ github.repository }} - cd radare2 - git fetch origin ${{ github.ref }} - git checkout -b local_branch FETCH_HEAD - - name: Extract r2 version - shell: bash - run: echo "##[set-output name=branch;]$(python sys/version.py)" - id: extract_version - working-directory: radare2 - - name: Preparing the deb package - run: | - sys/debian.sh - working-directory: radare2 - - name: Upload deb file - uses: actions/upload-artifact@v2 - with: - name: radare2_${{ steps.extract_version.outputs.branch }}_amd64.deb - path: radare2/radare2_${{ steps.extract_version.outputs.branch }}_amd64.deb - - name: Upload -dev deb file - uses: actions/upload-artifact@v2 - with: - name: radare2-dev_${{ steps.extract_version.outputs.branch }}_amd64.deb - path: radare2/radare2-dev_${{ steps.extract_version.outputs.branch }}_amd64.deb - - create-release: - name: Create/Update pre-release Continuous build - runs-on: ubuntu-latest - needs: [build-continuous-deb] - steps: - - uses: actions/checkout@v2 - - name: Extract r2 version - shell: bash - run: echo "##[set-output name=branch;]$(python sys/version.py)" - id: extract_version - - uses: actions/download-artifact@v2 - - name: Display structure of downloaded files - run: ls -R - - name: Upload files - shell: bash - run: .github/upload.sh ./radare2_${{ steps.extract_version.outputs.branch }}_amd64.deb/radare2_${{ steps.extract_version.outputs.branch }}_amd64.deb ./radare2-dev_${{ steps.extract_version.outputs.branch }}_amd64.deb/radare2-dev_${{ steps.extract_version.outputs.branch }}_amd64.deb - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - UPLOADTOOL_BODY: Continuous build ${{ github.sha }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 73cbcb8983..0000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: "Pull Request Labeler" -on: - schedule: - - cron: '*/30 * * * *' - -jobs: - triage: - runs-on: ubuntu-latest - steps: - - uses: paulfantom/periodic-labeler@v0.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_REPOSITORY: ${{ github.repository }} - LABEL_MAPPINGS_FILE: .github/labeler.yml diff --git a/.github/workflows/newshell-treesitter-tests.yml b/.github/workflows/newshell-treesitter-tests.yml deleted file mode 100644 index 4a9e339c63..0000000000 --- a/.github/workflows/newshell-treesitter-tests.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Radare2 CI tree-sitter test - -on: - pull_request: - paths: - - 'shlr/tree-sitter/*' - - 'shlr/tree-sitter/lib/*' - - 'shlr/tree-sitter/lib/**/*' - - 'shlr/radare2-shell-parser/*' - - 'shlr/radare2-shell-parser/**/*' - branches: - - master - -jobs: - build: - name: radare2-shell-parser-tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: '12.x' - - run: cd shlr/radare2-shell-parser/ && npm install - - name: Run tests - run: | - cd shlr/radare2-shell-parser - export PATH=${PATH}:./node_modules/.bin - tree-sitter generate - tree-sitter test diff --git a/README.md b/README.md index 2fe0d935b7..da840fdda8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ --pancake ``` -| **Build&Test** |[![Tests Status](https://github.com/radareorg/radare2/workflows/Radare2%20CI/badge.svg)](https://github.com/radareorg/radare2/actions?query=workflow%3A%22Radare2+CI%22) | [![Build Status](https://travis-ci.com/radareorg/radare2.svg?branch=master)](https://travis-ci.com/radareorg/radare2)| +| **Build&Test** | [![Tests Status](https://github.com/radareorg/radare2/workflows/Continuous%20build/badge.svg)](https://github.com/radareorg/radare2/actions?query=workflow%3A%22Continuous+build%22) | [![Build Status](https://travis-ci.com/radareorg/radare2.svg?branch=master)](https://travis-ci.com/radareorg/radare2)| |----------|------|--------| | **CodeQuality** | [![Build Status](https://scan.coverity.com/projects/416/badge.svg)](https://scan.coverity.com/projects/416) | [![Total alerts](https://img.shields.io/lgtm/alerts/g/radareorg/radare2.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/radareorg/radare2/alerts/) | | **Coverage** | [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/741/badge)](https://bestpractices.coreinfrastructure.org/projects/741) | [![codecov](https://codecov.io/gh/radareorg/radare2/branch/master/graph/badge.svg)](https://codecov.io/gh/radareorg/radare2) | diff --git a/binr/blob/Makefile b/binr/blob/Makefile index a86c77eb07..a2177cfdc2 100644 --- a/binr/blob/Makefile +++ b/binr/blob/Makefile @@ -66,6 +66,7 @@ include ../../shlr/ar/deps.mk include ../../shlr/sdb.mk include ../../shlr/capstone.mk include ../../shlr/radare2-shell-parser-deps.mk +LINK+=$(SHLR)/tcc/libr_tcc.a all: symlinks diff --git a/dist/plugins-cfg/plugins.static.nogpl.cfg b/dist/plugins-cfg/plugins.static.nogpl.cfg index d23ae7a9ec..481e9e65fe 100644 --- a/dist/plugins-cfg/plugins.static.nogpl.cfg +++ b/dist/plugins-cfg/plugins.static.nogpl.cfg @@ -19,8 +19,6 @@ anal.mips_cs anal.mips_gnu anal.nios2 anal.null -anal.ppc_cs -anal.ppc_gnu anal.sh anal.sparc_cs anal.sparc_gnu @@ -57,8 +55,6 @@ asm.malbolge asm.mips_cs asm.mips_gnu asm.nios2 -asm.ppc_cs -asm.ppc_gnu asm.propeller asm.riscv asm.lanai_gnu @@ -130,7 +126,6 @@ bin.psxexe bp.arm bp.bf bp.mips -bp.ppc bp.x86 core.a2f core.java @@ -201,7 +196,6 @@ parse.att2intel parse.dalvik_pseudo parse.m68k_pseudo parse.mips_pseudo -parse.ppc_pseudo parse.sh_pseudo parse.avr_pseudo parse.wasm_pseudo diff --git a/radare2.spec b/dist/rpm/radare2.spec similarity index 86% rename from radare2.spec rename to dist/rpm/radare2.spec index c9de1f3a2c..a7d3d96ad3 100644 --- a/radare2.spec +++ b/dist/rpm/radare2.spec @@ -1,19 +1,20 @@ -%global gituser radare +%global gituser radareorg %global gitname radare2 -#global commit a093958b6d24015d82782eb20a2e10d8f4afcd85 -%global commit 5a3dab0a86e1452c0bb0c13d869f95b41f50b9a9 +#global commit 5a3dab0a86e1452c0bb0c13d869f95b41f50b9a9 +%global commit 5860c3efc12d4b75e72bdce4b1d3834599620913 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: radare2 -Version: 0.10.0 +Version: 5.1.0 Release: 1%{?dist} Summary: The %{name} reverse engineering framework Group: Applications/Engineering License: LGPLv3 -URL: http://radare.org/ +URL: https://www.radare.org/ #Source0: http://radare.org/get/%{name}-%{version}.tar.gz #Source0: http://radare.org/get/%{name}-%{version}.tar.xz -Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz +# Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz +Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-git.tar.gz BuildRequires: file-devel @@ -106,6 +107,9 @@ cp shlr/sdb/src/libsdb.a %{buildroot}/%{_libdir}/libsdb.a %changelog +* Sat Oct 10 2020 pancake 5.1.0 +- update for latest centos8 and r2 codebase + * Sat Oct 10 2015 Michal Ambroz 0.10.0-1 - build for Fedora for alpha of 0.10.0 diff --git a/libr/anal/rtti_msvc.c b/libr/anal/rtti_msvc.c index 0336a13fb5..fe77619013 100644 --- a/libr/anal/rtti_msvc.c +++ b/libr/anal/rtti_msvc.c @@ -502,7 +502,7 @@ R_API void r_anal_rtti_msvc_print_base_class_descriptor(RVTableContext *context, static bool rtti_msvc_print_complete_object_locator_recurse(RVTableContext *context, ut64 atAddress, int mode, bool strict) { bool use_json = mode == 'j'; - PJ *pj; + PJ *pj = NULL; ut64 colRefAddr = atAddress - context->word_size; ut64 colAddr; @@ -606,7 +606,7 @@ static bool rtti_msvc_print_complete_object_locator_recurse(RVTableContext *cont } } - if(use_json) { + if (use_json) { pj_end (pj); } } diff --git a/libr/anal/var.c b/libr/anal/var.c index 565d290a9d..213420e671 100644 --- a/libr/anal/var.c +++ b/libr/anal/var.c @@ -1008,7 +1008,7 @@ R_API void r_anal_extract_rarg(RAnal *anal, RAnalOp *op, RAnalFunction *fcn, int } } if (!vname) { - name = r_str_newf ("arg%zu", i + 1); + name = r_str_newf ("arg%u", (int)i + 1); vname = name; } r_anal_function_set_var (fcn, delta, R_ANAL_VAR_KIND_REG, type, size, true, vname); diff --git a/libr/bin/format/mach0/mach0_specs.h b/libr/bin/format/mach0/mach0_specs.h index 61957d90fe..aa6c49398a 100644 --- a/libr/bin/format/mach0/mach0_specs.h +++ b/libr/bin/format/mach0/mach0_specs.h @@ -1,4 +1,3 @@ - #ifndef _INCLUDE_R_BIN_MACH0_SPECS_H_ #define _INCLUDE_R_BIN_MACH0_SPECS_H_ diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index c81fdd6324..aafdc3791e 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -3422,7 +3422,9 @@ R_API int r_core_config_init(RCore *core) { #endif free (p); r_config_desc (cfg, "cfg.editor", "Select default editor program"); - SETPREF ("cfg.user", r_sys_whoami (buf), "Set current username/pid"); + char *whoami = r_sys_whoami (); + SETPREF ("cfg.user", whoami, "Set current username/pid"); + free (whoami); SETCB ("cfg.fortunes", "true", &cb_cfg_fortunes, "If enabled show tips at start"); SETCB ("cfg.fortunes.type", "tips,fun", &cb_cfg_fortunes_type, "Type of fortunes to show (tips, fun)"); SETBPREF ("cfg.fortunes.clippy", "false", "Use ?E instead of ?e"); diff --git a/libr/core/citem.c b/libr/core/citem.c index c0d74a3f45..5f13b0f8fd 100644 --- a/libr/core/citem.c +++ b/libr/core/citem.c @@ -87,4 +87,3 @@ R_API void r_core_item_free (RCoreItem *ci) { free (ci->data); free (ci); } - diff --git a/libr/core/visual.c b/libr/core/visual.c index 8dd5b7c808..6f23f7e5f8 100644 --- a/libr/core/visual.c +++ b/libr/core/visual.c @@ -43,7 +43,6 @@ static const char *printfmtColumns[NPF] = { "pCc", // PC// copypasteable views }; - // to print the stack in the debugger view #define PRINT_HEX_FORMATS 10 #define PRINT_3_FORMATS 2 diff --git a/libr/include/r_util/r_sys.h b/libr/include/r_util/r_sys.h index 96fffa0d4f..4ba819ce34 100644 --- a/libr/include/r_util/r_sys.h +++ b/libr/include/r_util/r_sys.h @@ -65,7 +65,7 @@ R_API char *r_sys_getenv(const char *key); R_API bool r_sys_getenv_asbool(const char *key); R_API int r_sys_setenv(const char *key, const char *value); R_API int r_sys_clearenv(void); -R_API char *r_sys_whoami(char *buf); +R_API char *r_sys_whoami(void); R_API char *r_sys_getdir(void); R_API int r_sys_chdir(const char *s); R_API bool r_sys_aslr(int val); diff --git a/libr/util/sandbox.c b/libr/util/sandbox.c index 12e0b5d204..bb20ffac2b 100644 --- a/libr/util/sandbox.c +++ b/libr/util/sandbox.c @@ -222,6 +222,9 @@ R_API int r_sandbox_system(const char *x, int n) { char *argv0 = r_file_path (argv[0]); pid_t pid = 0; int r = posix_spawn (&pid, argv0, NULL, NULL, argv, NULL); + if (r != 0) { + return -1; + } int status; int s = waitpid (pid, &status, 0); return WEXITSTATUS (s); diff --git a/libr/util/sys.c b/libr/util/sys.c index 3008d2f59e..55cb1470d7 100644 --- a/libr/util/sys.c +++ b/libr/util/sys.c @@ -148,7 +148,11 @@ R_API int r_sys_fork(void) { #endif } -#if HAVE_SIGACTION +#if __WINDOWS__ +R_API int r_sys_sigaction(int *sig, void (*handler) (int)) { + return -1; +} +#elif HAVE_SIGACTION R_API int r_sys_sigaction(int *sig, void (*handler) (int)) { struct sigaction sigact = { }; int ret, i; @@ -171,7 +175,6 @@ R_API int r_sys_sigaction(int *sig, void (*handler) (int)) { return ret; } } - return 0; } #else @@ -1237,15 +1240,18 @@ R_API void r_sys_set_environ(char **e) { env = e; } -R_API char *r_sys_whoami (char *buf) { - char _buf[32]; - int uid = getuid (); - int hasbuf = (buf)? 1: 0; - if (!hasbuf) { - buf = _buf; +R_API char *r_sys_whoami(void) { + char buf[32]; +#if __WINDOWS__ + DWORD buf_sz = sizeof (buf); + if (!GetUserName(buf, (LPDWORD)&buf_sz) ) { + return strdup ("?"); } - sprintf (buf, "uid%d", uid); - return hasbuf? buf: strdup (buf); +#else + int uid = getuid (); + snprintf (buf, sizeof (buf), "uid%d", uid); +#endif + return strdup (buf); } R_API int r_sys_getpid(void) { diff --git a/meson.build b/meson.build index 4da17c93bd..a1969cffc4 100644 --- a/meson.build +++ b/meson.build @@ -507,7 +507,7 @@ install_headers(sdb_inc_files, install_dir: join_paths(r2_incdir, 'sdb')) libr2sdb = static_library('r2sdb', sdb_files, include_directories: sdb_inc, implicit_include_directories: false, - c_args: host_machine.system() == 'windows' ? '-DSDB_API=__declspec(dllexport)' : [], + c_args: host_machine.system() == 'windows' ? '-DSDB_IPI= -DSDB_API=__declspec(dllexport)' : [], ) sdb_dep = declare_dependency( diff --git a/shlr/Makefile b/shlr/Makefile index ffb167535a..717fd75c56 100644 --- a/shlr/Makefile +++ b/shlr/Makefile @@ -128,6 +128,7 @@ $(SDB_LIBA): $(MAKE) sdb-target sdbs: $(SDB_HOST) + $(MAKE) $(SDB_LIBA) sdb-host: @echo @@ -139,6 +140,7 @@ sdb-host: $(MAKE) -C sdb/src "CC=${HOST_CC}" LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='' CFLAGS='${HOST_CFLAGS} ${PIC}' bin cp -f sdb/src/sdb${BUILD_EXT_EXE} sdb/src/.sdb${BUILD_EXT_EXE} cp -f sdb/src/sdb${BUILD_EXT_EXE} sdb/sdb$(BUILD_EXT_EXE) + rm -f $(SDB_LIBA) -file sdb/sdb$(BUILD_EXT_EXE) sdb-target: @@ -373,6 +375,7 @@ spp-sync sync-spp: spp: spp-sync CFLAGS="-DUSE_R2=1 -I../../libr/include -DHAVE_FORK=${HAVE_FORK} -fPIC" $(MAKE) -C spp r2lib +SHLRS+=tcc/libr_tcc.a SHLRS+=ar/libr_ar.a SHLRS+=bochs/lib/libbochs.a SHLRS+=capstone/libcapstone.a diff --git a/shlr/sdb/src/Makefile b/shlr/sdb/src/Makefile index d25274c751..81cc37eda8 100644 --- a/shlr/sdb/src/Makefile +++ b/shlr/sdb/src/Makefile @@ -44,7 +44,12 @@ endif ${AR} q libsdb.a ${OBJ} ${RANLIB} libsdb.a +ifeq ($(CC),tcc) +libsdb.${SOVER}: + @echo TCC doesnt support shared libs on macos +else libsdb.${SOVER}: sdb_objs2 +endif ifneq ($(EXT_SO),${SOVER}) ln -fs libsdb.${SOVER} libsdb.${EXT_SO} endif diff --git a/shlr/sdb/src/types.h b/shlr/sdb/src/types.h index 7421a3c9a5..8200cc8b18 100644 --- a/shlr/sdb/src/types.h +++ b/shlr/sdb/src/types.h @@ -13,6 +13,7 @@ // Copied from https://gcc.gnu.org/wiki/Visibility #ifndef SDB_API + #undef SDB_IPI #if defined _WIN32 || defined __CYGWIN__ #ifdef __GNUC__ #define SDB_API __attribute__ ((dllexport)) diff --git a/sys/build-shlib.sh b/sys/build-shlib.sh index 51b747e0c0..daf7858a6a 100755 --- a/sys/build-shlib.sh +++ b/sys/build-shlib.sh @@ -2,6 +2,6 @@ rm -rf shlr/capstone make mrproper -cp -f plugins.static.nogpl.cfg plugins.cfg +cp -f dist/plugins-cfg/plugins.static.nogpl.cfg plugins.cfg ./configure --prefix=/usr --with-libr make -j4 diff --git a/sys/ios-cydia.sh b/sys/ios-cydia.sh index 0355195bb0..ac7e411182 100755 --- a/sys/ios-cydia.sh +++ b/sys/ios-cydia.sh @@ -45,28 +45,28 @@ makeDeb() { make install DESTDIR=/tmp/r2ios rm -rf /tmp/r2ios/${PREFIX}/share/radare2/*/www/*/node_modules ( cd /tmp/r2ios && tar czvf ../r2ios-${CPU}.tar.gz ./* ) - rm -rf $(ROOT) - mkdir -p $(ROOT) - sudo tar xpzvf /tmp/r2ios-${CPU}.tar.gz -C $(ROOT) - rm -f $(ROOT)/${PREFIX}/lib/*.{a,dylib,dSYM} + rm -rf "${ROOT}" + mkdir -p "${ROOT}" + sudo tar xpzvf /tmp/r2ios-${CPU}.tar.gz -C "${ROOT}" + rm -f ${ROOT}/${PREFIX}/lib/*.{a,dylib,dSYM} if [ "$static" = 1 ]; then ( - rm -f $(ROOT)/${PREFIX}/bin/* - cp -f binr/blob/radare2 $(ROOT)/${PREFIX}/bin - cd $(ROOT)/${PREFIX}/bin + rm -f ${ROOT}/${PREFIX}/bin/* + cp -f binr/blob/radare2 "${ROOT}/${PREFIX}/bin" + cd ${ROOT}/${PREFIX}/bin for a in r2 rabin2 rarun2 rasm2 ragg2 rahash2 rax2 rafind2 radiff2 ; do ln -fs radare2 $a ; done ) echo "Signing radare2" - ldid2 -Sbinr/radare2/radare2_ios.xml $(ROOT)/usr/bin/radare2 + ldid2 -Sbinr/radare2/radare2_ios.xml ${ROOT}/usr/bin/radare2 else - for a in $(ROOT)/usr/bin/* $(ROOT)/usr/lib/*.dylib ; do + for a in "${ROOT}/usr/bin/"* "${ROOT}/usr/lib/"*.dylib ; do echo "Signing $a" ldid2 -Sbinr/radare2/radare2_ios.xml $a done fi if [ "${STOW}" = 1 ]; then ( - cd $(ROOT)/ + cd "${ROOT}/" mkdir -p usr/bin # stow echo "Stowing ${PREFIX} into /usr..." @@ -94,9 +94,10 @@ if [ $onlymakedeb = 1 ]; then makeDeb else RV=0 + export CC="ios-sdk-gcc" if [ $fromscratch = 1 ]; then make clean - cp -f plugins.ios.cfg plugins.cfg + cp -f dist/plugins-cfg/plugins.ios.cfg plugins.cfg if [ "$static" = 1 ]; then ./configure --prefix="${PREFIX}" --with-ostype=darwin --without-libuv \ --with-compiler=ios-sdk --target=arm-unknown-darwin --with-libr diff --git a/sys/ios-static.sh b/sys/ios-static.sh index ce50d7b82a..80fd22bdd0 100755 --- a/sys/ios-static.sh +++ b/sys/ios-static.sh @@ -63,8 +63,8 @@ fi if [ "${CLEAN_BUILD}" = 1 ] ; then ${MAKE} clean -cp -f plugins.tiny.cfg plugins.cfg -cp -f plugins.ios.cfg plugins.cfg +# cp -f plugins.tiny.cfg plugins.cfg +cp -f dist/plugins-cfg/plugins.ios.cfg plugins.cfg ./configure --prefix="${PREFIX}" \ ${CFGFLAGS} \ diff --git a/sys/meson.py b/sys/meson.py index 5b4fd5d66f..66df784e13 100755 --- a/sys/meson.py +++ b/sys/meson.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python """Meson build for radare2""" import argparse diff --git a/sys/sdk.sh b/sys/sdk.sh index afdbedaece..0248b05af4 100755 --- a/sys/sdk.sh +++ b/sys/sdk.sh @@ -14,7 +14,7 @@ fi export CFLAGS="-Os -fPIC" make mrproper if [ -z "${R2_PLUGINS_CFG}" ]; then - R2_PLUGINS_CFG=plugins.bin.cfg + R2_PLUGINS_CFG=dist/plugins-cfg/plugins.bin.cfg fi cp -f "${R2_PLUGINS_CFG}" plugins.cfg #./configure-plugins diff --git a/sys/static.sh b/sys/static.sh index a6c8adc8de..441bbbc801 100755 --- a/sys/static.sh +++ b/sys/static.sh @@ -5,8 +5,10 @@ case "$(uname)" in Linux) LDFLAGS="${LDFLAGS} -lpthread -ldl -lutil -lm" - CFLAGS="${CFLAGS} -flto" - LDFLAGS="${LDFLAGS} -flto" + if [ "$NOLTO" != 1 ]; then + CFLAGS="${CFLAGS} -flto" + LDFLAGS="${LDFLAGS} -flto" + fi if [ -n "`gcc -v 2>&1 | grep gcc`" ]; then export AR=gcc-ar fi @@ -44,8 +46,7 @@ if [ 1 = "${DOCFG}" ]; then ${MAKE} mrproper > /dev/null 2>&1 fi export CFLAGS="${CFLAGS} -fPIC" - #cp -f plugins.static.cfg plugins.cfg - cp -f plugins.static.nogpl.cfg plugins.cfg + cp -f dist/plugins-cfg/plugins.static.nogpl.cfg plugins.cfg ./configure-plugins || exit 1 #./configure --prefix="$PREFIX" --without-gpl --with-libr --without-libuv --disable-loadlibs || exit 1 ./configure --prefix="$PREFIX" --without-gpl --with-libr --without-libuv || exit 1 diff --git a/sys/tiny.sh b/sys/tiny.sh index e9ee58824a..1fb2329e40 100755 --- a/sys/tiny.sh +++ b/sys/tiny.sh @@ -15,7 +15,7 @@ export AR="emar" CFGFLAGS="--prefix=/usr" make mrproper -cp -f plugins.tiny.cfg plugins.cfg +cp -f dist/plugins-cfg/plugins.tiny.cfg plugins.cfg ./configure-plugins # shellcheck disable=SC2086 diff --git a/sys/wasm.sh b/sys/wasm.sh index eceaf1213f..9b62bce5be 100755 --- a/sys/wasm.sh +++ b/sys/wasm.sh @@ -15,7 +15,7 @@ export AR="emar" CFGFLAGS="./configure --prefix=/usr --disable-debugger --with-compiler=wasm --with-libr" make mrproper -cp -f plugins.emscripten.cfg plugins.cfg +cp -f dist/plugins-cfg/plugins.emscripten.cfg plugins.cfg ./configure-plugins ./configure ${CFGFLAGS} --host=wasm && \