You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2013/03/04 22:30:10 UTC
[1/2] git commit: TS-1733 - Retool tsxs so that it can compile
multiple source files
TS-1733 - Retool tsxs so that it can compile multiple source files
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1944efad
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1944efad
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1944efad
Branch: refs/heads/master
Commit: 1944efad2529caf2b9065c82966d7787469f580d
Parents: f0b3b86
Author: Dale Ghent <da...@omniti.com>
Authored: Mon Mar 4 15:14:18 2013 -0500
Committer: Phil Sorber <so...@apache.org>
Committed: Mon Mar 4 15:14:18 2013 -0500
----------------------------------------------------------------------
CHANGES | 3 +
example/remap/remap.cc | 2 +-
plugins/experimental/channel_stats/Makefile.tsxs | 2 +-
plugins/experimental/gzip/README | 2 +-
plugins/experimental/memcached_remap/README | 4 +-
plugins/experimental/rfc5861/Makefile.tsxs | 2 +-
plugins/stats_over_http/README | 2 +-
tools/tsxs.in | 127 +++++++++--------
8 files changed, 77 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0af8634..8cada05 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 3.3.1
+ *) [TS-1733] Retool tsxs so that it can compile multiple source files
+ Author: Dale Ghent <da...@omniti.com>
+
*) [TS-1738] proxy.cluster.cache_total_hits_mem is missing in RecordsConfig
Author: Yunkai Zhang <qi...@taobao.com>
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/example/remap/remap.cc
----------------------------------------------------------------------
diff --git a/example/remap/remap.cc b/example/remap/remap.cc
index 8c1690a..f316ca4 100644
--- a/example/remap/remap.cc
+++ b/example/remap/remap.cc
@@ -23,7 +23,7 @@
@section description
Build this sample remap plugin using tsxs:
- $ tsxs -v -C remap.cc -o remap.so
+ $ tsxs -v -o remap.so remap.cc
To install it:
# tsxs -i -o remap.so
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/plugins/experimental/channel_stats/Makefile.tsxs
----------------------------------------------------------------------
diff --git a/plugins/experimental/channel_stats/Makefile.tsxs b/plugins/experimental/channel_stats/Makefile.tsxs
index 4ad59c7..405affc 100644
--- a/plugins/experimental/channel_stats/Makefile.tsxs
+++ b/plugins/experimental/channel_stats/Makefile.tsxs
@@ -17,7 +17,7 @@
TSXS?=tsxs
%.so: %.cc
- $(TSXS) -C $< -o $@
+ $(TSXS) -o $@ %<
all: channel_stats.so
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/plugins/experimental/gzip/README
----------------------------------------------------------------------
diff --git a/plugins/experimental/gzip/README b/plugins/experimental/gzip/README
index be357c1..6f3268e 100644
--- a/plugins/experimental/gzip/README
+++ b/plugins/experimental/gzip/README
@@ -8,7 +8,7 @@ installation:
make && sudo make install
if no makefile is present, you can compile it using
- tsxs -C *.cc -o gzip.so
+ tsxs -o gzip.so *.cc
and then install it using
tsxs -i -o gzip.so
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/plugins/experimental/memcached_remap/README
----------------------------------------------------------------------
diff --git a/plugins/experimental/memcached_remap/README b/plugins/experimental/memcached_remap/README
index 3ad0461..11de80c 100644
--- a/plugins/experimental/memcached_remap/README
+++ b/plugins/experimental/memcached_remap/README
@@ -26,12 +26,12 @@ sudo yum install memcached python-memcached
2. Compile and Install the memcached_remap plugin
[user@ memcached_remap]$ gmake
-/usr/local/bin/tsxs -C memcached_remap.cc -o memcached_remap.so
+/usr/local/bin/tsxs -o memcached_remap.so memcached_remap.cc
compiling memcached_remap.cc -> memcached_remap.lo
linking -> memcached_remap.so
[user@ memcached_remap]$ sudo gmake install
-/usr/local/bin/tsxs -C memcached_remap.cc -o memcached_remap.so
+/usr/local/bin/tsxs -o memcached_remap.so memcached_remap.cc
compiling memcached_remap.cc -> memcached_remap.lo
linking -> memcached_remap.so
/usr/local/bin/tsxs -i -o memcached_remap.so
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/plugins/experimental/rfc5861/Makefile.tsxs
----------------------------------------------------------------------
diff --git a/plugins/experimental/rfc5861/Makefile.tsxs b/plugins/experimental/rfc5861/Makefile.tsxs
index 78fcfc0..0b312d4 100644
--- a/plugins/experimental/rfc5861/Makefile.tsxs
+++ b/plugins/experimental/rfc5861/Makefile.tsxs
@@ -17,7 +17,7 @@
TSXS?=tsxs
all: rfc5861.c
- $(TSXS) -v -c $? -o rfc5861.so
+ $(TSXS) -v -o rfc5861.so $?
install:
$(TSXS) -i -o rfc5861.so
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/plugins/stats_over_http/README
----------------------------------------------------------------------
diff --git a/plugins/stats_over_http/README b/plugins/stats_over_http/README
index 03718af..751af18 100644
--- a/plugins/stats_over_http/README
+++ b/plugins/stats_over_http/README
@@ -1,5 +1,5 @@
Compile:
- tsxs -c stats_over_http.c -o stats_over_http.so
+ tsxs -o stats_over_http.so stats_over_http.c
Install:
sudo tsxs -o stats_over_http.so -i
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1944efad/tools/tsxs.in
----------------------------------------------------------------------
diff --git a/tools/tsxs.in b/tools/tsxs.in
index 25953f4..b0b1534 100755
--- a/tools/tsxs.in
+++ b/tools/tsxs.in
@@ -44,6 +44,53 @@ bail() {
exit 1
}
+usage() {
+ cat <<EOF
+$0 : a tool to compile, link and install trafficserver plugins.
+
+compiling/linking:
+-o modulename.so ## the name of the module
+-I include ## add -Iinclude to CFLAGS
+-L library path ## add -Lpath to LDFLAGS
+-l library ## add -llib to the LDFLAGS
+
+installing:
+-o modulename.so ## the name of the module
+-i ## install the object
+
+Example:
+ $0 -I/foo/include -L/foo/lib -lsomelib -o tsmodule.so src1.c src2.c ...
+
+EOF
+
+}
+
+compile() {
+ SRC=$1
+ extension=`echo $SRC | sed -e 's/^.*\.//g'`
+ case $extension in
+ c)
+ MY_CFLAGS="$CPPFLAGS $CFLAGS"
+ MY_CC=$CC
+ ;;
+ cpp|cxx|CPP|CXX|CC|C)
+ MY_CFLAGS="$CPPFLAGS $CXXFLAGS"
+ MY_CC=$CXX
+ ;;
+ *)
+ bail "Unrecognized input file: $SRC"
+ ;;
+ esac
+
+ obj=`echo $SRC | sed -e 's/\.[a-z]*$/\.lo/g;'`
+ echo " compiling $SRC -> $obj"
+ debug "$MY_CC $MY_CFLAGS $PICFLAGS -c $SRC -o $obj"
+ $MY_CC $MY_CFLAGS $PICFLAGS -c $SRC -o $obj ||
+ bail "Compile failed: $MY_CC $MY_CFLAGS $PICFLAGS -c $SRC -o $obj"
+ OBJS="$OBJS $obj"
+ BUILD=1
+}
+
case $host in
*-*-darwin*)
PICFLAGS="-fPIC"
@@ -92,78 +139,38 @@ case $host in
esac
LD=$MODULELD
-for v in $*
+while getopts "hivl:L:I:c:C:o:" OPTION
do
- case $v in
- -v)
- shift
+ case $OPTION in
+ v)
DEBUGECHO=1
;;
- -h)
- cat <<EOF
-$0 : a tool to compile, link and install trafficserver plugins.
-
- compiling/linking:
- -c [ file1.c [ file2.c [ ... ] ] ] ## compiles C files
- -C [ file1.cc [ file2.C [ ... ] ] ] ## compiles C++ files
- -o modulename.so ## the name of the module
- -I include ## add -Iinclude to the compile
- -l lib ## add -llib to the link
-
- installing:
- -o modulename.so ## the name of the module
- -i ## install the object
-
-EOF
- exit
- ;;
- -I)
- CPPFLAGS="$CPPFLAGS -I$2"
- shift 2
+ h)
+ usage
+ exit 1
;;
- -l)
- LIBS="$LIBS -l$2"
- shift 2
+ I)
+ CPPFLAGS="$CPPFLAGS -I$OPTARG"
;;
- -c)
- shift
- while [ -r "$1" ]; do
- SRC=$1
- obj=`echo $SRC | sed -e 's/\.[a-z]*$/\.lo/g;'`
- echo " compiling $SRC -> $obj"
- debug "$CC $CPPFLAGS $CFLAGS $PICFLAGS -c $SRC -o $obj"
- $CC $CPPFLAGS $CFLAGS $PICFLAGS -c $SRC -o $obj ||
- bail "Compile failed: $CC $CPPFLAGS $CFLAGS $PICFLAGS -c $SRC -o $obj"
- OBJS="$OBJS $obj"
- BUILD=1
- shift
- done
+ L)
+ LDFLAGS="$LDFLAGS -L$OPTARG $RLDFLAG$OPTARG"
;;
- -C)
- shift
- while [ -r "$1" ]; do
- SRC=$1
- obj=`echo $SRC | sed -e 's/\.[a-z]*$/\.lo/g;'`
- echo " compiling $SRC -> $obj"
- debug "$CXX $CPPFLAGS $CXXFLAGS $PICFLAGS -c $SRC -o $obj"
- $CXX $CPPFLAGS $CXXFLAGS $PICFLAGS -c $SRC -o $obj ||
- bail "Compile failed: $CXX $CPPFLAGS $CXXFLAGS $PICFLAGS -c $SRC -o $obj"
- OBJS="$OBJS $obj"
- LD=$MODULELDXX
- BUILD=1
- shift
- done
+ l)
+ LIBS="$LIBS -l$OPTARG"
;;
- -o)
- OBJ=$2
- shift 2
+ o)
+ OBJ=$OPTARG
;;
- -i)
+ i)
INSTALL=1
- shift
;;
esac
done
+shift $(( OPTIND - 1))
+
+for file in "$@"; do
+ compile $file
+done
if [ "$BUILD" = "1" -a -n "$OBJ" ]; then
echo " linking -> $OBJ"