Last active
March 30, 2019 03:02
-
-
Save tsutsui/8d7dd8c01276d2be513d0cfa8a62d64d to your computer and use it in GitHub Desktop.
A dumb patch to make mozc-config https://github.com/hidegit/mozc-config work with the latest mozc-2.20.2673.102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Makefile b/Makefile | |
index c8b7257..9c93338 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -1,5 +1,5 @@ | |
DESTDIR = | |
-prefix = /usr/local | |
+prefix = /usr/pkg | |
bindir = $(prefix)/bin | |
libexecdir = $(prefix)/libexec | |
datadir = $(prefix)/share | |
@@ -9,30 +9,33 @@ RM = rm -f | |
INSTALL = /usr/bin/install | |
MOZC_SRC = .. | |
+MOZC_RELEASE = $(MOZC_SRC)/out_bsd/Release | |
-CFLAGS = | |
+CFLAGS = -std=gnu++11 -DOS_NETBSD | |
LDFLAGS = | |
INCS = -I$(MOZC_SRC) \ | |
- -I$(MOZC_SRC)/out/Release/obj/gen \ | |
- -I$(MOZC_SRC)/out/Release/obj/gen/proto_out | |
+ -I$(MOZC_RELEASE)/gen \ | |
+ -I$(MOZC_RELEASE)/gen/proto_out \ | |
+ -I$(prefix)/include | |
MOZC_CONF = mozc-config | |
MOZC_CONF_OBJS = mozc_config_main.o | |
-MOZC_DICT = mozc-dict | |
+#MOZC_DICT = mozc-dict | |
-MOZC_DICT_OBJS = mozc_dict_main.o | |
+#MOZC_DICT_OBJS = mozc_dict_main.o | |
-EXTOBJS = $(MOZC_SRC)/out/Release/obj.target/session_protocol/gen/proto_out/session/config.pb.o \ | |
- $(MOZC_SRC)/out/Release/obj.target/session/libconfig_handler.a \ | |
- $(MOZC_SRC)/out/Release/obj.target/dictionary/libdictionary.a \ | |
- $(MOZC_SRC)/out/Release/obj.target/dictionary/libuser_pos_data.a \ | |
- $(MOZC_SRC)/out/Release/obj.target/base/*.a | |
+EXTOBJS = $(MOZC_RELEASE)/obj/protocol/gen/proto_out/protocol/config_proto.config.pb.o \ | |
+ $(MOZC_RELEASE)/obj/config/libconfig_handler.a \ | |
+ $(MOZC_RELEASE)/obj/dictionary/libsuppression_dictionary.a \ | |
+ $(MOZC_RELEASE)/obj/dictionary/libuser_dictionary.a \ | |
+ $(MOZC_RELEASE)/obj/base/*.a | |
-LIBS = -lpthread -lprotobuf | |
+ | |
+LIBS != pkg-config protobuf --libs | |
IBUS_SETUP_MOZC = ibus-setup-mozc | |
diff --git a/mozc_config_main.cc b/mozc_config_main.cc | |
index d3f5cd7..d8c2a27 100644 | |
--- a/mozc_config_main.cc | |
+++ b/mozc_config_main.cc | |
@@ -18,8 +18,9 @@ | |
using namespace std; | |
-#include "session/config.pb.h" | |
-#include "session/config_handler.h" | |
+#include "config/config_handler.h" | |
+#include "protocol/config.pb.h" | |
+ | |
#include "google/protobuf/descriptor.h" | |
#include "google/protobuf/message.h" | |
@@ -140,7 +141,7 @@ void get(string name) { | |
} else if (type == 14) { | |
value << ref->GetEnum(conf, field)->name(); | |
} else { | |
- value << "/* Not Impl Error!! */"; | |
+ value << "/* Not Impl Error!! */" << endl; | |
} | |
cout << value.str(); | |
if (type != 11) | |
@@ -148,7 +149,8 @@ void get(string name) { | |
} | |
void set_character_form_rules(string name, string group, string preedit, string conversion) { | |
- mozc::config::Config conf = mozc::config::ConfigHandler::GetConfig(); | |
+ mozc::config::Config conf; | |
+ mozc::config::ConfigHandler::GetConfig(&conf); | |
const google::protobuf::FieldDescriptor* field = | |
mozc::config::Config::descriptor()->FindFieldByName(name); | |
@@ -201,7 +203,7 @@ void set_character_form_rules(string name, string group, string preedit, string | |
mozc::config::ConfigHandler::SetConfig(conf); | |
} | |
-void set(string name, string value) { | |
+void set_config(string name, string value) { | |
if (is_ignore(name)) return; | |
mozc::config::Config conf; | |
@@ -246,10 +248,8 @@ void set(string name, string value) { | |
void clear(string name) { | |
if (is_ignore(name)) return; | |
-// mozc::config::Config conf; | |
- // mozc::config::ConfigHandler::GetConfig(&conf); | |
- | |
- mozc::config::Config conf = mozc::config::ConfigHandler::GetConfig(); | |
+ mozc::config::Config conf; | |
+ mozc::config::ConfigHandler::GetConfig(&conf); | |
const google::protobuf::FieldDescriptor* field = | |
conf.GetDescriptor()->FindFieldByName(name); | |
@@ -288,10 +288,8 @@ void print_modifier() { | |
} | |
void print_all() { | |
-// mozc::config::Config conf; | |
-// mozc::config::ConfigHandler::GetConfig(&conf); | |
- | |
- mozc::config::Config conf = mozc::config::ConfigHandler::GetConfig(); | |
+ mozc::config::Config conf; | |
+ mozc::config::ConfigHandler::GetConfig(&conf); | |
const google::protobuf::Descriptor* desc = conf.GetDescriptor();//mozc::config::Config::descriptor(); | |
const google::protobuf::Reflection* ref = conf.GetReflection(); | |
@@ -341,7 +339,7 @@ void print_all() { | |
} else if (type == 14) { | |
value << ref->GetEnum(conf, field)->name(); | |
} else { | |
- value << "/* Not Impl Error!! */"; | |
+ value << "/* Not Impl Error!! */" << endl; | |
} | |
cout << value.str(); | |
if (type != 11) cout << endl; | |
@@ -466,7 +464,7 @@ int main(int argc, char **argv) { | |
set_character_form_rules((string)argv[2], (string)argv[3], | |
(string)argv[4], (string)argv[5]); | |
} else if (argc > 3) { | |
- set((string)argv[2], (string)argv[3]); | |
+ set_config((string)argv[2], (string)argv[3]); | |
} | |
} else if (flg == "-c") { | |
if (argc > 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment