[Groonga-commit] groonga/groonga [master] httpd: integrate nginx build system into groonga build system

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 21日 (木) 13:31:21 JST


Ryo Onodera	2012-06-21 13:31:21 +0900 (Thu, 21 Jun 2012)

  New Revision: 20dd5c8df875d51033d88c20240fd894740d42c4
  https://github.com/groonga/groonga/commit/20dd5c8df875d51033d88c20240fd894740d42c4

  Log:
    httpd: integrate nginx build system into groonga build system

  Added files:
    data/groonga-httpd.conf.in
    groonga-httpd-conf.sh.in
    vendor/Makefile.am
    vendor/nginx/configure
  Modified files:
    Makefile.am
    configure.ac
    data/Makefile.am
    src/nginx-module/config

  Modified: Makefile.am (+1 -0)
===================================================================
--- Makefile.am    2012-06-21 13:56:54 +0900 (751bbd9)
+++ Makefile.am    2012-06-21 13:31:21 +0900 (6f4f5c6)
@@ -10,6 +10,7 @@ SUBDIRS =					\
 	lib					\
 	plugins					\
 	src					\
+	vendor					\
 	examples				\
 	test					\
 	packages				\

  Modified: configure.ac (+21 -2)
===================================================================
--- configure.ac    2012-06-21 13:56:54 +0900 (4c793f1)
+++ configure.ac    2012-06-21 13:31:21 +0900 (4058502)
@@ -274,6 +274,7 @@ AC_CONFIG_FILES([
   test/benchmark/fixtures/Makefile
   test/benchmark/fixtures/geo-select/Makefile
   test/benchmark/lib/Makefile
+  vendor/Makefile
 ])
 
 if test "$GCC" = "yes"; then
@@ -1124,7 +1125,7 @@ AC_SUBST(examples_dictionarydir)
 
 # for document root
 GRN_DEFAULT_DOCUMENT_ROOT_BASE="html/admin"
-GRN_DEFAULT_DOCUMENT_ROOT="\$(pkgdatadir)/\$(GRN_DEFAULT_DOCUMENT_ROOT_BASE)"
+GRN_DEFAULT_DOCUMENT_ROOT="\${pkgdatadir}/\${GRN_DEFAULT_DOCUMENT_ROOT_BASE}"
 GRN_EXPANDED_DEFAULT_DOCUMENT_ROOT="\${datadir}/${PACKAGE}/${GRN_DEFAULT_DOCUMENT_ROOT_BASE}"
 GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT="share/\$(PACKAGE)/\$(GRN_DEFAULT_DOCUMENT_ROOT_BASE)"
 AC_SUBST(GRN_DEFAULT_DOCUMENT_ROOT_BASE)
@@ -1155,6 +1156,16 @@ AC_ARG_WITH(groonga-github-com-path,
             [GROONGA_GITHUB_COM_PATH=""])
 AC_SUBST(GROONGA_GITHUB_COM_PATH)
 
+# nginx
+AC_ARG_ENABLE(nginx,
+  [AS_HELP_STRING([--enable-nginx],
+    [enable nginx used for groonga-httpd. [default=yes]])],
+  [enable_nginx="$enableval"],
+  [enable_nginx="auto"])
+if test "x$enable_nginx" != "xno"; then
+  AC_CONFIG_SUBDIRS([vendor/nginx])
+fi
+
 # For package
 AC_ARG_WITH(rsync-path,
             [AS_HELP_STRING([--with-rsync-path=PATH],
@@ -1166,7 +1177,7 @@ AC_SUBST(RSYNC_PATH)
 GPG_UID=m4_include(gpg_uid)
 AC_SUBST(GPG_UID)
 
-pkgsysconfdir="\$(sysconfdir)/$PACKAGE_NAME"
+pkgsysconfdir="\${sysconfdir}/$PACKAGE_NAME"
 AC_SUBST(pkgsysconfdir)
 
 GRN_CONFIG_PATH="`
@@ -1176,11 +1187,19 @@ GRN_CONFIG_PATH="`
 AC_DEFINE_UNQUOTED(GRN_CONFIG_PATH, ["$GRN_CONFIG_PATH"],
   [Default command line option configuration file.])
 
+GROONGA_HTTPD_DOCUMENT_ROOT="`
+  test \"$prefix\" = NONE && prefix=/usr/local
+  eval eval eval echo ${GRN_EXPANDED_DEFAULT_DOCUMENT_ROOT}
+`"
+AC_SUBST(GROONGA_HTTPD_DOCUMENT_ROOT)
+
 AC_OUTPUT([
   packages/rpm/centos/groonga.spec
   packages/rpm/fedora/groonga.spec
   packages/apt/debian/groonga-keyring.postrm
   groonga.pc
+  groonga-httpd-conf.sh
+  data/groonga-httpd.conf
   ])
 
 echo "$PACKAGE_NAME $PACKAGE_VERSION configuration:"

  Modified: data/Makefile.am (+4 -0)
===================================================================
--- data/Makefile.am    2012-06-21 13:56:54 +0900 (f197921)
+++ data/Makefile.am    2012-06-21 13:31:21 +0900 (725e66f)
@@ -9,5 +9,9 @@ pkgsysconfdir = $(sysconfdir)/$(PACKAGE)
 dist_pkgsysconf_DATA =		\
 	groonga.conf
 
+httpdconfdir = $(pkgsysconfdir)/httpd
+dist_httpdconf_DATA =		\
+	groonga-httpd.conf
+
 EXTRA_DIST =					\
 	CMakeLists.txt

  Added: data/groonga-httpd.conf.in (+32 -0) 100644
===================================================================
--- /dev/null
+++ data/groonga-httpd.conf.in    2012-06-21 13:31:21 +0900 (1cb2c28)
@@ -0,0 +1,32 @@
+worker_processes 1;
+
+events {
+  worker_connections 1024;
+}
+
+http {
+  include mime.types;
+  default_type application/octet-stream;
+  sendfile on;
+  keepalive_timeout 65;
+
+  server {
+    listen 10041;
+    server_name localhost;
+
+    location /d/ {
+      groonga;
+      #groonga_database /path/to/database;
+    }
+
+    location / {
+      root @GROONGA_HTTPD_DOCUMENT_ROOT@;
+      index index.html;
+    }
+
+    error_page   500 502 503 504  /50x.html;
+    location = /50x.html {
+      root html;
+    }
+  }
+}

  Added: groonga-httpd-conf.sh.in (+16 -0) 100644
===================================================================
--- /dev/null
+++ groonga-httpd-conf.sh.in    2012-06-21 13:31:21 +0900 (5cabf50)
@@ -0,0 +1,16 @@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+bindir="@bindir@"
+sysconfdir="@sysconfdir@"
+pkgsysconfdir="@pkgsysconfdir@"
+localstatedir="@localstatedir@"
+
+export GROONGA_HTTPD_MODULE_PATH="@abs_top_builddir@/src/nginx-module"
+export GROONGA_HTTPD_INCLUDE_PATH="@abs_top_builddir@/include"
+export GROONGA_HTTPD_LINK_PATH="@abs_top_builddir@/lib/.libs"
+export GROONGA_HTTPD_PKG_CONFIG_PATH="@abs_top_builddir@"
+export GROONGA_HTTPD_PREFIX="${pkgsysconfdir}/httpd"
+export GROONGA_HTTPD_BIN_PATH="${bindir}/groonga-httpd"
+export GROONGA_HTTPD_CONF_PATH="${pkgsysconfdir}/httpd/groonga-httpd.conf"
+export GROONGA_HTTPD_ERROR_LOG_PATH="${localstatedir}/log/groonga/httpd/error.log"
+export GROONGA_HTTPD_HTTP_LOG_PATH="${localstatedir}/log/groonga/httpd/access.log"

  Modified: src/nginx-module/config (+15 -0)
===================================================================
--- src/nginx-module/config    2012-06-21 13:56:54 +0900 (124594d)
+++ src/nginx-module/config    2012-06-21 13:31:21 +0900 (b198686)
@@ -4,6 +4,21 @@ groonga_strip_switch()
   tail -c +3
 }
 
+if [ "$GROONGA_HTTPD_IN_TREE" = yes ]; then
+  export PKG_CONFIG_PATH="${GROONGA_HTTPD_PKG_CONFIG_PATH}"
+
+  groonga_cflags="$(pkg-config --cflags groonga) -I ${GROONGA_HTTPD_INCLUDE_PATH}"
+  groonga_libs="$(pkg-config --libs groonga) -Wl,-rpath=${GROONGA_HTTPD_LINK_PATH} -L ${GROONGA_HTTPD_LINK_PATH}"
+
+  ngx_addon_name=ngx_http_groonga_module
+  HTTP_MODULES="$HTTP_MODULES ngx_http_groonga_module"
+  NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_groonga_module.c"
+  CFLAGS="$CFLAGS $groonga_cflags"
+  CORE_LIBS="$CORE_LIBS $groonga_libs"
+
+  return 0
+fi
+
 groonga_cflags="$(pkg-config --cflags groonga)"
 groonga_feature_path="$(pkg-config --cflags-only-I groonga |
                         groonga_strip_switch)"

  Added: vendor/Makefile.am (+9 -0) 100644
===================================================================
--- /dev/null
+++ vendor/Makefile.am    2012-06-21 13:31:21 +0900 (4445cb7)
@@ -0,0 +1,9 @@
+# nginx's Makefile specify 'build' as the default rule.
+# This isn't compatible with the 'all' default rule generated by Automake
+# So, override the all rule.
+
+all-local:
+	(cd nginx-1.2.1 && $(MAKE) build)
+
+install-exec-local:
+	(cd nginx-1.2.1 && $(MAKE) install)

  Added: vendor/nginx/configure (+18 -0) 100755
===================================================================
--- /dev/null
+++ vendor/nginx/configure    2012-06-21 13:31:21 +0900 (b20d0a9)
@@ -0,0 +1,18 @@
+set -e
+
+cd $(dirname $0)
+base_dir="$(pwd)"
+top_dir="$base_dir/../.."
+
+export GROONGA_HTTPD_IN_TREE=yes
+source "${top_dir}/groonga-httpd-conf.sh"
+
+cd ../nginx-1.2.1/
+
+./configure \
+  --prefix="${GROONGA_HTTPD_PREFIX}" \
+  --sbin-path="${GROONGA_HTTPD_BIN_PATH}" \
+  --conf-path="${GROONGA_HTTPD_CONF_PATH}" \
+  --error-log-path="${GROONGA_HTTPD_ERROR_LOG_PATH}" \
+  --http-log-path="${GROONGA_HTTPD_HTTP_LOG_PATH}" \
+  --add-module="${GROONGA_HTTPD_MODULE_PATH}"
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Back to archive index