diff --git a/.travis.yml b/.travis.yml index b0fe4162..779a434d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,14 +19,7 @@ script: - mkdir build ; cd build - qmake PREFIX=/usr ../src - make -j4 - - # make install does not work, so do it by hand - - # sudo make INSTALL_ROOT=appdir install ; sudo chown -R $USER appdir ; find appdir/ - - mkdir -p appdir/usr/bin - - mkdir -p appdir/usr/share/applications - - cp iaito appdir/usr/bin - - cp ../src/img/logo-small.png appdir/iaito.png - - cp ../src/iaito.desktop appdir/ - - cp ../src/iaito.desktop appdir/usr/share/applications/ + - sudo make INSTALL_ROOT=appdir install ; sudo chown -R $USER appdir ; find appdir/ after_success: - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" diff --git a/src/Iaito.pro b/src/Iaito.pro index 692cc7c2..b8cc7a51 100644 --- a/src/Iaito.pro +++ b/src/Iaito.pro @@ -1,14 +1,7 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2014-02-27T11:31:27 -# -#------------------------------------------------- - -ICON = img/Enso.icns - -# No idea what this does exactly TEMPLATE = app +TARGET = iaito + # The application version win32 { VERSION = 1.0 @@ -16,34 +9,27 @@ win32 { VERSION = 1.0-dev } +ICON = img/Enso.icns + +QT += core gui webkit webkitwidgets +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +QT_CONFIG -= no-pkg-config + +CONFIG += c++11 + # Define the preprocessor macro to get the application version in our application. DEFINES += APP_VERSION=\\\"$$VERSION\\\" -QT += core gui webkit webkitwidgets -QT_CONFIG -= no-pkg-config - macx { - QMAKE_CXXFLAGS = -mmacosx-version-min=10.7 -std=gnu0x -stdlib=libc++ - EXTSO=dylib -} else { - win32 { - EXTSO=dll - } else { - EXTSO=so - } + QMAKE_CXXFLAGS = -mmacosx-version-min=10.7 -std=gnu0x -stdlib=libc++ } -CONFIG += c++11 +INCLUDEPATH *= . -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = iaito -TEMPLATE = app - -INCLUDEPATH += ./ - -SOURCES += main.cpp\ - mainwindow.cpp \ +SOURCES += \ + main.cpp \ + mainwindow.cpp \ newfiledialog.cpp \ optionsdialog.cpp \ highlighter.cpp \ @@ -77,7 +63,8 @@ SOURCES += main.cpp\ dialogs/xrefsdialog.cpp \ hexhighlighter.cpp -HEADERS += mainwindow.h \ +HEADERS += \ + mainwindow.h \ newfiledialog.h \ optionsdialog.h \ highlighter.h \ @@ -112,7 +99,8 @@ HEADERS += mainwindow.h \ widgets/banned.h \ hexhighlighter.h -FORMS += mainwindow.ui \ +FORMS += \ + mainwindow.ui \ newfiledialog.ui \ optionsdialog.ui \ createnewdialog.ui \ @@ -136,22 +124,38 @@ FORMS += mainwindow.ui \ RESOURCES += \ resources.qrc -win32 { - DEFINES += _CRT_NONSTDC_NO_DEPRECATE - DEFINES += _CRT_SECURE_NO_WARNINGS - INCLUDEPATH += "$$PWD/../iaito_win32/include" - INCLUDEPATH += "$$PWD/../iaito_win32/radare2/include/libr" - !contains(QMAKE_HOST.arch, x86_64) { - LIBS += -L"$$PWD/../iaito_win32/radare2/lib32" - } else { - LIBS += -L"$$PWD/../iaito_win32/radare2/lib64" - } -} else { - #INCLUDEPATH += /usr/local/radare2/osx/include/libr - INCLUDEPATH += /usr/local/include/libr - INCLUDEPATH += /usr/include/libr - #LIBS += -L/usr/local/radare2/osx/lib -lr_core -lr_config -lr_cons -lr_io -lr_util -lr_flag -lr_asm -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_socket -lr_fs -lr_magic -lr_crypto - LIBS += -L/usr/local/lib -} +include(lib_radare2.pri) -LIBS += -lr_core -lr_config -lr_cons -lr_io -lr_util -lr_flag -lr_asm -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_socket -lr_fs -lr_magic -lr_crypto + +# 'make install' for AppImage +unix { + isEmpty(PREFIX) { + PREFIX = /usr/local + DEFAULT_PREFIX = true + } + + desktop_file = iaito.desktop + + # built-in no need for files atm + target.path = $$PREFIX/bin + + share_applications.path = $$PREFIX/share/applications + share_applications.files = $$desktop_file + + # TODO: + # iaito.png should be copied to $PREFIX/share/icons/$WIDTHx$HEIGHT + + INSTALLS += target share_applications + + # if a custom PREFIX is supplied, we asume it's an AppImage install + !defined(DEFAULT_PREFIX, var) { + # UGLY work around for the logo name in iaito.desktop + # Would be better to have a file called iaito.png in the first place + system(cp img/logo-small.png $$OUT_PWD/iaito.png) + + appimage_root.path = / + appimage_root.files = $$OUT_PWD/iaito.png $$desktop_file + + INSTALLS += appimage_root + } +} diff --git a/src/lib_radare2.pri b/src/lib_radare2.pri new file mode 100644 index 00000000..bc327f1c --- /dev/null +++ b/src/lib_radare2.pri @@ -0,0 +1,55 @@ +win32 { + DEFINES += _CRT_NONSTDC_NO_DEPRECATE + DEFINES += _CRT_SECURE_NO_WARNINGS + INCLUDEPATH += "$$PWD/../iaito_win32/include" + INCLUDEPATH += "$$PWD/../iaito_win32/radare2/include/libr" + !contains(QMAKE_HOST.arch, x86_64) { + LIBS += -L"$$PWD/../iaito_win32/radare2/lib32" + } else { + LIBS += -L"$$PWD/../iaito_win32/radare2/lib64" + } +} else { + # check if r2 is available + system(r2 > /dev/null 2>&1) { + + # see https://github.com/hteso/iaito/pull/5#issuecomment-290433796 + RADARE2_INCLUDE_PATH = $$system(r2 -H | grep INCDIR | sed 's/[^=]*=//') + RADARE2_LIB_PATH = $$system(r2 -H | grep LIBDIR | sed 's/[^=]*=//') + + !isEmpty(RADARE2_INCLUDE_PATH) { + INCLUDEPATH *= $$RADARE2_INCLUDE_PATH + LIBS *= -L$$RADARE2_LIB_PATH + } else { + error("sorry could not find radare2 lib") + } + } else { + error("r2 not found/in path") + } +} + + +LIBS += \ + -lr_core \ + -lr_config \ + -lr_cons \ + -lr_io \ + -lr_util \ + -lr_flag \ + -lr_asm \ + -lr_debug \ + -lr_hash \ + -lr_bin \ + -lr_lang \ + -lr_io \ + -lr_anal \ + -lr_parse \ + -lr_bp \ + -lr_egg \ + -lr_reg \ + -lr_search \ + -lr_syscall \ + -lr_socket \ + -lr_fs \ + -lr_magic \ + -lr_crypto +