Change symbol visibility and switch on LTO 30/62830/1
authorSlava Barinov <v.barinov@samsung.com>
Fri, 18 Mar 2016 12:53:29 +0000 (15:53 +0300)
committerSlava Barinov <v.barinov@samsung.com>
Fri, 18 Mar 2016 14:01:40 +0000 (17:01 +0300)
Switching on -fvisibility=hidden with Link-Time Optimization decreases
resulting binary size by ~20%

Change-Id: I7cf805fd928fbf927e2f1b15f8c64ab8000ad0d0

packaging/ise-engine-anthy.spec
src/scim_anthy_factory.cpp
src/scim_anthy_factory.h
src/scim_anthy_helper.cpp
src/scim_anthy_setup.cpp

index d2fb60ccb51cf4f68436ca975331db897bba45a8..24842255ce7bb95d8e01f1cb9417c1f63dc8f54c 100644 (file)
@@ -17,11 +17,14 @@ ISF is an input service framework for TIZEN.
 ise-engine-anthy is ISF IMEngine module for Japanese input method base.It converts Hiragana text to Kana Kanji mixed text.
 
 
-
 %prep
 %setup -q
 
 %build
+export CFLAGS+=" -fvisibility=hidden -flto "
+export CXXFLAGS+=" -fvisibility=hidden -flto "
+export CPPFLAGS+=" -DEXPORTED=__attribute__\(\(visibility\(\\\"default\\\"\)\)\)"
+
 ./bootstrap
 %configure --prefix=%{_prefix} --disable-static
 
index b0f81741a0c40aa996955700f5fd4d102dbb63fe..57c0cc792c49a13e57c3dbe05099338a5a916465 100755 (executable)
@@ -19,7 +19,7 @@
  */
 
 /*
- * The original code is scim_uim_imengine.cpp in scim-uim-0.1.3. 
+ * The original code is scim_uim_imengine.cpp in scim-uim-0.1.3.
  * Copyright (C) 2004 James Su <suzhe@tsinghua.org.cn>
  */
 
 static ConfigPointer _scim_config (0);
 
 extern "C" {
-    void scim_module_init (void)
+    EXPORTED void scim_module_init (void)
     {
         bindtextdomain (GETTEXT_PACKAGE, SCIM_ANTHY_LOCALEDIR);
         bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
     }
 
-    void scim_module_exit (void)
+    EXPORTED void scim_module_exit (void)
     {
         anthy_quit ();
         _scim_config.reset ();
     }
 
-    uint32 scim_imengine_module_init (const ConfigPointer &config)
+    EXPORTED uint32 scim_imengine_module_init (const ConfigPointer &config)
     {
         SCIM_DEBUG_IMENGINE(1) << "Initialize Anthy Engine.\n";
 
@@ -82,7 +82,7 @@ extern "C" {
         return 1;
     }
 
-    IMEngineFactoryPointer scim_imengine_module_create_factory (uint32 engine)
+    EXPORTED IMEngineFactoryPointer scim_imengine_module_create_factory (uint32 engine)
     {
         AnthyFactory *factory = 0;
 
@@ -188,7 +188,7 @@ AnthyFactory::get_name () const
 WideString
 AnthyFactory::get_authors () const
 {
-    const char *package = 
+    const char *package =
         PACKAGE "-" PACKAGE_VERSION "\n"
         "\n";
     const char *authors =
@@ -232,18 +232,18 @@ AnthyFactory::get_credits () const
 WideString
 AnthyFactory::get_help () const
 {
-    const char *title = 
+    const char *title =
         _("Basic operation:\n"
           "  \n");
 
-    const char *text1 = 
+    const char *text1 =
         _("1. Switch input mode:\n"
           "  You can switch on/off Japanese input mode by pressing Zenkaku_Hankaku key\n"
           "  or Control+J. Or you can rotate all input modes by pressing Control+,\n"
           "  (comma).\n"
           "  \n");
 
-    const char *text2 = 
+    const char *text2 =
         _("2. Input Japanese hiragana and katakana:\n"
           "  You can input Japanese hiragana and katakana by inputting romaji.\n"
           "  The Romaji table can be found out from the \"Anthy\" section of the setup\n"
@@ -252,7 +252,7 @@ AnthyFactory::get_help () const
           "  please press Alt + Romaji key or Conrol+\\ key to switch typing method.\n"
           "  \n");
 
-    const char *text3 = 
+    const char *text3 =
         _("3. Convert hiragana or katakana to Japanese kanji\n"
           "  After inputting hiragana or katakana, you can convert it to Japanese\n"
           "  kanji by pressing Space key. Then it will show some candidates. You can\n"
@@ -264,7 +264,7 @@ AnthyFactory::get_help () const
           "  right cursor key.\n"
           "  \n");
 
-    const char *text4 = 
+    const char *text4 =
         _("4. Other key bindings:\n"
           "  You can find out all key bindings definition of scim-anthy from \"Anthy\"\n"
           "  section on setup window of SCIM or SKIM.\n");
index bbe6e653d300d23a1a178b317b972b9bf2b6b085..58508d70c64257cffd8887cfe7cdbad585f0a155 100755 (executable)
@@ -19,7 +19,7 @@
  */
 
 /*
- * The original code is scim_uim_imengine.cpp in scim-uim-0.1.3. 
+ * The original code is scim_uim_imengine.cpp in scim-uim-0.1.3.
  * Copyright (C) 2004 James Su <suzhe@tsinghua.org.cn>
  */
 
index a0c0d30f0face702be0f1cd1b413333098e6c613..69efb0fb0406e972ed14c32c1c7777ed615c7c39 100755 (executable)
@@ -73,7 +73,7 @@ std::map <int, TimeoutIDList> timeout_ids;
 
 //Module Interface
 extern "C" {
-    void scim_module_init (void)
+    EXPORTED void scim_module_init (void)
     {
         bindtextdomain (GETTEXT_PACKAGE, SCIM_ANTHY_LOCALEDIR);
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -83,25 +83,25 @@ extern "C" {
             _("A helper module for Anthy IMEngine."));
     }
 
-    void scim_module_exit (void)
+    EXPORTED void scim_module_exit (void)
     {
     }
 
-    unsigned int scim_helper_module_number_of_helpers (void)
+    EXPORTED unsigned int scim_helper_module_number_of_helpers (void)
     {
         return 1;
     }
 
-    bool scim_helper_module_get_helper_info (unsigned int idx, HelperInfo &info)
+    EXPORTED bool scim_helper_module_get_helper_info (unsigned int idx, HelperInfo &info)
     {
         if (idx == 0) {
-            info = helper_info; 
+            info = helper_info;
             return true;
         }
         return false;
     }
 
-    void scim_helper_module_run_helper (const String &uuid,
+    EXPORTED void scim_helper_module_run_helper (const String &uuid,
                                         const ConfigPointer &config,
                                         const String &display)
     {
@@ -238,7 +238,7 @@ run (const String &display, const ConfigPointer &config)
     argv [1] = "--display";
     argv [2] = const_cast<char *> (display.c_str ());
     argv [3] = 0;
+
     setenv ("DISPLAY", display.c_str (), 1);
 
     gtk_init (&argc, &argv);
index 942e85228970888494a8d881d303bead4bd2f6d2..86ee9d46dc881a271c6799207a360e70f74d80a4 100755 (executable)
@@ -94,47 +94,47 @@ const String __user_style_file_name =
 
 // Module Interface.
 extern "C" {
-    void scim_module_init (void)
+    EXPORTED void scim_module_init (void)
     {
         bindtextdomain (GETTEXT_PACKAGE, SCIM_ANTHY_LOCALEDIR);
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
     }
 
-    void scim_module_exit (void)
+    EXPORTED void scim_module_exit (void)
     {
     }
 
-    GtkWidget * scim_setup_module_create_ui (void)
+    EXPORTED GtkWidget * scim_setup_module_create_ui (void)
     {
         return create_setup_window ();
     }
 
-    String scim_setup_module_get_category (void)
+    EXPORTED String scim_setup_module_get_category (void)
     {
         return String ("IMEngine");
     }
 
-    String scim_setup_module_get_name (void)
+    EXPORTED String scim_setup_module_get_name (void)
     {
         return String (_("Anthy"));
     }
 
-    String scim_setup_module_get_description (void)
+    EXPORTED String scim_setup_module_get_description (void)
     {
         return String (_("An Anthy IMEngine Module."));
     }
 
-    void scim_setup_module_load_config (const ConfigPointer &config)
+    EXPORTED void scim_setup_module_load_config (const ConfigPointer &config)
     {
         load_config (config);
     }
 
-    void scim_setup_module_save_config (const ConfigPointer &config)
+    EXPORTED void scim_setup_module_save_config (const ConfigPointer &config)
     {
         save_config (config);
     }
 
-    bool scim_setup_module_query_changed ()
+    EXPORTED bool scim_setup_module_query_changed ()
     {
         return query_changed ();
     }
@@ -628,7 +628,7 @@ append_key_bindings (GtkTreeView *treeview, gint idx, const gchar *filter)
 {
     GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model (treeview));
     KeyEventList keys1, keys2;
-    
+
     if (filter && *filter)
         scim_string_to_key_list (keys1, filter);
 
@@ -1164,7 +1164,7 @@ create_toolbar_page (void)
 static GtkWidget *
 create_appearance_page (void)
 {
-    GtkWidget *vbox, *table, *omenu, *widget, *hbox; 
+    GtkWidget *vbox, *table, *omenu, *widget, *hbox;
 
     vbox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (vbox);
@@ -1500,7 +1500,7 @@ setup_widget_value (void)
             }
         }
     }
-    
+
     for (unsigned int i = 0; config_color_common[i].fg_key; i++) {
         ColorConfigData &entry = config_color_common[i];
         if (entry.widget) {