]> git.siccegge.de Git - frida/frida.git/commitdiff
Build working `make install` target
authorChristoph Egger <Christoph.Egger@fau.de>
Mon, 16 Mar 2015 16:34:13 +0000 (17:34 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Wed, 18 Mar 2015 13:51:35 +0000 (14:51 +0100)
Should install the frida binary and the libraries into appropriate
places using the Cmake GNUInstallDirs module. Included is some cleanup
in the guile module.

CMakeLists.txt
src/bindings/Guile.cxx
src/main.cxx

index 51f9689ee3f673fb785d80b8410e126aa690508b..242fbfc49a1e4c2545fe68d0e9ee4df70dfcad82 100644 (file)
@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.8.9)
 PROJECT(frida)
 
 set(CMAKE_VERBOSE_MAKEFILE on)
-
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
+include(GNUInstallDirs)
 
 find_package(Qt5Widgets)
 find_package(Qt5 CONFIG REQUIRED Widgets Gui)
@@ -28,6 +28,7 @@ separate_arguments(LLVM_LDFLAGS)
 separate_arguments(LLVM_LIBS)
 
 INCLUDE_DIRECTORIES("src")
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
 
 #####################
 # Language Bindings #
@@ -37,8 +38,8 @@ SET(CMAKE_SWIG_FLAGS -Linkage passive)
 #FIND_PACKAGE(PythonLibs)
 #INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
 SET_SOURCE_FILES_PROPERTIES(src/bindings/guile/frida.i PROPERTIES CPLUSPLUS ON)
-SWIG_ADD_MODULE(frida-guile guile src/bindings/guile/frida.i)
-SWIG_LINK_LIBRARIES(frida-guile ${GUILE_LDFLAGS})
+SWIG_ADD_MODULE(guile-frida-binding guile src/bindings/guile/frida.i)
+SWIG_LINK_LIBRARIES(guile-frida-binding ${GUILE_LDFLAGS})
 
 
 #################
@@ -82,7 +83,7 @@ SET(frida_HEADERS
   )
 
 ADD_EXECUTABLE(frida src/main.cxx ${frida_SOURCES} ${frida_HEADERS_MOC})
-#ADD_LIBRARY(llvm SHARED )
+
 
 ADD_DEFINITIONS(${QT_DEFINITIONS})
 
@@ -96,6 +97,7 @@ TARGET_LINK_LIBRARIES(frida
   ${LOG4CXX_LDFLAGS}
   ${QUAZIP_LIBRARIES})
 
+configure_file(src/Config.hxx.in src/Config.hxx @ONLY)
 
 ###########
 # Plugins #
@@ -134,3 +136,11 @@ ADD_SUBDIRECTORY(/usr/src/gmock gmock)
 enable_testing()
 target_link_libraries(fridatest gmock gtest ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES})
 add_test(NAME fridatest COMMAND fridatest ${CMAKE_SOURCE_DIR})
+
+
+
+install(TARGETS frida
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+install(TARGETS guilePlugin guile-frida-binding
+  DESTINATION ${CMAKE_INSTALL_LIBDIR}/frida/plugins/Interpreter)
index fcc108349b55fa1afda71ad142f9e8bf15e79a72..86ab6dd1338e2abafdd9b4c5b29f6762736bfd3c 100644 (file)
@@ -1,4 +1,5 @@
 #include "Guile.hxx"
+#include "Config.hxx"
 
 namespace {
        SCM handler (void*, SCM tag, SCM throw_args) {
@@ -10,18 +11,10 @@ namespace {
 GuileInterpreter::GuileInterpreter() {
        scm_init_guile();
 
-       scm_internal_catch(SCM_BOOL_T,
-                          (SCM (*)(void *))scm_c_eval_string,
-                          (void*)"(use-modules (system repl server))",
-                          handler, NULL);
-       scm_internal_catch(SCM_BOOL_T,
-                          (SCM (*)(void *))scm_c_eval_string,
-                          (void*)"(spawn-server)",
-                          handler, NULL);
-       scm_internal_catch(SCM_BOOL_T,
-                          (SCM (*)(void *))scm_c_eval_string,
-                          (void*)"(load-extension \"libfrida-guile\" \"scm_init_frida_module\")",
-                          handler, NULL);
+       scm_c_use_module("system repl server");
+       scm_call_0(scm_c_public_ref("system repl server", "spawn-server"));
+       scm_c_load_extension(CMAKE_INSTALL_FULL_LIBDIR "/frida/plugins/Interpreter/libguile-frida-binding",
+                            "scm_init_frida_module");
 
        guile_output_port = scm_open_output_string();
        guile_error_port = scm_open_output_string();
@@ -59,6 +52,5 @@ int GuileInterpreter::loadFile(const std::string& filename,
                                std::ostream& stdout,
                                std::ostream& stderr,
                                std::string& result) {
-       return evaluate("(load \"" + filename + "\")",
-                       stdout, stderr, result);
+       scm_c_primitive_load(filename.c_str());
 }
index 8c0916cd0d9de3b7bd12531cccf96620fd923e34..a627b61dc7a391263adcb6bef67af3e431f5133c 100644 (file)
@@ -18,6 +18,7 @@
 #include "gui/Mainwindow.hxx"
 #include "core/InformationManager.hxx"
 #include "disassembler/llvm/LLVMDisassembler.hxx"
+#include "Config.hxx"
 
 int main(int argc, char** argv)
 {
@@ -32,6 +33,7 @@ int main(int argc, char** argv)
 
        QApplication::setApplicationName("frida");
        QApplication::setApplicationVersion("0.0");
+       QApplication::addLibraryPath(CMAKE_INSTALL_FULL_LIBDIR "/frida/plugins/Interpreter");
 #ifdef ARGPARSE
        parser.addHelpOption();
        parser.addVersionOption();