Remove cutter win32 (#58)

* remove cutter_win32
* build without compile errors
* temporary workaround for sdb problems (now compiles again at least)
* totally not a hack to get sdb working
seriously, don't do this but it works
This commit is contained in:
Duncan Ogilvie 2017-10-15 21:19:48 +02:00 committed by xarkes
parent ff080c1d3c
commit e3e070d094
20 changed files with 212 additions and 51 deletions

View File

@ -14,45 +14,28 @@ branches:
# Environment
environment:
PYTHON: 'C:\\Python36-x64'
BDIR: build-cmake
NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip
PYTHON: 'C:\Python36-x64'
NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip
QTDIR: 'C:\Qt\5.9.1\msvc2015_64'
install:
- cmd: git submodule init && git submodule update
- cmd: if defined BDIR ( %PYTHON%\python.exe -m pip install meson && COPY %PYTHON%\Scripts\meson.py radare2\meson.py )
- cmd: if defined NINJA_URL ( powershell -Command wget %NINJA_URL% -OutFile radare2\ninja.zip && unzip radare2\ninja.zip -d radare2\ )
QT32PATH: 'C:\Qt\5.9.1\msvc2015'
QT64PATH: 'C:\Qt\5.9.1\msvc2015_64'
VSVARSALLPATH: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat'
before_build:
# Build r2 and generate sln
- cmd: cd radare2 && set "PATH=%PYTHON%;%PATH%" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && meson.bat --release --shared && sys\meson_install.bat --with-static dist && cd ..
# Build cutter
- cmd: set "PATH=%PATH%;%QTDIR%\bin;" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && cd src && qmake -config release -tp vc cutter.pro && cd ..
- cmd: prepare_r2.bat
# Build config
build:
project: src\cutter.vcxproj
after_build:
# Install r2
- cmd: move radare2\dist cutter
- cmd: cd cutter && dir
- cmd: for %%v in (*.dll) do echo %%v
- cmd: for %%v in (*.dll) do ren %%v lib%%v
- cmd: cd ..
# Install cutter
- cmd: windeployqt src\release\cutter.exe --dir cutter
- cmd: move src\release\cutter.exe cutter\
- cmd: set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PATH%" && zip -r cutter.zip cutter
build_script:
- cmd: build.bat 32
- cmd: build.bat 64
# Tests
test: off
# Artifacts
artifacts:
- path: cutter.zip
name: Cutter
- path: build32\cutter32
- path: build64\cutter64
#deploy:
# release: cutter-1.0-$(appveyor_build_version)

12
.gitignore vendored
View File

@ -59,4 +59,16 @@ Win32/
x64/
*.dir/
build*/
release/
debug/
*.orig
/src/*.vcxproj
/src/*.vcxproj.filters
/src/cutter_resource.rc
#prepare_r2
meson.py
ninja.exe
/dist32/
/dist64/
*.pdb

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "radare2"]
path = radare2
url = https://github.com/radare/radare2
[submodule "cutter_win32"]
path = cutter_win32
url = https://github.com/radareorg/cutter_win32

43
build.bat Normal file
View File

@ -0,0 +1,43 @@
@echo off
echo Setting path
if "%OLDPATH%"=="" set OLDPATH=%PATH%
if "%QT32PATH%"=="" set QT32PATH=C:\Qt\5.9.1\msvc2015
if "%QT64PATH%"=="" set QT64PATH=C:\Qt\5.9.1\msvc2015_64
if "%VSVARSALLPATH%"=="" set VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
if "%1"=="32" (
set "PATH=%QT32PATH%\bin;%PATH%"
call "%VSVARSALLPATH%" x86
set MSBUILDPLATFORM=Win32
) else if "%1"=="64" (
set "PATH=%QT64PATH%\bin;%PATH%"
call "%VSVARSALLPATH%" x64
set MSBUILDPLATFORM=x64
) else (
echo Usage: build.bat 32/64
goto restorepath
)
echo Preparing directory
rmdir /s /q build%1
mkdir build%1
cd build%1
echo Building cutter
qmake ..\src\cutter.pro -config release -tp vc
if not %ERRORLEVEL%==0 exit
msbuild /m cutter.vcxproj /p:Configuration=Release;Platform=%MSBUILDPLATFORM%
if not %ERRORLEVEL%==0 exit
echo Deploying cutter
mkdir cutter%1
move release\cutter.exe cutter%1\cutter.exe
xcopy /s ..\dist%1 cutter%1\
windeployqt cutter%1\cutter.exe
cd ..
:restorepath
echo Restoring path
set PATH=%OLDPATH%
set OLDPATH=

@ -1 +0,0 @@
Subproject commit 5f8109de359fc3e65cc0382691d99c5a7852f26e

View File

@ -0,0 +1,57 @@
#ifndef R_ADDR_INTERVAL_H
#define R_ADDR_INTERVAL_H
#pragma message("r_addr_interval_msvc.h(4): warning C1337: hacky implementation of r_addr_interval, be wary!")
//MSVC (C++) implementation of radare2/include/libr/r_util/r_addr_interval.h
//DO NOT REMOVE THE WARNING BEFORE R2 IS FIXED!
#include <r_types.h>
// An interval in 64-bit address space which is aware of address space wraparound
// Precondition: 0 <= size < 2**64 and addr + size <= 2**64
typedef struct r_addr_interval_t {
// public:
ut64 addr;
ut64 size;
} RAddrInterval;
static inline ut64 r_itv_begin(RAddrInterval itv) {
return itv.addr;
}
// Returns the right endpoint address (not included)
static inline ut64 r_itv_end(RAddrInterval itv) {
return itv.addr + itv.size;
}
// Returns true if itv contained addr
static inline bool r_itv_contain(RAddrInterval itv, ut64 addr) {
ut64 end = itv.addr + itv.size;
return itv.addr <= addr && (!end || addr < end);
}
// Returns true if x is a subset of itv
static inline bool r_itv_include(RAddrInterval itv, RAddrInterval x) {
ut64 end = itv.addr + itv.size;
return itv.addr <= x.addr && (!end || (x.addr + x.size && x.addr + x.size <= end));
}
// Returns true if itv and x overlap (implying they are non-empty)
static inline bool r_itv_overlap(RAddrInterval itv, RAddrInterval x) {
ut64 end = itv.addr + itv.size, end1 = x.addr + x.size;
return (!end1 || itv.addr < end1) && (!end || x.addr < end);
}
static inline bool r_itv_overlap2(RAddrInterval itv, ut64 addr, ut64 size) {
return r_itv_overlap (itv, RAddrInterval{addr, size});
}
// Precondition: itv and x overlap
// Returns the intersection of itv and x
static inline RAddrInterval r_itv_intersect(RAddrInterval itv, RAddrInterval x) {
ut64 addr = R_MAX (itv.addr, x.addr),
end = R_MIN (itv.addr + itv.size - 1, x.addr + x.size - 1) + 1;
return RAddrInterval{addr, end - addr};
}
#endif // R_ADDR_INTERVAL_H

View File

View File

@ -0,0 +1,10 @@
//http://stackoverflow.com/a/826027/1806760
#ifndef UNISTD_H
#define UNISTD_H
#include <stdlib.h>
#include <io.h>
#include <stdio.h>
#endif

View File

@ -0,0 +1,2 @@
# Relevant files will be placed here after running prepare_r2.bat
/libr/

2
cutter_win32/radare2/lib32/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Relevant files will be placed here after running prepare_r2.bat
/*.lib

2
cutter_win32/radare2/lib64/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Relevant files will be placed here after running prepare_r2.bat
/*.lib

54
prepare_r2.bat Normal file
View File

@ -0,0 +1,54 @@
@echo off
if "%OLDPATH%"=="" set OLDPATH=%PATH%
if "%PYTHON%"=="" set PYTHON=C:\Python36-x64
if "%NINJA_URL%"=="" set NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip
if "%VSVARSALLPATH%"=="" set VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
set "PYTHONHOME=%PYTHON%"
set "PATH=%PYTHON%;%PATH%"
git submodule update --init
echo Downloading meson and ninja
python -m pip install meson && COPY %PYTHON%\Scripts\meson.py meson.py
if defined NINJA_URL ( powershell -Command wget %NINJA_URL% -OutFile ninja.zip && unzip -o ninja.zip -d .\ && del ninja.zip )
cd radare2
echo Building radare2 (x86)
git clean -xfd
copy ..\ninja.exe .\
copy ..\meson.py .\
rmdir /s /q ..\dist32
call "%VSVARSALLPATH%" x86
call meson.bat --release --shared
if not %ERRORLEVEL%==0 exit
call sys\meson_install.bat --with-static ..\dist32
copy /Y build\r_userconf.h ..\dist32\include\libr\
copy /Y build\r_version.h ..\dist32\include\libr\
copy /Y build\shlr\liblibr2sdb.a ..\dist32\r_sdb.lib
echo Building radare2 (x64)
git clean -xfd
copy ..\ninja.exe .\
copy ..\meson.py .\
rmdir /s /q ..\dist64
call "%VSVARSALLPATH%" x64
call meson.bat --release --shared
if not %ERRORLEVEL%==0 exit
call sys\meson_install.bat --with-static ..\dist64
copy /Y build\shlr\liblibr2sdb.a ..\dist64\r_sdb.lib
cd ..
echo Copying relevant files in cutter_win32
xcopy /s /Y dist32\include\libr cutter_win32\radare2\include\libr\
copy /Y dist32\*.lib cutter_win32\radare2\lib32\
copy /Y dist64\*.lib cutter_win32\radare2\lib64\
del ninja.exe
del meson.py
set PATH=%OLDPATH%
set OLDPATH=

View File

@ -1,18 +1,10 @@
#ifndef CUTTER_H
#define CUTTER_H
#include <QMap>
#include <QDebug>
#include <QObject>
#include <QStringList>
#include <QMessageBox>
#include <QJsonDocument>
// Workaround for compile errors on Windows
#ifdef _WIN32
#include <r2hacks.h>
#endif
#include <r_addr_interval_msvc.h>
#endif //_WIN32
#include "r_core.h"
@ -22,6 +14,13 @@
#undef max
#endif //_WIN32
#include <QMap>
#include <QDebug>
#include <QObject>
#include <QStringList>
#include <QMessageBox>
#include <QJsonDocument>
#define HAVE_LATEST_LIBR2 false
#define CutterRListForeach(list, it, type, x) \

View File

@ -32,7 +32,8 @@ win32 {
-lr_socket \
-lr_fs \
-lr_magic \
-lr_crypto
-lr_crypto \
-lr_sdb
} else {
USE_PKGCONFIG = 1
R2_USER_PKGCONFIG = $$(HOME)/bin/prefix/radare2/lib/pkgconfig

View File

@ -1,8 +1,8 @@
#include <QtGui>
#include "Highlighter.h"
#include "MainWindow.h"
#include <QtGui>
Highlighter::Highlighter(QTextDocument *parent) :
QSyntaxHighlighter(parent)
{

View File

@ -1,9 +1,9 @@
#ifndef HIGHLIGHTER_H
#define HIGHLIGHTER_H
#include <QSyntaxHighlighter>
#include "cutter.h"
#include <QSyntaxHighlighter>
#include <QHash>
#include <QTextCharFormat>

View File

@ -1,9 +1,9 @@
#ifndef DISASSEMBLYVIEW_H
#define DISASSEMBLYVIEW_H
#include "cutter.h"
#include <QDockWidget>
#include <QTextEdit>
#include "cutter.h"
class DisassemblyWidget : public QDockWidget
{

View File

@ -1,10 +1,10 @@
#ifndef EXPORTSWIDGET_H
#define EXPORTSWIDGET_H
#include "cutter.h"
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
#include <memory>
#include "cutter.h"
#include "DockWidget.h"
class MainWindow;

View File

@ -38,6 +38,7 @@
**
****************************************************************************/
#include "cutter.h"
#include <math.h>
#include <QtWidgets>
#include <QDebug>
@ -46,7 +47,6 @@
#define M_PI 3.1415927
#endif
#include "cutter.h"
#include "PieView.h"
PieView::PieView(QWidget *parent)

View File

@ -1,6 +1,7 @@
#ifndef PREVIEWWIDGET_H
#define PREVIEWWIDGET_H
#include "cutter.h"
#include <QDebug>
#include <QTextEdit>
#include <QDockWidget>
@ -10,7 +11,6 @@
#include <QPlainTextEdit>
#include <QMouseEvent>
#include <memory>
#include "cutter.h"
#include "utils/Highlighter.h"
#include "utils/HexAsciiHighlighter.h"
#include "utils/HexHighlighter.h"