Mark exported API with macro 34/64834/1 sandbox/vbarinov/vis
authorSlava Barinov <v.barinov@samsung.com>
Tue, 5 Apr 2016 09:58:19 +0000 (12:58 +0300)
committerSlava Barinov <v.barinov@samsung.com>
Tue, 5 Apr 2016 13:30:55 +0000 (16:30 +0300)
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>
CMakeLists.txt
src/tpk/step/configuration/step_parse_preload.h
src/tpk/step/filesystem/step_check_pkg_directory_path.h
src/tpk/step/filesystem/step_create_symbolic_link.h
src/tpk/step/filesystem/step_tpk_patch_icons.h
src/tpk/step/pkgmgr/step_convert_xml.h
src/tpk/step/pkgmgr/step_manifest_adjustment.h
src/tpk/step/security/step_check_tpk_background_category.h
src/tpk/tpk_app_query_interface.h
src/tpk/tpk_installer.h

index 10f540f7b6a709fb45c083e49c685ac6382fda21..931ad6e775bb0e0e44d79b18f6b1425d068da974 100644 (file)
@@ -13,13 +13,13 @@ IF(NOT CMAKE_BUILD_TYPE)
 ENDIF(NOT CMAKE_BUILD_TYPE)
 
 # Compiler flags
-SET(CMAKE_C_FLAGS_PROFILING    "-O2")
-SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++11")
-SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
-SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++11 -g")
-SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++11 -g")
-SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++11 -g --coverage")
+SET(CMAKE_C_FLAGS_PROFILING    "-O2 -fvisibility=hidden -flto")
+SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++11 -fvisibility=hidden -flto")
+SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g -fvisibility=hidden -flto")
+SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++11 -g -fvisibility=hidden -flto")
+SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g -fvisibility=hidden -flto")
+SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++11 -g -fvisibility=hidden -flto")
+SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++11 -g --coverage -fvisibility=hidden -flto")
 
 # Targets
 SET(TARGET_LIBNAME_TPK "tpk-installer")
@@ -33,6 +33,7 @@ ADD_DEFINITIONS("-Wall")
 ADD_DEFINITIONS("-Wextra")
 ADD_DEFINITIONS("-fPIE")
 ADD_DEFINITIONS("-fPIC")
+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 d0e02b59a0c493771f6fa43e76ddde0c91991182..d7e38c3fe1322e889f5dda65cb510085a8764370 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_
 #define TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <manifest_parser/utils/logging.h>
 
 #include "common/installer_context.h"
@@ -13,7 +17,7 @@
 namespace tpk {
 namespace configuration {
 
-class StepParsePreload : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepParsePreload : public common_installer::Step {
  public:
   using Step::Step;
 
index 98453ef4f72ae1d8ad8350f599e9ec2b58c8c450..2e76a8177ea55009d84e4df6d32b22384d3c9f70 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_FILESYSTEM_STEP_CHECK_PKG_DIRECTORY_PATH_H_
 #define TPK_STEP_FILESYSTEM_STEP_CHECK_PKG_DIRECTORY_PATH_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <manifest_parser/utils/logging.h>
 
 #include "common/installer_context.h"
@@ -13,7 +17,7 @@
 namespace tpk {
 namespace filesystem {
 
-class StepCheckPkgDirPath : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepCheckPkgDirPath : public common_installer::Step {
  public:
   using Step::Step;
 
index 8b9a6aca4a8c7c85a7d7847b799007c1e0a923f5..35350570d23a165689afe6f7cab2c4ff8e56ea56 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,7 @@
 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 a3806b1a3f3267c0948dbd32a98c377f2b06f591..aae884785795c6d47b7ce41bd3e769b9faf47ca6 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 12332f6dc96025cb174337e85b2e76531fa645df..42be648aa326527e90eca7c225edfe3fde34a6ef 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_PKGMGR_STEP_CONVERT_XML_H_
 #define TPK_STEP_PKGMGR_STEP_CONVERT_XML_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <manifest_parser/utils/logging.h>
 
 #include <boost/filesystem/path.hpp>
@@ -15,7 +19,7 @@
 namespace tpk {
 namespace pkgmgr {
 
-class StepConvertXml : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepConvertXml : public common_installer::Step {
  public:
   using Step::Step;
 
index 9bac6ed95ac4d5fd6da85dec69a6bfa2cfa3e7c9..55f62503964bd9119263fcc1421632466715e571 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_PKGMGR_STEP_MANIFEST_ADJUSTMENT_H_
 #define TPK_STEP_PKGMGR_STEP_MANIFEST_ADJUSTMENT_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <manifest_parser/utils/logging.h>
 
 #include <boost/filesystem/path.hpp>
@@ -14,7 +18,7 @@
 namespace tpk {
 namespace pkgmgr {
 
-class StepManifestAdjustment : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepManifestAdjustment : public common_installer::Step {
  public:
   using Step::Step;
 
index 445e4b7556237db481dfb1fb326a641b03fbeb04..03bcaa689d9b670b4dedbe3ffee3d920b3936549 100644 (file)
@@ -5,6 +5,10 @@
 #ifndef TPK_STEP_SECURITY_STEP_CHECK_TPK_BACKGROUND_CATEGORY_H_
 #define TPK_STEP_SECURITY_STEP_CHECK_TPK_BACKGROUND_CATEGORY_H_
 
+#ifndef TPK_BACKEND_EXPORT_API
+#define TPK_BACKEND_EXPORT_API
+#endif
+
 #include <manifest_parser/utils/version_number.h>
 
 #include <common/step/security/step_check_background_category.h>
@@ -16,7 +20,7 @@ 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 :
+class TPK_BACKEND_EXPORT_API StepCheckTpkBackgroundCategory :
     public common_installer::security::StepCheckBackgroundCategory {
  public:
   explicit StepCheckTpkBackgroundCategory(
index 0dbf471daf8b54524ae8c51154abbed81fb66e66..52465dff249f195fde3c1cffc6e6278dce45608f 100644 (file)
@@ -5,11 +5,15 @@
 #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 8037f81071161fdb86e34f814c9ee40606da0c40..a2f056e27ca5fe948a0ebc137eb6ae167904f0f3 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,7 @@ 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();