trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject git commit: TS-2711 Build with the include LuaJIT
Date Tue, 15 Apr 2014 14:29:51 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 1e6b4194e -> 31f1857cd


TS-2711 Build with the include LuaJIT


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/31f1857c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/31f1857c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/31f1857c

Branch: refs/heads/master
Commit: 31f1857cd465834e55fa459ed986c2d64f4c4abb
Parents: 1e6b419
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Tue Apr 15 08:29:30 2014 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Tue Apr 15 08:29:30 2014 -0600

----------------------------------------------------------------------
 Makefile.am                             |  18 ++--
 NOTICE                                  |   6 ++
 build/lua.m4                            | 142 ---------------------------
 configure.ac                            |  51 ----------
 lib/Makefile.am                         |  19 +++-
 plugins/experimental/Makefile.am        |   1 -
 plugins/experimental/ts_lua/Makefile.am |  33 ++++---
 proxy/Makefile.am                       |  75 +++++++++++++-
 8 files changed, 129 insertions(+), 216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 398f300..0be55a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,12 +53,6 @@ distclean-local:
 doxygen:
 	@cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
 
-asf-distdir:
-	@$(am__remove_distdir)
-	test -d .git && git clone . $(distdir)
-	cd $(distdir) && autoreconf -i
-	rm -rf -- $(distdir)/autom4te.cache $(distdir)/.git $(distdir)/.gitignore $(distdir)/ci
-
 asf-dist: asf-distdir
 	tardir=$(distdir) && $(am__tar) --mtime=./configure.ac | bzip2 -9 -c >$(distdir).tar.bz2
 	@$(am__remove_distdir)
@@ -67,6 +61,12 @@ asf-dist-rc: asf-distdir
 	tardir=$(distdir) && $(am__tar) --mtime=./configure.ac | bzip2 -9 -c >$(distdir)-rc$(RC).tar.bz2
 	@$(am__remove_distdir)
 
+asf-distdir:
+	@$(am__remove_distdir)
+	test -d .git && git clone . $(distdir)
+	cd $(distdir) && git submodule update --init && autoreconf -i
+	rm -rf -- $(distdir)/autom4te.cache $(distdir)/.git $(distdir)/.gitignore $(distdir)/ci
+
 asf-dist-sign: asf-dist
 	md5sum -b $(distdir).tar.bz2 >$(distdir).tar.bz2.md5
 	sha1sum -b $(distdir).tar.bz2 >$(distdir).tar.bz2.sha1
@@ -95,8 +95,11 @@ install-data-hook:
 rat:
 	java -jar $(top_srcdir)/ci/apache-rat-0.11-SNAPSHOT.jar -E $(top_srcdir)/ci/rat-regex.txt
 -d $(top_srcdir)
 
+submodules:
+	git submodule update --init
+
 help:
-	@echo 'all              default target for building the package' && \
+	@echo 'all             default target for building the package' && \
 	echo 'check            run the test suite, if any' && \
 	echo 'clean            remove whatever make created' && \
 	echo 'distclean        remove whatever configure created' && \
@@ -108,6 +111,7 @@ help:
 	echo 'rel-candidate    recreate a signed relelease candidate source package and a signed
git tag' && \
 	echo 'distcheck        verify dist by performing VPATH build and then distclean' &&
\
 	echo 'rat              produce a RAT licence compliance report of the source' &&
\
+	echo 'submodules       update the git submodules' && \
 	echo 'doxygen          generate doxygen docs in doc/html dir' && \
 	echo 'help             display this list of make targets' && \
 	echo 'install          install by copying the built files to system-wide dirs' &&
\

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index ecf66b0..00196cb 100644
--- a/NOTICE
+++ b/NOTICE
@@ -8,6 +8,7 @@ This product includes software developed at
   - OmniTI
   - Comcast
   - LinkedIn
+  - Mike Pall
 
 ~~~
 
@@ -55,3 +56,8 @@ Copyright (c) 2013 LinkedIn
 
 remap_stats plugin developed by Comcast.
 Copyright (C) 2013 Comcast
+
+~~~
+
+LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
+Copyright (C) 2005-2014 Mike Pall. All rights reserved.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/build/lua.m4
----------------------------------------------------------------------
diff --git a/build/lua.m4 b/build/lua.m4
deleted file mode 100644
index 8d83b13..0000000
--- a/build/lua.m4
+++ /dev/null
@@ -1,142 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Licensed to the Apache Software Foundation (ASF) under one or more
-dnl contributor license agreements.  See the NOTICE file distributed with
-dnl this work for additional information regarding copyright ownership.
-dnl The ASF licenses this file to You under the Apache License, Version 2.0
-dnl (the "License"); you may not use this file except in compliance with
-dnl the License.  You may obtain a copy of the License at
-dnl
-dnl     http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-
-dnl Check for Lua 5.1 Libraries
-dnl
-dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
-dnl Sets:
-dnl  LUA_CFLAGS
-dnl  LUA_LIBS
-AC_DEFUN([CHECK_LUA],
-[dnl
-
-AC_ARG_WITH(
-    lua,
-    [AC_HELP_STRING([--with-lua=PATH],[Path to the Lua 5.1 prefix])],
-    lua_path="$withval",
-    :)
-
-dnl # Determine lua lib directory
-if test -z "$lua_path"; then
-    test_paths=". /usr/local /usr"
-else
-    test_paths="${lua_path}"
-fi
-
-dnl
-dnl Note that we check for the existence of lua_getfenv (used to be
-dnl luaL_newstate). This is because Lua v5.2 and later deprecates
-dnl lua_getfenv() because of changes in how environements are handled.
-dnl Also see: https://issues.apache.org/jira/browse/TS-1931
-dnl
-AC_CHECK_LIB(m, pow, lib_m="-lm")
-AC_CHECK_LIB(m, sqrt, lib_m="-lm")
-for x in $test_paths ; do
-  if test "x$x" = "x."; then
-    AC_CHECK_HEADER(lua.h,[
-        save_CFLAGS=$CFLAGS
-        save_LDFLAGS=$LDFLAGS
-        CFLAGS="$CFLAGS"
-        LDFLAGS="$LDFLAGS $lib_m"
-        AC_CHECK_LIB(lua5.1, lua_getfenv, [
-            LUA_LIBS="-llua5.1 $lib_m"
-        ],[
-            AC_CHECK_LIB(lua-5.1, lua_getfenv, [
-                LUA_LIBS="-llua-5.1 $lib_m"
-            ],[
-                AC_CHECK_LIB(lua, lua_getfenv, [
-                    LUA_LIBS="-llua $lib_m"
-                ])
-            ])
-        ])
-        LUA_CFLAGS=
-        CFLAGS=$save_CFLAGS
-        LDFLAGS=$save_LDFLAGS
-        break
-    ])
-  else
-    AC_MSG_CHECKING([for lua.h in ${x}/include/lua5.1])
-    if test -f ${x}/include/lua5.1/lua.h; then
-        AC_MSG_RESULT([yes])
-        save_CFLAGS=$CFLAGS
-        save_LDFLAGS=$LDFLAGS
-        CFLAGS="$CFLAGS"
-        LDFLAGS="-L$x/lib $LDFLAGS $lib_m"
-        AC_CHECK_LIB(lua5.1, lua_getfenv, [
-            LUA_LIBS="-L$x/lib -llua5.1 $lib_m"
-            LUA_CFLAGS="-I$x/include/lua5.1"
-            ])
-        CFLAGS=$save_CFLAGS
-        LDFLAGS=$save_LDFLAGS
-        break
-    else
-        AC_MSG_RESULT([no])
-    fi
-    AC_MSG_CHECKING([for lua.h in ${x}/include/lua51])
-    if test -f ${x}/include/lua51/lua.h; then
-        AC_MSG_RESULT([yes])
-        save_CFLAGS=$CFLAGS
-        save_LDFLAGS=$LDFLAGS
-        CFLAGS="$CFLAGS"
-        LDFLAGS="-L$x/lib/lua51 $LDFLAGS $lib_m"
-        AC_CHECK_LIB(lua, lua_getfenv, [
-            LUA_LIBS="-L$x/lib/lua51 -llua $lib_m"
-            LUA_CFLAGS="-I$x/include/lua51"
-            ])
-        CFLAGS=$save_CFLAGS
-        LDFLAGS=$save_LDFLAGS
-        break
-    else
-        AC_MSG_RESULT([no])
-    fi
-    AC_MSG_CHECKING([for lua.h in ${x}/include])
-    if test -f ${x}/include/lua.h; then
-        AC_MSG_RESULT([yes])
-        save_CFLAGS=$CFLAGS
-        save_LDFLAGS=$LDFLAGS
-        CFLAGS="$CFLAGS"
-        LDFLAGS="-L$x/lib $LDFLAGS $lib_m"
-        AC_CHECK_LIB(lua, lua_getfenv, [
-            LUA_LIBS="-L$x/lib -llua $lib_m"
-            LUA_CFLAGS="-I$x/include"
-            ])
-        CFLAGS=$save_CFLAGS
-        LDFLAGS=$save_LDFLAGS
-        break
-    else
-        AC_MSG_RESULT([no])
-    fi
-  fi
-done
-
-AC_SUBST(LUA_LIBS)
-AC_SUBST(LUA_CFLAGS)
-
-if test -z "${LUA_LIBS}"; then
-  AC_MSG_WARN([*** Lua 5.1 library not found.])
-  ifelse([$2], ,
-    enable_lua="no"
-    if test -z "${lua_path}"; then
-        AC_MSG_WARN([Lua 5.1 library is required])
-    else
-        AC_MSG_ERROR([Lua 5.1 library is required])
-    fi,
-    $2)
-else
-  ifelse([$1], , , $1) 
-fi 
-])
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 504f357..b0502a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1417,56 +1417,6 @@ TS_CHECK_TCMALLOC
 # Check for libreadline/libedit
 AX_LIB_READLINE
 
-#
-# Check for Lua, at least version 5.1, sets LUA_CFLAGS and LUA_LIBS. We support both standard
-# Lua and LuaJIT, preferring LuaJIT if the user did not indicate a preference.
-AC_MSG_CHECKING([whether to enable Linux LuaJIT support])
-AC_ARG_ENABLE([luajit],
-  [AS_HELP_STRING([--enable-luajit], [enable LuaJIT support @<:@default=check@:>@])],
-  [enable_luajit="${enableval}"],
-  [enable_luajit=check]
-)
-AC_MSG_RESULT([$enable_luajit])
-
-PKG_CHECK_MODULES([luajit], [luajit], [have_luajit=yes], [have_luajit=no])
-CHECK_LUA([have_lua=yes], [have_lua=no])
-
-case $enable_luajit in
-yes)
-  # LuaJIT required. Fail if it's not available.
-  AS_IF([ test "x${have_luajit}" = "xyes" ], [
-    LUA_CFLAGS="${luajit_CFLAGS}"
-    LUA_LIBS="${luajit_LIBS}"
-    enable_lua_support=LuaJIT
-  ], [
-    AC_MSG_ERROR([LuaJIT package not available])
-  ])
-  ;;
-
-no)
-  # LuaJIT disabled, just check for the regular Lua support.
-  enable_lua_support="${have_lua}"
-  ;;
-
-*)
-  # No user preference, prefer LuaJIT over standard Lua.
-  AS_IF([ test "x${have_luajit}" = "xyes" ], [
-    LUA_CFLAGS="${luajit_CFLAGS}"
-    LUA_LIBS="${luajit_LIBS}"
-    enable_lua_support=LuaJIT
-  ], [
-    enable_lua_support="${have_lua}"
-  ])
-  ;;
-esac
-
-AC_SUBST(LUA_CFLAGS)
-AC_SUBST(LUA_LIBS)
-AC_MSG_CHECKING([whether to enable Lua support])
-AM_CONDITIONAL([BUILD_LUA_SUPPORT], [ test "x${enable_lua_support}" != "xno" ])
-AM_CONDITIONAL([BUILD_HAVE_LUAJIT], [ test "x${have_luajit}" = "xyes" ])
-AC_MSG_RESULT([$enable_lua_support])
-
 # On Darwin LuaJIT requires magic link options, otherwise it will crash in luaL_openlibs()
at startup. See
 # http://luajit.org/install.html.
 case $host_os in
@@ -1989,7 +1939,6 @@ AC_CONFIG_FILES([
   plugins/experimental/geoip_acl/Makefile
   plugins/experimental/healthchecks/Makefile
   plugins/experimental/hipes/Makefile
-  plugins/experimental/lua/Makefile
   plugins/experimental/metalink/Makefile
   plugins/experimental/remap_stats/Makefile
   plugins/experimental/rfc5861/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/lib/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 9664374..b52766b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -29,4 +29,21 @@ endif
 
 if ENABLE_CPPAPI
 SUBDIRS += atscppapi
-endif
\ No newline at end of file
+endif
+
+# Some special hacks around building the luajit.
+#
+#  - Copy the luajit source tree if we're doing out-of-source builds
+#  - Upon clean, remove the luajit tree from the out-of-source build tree
+#
+# ToDo: Can we do this without copying the source? I tried setting the VPATH, but
+#       it did not work. Can we make more intelligent build targets, avoiding [ test ] ?
+all-local:
+	@echo "Making all in luajit"
+	test -d "$(top_srcdir)/luajit/src" || (cd "$(top_srcdir)" && git submodule update
--init)
+	test -d "$(top_builddir)/$(subdir)/luajit/src" || cp -rf "$(srcdir)/luajit" "$(top_builddir)/$(subdir)/"
+	make -C luajit PREFIX=$(prefix)
+
+clean-local:
+	test "$(top_srcdir)" != "$(top_builddir)" || make -C "$(top_builddir)/$(subdir)/luajit"
clean
+	test "$(top_srcdir)" = "$(top_builddir)" || rm -rf "$(top_builddir)/$(subdir)/luajit"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/plugins/experimental/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/Makefile.am b/plugins/experimental/Makefile.am
index a2c5a37..9aac6ad 100644
--- a/plugins/experimental/Makefile.am
+++ b/plugins/experimental/Makefile.am
@@ -28,7 +28,6 @@ SUBDIRS = \
  geoip_acl \
  healthchecks \
  hipes \
- lua \
  metalink \
  remap_stats \
  rfc5861 \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/plugins/experimental/ts_lua/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/ts_lua/Makefile.am b/plugins/experimental/ts_lua/Makefile.am
index a519578..4a696f6 100644
--- a/plugins/experimental/ts_lua/Makefile.am
+++ b/plugins/experimental/ts_lua/Makefile.am
@@ -16,20 +16,29 @@
 
 include $(top_srcdir)/build/plugins.mk
 
-if BUILD_LUA_SUPPORT
-
-# We have to use the per-target CPPFLAGS here to make sure that the Lua include
-# path comes first. If we have LuaJIT (/opt/local/include/luajit-2.0) and Lua
-# (/opt/local/include) headers, then we need to make sure that we don't end up
-# building with the Lua headers but linking LuaJIT.
 tslua_la_CPPFLAGS = \
-  $(LUA_CFLAGS) \
-  $(AM_CPPFLAGS)
+  $(AM_CPPFLAGS) \
+  -I$(top_srcdir)/lib/luajit/src
 
 pkglib_LTLIBRARIES = tslua.la
 
-tslua_la_LIBADD = $(LUA_LIBS)
-tslua_la_SOURCES = ts_lua.c ts_lua_cached_response.c ts_lua_client_request.c ts_lua_client_response.c
ts_lua_context.c ts_lua_hook.c ts_lua_http.c ts_lua_http_intercept.c ts_lua_log.c ts_lua_misc.c
ts_lua_server_request.c ts_lua_server_response.c ts_lua_transform.c ts_lua_util.c ts_lua_remap.c
-tslua_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
+#tslua_la_LIBADD = $(top_builddir)/lib/luajit/src/libluajit.a
 
-endif
+tslua_la_SOURCES = \
+  ts_lua.c \
+  ts_lua_cached_response.c \
+  ts_lua_client_request.c \
+  ts_lua_client_response.c \
+  ts_lua_context.c \
+  ts_lua_hook.c \
+  ts_lua_http.c \
+  ts_lua_http_intercept.c \
+  ts_lua_log.c \
+  ts_lua_misc.c \
+  ts_lua_server_request.c \
+  ts_lua_server_response.c \
+  ts_lua_transform.c \
+  ts_lua_util.c \
+  ts_lua_remap.c
+
+tslua_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31f1857c/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 6dfc816..5b753b2 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -52,6 +52,75 @@ noinst_HEADERS = \
   ConfigParse.h \
   Show.h
 
+# These are currently built separate, as part of building the lib/ tree, using
+# the normal LuaJIT build system. We are using the .o's directly, instead of the
+# luajit.a to avoid the linker from optimizing symbols away. We could maybe
+# switch to using the luajit.so, but that involves making sure it installs safely
+# and cleanly.
+LUAJIT = \
+  lib_aux.o \
+  lib_base.o \
+  lib_bit.o \
+  lib_debug.o \
+  lib_ffi.o \
+  lib_init.o \
+  lib_io.o \
+  lib_jit.o \
+  lib_math.o \
+  lib_os.o \
+  lib_package.o \
+  lib_string.o \
+  lib_table.o \
+  lj_alloc.o \
+  lj_api.o \
+  lj_asm.o \
+  lj_bc.o \
+  lj_bcread.o \
+  lj_bcwrite.o \
+  lj_carith.o \
+  lj_ccall.o \
+  lj_ccallback.o \
+  lj_cconv.o \
+  lj_cdata.o \
+  lj_char.o \
+  lj_clib.o \
+  lj_cparse.o \
+  lj_crecord.o \
+  lj_ctype.o \
+  lj_debug.o \
+  lj_dispatch.o \
+  lj_err.o \
+  lj_ffrecord.o \
+  lj_func.o \
+  lj_gc.o \
+  lj_gdbjit.o \
+  lj_ir.o \
+  lj_lex.o \
+  lj_lib.o \
+  lj_load.o \
+  lj_mcode.o \
+  lj_meta.o \
+  lj_obj.o \
+  lj_opt_dce.o \
+  lj_opt_fold.o \
+  lj_opt_loop.o \
+  lj_opt_mem.o \
+  lj_opt_narrow.o \
+  lj_opt_sink.o \
+  lj_opt_split.o \
+  lj_parse.o \
+  lj_record.o \
+  lj_snap.o \
+  lj_state.o \
+  lj_str.o \
+  lj_strscan.o \
+  lj_tab.o \
+  lj_trace.o \
+  lj_udata.o \
+  lj_vm.o \
+  lj_vmevent.o \
+  lj_vmmath.o
+
 if STATIC_LIBTS
     which_libts = $(top_builddir)/lib/ts/.libs/libtsutil.a
 else
@@ -146,6 +215,7 @@ traffic_server_LDADD = \
   $(top_builddir)/lib/records/librecprocess.a \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(which_libts) \
+  $(LUAJIT:%=$(top_builddir)/lib/luajit/src/%) \
   @hwloc_LIBS@ \
   @LIBPCRE@ \
   @OPENSSL_LIBS@ \
@@ -160,9 +230,10 @@ traffic_server_LDADD = \
   @SPDYLAY_LIBS@ \
   -lm
 
-if BUILD_LUA_SUPPORT
+
+# On Darwin LuaJIT requires magic link options, otherwise it will crash in luaL_openlibs()
at startup. See
+# http://luajit.org/install.html.
 traffic_server_LDFLAGS += @LUA_LUAJIT_LDFLAGS@
-endif
 
 traffic_logcat_SOURCES = logcat.cc
 traffic_logcat_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@


Mime
View raw message