Mark exported API with macro 34/64834/4 accepted/tizen/common/20160803.193133 accepted/tizen/ivi/20160804.080745 accepted/tizen/mobile/20160804.080836 accepted/tizen/tv/20160804.080702 accepted/tizen/wearable/20160804.080508 submit/tizen/20160803.012753
authorSlava Barinov <v.barinov@samsung.com>
Tue, 5 Apr 2016 09:58:19 +0000 (12:58 +0300)
committerSangyoon Jang <s89.jang@samsung.com>
Tue, 2 Aug 2016 08:23:39 +0000 (01:23 -0700)
Switch on -fvisibility=hidden to remove non-needed symbols from resulting binary
and LTO to reduce size.
libtpk-installer.so is reduced by 40%

Change-Id: I8c75de21d6b4052835f997ebb3382174416f4f0c
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
CMakeLists.txt
src/tpk/step/filesystem/step_create_symbolic_link.h
src/tpk/step/filesystem/step_tpk_patch_icons.h
src/tpk/step/filesystem/step_tpk_prepare_package_directory.h
src/tpk/step/filesystem/step_tpk_update_package_directory.h
src/tpk/step/security/step_check_tpk_background_category.h
src/tpk/tpk_app_query_interface.h
src/tpk/tpk_installer.h

index eb48c3c..7a8d8ce 100644 (file)
@@ -13,7 +13,7 @@ IF(NOT CMAKE_BUILD_TYPE)
 ENDIF(NOT CMAKE_BUILD_TYPE)
 
 # Compiler flags
-SET(EXTRA_FLAGS "-Wall -Wextra")
+SET(EXTRA_FLAGS "-fvisibility=hidden -flto -Wall -Wextra")
 SET(CMAKE_C_FLAGS_PROFILING    "-O2 ${EXTRA_FLAGS}")
 SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++11 ${EXTRA_FLAGS}")
 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g ${EXTRA_FLAGS}")
@@ -35,6 +35,7 @@ SET(TARGET_SMOKE_TEST_HELPER "smoke-test-helper")
 SET(TARGET_MANIFEST_TEST "manifest-test")
 
 ADD_DEFINITIONS("-DPROJECT_TAG=\"TPK_BACKEND\"")
+ADD_DEFINITIONS("-DTPK_BACKEND_EXPORT_API=__attribute__((visibility(\"default\")))")
 
 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
 INCLUDE(FindPkgConfig)
index 5a7f57c..81d8b60 100644 (file)
@@ -3,6 +3,10 @@
 #ifndef TPK_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_
 #define TPK_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <manifest_parser/utils/logging.h>
 
 #include <common/app_installer.h>
@@ -10,7 +14,8 @@
 namespace tpk {
 namespace filesystem {
 
-class StepCreateSymbolicLink : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepCreateSymbolicLink
+    : public common_installer::Step {
  public:
   using Step::Step;
   Status process() override;
index 1458cbf..2d7d96d 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_FILESYSTEM_STEP_TPK_PATCH_ICONS_H_
 #define TPK_STEP_FILESYSTEM_STEP_TPK_PATCH_ICONS_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <boost/filesystem/path.hpp>
 
 #include <common/step/step.h>
@@ -18,7 +22,7 @@ namespace filesystem {
  *        Fixes location of icons for tpk apps if icons are not located in
  *        "shared/res/" directory.
  */
-class StepTpkPatchIcons : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepTpkPatchIcons : public common_installer::Step {
  public:
   using Step::Step;
 
index 5979820..c08372d 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_FILESYSTEM_STEP_TPK_PREPARE_PACKAGE_DIRECTORY_H_
 #define TPK_STEP_FILESYSTEM_STEP_TPK_PREPARE_PACKAGE_DIRECTORY_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <manifest_parser/utils/logging.h>
 
 #include <boost/filesystem/path.hpp>
@@ -38,7 +42,8 @@ namespace filesystem {
  *    - signature*.xml
  *    - res/
  */
-class StepTpkPreparePackageDirectory : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepTpkPreparePackageDirectory
+    : public common_installer::Step {
  public:
   using Step::Step;
 
index 0d48ce3..b33d9b4 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_FILESYSTEM_STEP_TPK_UPDATE_PACKAGE_DIRECTORY_H_
 #define TPK_STEP_FILESYSTEM_STEP_TPK_UPDATE_PACKAGE_DIRECTORY_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <boost/filesystem/path.hpp>
 #include <manifest_parser/utils/logging.h>
 
@@ -22,7 +26,8 @@ namespace filesystem {
  * This step will, additionally to base step actions, ,aintain backup
  * of directories from point 1) for operation rollback scenario.
  */
-class StepTpkUpdatePackageDirectory : public StepTpkPreparePackageDirectory {
+class TPK_BACKEND_EXPORT_API StepTpkUpdatePackageDirectory
+    : public StepTpkPreparePackageDirectory {
  public:
   using StepTpkPreparePackageDirectory::StepTpkPreparePackageDirectory;
 
index 445e4b7..520df47 100644 (file)
@@ -16,8 +16,8 @@ namespace security {
  * \brief This step check background category value and modify it depending on
  *        required version, cert level, background support, and value itself
  */
-class StepCheckTpkBackgroundCategory :
-    public common_installer::security::StepCheckBackgroundCategory {
+class StepCheckTpkBackgroundCategory
+    public common_installer::security::StepCheckBackgroundCategory {
  public:
   explicit StepCheckTpkBackgroundCategory(
       common_installer::InstallerContext* context);
index 0dbf471..e2ca078 100644 (file)
@@ -5,11 +5,16 @@
 #ifndef TPK_TPK_APP_QUERY_INTERFACE_H_
 #define TPK_TPK_APP_QUERY_INTERFACE_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <common/app_query_interface.h>
 
 namespace tpk {
 
-class TpkAppQueryInterface : public common_installer::AppQueryInterface {
+class TPK_BACKEND_EXPORT_API TpkAppQueryInterface
+    : public common_installer::AppQueryInterface {
  public:
   bool IsAppInstalledByArgv(int argc, char** argv) override;
 };
index 7de06d9..e940ecc 100644 (file)
@@ -3,6 +3,10 @@
 #ifndef TPK_TPK_INSTALLER_H_
 #define TPK_TPK_INSTALLER_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <common/app_installer.h>
 #include <common/pkgmgr_interface.h>
 #include <manifest_parser/utils/logging.h>
@@ -17,7 +21,8 @@ namespace tpk {
  * packages. Pkgmgr request is parsed within and sequence of steps is built to
  * be run.
  */
-class TpkInstaller : public common_installer::AppInstaller {
+class TPK_BACKEND_EXPORT_API TpkInstaller
+    : public common_installer::AppInstaller {
  public:
   explicit TpkInstaller(common_installer::PkgMgrPtr pkgmgr);
   ~TpkInstaller();