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 ninja.exe
r2_dist_x86/ r2_dist_x86/
r2_dist_x64/ r2_dist_x64/
r2_dist/
*.pdb *.pdb
# Mesonbuild # Mesonbuild

View File

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

View File

@ -16,7 +16,7 @@ ECHO Building radare2 (%PLATFORM%)
CD radare2 CD radare2
git clean -xfd git clean -xfd
RMDIR /S /Q ..\%R2DIST% 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 meson.exe r2_builddir --buildtype=release --prefix=%CD%\..\%R2DIST% || EXIT /B 1
ninja -C r2_builddir install || EXIT /B 1 ninja -C r2_builddir install || EXIT /B 1
IF !ERRORLEVEL! NEQ 0 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 \ scripts/r2ghidra.sh \
-DCMAKE_C_COMPILER=cl \ -DCMAKE_C_COMPILER=cl \
-DCMAKE_BUILD_TYPE=Release \ -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" \ -DCMAKE_INSTALL_PREFIX="$APPVEYOR_BUILD_FOLDER/r2_dist" \
-DRADARE2_INSTALL_PLUGDIR="$APPVEYOR_BUILD_FOLDER/r2_dist/lib/plugins" -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) { unix:exists(/usr/local/include/libr)|bsd:exists(/usr/local/include/libr) {
INCLUDEPATH += /usr/local/include/libr INCLUDEPATH += /usr/local/include/libr
INCLUDEPATH += /usr/local/include/libr/sdb
} }
unix { unix {
QMAKE_LFLAGS += -rdynamic # Export dynamic symbols for plugins QMAKE_LFLAGS += -rdynamic # Export dynamic symbols for plugins
@ -166,8 +167,10 @@ CUTTER_ENABLE_PYTHON {
BINDINGS_INCLUDE_DIRS = "$$[QT_INSTALL_HEADERS]" \ BINDINGS_INCLUDE_DIRS = "$$[QT_INSTALL_HEADERS]" \
"$$[QT_INSTALL_HEADERS]/QtCore" \ "$$[QT_INSTALL_HEADERS]/QtCore" \
"$$[QT_INSTALL_HEADERS]/QtWidgets" \ "$$[QT_INSTALL_HEADERS]/QtWidgets" \
"$$[QT_INSTALL_HEADERS]/QtGui" \ "$$[QT_INSTALL_HEADERS]/QtGui"
"$$R2_INCLUDEPATH" for (path, R2_INCLUDEPATH) {
BINDINGS_INCLUDE_DIRS += "$$path"
}
for(path, INCLUDEPATH) { for(path, INCLUDEPATH) {
BINDINGS_INCLUDE_DIRS += $$absolute_path("$$path") BINDINGS_INCLUDE_DIRS += $$absolute_path("$$path")
} }

View File

@ -30,7 +30,7 @@ ExternalProject_Add(Radare2-Bundled
BUILD_COMMAND "${NINJA}" BUILD_COMMAND "${NINJA}"
INSTALL_COMMAND "${NINJA}" install) 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_library(Radare2 INTERFACE)
add_dependencies(Radare2 Radare2-Bundled) 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 target_link_libraries(Radare2 INTERFACE
${R2_LIBS}) ${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) install(TARGETS Radare2 EXPORT CutterTargets)
if (APPLE) if (APPLE)

View File

@ -22,6 +22,14 @@ if(WIN32)
"$ENV{HOME}/bin/prefix/radare2/include/libr" "$ENV{HOME}/bin/prefix/radare2/include/libr"
/usr/local/include/libr /usr/local/include/libr
/usr/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 set(Radare2_LIBRARY_NAMES
core core

View File

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