Fixed build.sh constantly updating r2 and added *BSD support (#994)

* Fixed build.sh constantly updating r2 and added *BSD support
This commit is contained in:
nullableVoidPtr 2018-12-13 20:23:03 +08:00 committed by xarkes
parent 4026ea11a1
commit 984681700b
3 changed files with 50 additions and 29 deletions

View File

@ -18,47 +18,61 @@ lrelease ./src/Cutter.pro
# Checking for radare2
r2 -v >/dev/null 2>&1
if [ $? = 0 ]; then
R2COMMIT=$(r2 -v | tail -n1 | sed "s,commit: \\(.*\\) build.*,\\1,")
SUBMODULE=$(git submodule | awk '{print $1}')
if [ "$R2COMMIT" = "$SUBMODULE" ]; then
BUILDR2=0
fi
R2COMMIT=$(r2 -v | tail -n1 | sed "s,commit: \\(.*\\) build.*,\\1,")
SUBMODULE=$(git submodule | grep "radare2" | awk '{print $1}')
if [ "$R2COMMIT" = "$SUBMODULE" ]; then
BUILDR2=0
fi
fi
# Check if either qmake or qmake-qt5 is available
qmakepath=$(which qmake-qt5)
if [ -z "$qmakepath" ]; then
qmakepath=$(which qmake)
qmakepath=$(which qmake)
fi
if [ -z "$qmakepath" ]; then
echo "You need qmake to build Cutter."
echo "Please make sure qmake is in your PATH environment variable."
exit 1
echo "You need qmake to build Cutter."
echo "Please make sure qmake is in your PATH environment variable."
exit 1
fi
# Check if GNU make is available
gmakepath=$(which gmake)
if [ -z "$qmakepath" ]; then
gmakepath=$(which make)
fi
${gmakepath} --help 2>&1 | grep -q gnu
if [ $? != 0 ]; then
echo "You need GNU make to build Cutter."
echo "Please make sure qmake is in your PATH environment variable."
exit 1
fi
# Build radare2
if [ $BUILDR2 -eq 1 ]; then
answer="Y"
printf "A (new?) version of radare2 will be installed. Do you agree? [Y/n] "
read answer
if [ -z "$answer" -o "$answer" = "Y" -o "$answer" = "y" ]; then
git submodule init && git submodule update
cd radare2 || exit 1
./sys/install.sh
cd ..
else
echo "Sorry but this script won't work otherwise. Read the README."
exit 1
fi
answer="Y"
printf "A (new?) version of radare2 will be installed. Do you agree? [Y/n] "
read answer
if [ -z "$answer" -o "$answer" = "Y" -o "$answer" = "y" ]; then
R2PREFIX=${1:-"/usr"}
git submodule init && git submodule update
cd radare2 || exit 1
./sys/install.sh "$R2PREFIX"
cd ..
else
echo "Sorry but this script won't work otherwise. Read the README."
exit 1
fi
else
echo "Correct radare2 version found, skipping..."
echo "Correct radare2 version found, skipping..."
fi
# Build
mkdir -p "$BUILD"
cd "$BUILD" || exit 1
"$qmakepath" ../src/Cutter.pro $QMAKE_CONF
make -j4
"$gmakepath" -j4
ERR=$((ERR+$?))
# Move translations
@ -71,8 +85,8 @@ cd ..
# Done
if [ ${ERR} -gt 0 ]; then
echo "Something went wrong!"
echo "Something went wrong!"
else
echo "Build complete. Binary available at: $BUILD/Cutter"
echo "Build complete. Binary available at: $BUILD/Cutter"
fi

View File

@ -77,7 +77,7 @@ macx {
QMAKE_INFO_PLIST = macos/Info.plist
}
unix:exists(/usr/local/include/libr) {
unix:exists(/usr/local/include/libr)|bsd:exists(/usr/local/include/libr) {
INCLUDEPATH += /usr/local/include/libr
}
unix {
@ -95,7 +95,7 @@ win32:CUTTER_ENABLE_JUPYTER {
INCLUDEPATH += $${pythonpath}/include
}
unix:CUTTER_ENABLE_JUPYTER|macx:CUTTER_ENABLE_JUPYTER {
unix:CUTTER_ENABLE_JUPYTER|macx:CUTTER_ENABLE_JUPYTER|bsd:CUTTER_ENABLE_JUPYTER {
defined(PYTHON_FRAMEWORK_DIR, var) {
message("Using Python.framework at $$PYTHON_FRAMEWORK_DIR")
INCLUDEPATH += $$PYTHON_FRAMEWORK_DIR/Python.framework/Headers

View File

@ -35,7 +35,7 @@ win32 {
-lr_crypto \
-lr_sdb
} else {
macx {
macx|bsd {
PREFIX=/usr/local
} else {
PREFIX=/usr
@ -53,13 +53,20 @@ win32 {
LIBS += -L$$PREFIX/lib
INCLUDEPATH += $$PREFIX/include/libr
USE_PKGCONFIG = 0
}
}
}
macx {
LIBS += -L$$PREFIX/lib
INCLUDEPATH += $$PREFIX/include/libr
USE_PKGCONFIG = 0
}
bsd {
!exists($$PKG_CONFIG_PATH/r_core.pc) {
LIBS += -L$$PREFIX/lib
INCLUDEPATH += $$PREFIX/include/libr
USE_PKGCONFIG = 0
}
}
}
DEFINES += _CRT_NONSTDC_NO_DEPRECATE