From e4987d2ac937b8b3b1d4e0392f41b69c40ef9fc1 Mon Sep 17 00:00:00 2001 From: Slava Barinov Date: Fri, 18 Mar 2016 15:53:29 +0300 Subject: Change symbol visibility and switch on LTO Switching on -fvisibility=hidden with Link-Time Optimization decreases resulting binary size by ~20% Change-Id: I7cf805fd928fbf927e2f1b15f8c64ab8000ad0d0 --- packaging/ise-engine-anthy.spec | 5 ++++- src/scim_anthy_factory.cpp | 22 +++++++++++----------- src/scim_anthy_factory.h | 2 +- src/scim_anthy_helper.cpp | 14 +++++++------- src/scim_anthy_setup.cpp | 24 ++++++++++++------------ 5 files changed, 35 insertions(+), 32 deletions(-) diff --git a/packaging/ise-engine-anthy.spec b/packaging/ise-engine-anthy.spec index d2fb60c..2484225 100644 --- a/packaging/ise-engine-anthy.spec +++ b/packaging/ise-engine-anthy.spec @@ -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 diff --git a/src/scim_anthy_factory.cpp b/src/scim_anthy_factory.cpp index b0f8174..57c0cc7 100755 --- a/src/scim_anthy_factory.cpp +++ b/src/scim_anthy_factory.cpp @@ -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 */ @@ -56,19 +56,19 @@ 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"); diff --git a/src/scim_anthy_factory.h b/src/scim_anthy_factory.h index bbe6e65..58508d7 100755 --- a/src/scim_anthy_factory.h +++ b/src/scim_anthy_factory.h @@ -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 */ diff --git a/src/scim_anthy_helper.cpp b/src/scim_anthy_helper.cpp index a0c0d30..69efb0f 100755 --- a/src/scim_anthy_helper.cpp +++ b/src/scim_anthy_helper.cpp @@ -73,7 +73,7 @@ std::map 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 (display.c_str ()); argv [3] = 0; - + setenv ("DISPLAY", display.c_str (), 1); gtk_init (&argc, &argv); diff --git a/src/scim_anthy_setup.cpp b/src/scim_anthy_setup.cpp index 942e852..86ee9d4 100755 --- a/src/scim_anthy_setup.cpp +++ b/src/scim_anthy_setup.cpp @@ -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) { -- cgit v1.2.3