# pkg_add loudmouth
# pkg_add guile
# pkg_add gettext
# pkg_add glib2
FreetalkはGNU LIBCに含まれるargp.hを使っている。
NetBSDのLIBCにはargp.hは無いので、以下のパッチでargpの代わりにgetoptを使う。
diff -u -r freetalk-0.69-orig/src/freetalk.cc freetalk-0.69/src/freetalk.cc
--- freetalk-0.69-orig/src/freetalk.cc 2006-04-19 09:31:49.000000000 +0900
+++ freetalk-0.69/src/freetalk.cc 2006-06-08 06:21:09.000000000 +0900
@@ -21,7 +21,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -123,31 +123,6 @@
g_io_add_watch (chan, G_IO_IN, (GIOFunc) stdin_input_cb, NULL);
}
-const char *argp_program_version = PACKAGE_NAME " " PACKAGE_VERSION;
-const char *argp_program_bug_address = PACKAGE_BUGREPORT;
-
-static error_t
-parse_opts (int key, char *arg, struct argp_state *_state)
-{
- switch (key) {
- case 'j':
- do_set_jid (arg);
- break;
- case 's':
- state.script = arg;
- break;
- case 'r':
- ft_register ();
- break; /* not reached */
- default:
- /* hack to allow args to script */
- if (!state.script)
- return ARGP_ERR_UNKNOWN;
- }
-
- return 0;
-}
-
static void
mode_init (void)
{
@@ -165,20 +140,30 @@
static void
args_init (void)
{
- struct {
- char *f[2];
- } f;
- static char doc[] = "Freetalk is a console based jabber client/bot with a readline interface and guile extensions";
- static char argp_doc[] = " ";
- static struct argp_option options [] = {
- {"jid", 'j', "JABBERID", 0, "user@domain Jabber ID" },
- {"script", 's', "SCRIPTFILE", 0, "Freetalk script" },
- {"register", 'r', 0, 0, "Register an account with a server"},
- { 0, }
+ extern char *optarg;
+ int ch;
+ static struct option longopts[] = {
+
+ { "jid", required_argument, 0, 'j' },
+ { "script", required_argument, 0, 's' },
+ { "register", no_argument, 0, 'r'},
+ { NULL, 0, NULL, 0 },
};
- static struct argp argp = { options, parse_opts, argp_doc, doc };
-
- argp_parse (&argp, state.argc, state.argv, 0, 0, &f);
+
+ while ((ch = getopt_long(state.argc, state.argv, "j:s:r", longopts, NULL)) != -1) {
+ switch (ch) {
+ case 'j':
+ do_set_jid(optarg);
+ break;
+ case 's':
+ state.script = (char*)malloc(strlen(optarg));
+ strcpy(state.script, optarg);
+ break;
+ case 'r':
+ ft_register();
+ break;
+ }
+ }
}
static void
diff -u -r freetalk-0.69-orig/src/primitives.cc freetalk-0.69/src/primitives.cc
--- freetalk-0.69-orig/src/primitives.cc 2006-04-19 09:31:49.000000000 +0900
+++ freetalk-0.69/src/primitives.cc 2006-06-07 07:27:53.000000000 +0900
@@ -22,7 +22,7 @@
#include
#include
#include
-#include
+//#include
#include
あとは、configure, make
$ cd freetalk-0.69
$ CPPFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib ./configure
トップディレクトリでmakeすると、version.texiの作成のあたりでエラーが出る。
何かよくわからんので、バイナリと.scmのみインストールする。
$ make (エラーが出る)
$ cd src
$ make
$ cd ../extension
$ sudo make install
0 件のコメント:
コメントを投稿