Use cutter-deps on Windows (#1286)

Also enable python plugins for Windows builds
This commit is contained in:
Florian Märkl 2019-03-16 11:35:31 +01:00 committed by GitHub
parent 46bb07d725
commit 8061120657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 32 deletions

View File

@ -32,6 +32,8 @@ environment:
install: install:
- ps: $env:path = ($env:path -split ";").Where({!($_ -like "*Microsoft SQL Server*")}) -join ";" - ps: $env:path = ($env:path -split ";").Where({!($_ -like "*Microsoft SQL Server*")}) -join ";"
- cmd: C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && scripts/fetch_deps.sh"
- cmd: set "CUTTER_DEPS_DIR=%APPVEYOR_BUILD_FOLDER%\cutter-deps"
- cmd: set "PATH=%CD%;%PYTHON%;%PATH%" - cmd: set "PATH=%CD%;%PYTHON%;%PATH%"
- cmd: call "%VSVARSALLPATH%" %ARCH% - cmd: call "%VSVARSALLPATH%" %ARCH%
- cmd: if "%ARCH%" == "x64" ( set "PATH=%QT64PATH%\bin;%PATH%" ) else ( set "PATH=%QT32PATH%\bin;%PATH%" ) - cmd: if "%ARCH%" == "x64" ( set "PATH=%QT64PATH%\bin;%PATH%" ) else ( set "PATH=%QT32PATH%\bin;%PATH%" )
@ -47,7 +49,7 @@ before_build:
# Build config # Build config
build_script: build_script:
- cmd: if defined QMAKE ( call prepare_r2.bat && call build.bat CUTTER_ENABLE_PYTHON=true CUTTER_ENABLE_PYTHON_BINDINGS=false CUTTER_ENABLE_JUPYTER=true CUTTER_ENABLE_QTWEBENGINE=false CUTTER_APPVEYOR_R2DEC=true ) - cmd: if defined QMAKE ( call prepare_r2.bat && call build.bat CUTTER_ENABLE_PYTHON=true CUTTER_ENABLE_PYTHON_BINDINGS=false CUTTER_ENABLE_JUPYTER=true CUTTER_ENABLE_QTWEBENGINE=false CUTTER_APPVEYOR_R2DEC=true CUTTER_ENABLE_PYTHON=true CUTTER_ENABLE_PYTHON_BINDINGS=true SHIBOKEN_EXECUTABLE="%CUTTER_DEPS_DIR%\pyside\bin\shiboken2.exe" SHIBOKEN_INCLUDEDIR="%CUTTER_DEPS_DIR%/pyside/include/shiboken2" SHIBOKEN_LIBRARY="%CUTTER_DEPS_DIR%/pyside/lib/shiboken2.cp36-win_amd64.lib" PYSIDE_INCLUDEDIR="%CUTTER_DEPS_DIR%/pyside/include/PySide2" PYSIDE_LIBRARY="%CUTTER_DEPS_DIR%/pyside/lib/pyside2.cp36-win_amd64.lib" PYSIDE_TYPESYSTEMS="%CUTTER_DEPS_DIR%/pyside/share/PySide2/typesystems")
- cmd: if defined MESON ( python meson.py --release --dist=%ARTIFACT_PATH% --backend=%BACKEND% --python --jupyter ) - cmd: if defined MESON ( python meson.py --release --dist=%ARTIFACT_PATH% --backend=%BACKEND% --python --jupyter )
after_build: after_build:
@ -67,6 +69,9 @@ after_build:
- cmd: copy python_embed\*.pyd "%ARTIFACT_PATH%\python36\" - cmd: copy python_embed\*.pyd "%ARTIFACT_PATH%\python36\"
- cmd: copy python_embed\sqlite3.dll "%ARTIFACT_PATH%\python36\" - cmd: copy python_embed\sqlite3.dll "%ARTIFACT_PATH%\python36\"
- cmd: copy python_embed\python*.dll "%ARTIFACT_PATH%\" - cmd: copy python_embed\python*.dll "%ARTIFACT_PATH%\"
- cmd: xcopy "%CUTTER_DEPS_DIR%\pyside\lib\site-packages" "%ARTIFACT_PATH%\python36\site-packages" /e /i /h
- cmd: copy "%CUTTER_DEPS_DIR%\pyside\bin\shiboken2.cp36-win_amd64.dll" "%ARTIFACT_PATH%\"
- cmd: copy "%CUTTER_DEPS_DIR%\pyside\bin\pyside2.cp36-win_amd64.dll" "%ARTIFACT_PATH%\"
- cmd: powershell -Command "[System.IO.File]::WriteAllLines(\"%ARTIFACT_PATH%\python36._pth\", \"python36`r`npython36\python36.zip`r`npython36\site-packages\")" - cmd: powershell -Command "[System.IO.File]::WriteAllLines(\"%ARTIFACT_PATH%\python36._pth\", \"python36`r`npython36\python36.zip`r`npython36\site-packages\")"
# Tests # Tests

View File

@ -22,9 +22,9 @@ FOR %%i in (src\translations\*.ts) DO lrelease %%i
CD %BUILDDIR% CD %BUILDDIR%
ECHO Building cutter ECHO Building cutter
qmake %* ..\src\cutter.pro -config release -tp vc qmake %* ..\src\cutter.pro -config release
IF !ERRORLEVEL! NEQ 0 EXIT /B 1 IF !ERRORLEVEL! NEQ 0 EXIT /B 1
msbuild /m cutter.vcxproj /p:Configuration=Release nmake
IF !ERRORLEVEL! NEQ 0 EXIT /B 1 IF !ERRORLEVEL! NEQ 0 EXIT /B 1
ECHO Deploying cutter ECHO Deploying cutter

View File

@ -4,25 +4,35 @@ cd $(dirname "${BASH_SOURCE[0]}")/..
mkdir -p cutter-deps && cd cutter-deps mkdir -p cutter-deps && cd cutter-deps
LINUX_FILE="cutter-deps-linux.tar.gz" LINUX_FILE="cutter-deps-linux.tar.gz"
LINUX_MD5=b52ab4f06cb9e4b92372022c37920bf1 LINUX_MD5=0d20ec9217bed56098b78e9031b544ab
LINUX_URL=https://github.com/radareorg/cutter-deps/releases/download/v6/cutter-deps-linux.tar.gz LINUX_URL=https://github.com/radareorg/cutter-deps/releases/download/v8/cutter-deps-linux.tar.gz
MACOS_FILE="cutter-deps-macos.tar.gz" MACOS_FILE="cutter-deps-macos.tar.gz"
MACOS_MD5=85b663ea73b80663a532dfafe998905d MACOS_MD5=2763c59a9917a0f7c88995d4b77ec209
MACOS_URL=https://github.com/radareorg/cutter-deps/releases/download/v6/cutter-deps-macos.tar.gz MACOS_URL=https://github.com/radareorg/cutter-deps/releases/download/v8/cutter-deps-macos.tar.gz
UNAME_S="$(uname -s)" WIN_FILE="cutter-deps-win.tar.gz"
if [ "$UNAME_S" == "Linux" ]; then WIN_MD5=74aa2b35a2c87ceba81c8049d702f63d
FILE="${LINUX_FILE}" WIN_URL=https://github.com/radareorg/cutter-deps/releases/download/v8/cutter-deps-win.tar.gz
MD5="${LINUX_MD5}"
URL="${LINUX_URL}" if [ "$OS" == "Windows_NT" ]; then
elif [ "$UNAME_S" == "Darwin" ]; then FILE="${WIN_FILE}"
FILE="${MACOS_FILE}" MD5="${WIN_MD5}"
MD5="${MACOS_MD5}" URL="${WIN_URL}"
URL="${MACOS_URL}"
else else
echo "Unsupported Platform: $UNAME_S" UNAME_S="$(uname -s)"
exit 1 if [ "$UNAME_S" == "Linux" ]; then
FILE="${LINUX_FILE}"
MD5="${LINUX_MD5}"
URL="${LINUX_URL}"
elif [ "$UNAME_S" == "Darwin" ]; then
FILE="${MACOS_FILE}"
MD5="${MACOS_MD5}"
URL="${MACOS_URL}"
else
echo "Unsupported Platform: uname -s => $UNAME_S, \$OS => $OS"
exit 1
fi
fi fi
curl -L "$URL" -o "$FILE" || exit 1 curl -L "$URL" -o "$FILE" || exit 1
@ -39,5 +49,8 @@ else
fi fi
tar -xf "$FILE" || exit 1 tar -xf "$FILE" || exit 1
./relocate.sh || exit 1
if [ -f relocate.sh ]; then
./relocate.sh || exit 1
fi

View File

@ -124,7 +124,8 @@ include(lib_radare2.pri)
CUTTER_ENABLE_PYTHON { CUTTER_ENABLE_PYTHON {
win32 { win32 {
PYTHON_EXECUTABLE = $$quote($$system("where python")) PYTHON_EXECUTABLE = $$system("where python", lines)
PYTHON_EXECUTABLE = $$first(PYTHON_EXECUTABLE)
pythonpath = $$replace(PYTHON_EXECUTABLE, ".exe ", ".exe;") pythonpath = $$replace(PYTHON_EXECUTABLE, ".exe ", ".exe;")
pythonpath = $$section(pythonpath, ";", 0, 0) pythonpath = $$section(pythonpath, ";", 0, 0)
pythonpath = $$clean_path($$dirname(pythonpath)) pythonpath = $$clean_path($$dirname(pythonpath))
@ -147,10 +148,10 @@ CUTTER_ENABLE_PYTHON {
} }
CUTTER_ENABLE_PYTHON_BINDINGS { CUTTER_ENABLE_PYTHON_BINDINGS {
!packagesExist(shiboken2) { isEmpty(SHIBOKEN_EXECUTABLE):!packagesExist(shiboken2) {
error("ERROR: Shiboken2, which is required to build the Python Bindings, could not be found. Make sure it is available to pkg-config.") error("ERROR: Shiboken2, which is required to build the Python Bindings, could not be found. Make sure it is available to pkg-config.")
} }
!packagesExist(pyside2) { isEmpty(PYSIDE_LIBRARY):!packagesExist(pyside2) {
error("ERROR: PySide2, which is required to build the Python Bindings, could not be found. Make sure it is available to pkg-config.") error("ERROR: PySide2, which is required to build the Python Bindings, could not be found. Make sure it is available to pkg-config.")
} }
win32 { win32 {
@ -169,25 +170,50 @@ CUTTER_ENABLE_PYTHON {
for(path, INCLUDEPATH) { for(path, INCLUDEPATH) {
BINDINGS_INCLUDE_DIRS += $$absolute_path("$$path") BINDINGS_INCLUDE_DIRS += $$absolute_path("$$path")
} }
BINDINGS_INCLUDE_DIRS = $$join(BINDINGS_INCLUDE_DIRS, ":")
PYSIDE_TYPESYSTEMS = $$system("pkg-config --variable=typesystemdir pyside2") win32 {
PYSIDE_INCLUDEDIR = $$system("pkg-config --variable=includedir pyside2") PATH_SEP = ";"
} else {
PATH_SEP = ":"
}
BINDINGS_INCLUDE_DIRS = $$join(BINDINGS_INCLUDE_DIRS, $$PATH_SEP)
isEmpty(SHIBOKEN_EXECUTABLE) {
SHIBOKEN_EXECUTABLE = $$system("pkg-config --variable=generator_location shiboken2")
}
isEmpty(PYSIDE_TYPESYSTEMS) {
PYSIDE_TYPESYSTEMS = $$system("pkg-config --variable=typesystemdir pyside2")
}
isEmpty(PYSIDE_INCLUDEDIR) {
PYSIDE_INCLUDEDIR = $$system("pkg-config --variable=includedir pyside2")
}
QMAKE_SUBSTITUTES += bindings/bindings.txt.in QMAKE_SUBSTITUTES += bindings/bindings.txt.in
SHIBOKEN_EXECUTABLE = $$system("pkg-config --variable=generator_location shiboken2")
SHIBOKEN_OPTIONS = --project-file="$${BINDINGS_BUILD_DIR}/bindings.txt"
win32:SHIBOKEN_OPTIONS += --avoid-protected-hack
bindings.target = bindings_target bindings.target = bindings_target
bindings.commands = "$${SHIBOKEN_EXECUTABLE}" --project-file="$${BINDINGS_BUILD_DIR}/bindings.txt" bindings.commands = "$${SHIBOKEN_EXECUTABLE}" $${SHIBOKEN_OPTIONS}
QMAKE_EXTRA_TARGETS += bindings QMAKE_EXTRA_TARGETS += bindings
GENERATED_SOURCES += $${BINDINGS_SOURCE}
INCLUDEPATH += "$${BINDINGS_BUILD_DIR}/CutterBindings"
PRE_TARGETDEPS += bindings_target PRE_TARGETDEPS += bindings_target
macx { GENERATED_SOURCES += $${BINDINGS_SOURCE}
INCLUDEPATH += "$${BINDINGS_BUILD_DIR}/CutterBindings"
win32:DEFINES += WIN32_LEAN_AND_MEAN
!isEmpty(PYSIDE_LIBRARY) {
LIBS += "$$SHIBOKEN_LIBRARY" "$$PYSIDE_LIBRARY"
INCLUDEPATH += "$$SHIBOKEN_INCLUDEDIR"
} else:macx {
# Hack needed because with regular PKGCONFIG qmake will mess up everything # Hack needed because with regular PKGCONFIG qmake will mess up everything
QMAKE_CXXFLAGS += $$system("pkg-config --cflags shiboken2 pyside2") QMAKE_CXXFLAGS += $$system("pkg-config --cflags shiboken2 pyside2")
LIBS += $$system("pkg-config --libs shiboken2 pyside2") LIBS += $$system("pkg-config --libs shiboken2 pyside2")
} else { } else {
PKGCONFIG += shiboken2 pyside2 PKGCONFIG += shiboken2 pyside2
} }
INCLUDEPATH += "$$PYSIDE_INCLUDEDIR/QtCore" "$$PYSIDE_INCLUDEDIR/QtWidgets" "$$PYSIDE_INCLUDEDIR/QtGui" INCLUDEPATH += "$$PYSIDE_INCLUDEDIR" "$$PYSIDE_INCLUDEDIR/QtCore" "$$PYSIDE_INCLUDEDIR/QtWidgets" "$$PYSIDE_INCLUDEDIR/QtGui"
} }
} }