Permalink
Browse files

Install admin_html and groonga can specify the path.

  • Loading branch information...
gunyarakun committed Sep 10, 2009
1 parent 937a392 commit 0713b766292515ae7e5eafcac1809077c349ce6e
Showing with 62 additions and 37 deletions.
  1. +11 −1 Makefile.am
  2. +9 −17 configure.ac
  3. +20 −3 lib/proc.c
  4. +1 −0 lib/proc.h
  5. +1 −1 {src/s → resource/admin_html}/css/admin.css
  6. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
  7. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
  8. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
  9. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png
  10. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png
  11. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png
  12. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
  13. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
  14. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
  15. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-icons_222222_256x240.png
  16. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-icons_228ef1_256x240.png
  17. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-icons_ef8c08_256x240.png
  18. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-icons_ffd27a_256x240.png
  19. BIN {src/s → resource/admin_html}/css/ui-lightness/images/ui-icons_ffffff_256x240.png
  20. 0 {src/s → resource/admin_html}/css/ui-lightness/jquery-ui-1.7.2.custom.css
  21. BIN {src/s → resource/admin_html}/images/groonga.png
  22. +4 −4 {src/s → resource/admin_html}/index.html
  23. 0 {src/s → resource/admin_html}/js/jquery-1.3.2.min.js
  24. 0 {src/s → resource/admin_html}/js/jquery-ui-1.7.2.custom.min.js
  25. +16 −11 src/groonga.c
View
@@ -1,5 +1,6 @@
SUBDIRS = lib src examples test
-EXTRA_DIST = bindings
+#dist_data_DATA =
+EXTRA_DIST = bindings resource
pkginclude_HEADERS = groonga.h
pkgconfigdir = $(libdir)/pkgconfig
@@ -17,6 +18,15 @@ dist-hook:
rm -rf `find $(distdir) -name '*.bak'`
rm -rf `find $(distdir) -name '*.orig'`
+install-data-local:
+ @$(NORMAL_INSTALL)
+ test -z "$(DESTDIR)$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
+ cp -R resource/* $(DESTDIR)$(pkgdatadir)
+
+uninstall-local:
+ @$(NORMAL_UNINSTALL)
+ rm -rf $(DESTDIR)$(pkgdatadir)
+
ruby-bindings:
cd bindings/ruby && \
ruby extconf.rb && \
View
@@ -99,34 +99,26 @@ int main(int argc, char **argv)
AC_MSG_RESULT(no)
])
-# will deprecated
-AC_ARG_WITH(groongahome,
- [AC_HELP_STRING([--with-groongahome=DIR],
- [specify Groonga home directory])],
- GROONGA_HOME="$withval",
- GROONGA_HOME="${prefix}/lib/$PACKAGE_NAME/$PACKAGE_VERSION")
-AC_DEFINE_UNQUOTED(GROONGA_HOME, "$GROONGA_HOME", "specified home directory")
-
-# log directory
-AC_ARG_WITH(log,
- [AC_HELP_STRING([--with-log=PATH],
- [specify Groonga log path.])],
+# log path
+AC_ARG_WITH(log_path,
+ [AC_HELP_STRING([--with-log-path=PATH],
+ [specify groonga log path.])],
GROONGA_LOG_PATH="$withval",
GROONGA_LOG_PATH="/var/log/$PACKAGE_NAME/$PACKAGE_NAME.log")
AC_DEFINE_UNQUOTED(GROONGA_LOG_PATH, "$GROONGA_LOG_PATH", "specified log directory")
# default encoding
-AC_ARG_WITH(encoding,
- [AC_HELP_STRING([--with-encoding=ENCODING],
- [specify Groonga default encoding(euc/sjis/utf8/latin1/koi8r/none)])],
+AC_ARG_WITH(default_encoding,
+ [AC_HELP_STRING([--with-default-encoding=ENCODING],
+ [specify groonga default encoding(euc/sjis/utf8/latin1/koi8r/none)])],
GROONGA_DEFAULT_ENCODING="$withval",
GROONGA_DEFAULT_ENCODING="utf8")
AC_DEFINE_UNQUOTED(GROONGA_DEFAULT_ENCODING, "$GROONGA_DEFAULT_ENCODING", "specified default encoding")
# default query escalation threshold
AC_ARG_WITH(query_escalation_threshold,
[AC_HELP_STRING([--with-query-escalation-threshold=NUMBER],
- [specify Groonga default query escalation threshold])],
+ [specify groonga default query escalation threshold])],
GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD="$withval",
GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD="0")
AC_DEFINE_UNQUOTED(GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD, $GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD, "specified query escalation threshold")
@@ -158,7 +150,7 @@ fi
# coverage
m4_ifdef([AC_CHECK_COVERAGE], [AC_CHECK_COVERAGE])
-GENHTML_OPTIONS="--title 'Groonga Code Coverage'"
+GENHTML_OPTIONS="--title 'groonga Code Coverage'"
# microyield
AC_MSG_CHECKING([whether enable uyield])
View
@@ -22,6 +22,9 @@
#include "proc.h"
#include "ql.h"
+/**** globals for procs ****/
+char *admin_html_path = NULL;
+
/**** procs ****/
#define GET_OTYPE(var) \
@@ -465,11 +468,25 @@ proc_missing(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
uint32_t nvars, plen;
grn_obj *buf = args[0];
grn_expr_var *vars;
+ static int admin_html_path_len = -1;
+ if (!admin_html_path) { return buf; }
+ if (admin_html_path_len < 0) {
+ size_t l;
+ if ((l = strlen(admin_html_path)) > PATH_MAX) {
+ return buf;
+ }
+ admin_html_path_len = (int)l;
+ if (l > 0 && admin_html_path[l - 1] == '/') { admin_html_path_len--; }
+ }
grn_proc_get_info(ctx, user_data, &vars, &nvars, NULL);
- if (nvars == 2 && (plen = GRN_TEXT_LEN(&vars[0].value)) < PATH_MAX) {
+ if (nvars == 2 &&
+ (plen = GRN_TEXT_LEN(&vars[0].value)) + admin_html_path_len < PATH_MAX) {
char path[PATH_MAX];
- memcpy(path, GRN_TEXT_VALUE(&vars[0].value), GRN_TEXT_LEN(&vars[0].value));
- path[GRN_TEXT_LEN(&vars[0].value)] = '\0';
+ memcpy(path, admin_html_path, admin_html_path_len);
+ path[admin_html_path_len] = '/';
+ memcpy(path + admin_html_path_len + 1,
+ GRN_TEXT_VALUE(&vars[0].value), GRN_TEXT_LEN(&vars[0].value));
+ path[GRN_TEXT_LEN(&vars[0].value) + admin_html_path_len + 1] = '\0';
grn_bulk_put_from_file(ctx, buf, path);
}
return buf;
View
@@ -25,6 +25,7 @@
extern "C" {
#endif
+extern char *admin_html_path;
void grn_db_init_builtin_query(grn_ctx *ctx);
#ifdef __cplusplus
@@ -30,7 +30,7 @@ input {
#header {
height: 80px;
- background: url(../images/groonga.png) no-repeat left bottom;
+ background: url(/images/groonga.png) no-repeat left bottom;
}
#side-menu {
File renamed without changes.
@@ -7,10 +7,10 @@
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="robots" content="noindex,nofollow,noarchive">
<title>groonga admin</title>
-<link rel="stylesheet" type="text/css" href="/s/css/admin.css">
-<link rel="stylesheet" type="text/css" href="/s/css/ui-lightness/jquery-ui-1.7.2.custom.css">
-<script type="text/javascript" src="/s/js/jquery-1.3.2.min.js"></script>
-<script type="text/javascript" src="/s/js/jquery-ui-1.7.2.custom.min.js"></script>
+<link rel="stylesheet" type="text/css" href="/css/admin.css">
+<link rel="stylesheet" type="text/css" href="/css/ui-lightness/jquery-ui-1.7.2.custom.css">
+<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
+<script type="text/javascript" src="/js/jquery-ui-1.7.2.custom.min.js"></script>
</head>
<body>
<div id="header">
View
@@ -17,6 +17,7 @@
#include "lib/com.h"
#include "lib/ql.h"
+#include "lib/proc.h"
#include <string.h>
#include <stdio.h>
#ifdef HAVE_SYS_WAIT_H
@@ -48,17 +49,19 @@ usage(void)
fprintf(stderr,
"Usage: groonga [options...] [dest]\n"
"options:\n"
- " -n: create new database\n"
- " -a: run in standalone mode (default)\n"
- " -c: run in client mode\n"
- " -s: run in server mode\n"
- " -d: run in daemon mode\n"
- " -e: encoding for new database [none|euc|utf8|sjis|latin1|koi8r]\n"
- " -l <log level>: log level\n"
- " -i <ip/hostname>: server address to listen (default: %s)\n"
- " -p <port number>: server port number (default: %d)\n"
- " -t <max threads>: max number of free threads (default: %d)\n"
- " -h, --help: show usage\n"
+ " -n: create new database\n"
+ " -a: run in standalone mode (default)\n"
+ " -c: run in client mode\n"
+ " -s: run in server mode\n"
+ " -d: run in daemon mode\n"
+ " -e: encoding for new database [none|euc|utf8|sjis|latin1|koi8r]\n"
+ " -l <log level>: log level\n"
+ " -i <ip/hostname>: server address to listen (default: %s)\n"
+ " -p <port number>: server port number (default: %d)\n"
+ " -t <max threads>: max number of free threads (default: %d)\n"
+ " -h, --help: show usage\n"
+ " --admin-html-path <path>: specify admin html path\n"
+ "\n"
"dest: <db pathname> [<command>] or <dest hostname>\n"
" <db pathname> [<command>]: when standalone/server mode\n"
" <dest hostname>: when client mode (default: \"%s\")\n",
@@ -1156,13 +1159,15 @@ main(int argc, char **argv)
{'i', NULL, NULL, 0, getopt_op_none},
{'q', NULL, NULL, MODE_USE_QL, getopt_op_on},
{'n', NULL, NULL, MODE_NEW_DB, getopt_op_on},
+ {'\0', "admin-html-path", NULL, 0, getopt_op_none},
{'\0', NULL, NULL, 0, 0}
};
opts[0].arg = &portstr;
opts[1].arg = &encstr;
opts[2].arg = &max_nfthreadsstr;
opts[8].arg = &loglevel;
opts[9].arg = &hostnamestr;
+ opts[12].arg = &admin_html_path;
i = grn_str_getopt(argc, argv, opts, &mode);
if (i < 0) { mode = mode_usage; }
if (portstr) { port = atoi(portstr); }

0 comments on commit 0713b76

Please sign in to comment.