Skip to content

Commit

Permalink
Refine Makefile and do not install engine.db if English mode is disab…
Browse files Browse the repository at this point in the history
…led.

Move english related files into data/db/english folder and update Makefile.am

BUG=None
TEST=make & make install

Review URL: http://codereview.appspot.com/5503058
  • Loading branch information
phuang committed Jan 3, 2012
1 parent 0e658c7 commit dae2d6b
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 32 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ data/Makefile
data/db/Makefile
data/db/android/Makefile
data/db/open-phrase/Makefile
data/db/english/Makefile
data/icons/Makefile
m4/Makefile
])
Expand Down
24 changes: 0 additions & 24 deletions data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

WORDLIST = wordlist
ENGLISH_AWK = english.awk
ENGLISH_DB = english.db

SUBDIRS = \
db \
icons \
$(NULL)

english_db_DATA = \
$(ENGLISH_DB) \
$(NULL)
english_dbdir = $(pkgdatadir)/db

$(ENGLISH_DB): $(WORDLIST) $(ENGLISH_AWK)
$(AM_V_GEN) \
$(RM) $@; \
$(AWK) -f $(srcdir)/$(ENGLISH_AWK) $(srcdir)/$(WORDLIST) | @SQLITE3@ $@ || \
( $(RM) $@ ; exit 1 )

EXTRA_DIST = \
$(WORDLIST) \
$(ENGLISH_AWK) \
$(NULL)

CLEANFILES = \
$(ENGLISH_DB) \
$(NULL)
17 changes: 15 additions & 2 deletions data/db/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

if IBUS_BUILD_DB_ANDROID
ANDROID_DIR=android
endif

if IBUS_BUILD_DB_OPEN_PHRASE
OPEN_PHRASE_DIR=open-phrase
endif

if IBUS_BUILD_ENGLISH_INPUT_MODE
ENGLISH_DIR=english
endif

main_db_DATA = \
create_index.sql \
$(NULL)
Expand All @@ -28,8 +40,9 @@ EXTRA_DIST = \
$(NULL)

SUBDIRS = \
android \
open-phrase \
$(ANDROID_DIR) \
$(OPEN_PHRASE_DIR) \
$(ENGLISH_DIR) \
$(NULL)


Expand Down
2 changes: 0 additions & 2 deletions data/db/android/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ data_files = \
rawdict_utf16_65105_freq.txt \
$(NULL)

if IBUS_BUILD_DB_ANDROID
main_db_DATA = \
android.db \
$(NULL)
main_dbdir = $(pkgdatadir)/db
endif

android.db: $(android_raw_data) $(create_scripts)
$(AM_V_GEN) \
Expand Down
43 changes: 43 additions & 0 deletions data/db/english/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# vim:set noet ts=4:
#
# ibus-pinyin - The Chinese PinYin engine for IBus
#
# Copyright (c) 2008-2010 Peng Huang <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

WORDLIST = wordlist
ENGLISH_AWK = english.awk
ENGLISH_DB = english.db

english_db_DATA = \
$(ENGLISH_DB) \
$(NULL)
english_dbdir = $(pkgdatadir)/db

$(ENGLISH_DB): $(WORDLIST) $(ENGLISH_AWK)
$(AM_V_GEN) \
$(RM) $@; \
$(AWK) -f $(srcdir)/$(ENGLISH_AWK) $(srcdir)/$(WORDLIST) | @SQLITE3@ $@ || \
( $(RM) $@ ; exit 1 )

EXTRA_DIST = \
$(WORDLIST) \
$(ENGLISH_AWK) \
$(NULL)

CLEANFILES = \
$(ENGLISH_DB) \
$(NULL)
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions data/db/open-phrase/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


if IBUS_BUILD_DB_OPEN_PHRASE
db_file = open-phrase.db
main_db_DATA = \
db/$(db_file) \
Expand Down Expand Up @@ -51,5 +49,4 @@ CLEANFILES = \
DISTCLEANFILES = \
$(DBTAR) \
$(NULL)
endif

2 changes: 1 addition & 1 deletion src/PYEnglishEditor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ EnglishEditor::EnglishEditor (PinyinProperties & props, Config &config)
"ibus", "pinyin", "english-user.db", NULL);

gboolean result = m_english_database->openDatabase
(".." G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S "english.db",
(".." G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S "db" G_DIR_SEPARATOR_S "english" G_DIR_SEPARATOR_S "english.db",
"english-user.db") ||
m_english_database->openDatabase
(PKGDATADIR G_DIR_SEPARATOR_S "db" G_DIR_SEPARATOR_S "english.db", path);
Expand Down

0 comments on commit dae2d6b

Please sign in to comment.