Update R2 submodule (#2378)

* Handle r2 sdb include path changes.
This commit is contained in:
yossizap 2020-08-13 14:08:39 +00:00 committed by GitHub
parent 63d3acb8a2
commit 83cd7e8698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 17 deletions

1
.gitignore vendored
View File

@ -59,6 +59,7 @@ src/CMakeFiles/*
ninja.exe
r2_dist_x86/
r2_dist_x64/
r2_dist/
*.pdb
# Mesonbuild

View File

@ -32,16 +32,13 @@ def set_global_vars():
r2_meson_mod.set_global_variables()
def win_dist(args):
build = os.path.join(ROOT, args.dir)
dist = os.path.join(ROOT, args.dist)
os.makedirs(dist)
r2_meson_mod.copy(os.path.join(build, 'Cutter.exe'), dist)
os.makedirs(args.dist)
r2_meson_mod.copy(os.path.join(args.dir, 'Cutter.exe'), args.dist)
log.debug('Deploying Qt5')
subprocess.call(['windeployqt', '--release', os.path.join(dist, 'Cutter.exe')])
subprocess.call(['windeployqt', '--release', os.path.join(args.dist, 'Cutter.exe')])
log.debug('Deploying libr2')
r2_meson_mod.PATH_FMT.update(r2_meson_mod.R2_PATH)
r2_meson_mod.win_dist_libr2(DIST=dist, BUILDDIR=os.path.join(build, 'subprojects', 'radare2'),
R2_DATDIR=r'radare2\share', R2_INCDIR=r'radare2\include')
r2_meson_mod.meson('install', options=[['-C', '{}'.format(args.dir)], '--no-rebuild'])
def build(args):
cutter_builddir = os.path.join(ROOT, args.dir)
@ -53,8 +50,8 @@ def build(args):
defines.append('-Dradare2:r2_libdir=radare2/lib')
defines.append('-Dradare2:r2_datdir=radare2/share')
defines.append('-Dc_args=-D_UNICODE -DUNICODE')
r2_meson_mod.meson(os.path.join(ROOT, 'src'), cutter_builddir,
prefix=cutter_builddir, backend=args.backend,
r2_meson_mod.meson('setup', rootdir=os.path.join(ROOT, 'src'), builddir=args.dir,
prefix=os.path.abspath(args.dist), backend=args.backend,
release=args.release, shared=False, options=defines)
if not args.nobuild:
log.info('Building cutter')
@ -84,6 +81,11 @@ def main():
parser.add_argument('--dist', help='dist directory')
args = parser.parse_args()
if os.name == 'nt' and not args.dist:
args.dist = args.dir
args.dist = os.path.abspath(args.dist)
args.dir = os.path.abspath(args.dir)
if hasattr(args, 'dist') and args.dist and os.path.exists(args.dist):
log.error('%s already exists', args.dist)
sys.exit(1)
@ -92,7 +94,7 @@ def main():
build(args)
if hasattr(args, 'dist') and args.dist:
if os.name == 'nt' and hasattr(args, 'dist') and args.dist:
win_dist(args)
import_r2_meson_mod()

View File

@ -16,7 +16,7 @@ ECHO Building radare2 (%PLATFORM%)
CD radare2
git clean -xfd
RMDIR /S /Q ..\%R2DIST%
rem python sys\meson.py --release --shared --install=..\%R2DIST% --options "r2_datdir=radare2/share" "r2_libdir=radare2/lib" #"c_args=-D_UNICODE -DUNICODE"
rem python sys\meson.py --release --shared --install --prefix=%CD%\..\%R2DIST% --options "r2_datdir=radare2/share" "r2_libdir=radare2/lib" #"c_args=-D_UNICODE -DUNICODE"
meson.exe r2_builddir --buildtype=release --prefix=%CD%\..\%R2DIST% || EXIT /B 1
ninja -C r2_builddir install || EXIT /B 1
IF !ERRORLEVEL! NEQ 0 EXIT /B 1

@ -1 +1 @@
Subproject commit 9d7eda5ec7367d1682e489e92d1be8e37e459296
Subproject commit 68a1db448d9007fb8548b8806cbea6698acc2066

View File

@ -3,6 +3,6 @@
scripts/r2ghidra.sh \
-DCMAKE_C_COMPILER=cl \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$APPVEYOR_BUILD_FOLDER/r2_dist;$APPVEYOR_BUILD_FOLDER/r2_dist/include/libr;$QT64PATH" \
-DCMAKE_PREFIX_PATH="$APPVEYOR_BUILD_FOLDER/r2_dist;$APPVEYOR_BUILD_FOLDER/r2_dist/include/libr;$APPVEYOR_BUILD_FOLDER/r2_dist/include/libr/sdb;$QT64PATH" \
-DCMAKE_INSTALL_PREFIX="$APPVEYOR_BUILD_FOLDER/r2_dist" \
-DRADARE2_INSTALL_PLUGDIR="$APPVEYOR_BUILD_FOLDER/r2_dist/lib/plugins"

View File

@ -112,6 +112,7 @@ macx {
unix:exists(/usr/local/include/libr)|bsd:exists(/usr/local/include/libr) {
INCLUDEPATH += /usr/local/include/libr
INCLUDEPATH += /usr/local/include/libr/sdb
}
unix {
QMAKE_LFLAGS += -rdynamic # Export dynamic symbols for plugins
@ -166,8 +167,10 @@ CUTTER_ENABLE_PYTHON {
BINDINGS_INCLUDE_DIRS = "$$[QT_INSTALL_HEADERS]" \
"$$[QT_INSTALL_HEADERS]/QtCore" \
"$$[QT_INSTALL_HEADERS]/QtWidgets" \
"$$[QT_INSTALL_HEADERS]/QtGui" \
"$$R2_INCLUDEPATH"
"$$[QT_INSTALL_HEADERS]/QtGui"
for (path, R2_INCLUDEPATH) {
BINDINGS_INCLUDE_DIRS += "$$path"
}
for(path, INCLUDEPATH) {
BINDINGS_INCLUDE_DIRS += $$absolute_path("$$path")
}

View File

@ -30,7 +30,7 @@ ExternalProject_Add(Radare2-Bundled
BUILD_COMMAND "${NINJA}"
INSTALL_COMMAND "${NINJA}" install)
set(Radare2_INCLUDE_DIRS "${RADARE2_INSTALL_DIR}/include/libr")
set(Radare2_INCLUDE_DIRS "${RADARE2_INSTALL_DIR}/include/libr" "${RADARE2_INSTALL_DIR}/include/libr/sdb")
add_library(Radare2 INTERFACE)
add_dependencies(Radare2 Radare2-Bundled)
@ -50,7 +50,9 @@ set (R2_BIN r2agent rabin2 radare2 radiff2 rafind2 ragg2 rahash2 rarun2 rasm2 ra
target_link_libraries(Radare2 INTERFACE
${R2_LIBS})
target_include_directories(Radare2 INTERFACE $<BUILD_INTERFACE:${Radare2_INCLUDE_DIRS}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libr>)
target_include_directories(Radare2 INTERFACE
"$<BUILD_INTERFACE:${Radare2_INCLUDE_DIRS}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libr>")
install(TARGETS Radare2 EXPORT CutterTargets)
if (APPLE)

View File

@ -22,6 +22,14 @@ if(WIN32)
"$ENV{HOME}/bin/prefix/radare2/include/libr"
/usr/local/include/libr
/usr/include/libr)
find_path(SDB_INCLUDE_DIR
NAMES sdb.h sdbht.h sdb_version.h
HINTS
"$ENV{HOME}/bin/prefix/radare2/include/libr/sdb"
/usr/local/include/libr/sdb
/usr/include/libr/sdb)
list(APPEND Radare2_INCLUDE_DIRS ${SDB_INCLUDE_DIR})
set(Radare2_LIBRARY_NAMES
core

View File

@ -3,6 +3,7 @@ win32 {
DEFINES += _CRT_SECURE_NO_WARNINGS
LIBS += -L"$$PWD/../r2_dist/lib"
R2_INCLUDEPATH += "$$PWD/../r2_dist/include/libr"
R2_INCLUDEPATH += "$$PWD/../r2_dist/include/libr/sdb"
INCLUDEPATH += $$R2_INCLUDEPATH
LIBS += \
@ -46,18 +47,21 @@ win32 {
} else {
LIBS += -L$$R2PREFIX/lib
R2_INCLUDEPATH += $$R2PREFIX/include/libr
R2_INCLUDEPATH += $$R2PREFIX/include/libr/sdb
USE_PKGCONFIG = 0
}
}
macx {
LIBS += -L$$R2PREFIX/lib
R2_INCLUDEPATH += $$R2PREFIX/include/libr
R2_INCLUDEPATH += $$R2PREFIX/include/libr/sdb
USE_PKGCONFIG = 0
}
bsd {
!exists($$PKG_CONFIG_PATH/r_core.pc) {
LIBS += -L$$R2PREFIX/lib
R2_INCLUDEPATH += $$R2PREFIX/include/libr
R2_INCLUDEPATH += $$R2PREFIX/include/libr/sdb
USE_PKGCONFIG = 0
}
}
@ -70,6 +74,7 @@ win32 {
CONFIG += link_pkgconfig
PKGCONFIG += r_core
R2_INCLUDEPATH = "$$system("pkg-config --variable=includedir r_core")/libr"
R2_INCLUDEPATH += "$$system("pkg-config --variable=includedir r_core")/libr/sdb"
} else {
LIBS += \
-lr_core \