Fix CMakeLists.txt to make extendible.
Clean build dependency of each components.
Rename some files.
Change-Id: I5fe6ee6d7618ec6da82ec717fec9e50cab6681c1
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
# Local include directories
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
- ${CMAKE_SOURCE_DIR}/common/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
# build app2ext library
SET(APP2EXT "app2ext")
-SET(app2ext_src_dir "${CMAKE_SOURCE_DIR}/src")
-SET(libapp2ext_SOURCES
- ${app2ext_src_dir}/app2ext_interface.c
- ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src APP2EXT_SRCS)
-ADD_LIBRARY(${APP2EXT} SHARED ${libapp2ext_SOURCES})
+ADD_LIBRARY(${APP2EXT} SHARED ${APP2EXT_SRCS})
SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIC")
INSTALL(TARGETS ${APP2EXT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/app2ext_interface.h DESTINATION include)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION include)
IF(TIZEN_FEATURE_APP2SD_PLUGIN)
ADD_SUBDIRECTORY(test)
%files devel
%defattr(-,root,root,-)
-%{_includedir}/app2ext_interface.h
+%{_includedir}/*.h
%{_libdir}/pkgconfig/app2sd.pc
%if 0%{?tizen_feature_app2sd_plugin}
%{_libdir}/libapp2sd.so
SET(CMAKE_C_FLAGS "${EXTRA_CFLAGS} ${APP2SD_CFLAGS}")
# Local include directories
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
- ${CMAKE_SOURCE_DIR}/common/inc
- ${CMAKE_SOURCE_DIR}/plugin/app2sd/inc)
+INCLUDE_DIRECTORIES(
+ ${CMAKE_SOURCE_DIR}/inc
+ ${CMAKE_SOURCE_DIR}/plugin/app2sd/common/inc)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/common/src APP2SD_COMMON_SRCS)
# build app2sd library
SET(APP2SD "app2sd")
-SET(app2sd_src_dir "${CMAKE_SOURCE_DIR}/plugin/app2sd/src")
-SET(libapp2sd_SOURCES
- ${app2sd_src_dir}/app2sd_client_interface.c
- ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
-
-ADD_LIBRARY(${APP2SD} SHARED ${libapp2sd_SOURCES})
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/lib APP2SD_LIB_SRCS)
+ADD_LIBRARY(${APP2SD} SHARED ${APP2SD_LIB_SRCS} ${APP2SD_COMMON_SRCS})
SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIC")
# build app2sd-server binary
SET(APP2SD_SERVER "app2sd-server")
-SET(app2sd_server_SOURCES
- ${app2sd_src_dir}/app2sd_internals.c
- ${app2sd_src_dir}/app2sd_interface.c
- ${app2sd_src_dir}/app2sd_internals_registry.c
- ${app2sd_src_dir}/app2sd_internals_utils.c
- ${app2sd_src_dir}/app2sd_server.c
- ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
-ADD_EXECUTABLE(${APP2SD_SERVER} ${app2sd_server_SOURCES})
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/server APP2SD_SERVER_SRCS)
+ADD_EXECUTABLE(${APP2SD_SERVER} ${APP2SD_SERVER_SRCS} ${APP2SD_COMMON_SRCS})
SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIE ")
SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES LINK_FLAGS "-pie")
TARGET_LINK_LIBRARIES(${APP2SD_SERVER} app2sd ${app2sd_pkgs_LDFLAGS} "-lm")
#include <stdio.h>
#include <stdlib.h>
-#include "app2ext_utils.h"
+#include "app2sd_utils.h"
int _is_global(uid_t uid)
{
#include <pkgmgr-info.h>
#include "app2sd_client_interface.h"
-#include "app2ext_utils.h"
+#include "app2sd_utils.h"
#define CONNECTION_RETRY_MAX 5
#define CONNECTION_WAIT_USEC (1000000 / 2) /* 0.5 sec */
#endif
#include "app2ext_interface.h"
-#include "app2ext_utils.h"
+#include "app2sd_utils.h"
int app2sd_usr_pre_app_install(const char *pkgid,
GList *dir_list, int size, uid_t uid);
--- /dev/null
+/*
+ * app2ext
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _APP2EXT_DEBUG_H
+#define _APP2EXT_DEBUG_H
+
+#include <dlog.h>
+
+#define _E(fmt, arg...) LOGE(fmt, ##arg)
+#define _D(fmt, arg...) LOGD(fmt, ##arg)
+#define _W(fmt, arg...) LOGW(fmt, ##arg)
+#define _I(fmt, arg...) LOGI(fmt, ##arg)
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "APP2EXT"
+
+#endif
#include <dirent.h>
#include "app2ext_interface.h"
-#include "app2ext_utils.h"
+#include "app2ext_debug.h"
#define APP2EXT_SD_PLUGIN_PATH LIBPREFIX "/libapp2sd.so"
+#define REGULAR_USER 5000
app2ext_handle *app2ext_init(int storage_type)
{
#include <getopt.h>
#include <unzip.h>
#include <storage-internal.h>
+#include <tzplatform_config.h>
#include "app2ext_interface.h"
-#include "app2ext_utils.h"
#define SUCCESS 0
#define FAIL 1
#define CMD_LEN 256
#define TEST_PKGNAME "org.example.basicuiapplication"
#define TEST_PKGNAME_PATH "/tmp/org.example.basicuiapplication-1.0.0-arm.tpk"
+#define OWNER_ROOT 0
+#define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
app2ext_handle *handle = NULL;