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>
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")
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)
#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"
namespace tpk {
namespace configuration {
-class StepParsePreload : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepParsePreload : public common_installer::Step {
public:
using Step::Step;
#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"
namespace tpk {
namespace filesystem {
-class StepCheckPkgDirPath : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepCheckPkgDirPath : public common_installer::Step {
public:
using Step::Step;
#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>
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;
#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>
* 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;
#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>
namespace tpk {
namespace pkgmgr {
-class StepConvertXml : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepConvertXml : public common_installer::Step {
public:
using Step::Step;
#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>
namespace tpk {
namespace pkgmgr {
-class StepManifestAdjustment : public common_installer::Step {
+class TPK_BACKEND_EXPORT_API StepManifestAdjustment : public common_installer::Step {
public:
using Step::Step;
#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>
* \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(
#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;
};
#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>
* 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();