MESSAGE("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer ecore bundle dlog liblaunchpad glib-2.0 libsmack capi-appfw-app-common storage jsoncpp openssl1.1 sqlite3)
+PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer bundle dlog liblaunchpad glib-2.0 libsmack jsoncpp openssl3 sqlite3 libtzplatform-config)
FOREACH(flag ${${PROJECT_NAME}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(target_hydra dotnet_hydra_launcher)
+SET(target_hydra dotnet_hydra_loader)
PKG_CHECK_MODULES(${target_hydra} REQUIRED liblaunchpad-hydra)
SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DRUNTIME_DIR=${RUNTIME_DIR}")
ENDIF(DEFINED RUNTIME_DIR)
+IF(DEFINED FRAMEWORK_DIR)
+ SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DFRAMEWORK_DIR=${FRAMEWORK_DIR}")
+ENDIF(DEFINED FRAMEWORK_DIR)
+
IF(DEFINED CROSSGEN_PATH)
SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DCROSSGEN_PATH=${CROSSGEN_PATH}")
ENDIF(DEFINED CROSSGEN_PATH)
SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DNATIVE_LIB_DIR=${NATIVE_LIB_DIR}")
ENDIF(DEFINED NATIVE_LIB_DIR)
-IF(DEFINED TAC_DIR)
- SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DTAC_DIR=${TAC_DIR}")
-ENDIF(DEFINED TAC_DIR)
+IF(DEFINED DOTNET_DIR)
+ SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DDOTNET_DIR=${DOTNET_DIR}")
+ENDIF(DEFINED DOTNET_DIR)
+
+IF(DEFINED READ_ONLY_APP_UPDATE_DIR)
+ SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DREAD_ONLY_APP_UPDATE_DIR=${READ_ONLY_APP_UPDATE_DIR}")
+ENDIF(DEFINED READ_ONLY_APP_UPDATE_DIR)
+
+IF(DEFINED READ_ONLY_TAC_DIR)
+ SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DREAD_ONLY_TAC_DIR=${READ_ONLY_TAC_DIR}")
+ENDIF(DEFINED READ_ONLY_TAC_DIR)
IF(DEFINED USE_DEFAULT_BASE_ADDR)
SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DUSE_DEFAULT_BASE_ADDR")
ADD_DEFINITIONS(-DLOADERDIR="${LOADERDIR}")
+ADD_DEFINITIONS(-DPAL_STDCPP_COMPAT)
+
OPTION(NOT_USE_FUNCTION "Remove build warning" OFF)
IF(NOT_USE_FUNCTION)
ADD_DEFINITIONS("-DNOT_USE_FUNCTION")
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${EXTRA_CFLAGS_COMMON}")
SET(EXTRA_CFLAGS_EXE "${EXTRA_CFLAGS} -fPIE")
-SET(EXTRA_CFLAGS_LIB "${EXTRA_CFLAGS} -fPIC")
+SET(EXTRA_CFLAGS_LIB "${EXTRA_CFLAGS} -fPIC -Wl,-z,relro")
SET(EXTRA_CFLAGS_HYDRA "${EXTRA_CFLAGS_HYDRA} ${EXTRA_CFLAGS_COMMON}")
SET(EXTRA_CFLAGS_HYDRA "${EXTRA_CFLAGS_HYDRA} -fPIE")
SET(DOTNET_LAUNCHER_UTIL "dotnet_launcher_util")
SET(${DOTNET_LAUNCHER_UTIL}_SOURCE_FILES
- util/utils.cc
- util/plugin_manager.cc
+ tool/r2r_checker.cc
util/path_manager.cc
- util/log_manager.cc
+ util/plugin_manager.cc
+ util/utils.cc
)
ADD_LIBRARY(${DOTNET_LAUNCHER_UTIL} SHARED ${${DOTNET_LAUNCHER_UTIL}_SOURCE_FILES})
SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER_UTIL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
+TARGET_INCLUDE_DIRECTORIES(${DOTNET_LAUNCHER_UTIL} PRIVATE ${RUNTIME_DIR}/src/ ${RUNTIME_DIR}/src/pal ${RUNTIME_DIR}/src/pal/inc ${RUNTIME_DIR}/src/pal/inc/rt)
TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER_UTIL} ${${PROJECT_NAME}_LDFLAGS} "-ldl" boost_filesystem boost_system)
+SET(DOTNET_LAUNCHER_CORE "dotnet_launcher_core")
+SET(${DOTNET_LAUNCHER_CORE}_SOURCE_FILES
+ launcher/lib/injection.cc
+ launcher/lib/core_runtime.cc
+)
+ADD_LIBRARY(${DOTNET_LAUNCHER_CORE} SHARED ${${DOTNET_LAUNCHER_CORE}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER_CORE} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
+TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER_CORE} ${${PROJECT_NAME}_LDFLAGS} "-ldl" boost_filesystem boost_system ${DOTNET_LAUNCHER_UTIL})
+
SET(DOTNET_LAUNCHER "dotnet-launcher")
SET(${DOTNET_LAUNCHER}_SOURCE_FILES
- launcher/main.cc
- launcher/injection.cc
- launcher/launcher.cc
- launcher/dotnet/dotnet_launcher.cc
+ launcher/exec/launcher.cc
)
ADD_EXECUTABLE(${DOTNET_LAUNCHER} ${${DOTNET_LAUNCHER}_SOURCE_FILES})
SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_EXE})
-TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER} ${${PROJECT_NAME}_LDFLAGS} "-pie -ldl -lpthread" aul ${DOTNET_LAUNCHER_UTIL})
+TARGET_INCLUDE_DIRECTORIES(${DOTNET_LAUNCHER} PRIVATE "launcher/lib")
+TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER} ${${PROJECT_NAME}_LDFLAGS} "-pie -ldl -lpthread" aul ${DOTNET_LAUNCHER_UTIL} ${DOTNET_LAUNCHER_CORE})
SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER}
PROPERTIES SKIP_BUILD_RPATH TRUE
) # remove rpath option that is automatically generated by cmake.
-SET(DOTNET_HYDRA_LAUNCHER "dotnet-hydra-launcher")
-SET(${DOTNET_HYDRA_LAUNCHER}_SOURCE_FILES
+SET(DOTNET_LOADER "dotnet-loader")
+SET(${DOTNET_LOADER}_SOURCE_FILES
+ launcher/exec/loader.cc
+)
+ADD_EXECUTABLE(${DOTNET_LOADER} ${${DOTNET_LOADER}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${DOTNET_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_EXE})
+TARGET_INCLUDE_DIRECTORIES(${DOTNET_LOADER} PRIVATE "launcher/lib")
+TARGET_LINK_LIBRARIES(${DOTNET_LOADER} ${${PROJECT_NAME}_LDFLAGS} "-pie -ldl -lpthread" aul ${DOTNET_LAUNCHER_UTIL} ${DOTNET_LAUNCHER_CORE})
+
+SET_TARGET_PROPERTIES(${DOTNET_LOADER}
+ PROPERTIES SKIP_BUILD_RPATH TRUE
+) # remove rpath option that is automatically generated by cmake.
+
+SET(DOTNET_CORERUN "dotnet")
+SET(${DOTNET_CORERUN}_SOURCE_FILES
+ launcher/exec/corerun.cc
+)
+ADD_EXECUTABLE(${DOTNET_CORERUN} ${${DOTNET_CORERUN}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${DOTNET_CORERUN} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_EXE})
+TARGET_INCLUDE_DIRECTORIES(${DOTNET_CORERUN} PRIVATE)
+TARGET_LINK_LIBRARIES(${DOTNET_CORERUN} ${${PROJECT_NAME}_LDFLAGS} "-pie -ldl -lpthread" ${DOTNET_LAUNCHER_UTIL})
+
+SET_TARGET_PROPERTIES(${DOTNET_CORERUN}
+ PROPERTIES SKIP_BUILD_RPATH TRUE
+) # remove rpath option that is automatically generated by cmake.
+
+SET(DOTNET_HYDRA_LOADER "dotnet-hydra-loader")
+SET(${DOTNET_HYDRA_LOADER}_SOURCE_FILES
hydra/hydra_main.cc
)
-ADD_EXECUTABLE(${DOTNET_HYDRA_LAUNCHER} ${${DOTNET_HYDRA_LAUNCHER}_SOURCE_FILES})
-TARGET_LINK_LIBRARIES(${DOTNET_HYDRA_LAUNCHER} ${${target_hydra}_LDFLAGS} "-pie -ldl")
-SET_TARGET_PROPERTIES(${DOTNET_HYDRA_LAUNCHER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_HYDRA})
-SET_TARGET_PROPERTIES(${DOTNET_HYDRA_LAUNCHER}
+ADD_EXECUTABLE(${DOTNET_HYDRA_LOADER} ${${DOTNET_HYDRA_LOADER}_SOURCE_FILES})
+TARGET_LINK_LIBRARIES(${DOTNET_HYDRA_LOADER} ${${target_hydra}_LDFLAGS} "-pie -ldl")
+SET_TARGET_PROPERTIES(${DOTNET_HYDRA_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_HYDRA})
+
+SET_TARGET_PROPERTIES(${DOTNET_HYDRA_LOADER}
PROPERTIES SKIP_BUILD_RPATH TRUE
) # remove rpath option that is automatically generated by cmake.
SET(TAC_COMMON "tac_common")
SET(${TAC_COMMON}_SOURCE_FILES
tool/tac_common.cc
+ tool/tac_installer.cc
+ tool/tac_db.cc
util/db_manager.cc
)
ADD_LIBRARY(${TAC_COMMON} SHARED ${${TAC_COMMON}_SOURCE_FILES})
SET_TARGET_PROPERTIES(${NI_COMMON} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
TARGET_LINK_LIBRARIES(${NI_COMMON} ${${PROJECT_NAME}_LDFLAGS} ${DOTNET_LAUNCHER_UTIL} ${TAC_COMMON})
-SET(NITOOL "nitool")
-SET(${NITOOL}_SOURCE_FILES
- tool/nitool.cc
+SET(PROFILE_COMMON "profile_common")
+SET(${PROFILE_COMMON}_SOURCE_FILES
+ tool/profile_common.cc
)
-ADD_EXECUTABLE(${NITOOL} ${${NITOOL}_SOURCE_FILES})
-SET_TARGET_PROPERTIES(${NITOOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_EXE})
-TARGET_LINK_LIBRARIES(${NITOOL} ${${PROJECT_NAME}_LDFLAGS} "-pie" ${DOTNET_LAUNCHER_UTIL} ${NI_COMMON})
+ADD_LIBRARY(${PROFILE_COMMON} SHARED ${${PROFILE_COMMON}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${PROFILE_COMMON} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
+TARGET_LINK_LIBRARIES(${PROFILE_COMMON} ${${PROJECT_NAME}_LDFLAGS} ${DOTNET_LAUNCHER_UTIL})
+
+SET(PRIVILEGE_COMMON "privilege_common")
+SET(${PRIVILEGE_COMMON}_SOURCE_FILES
+ tool/privilege_common.cc
+)
+ADD_LIBRARY(${PRIVILEGE_COMMON} SHARED ${${PRIVILEGE_COMMON}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${PRIVILEGE_COMMON} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
+TARGET_LINK_LIBRARIES(${PRIVILEGE_COMMON} ${${PROJECT_NAME}_LDFLAGS} ${DOTNET_LAUNCHER_UTIL})
+
+SET(MULTI_TARGET_RESOLVER "multi_target_resolver")
+SET(${MULTI_TARGET_RESOLVER}_SOURCE_FILES
+ tool/multi_target_resolver.cc
+)
+ADD_LIBRARY(${MULTI_TARGET_RESOLVER} SHARED ${${MULTI_TARGET_RESOLVER}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${MULTI_TARGET_RESOLVER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
+TARGET_LINK_LIBRARIES(${MULTI_TARGET_RESOLVER} ${${PROJECT_NAME}_LDFLAGS} ${DOTNET_LAUNCHER_UTIL})
SET(TPATOOL "tpatool")
SET(${TPATOOL}_SOURCE_FILES
)
ADD_EXECUTABLE(${DOTNETTOOL} ${${DOTNETTOOL}_SOURCE_FILES})
SET_TARGET_PROPERTIES(${DOTNETTOOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_EXE})
-TARGET_LINK_LIBRARIES(${DOTNETTOOL} ${${PROJECT_NAME}_LDFLAGS} "-pie" ${DOTNET_LAUNCHER_UTIL} ${NI_COMMON})
+TARGET_LINK_LIBRARIES(${DOTNETTOOL} ${${PROJECT_NAME}_LDFLAGS} "-pie" ${DOTNET_LAUNCHER_UTIL} ${NI_COMMON} ${TAC_COMMON} ${PROFILE_COMMON} ${PRIVILEGE_COMMON} ${MULTI_TARGET_RESOLVER})
SET(PREFER_DOTNET_AOT_PLUGIN "prefer_dotnet_aot_plugin")
SET(${PREFER_DOTNET_AOT_PLUGIN}_SOURCE_FILES
SET_TARGET_PROPERTIES(${PREFER_NUGET_CACHE_PLUGIN} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
TARGET_LINK_LIBRARIES(${PREFER_NUGET_CACHE_PLUGIN} ${${PROJECT_NAME}_LDFLAGS} ${DOTNET_LAUNCHER_UTIL} ${TAC_COMMON})
+SET(DOTNET_APPTYPE_PLUGIN "dotnet_apptype_plugin")
+SET(${DOTNET_APPTYPE_PLUGIN}_SOURCE_FILES
+ installer-plugin/dotnet_apptype_plugin.cc
+)
+ADD_LIBRARY(${DOTNET_APPTYPE_PLUGIN} SHARED ${${DOTNET_APPTYPE_PLUGIN}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${DOTNET_APPTYPE_PLUGIN} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
+TARGET_LINK_LIBRARIES(${DOTNET_APPTYPE_PLUGIN} ${${PROJECT_NAME}_LDFLAGS} ${DOTNET_LAUNCHER_UTIL} ${MULTI_TARGET_RESOLVER} ${NI_COMMON} ${PROFILE_COMMON} ${PRIVILEGE_COMMON})
+
+# Build for test plugin library (libdotnet-plugin.so)
+IF(DEFINED BUILD_DOTNET_PLUGIN)
+ SET(DOTNET_PLUGIN "dotnet_plugin")
+ SET(${DOTNET_PLUGIN}_SOURCE_FILES
+ dotnet-plugin/dotnet_plugin.cc
+ )
+ ADD_LIBRARY(${DOTNET_PLUGIN} SHARED ${${DOTNET_PLUGIN}_SOURCE_FILES})
+ SET_TARGET_PROPERTIES(${DOTNET_PLUGIN} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_LIB})
+ TARGET_LINK_LIBRARIES(${DOTNET_PLUGIN} ${${PROJECT_NAME}_LDFLAGS})
+ENDIF(DEFINED BUILD_DOTNET_PLUGIN)
+
CONFIGURE_FILE(dotnet-launcher.pc.in dotnet-launcher.pc @ONLY)
INSTALL(TARGETS ${DOTNET_LAUNCHER_UTIL} DESTINATION ${LIBDIR})
+INSTALL(TARGETS ${DOTNET_LAUNCHER_CORE} DESTINATION ${LIBDIR})
INSTALL(TARGETS ${DOTNET_LAUNCHER} DESTINATION ${BINDIR})
-INSTALL(TARGETS ${DOTNET_HYDRA_LAUNCHER} DESTINATION ${BINDIR})
+INSTALL(TARGETS ${DOTNET_LOADER} DESTINATION ${BINDIR})
+INSTALL(TARGETS ${DOTNET_CORERUN} DESTINATION ${BINDIR})
+INSTALL(TARGETS ${DOTNET_HYDRA_LOADER} DESTINATION ${BINDIR})
INSTALL(TARGETS ${TAC_COMMON} DESTINATION ${LIBDIR})
INSTALL(TARGETS ${NI_COMMON} DESTINATION ${LIBDIR})
-INSTALL(TARGETS ${NITOOL} DESTINATION ${BINDIR})
+INSTALL(TARGETS ${PROFILE_COMMON} DESTINATION ${LIBDIR})
+INSTALL(TARGETS ${PRIVILEGE_COMMON} DESTINATION ${LIBDIR})
+INSTALL(TARGETS ${MULTI_TARGET_RESOLVER} DESTINATION ${LIBDIR})
INSTALL(TARGETS ${TPATOOL} DESTINATION ${BINDIR})
INSTALL(TARGETS ${DOTNETTOOL} DESTINATION ${BINDIR})
INSTALL(TARGETS ${PREFER_DOTNET_AOT_PLUGIN} DESTINATION ${INSTALL_MDPLUGIN_DIR})
INSTALL(TARGETS ${PREFER_NUGET_CACHE_PLUGIN} DESTINATION ${INSTALL_MDPLUGIN_DIR})
+INSTALL(TARGETS ${DOTNET_APPTYPE_PLUGIN} DESTINATION ${INSTALL_PLUGIN_DIR})
INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR})
INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR})
INSTALL(FILES dotnet.debugger DESTINATION ${LOADERDIR})
INSTALL(FILES inc/dotnet_launcher_plugin.h DESTINATION ${INCLUDEDIR})
INSTALL(FILES inc/ni_common.h DESTINATION ${INCLUDEDIR})
INSTALL(FILES inc/tac_common.h DESTINATION ${INCLUDEDIR})
+INSTALL(FILES inc/tac_installer.h DESTINATION ${INCLUDEDIR})
+INSTALL(FILES inc/tac_db.h DESTINATION ${INCLUDEDIR})
+INSTALL(FILES inc/profile_common.h DESTINATION ${INCLUDEDIR})
+INSTALL(FILES inc/privilege_common.h DESTINATION ${INCLUDEDIR})
INSTALL(FILES ../dotnet-launcher.pc DESTINATION ${LIBDIR}/pkgconfig)
INSTALL(FILES dotnet-launcher.info DESTINATION /usr/share/parser-plugins)
-INSTALL(FILES dotnet.preload.list DESTINATION ${LOADERDIR})
+IF(DEFINED BUILD_DOTNET_PLUGIN)
+ INSTALL(TARGETS ${DOTNET_PLUGIN} DESTINATION ${NATIVE_LIB_DIR})
+ENDIF(DEFINED BUILD_DOTNET_PLUGIN)
+