summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorSteven Shaw <steshaw@apache.org>2006-12-07 20:07:19 +0000
committerSteven Shaw <steshaw@apache.org>2006-12-07 20:07:19 +0000
commitc20d7eddc08de878a5407f03e0cd984f60262995 (patch)
tree86aa0c74a27f74fecd7eb127ba385116e2a2f868 /cpp
parent8acccbfa9493064e2bb6d38b830c1814ca0dc463 (diff)
downloadqpid-python-c20d7eddc08de878a5407f03e0cd984f60262995.tar.gz
New make-dist script and related files. Just a hack for now to build a binary dev release. Also updated README-dev with correct automake version and note about configuring cppunit
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@483638 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/README-dev3
-rwxr-xr-xcpp/build.rhel318
-rwxr-xr-xcpp/make-dist83
-rw-r--r--cpp/options-rhel3.mk18
-rw-r--r--cpp/options.mk100
-rwxr-xr-xcpp/release.client.rhel367
-rw-r--r--cpp/tests/examples.Makefile66
-rw-r--r--cpp/tests/examples.README18
8 files changed, 169 insertions, 204 deletions
diff --git a/cpp/README-dev b/cpp/README-dev
index c39dcc613a..5ff346cf4d 100644
--- a/cpp/README-dev
+++ b/cpp/README-dev
@@ -4,9 +4,10 @@
As per README-dist plus:
* autoconf 2.59: http://www.gnu.org/software/autoconf
- * automake 1.9.6: http://www.gnu.org/software/automake
+ * automake 1.9.2: http://www.gnu.org/software/automake
* libtool 1.5: http://www.gnu.org/software/libtool
* CppUnit 1.10.2: http://cppunit.sourceforge.net
+ Note: Ensure cppunit-config is in your PATH.
Optional: to re-generated generated code from the XML specification:
* java 5
diff --git a/cpp/build.rhel3 b/cpp/build.rhel3
deleted file mode 100755
index bc35b7cfa2..0000000000
--- a/cpp/build.rhel3
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-ln -fs options-rhel3.mk options-local.mk
-
-PATH=~/local/make-3.80/bin:$PATH
-PATH=~/local/apr-1.2.7/bin:$PATH
-PATH=~/local/cppunit-1.11.4/bin:$PATH
-PATH=~/local/jdk-1.5/bin:$PATH
-
-LD_LIBRARY_PATH=~/local/apr-1.2.7/lib:$LD_LIBRARY_PATH
-
-export GENTOOLS_DIR=../gentools
-
-echo Building release build
-RELEASE=1 make "$@"
-
-echo Building debug build
-make "$@"
diff --git a/cpp/make-dist b/cpp/make-dist
new file mode 100755
index 0000000000..7d4a04785c
--- /dev/null
+++ b/cpp/make-dist
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# Temporary hack for producing a binary dev distribution.
+# Includes regular stuff from 'make install' + examples and headers.
+#
+# TODO: Also include debug libraries.
+#
+
+Usage() {
+ echo "usage: $0 [release-version]
+ release-version e.g. 1.0M1 (defaults to the svn revision)" >&2
+ exit 2
+}
+
+if [[ $# -eq 1 ]]; then
+ [[ $1 == "-?" ]] && Usage
+ version=$1
+elif [[ $# -ne 0 ]]; then
+ Usage
+else
+ # Default the version to the svn revision
+ if which svn >/dev/null 2>&1; then
+ svnRevision=$(svn info | grep ^Revision: | awk '{print $2}')
+ version=r${svnRevision}
+ else
+ echo "You need to have svn in your PATH or specify a release-version"
+ exit 2
+ fi
+fi
+
+releaseName=qpid-cpp-dev-${version}
+releaseDir=release/$releaseName
+
+if [[ -d $releaseDir ]]; then
+ echo "$releaseDir already exists"
+ exit 2
+fi
+
+# Copy bin.
+mkdir -p $releaseDir/bin
+cp -r src/.libs/* ${releaseDir}/bin
+
+# Copy libs.
+mkdir -p $releaseDir/lib
+cp lib/broker/.libs/lib* lib/common/.libs/lib* lib/client/.libs/lib* \
+ $releaseDir/lib
+
+# Copy gen include files.
+find gen -name \*.h | while read file; do
+ destFile=${releaseDir}/include/$file
+ baseDir=$(dirname $destFile)
+ mkdir -p $baseDir
+ cp $file $destFile
+done
+
+# Copy in lib include files.
+(
+ cd lib; find . -name \*.h | while read file; do
+ destFile=../${releaseDir}/include/$file
+ baseDir=$(dirname $destFile)
+ mkdir -p $baseDir
+ cp $file $destFile
+ done
+)
+
+# Copy non-cppunit tests as examples.
+mkdir -p $releaseDir/examples
+for file in tests/*.cpp; do
+ if grep CppUnit $file >/dev/null; then
+ echo Skipping cppunit file $file
+ else
+ cp $file $releaseDir/examples
+ fi
+done
+
+# Copy Makefile and README for examples.
+cp tests/examples.Makefile $releaseDir/examples/Makefile
+cp tests/examples.README $releaseDir/examples/README
+
+cd release
+tar=$releaseName.tar
+tar cvf $tar $releaseName
+bzip2 $tar
diff --git a/cpp/options-rhel3.mk b/cpp/options-rhel3.mk
deleted file mode 100644
index be5741e8c6..0000000000
--- a/cpp/options-rhel3.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Expects dependencies in ~/local
-#
-
-# Configure Boost.
-BOOST_CXXFLAGS := -I$(HOME)/local/boost-1.33.1/include/boost-1_33_1
-CXXFLAGS := $(CXXFLAGS) $(BOOST_CXXFLAGS)
-
-# Configure CppUnit.
-CPPUNIT_CFLAGS := `cppunit-config --cflags`
-CPPUNIT_LDFLAGS := `cppunit-config --libs`
-CXXFLAGS := $(CXXFLAGS) $(CPPUNIT_CFLAGS)
-
-#
-# RedHat Enterprise 3 g++ can't handle -Wextra etc so remove them.
-#
-
-WARN := -Werror -pedantic -Wall -Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wno-system-headers
diff --git a/cpp/options.mk b/cpp/options.mk
deleted file mode 100644
index ac07467916..0000000000
--- a/cpp/options.mk
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Use APR by default till Posix is complete.
-USE_APR := 1
-
-# Local options.
--include options-local.mk
-
-## Release vs. debug build.
-ifdef RELEASE
-BUILD := release
-CXXFLAGS := $(CXXFLAGS) -O3 -DNDEBUG
-else
-BUILD := debug
-CXXFLAGS := $(CXXFLAGS) -ggdb3
-endif
-
-## Platform specific options
-ifdef USE_APR
-PLATFORM := apr
-IGNORE := posix
-APR_LDFLAGS := $(shell apr-1-config --link-ld --libs)
-APR_CFLAGS := -DUSE_APR -I$(shell apr-1-config --includedir)
-CXXFLAGS := $(CXXFLAGS) $(APR_CFLAGS)
-LDFLAGS := $(LDFLAGS) $(APR_LDFLAGS)
-else
-PLATFORM := posix
-IGNORE := apr
-LDFLAGS := $(LDFLAGS) -lpthread -lrt -ldl
-endif
-
-## Build directories.
-
-BUILD :=$(PLATFORM)-$(BUILD)
-BINDIR:=build/$(BUILD)/bin
-LIBDIR:=build/$(BUILD)/lib
-OBJDIR:=build/$(BUILD)/obj
-TESTDIR:=build/$(BUILD)/test
-
-GENDIR:=build/gen
-GENTOOLS_DIR:= ../gentools
-SPEC_DIR:=../specs
-
-BUILDDIRS := $(BINDIR) $(LIBDIR) $(OBJDIR) $(TESTDIR) $(GENDIR)
-SRCDIRS := src $(GENDIR)
-
-## External dependencies:
-
-# Add location for headers and libraries of any external dependencies here
-EXTRA_INCLUDES :=
-EXTRA_LIBDIRS :=
-
-## Compile flags
-
-# Warnings: Enable as many as possible, keep the code clean. Please
-# do not disable warnings or remove -Werror without discussing on
-# qpid-dev list.
-#
-# The following warnings deliberately omitted, they warn on valid code.
-# -Wunreachable-code -Wpadded -Winline
-# -Wshadow - warns about boost headers.
-#
-ifndef WARN
-WARN := -Werror -pedantic -Wall -Wextra -Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch -Wno-system-headers
-endif
-
-INCLUDES := $(SRCDIRS:%=-I%) $(EXTRA_INCLUDES)
-LDFLAGS := $(LDFLAGS) -L$(LIBDIR)
-CXXFLAGS := $(CXXFLAGS) $(WARN) -MMD -fpic $(INCLUDES)
-
-## Macros for linking, must be late evaluated
-
-# Collect object files from a collection of src subdirs
-# $(call OBJ_FROM,srcdir,subdir)
-OBJECTS_1 = $(patsubst $1/$2/%.cpp,$(OBJDIR)/$2/%.o,$(wildcard $1/$2/*.cpp))
-OBJECTS = $(foreach src,$(SRCDIRS),$(foreach sub,$1,$(call OBJECTS_1,$(src),$(sub))))
-
-# $(call LIBFILE,name,version)
-LIBFILE =$(CURDIR)/$(LIBDIR)/libqpid_$1.so.$2
-
-LIB_COMMAND = mkdir -p $(dir $@) && $(CXX) -shared -o $@ $(LDFLAGS) $(CXXFLAGS) $^
-
--include options-local-override.mk
diff --git a/cpp/release.client.rhel3 b/cpp/release.client.rhel3
deleted file mode 100755
index 839277a5c0..0000000000
--- a/cpp/release.client.rhel3
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-
-if [[ $# -eq 1 ]]; then
- name=$1
-elif [[ $# -ne 0 ]]; then
- echo "usage: $0 [release-name]"
- exit 2
-else
- # Default the name to the svn revision
- if which svn >/dev/null 2>&1; then
- svnRevision=$(svn info | grep ^Revision: | awk '{print $2}')
- name=r${svnRevision}
- else
- echo "You need to have svn in your PATH or specify a release name"
- exit 2
- fi
-fi
-
-name=qpid-cpp-client-$name
-dir=build/$name
-
-if [[ -d $dir ]]; then
- echo "$dir already exists"
- exit 2
-fi
-
-mkdir $dir
-
-#
-# Copy over libs.
-#
-mkdir $dir/lib
-cp \
- build/apr-release/lib/libqpid_client.so.1.0 \
- build/apr-release/lib/libqpid_common.so.1.0 \
- $dir/lib
-mkdir $dir/lib.debug
-cp \
- build/apr-debug/lib/libqpid_client.so.1.0 \
- build/apr-debug/lib/libqpid_common.so.1.0 \
- $dir/lib.debug
-#cp -r ~/local/apr-1.2.7 $dir/lib
-#cp -r ~/local/boost-1.33.1 $dir/lib
-
-#
-# Copy over headers.
-#
-
-cp -r src $dir/include
-cp build/gen/qpid/framing/*.h $dir/include/qpid/framing
-# remove .svn directories
-find $dir/include -type d -name .svn | xargs rm -r
-# remove .cpp source files
-find $dir/include -type f -name \*.cpp | xargs rm
-
-#
-# Copy over examples.
-#
-mkdir $dir/examples
-cp test/client/*.cpp $dir/examples
-cp test/client/Makefile.cppclient.examples $dir/examples/Makefile
-
-#
-# Build tarball
-#
-cd build
-tar -cvjf $name.tar.bz2 $name
diff --git a/cpp/tests/examples.Makefile b/cpp/tests/examples.Makefile
new file mode 100644
index 0000000000..45999f7852
--- /dev/null
+++ b/cpp/tests/examples.Makefile
@@ -0,0 +1,66 @@
+#
+# XXX: Edit these locations to suit.
+#
+BOOST_LOCATION := $(HOME)/local/boost-1.33.1
+APR_LOCATION := $(HOME)/local/apr-1.2.7
+
+CXXFLAGS := -DNDEBUG -DUSE_APR -MMD -fpic
+
+#
+# Configure Boost.
+#
+BOOST_CFLAGS := -I$(BOOST_LOCATION)/include/boost-1_33_1
+CXXFLAGS := $(CXXFLAGS) $(BOOST_CFLAGS)
+
+#
+# Configure APR.
+#
+APR_CFLAGS := -I$(APR_LOCATION)/include/apr-1
+APR_LDFLAGS := $(shell $(APR_LOCATION)/bin/apr-1-config --libs) -L$(APR_LOCATION)/lib -lapr-1
+CXXFLAGS := $(CXXFLAGS) $(APR_CFLAGS)
+LDFLAGS := $(LDFLAGS) $(APR_LDFLAGS)
+
+#
+# Configure Qpid cpp client.
+#
+QPID_CLIENT_LDFLAGS := ../lib/libcommon.so ../lib/libclient.so
+includeDir := ../include
+QPID_CLIENT_CFLAGS := \
+ -I$(includeDir)/gen \
+ -I$(includeDir)/client \
+ -I$(includeDir)/broker \
+ -I$(includeDir)/common \
+ -I$(includeDir)/common/sys \
+ -I$(includeDir)/common/framing
+
+CXXFLAGS := $(CXXFLAGS) $(QPID_CLIENT_CFLAGS)
+LDFLAGS := $(LDFLAGS) $(QPID_CLIENT_LDFLAGS)
+
+CXX := g++
+
+#
+# Add rule to build examples.
+#
+.SUFFIX: .cpp
+%: %.cpp
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@
+
+#
+# Define targets.
+#
+
+EXAMPLES := client_test topic_listener topic_publisher echo_service
+
+cppFiles := $(wildcard *.cpp)
+programs = $(foreach cppFile, $(cppFiles), $(subst .cpp, ,$(cppFile)))
+
+.PHONY:
+all: $(programs)
+
+debug:
+ @echo cppFiles = $(cppFiles)
+ @echo programs = $(programs)
+
+.PHONY:
+clean:
+ -rm $(EXAMPLES)
diff --git a/cpp/tests/examples.README b/cpp/tests/examples.README
new file mode 100644
index 0000000000..65f908c249
--- /dev/null
+++ b/cpp/tests/examples.README
@@ -0,0 +1,18 @@
+Building the examples
+---------------------
+
+You had better edit the Makefile and provide the locations for APR and boost.
+
+Then just type 'make'.
+
+
+Running the examples
+--------------------
+
+Before running the examples ensure that you have setup your LD_LIBRARY_PATH.
+
+Most of the examples take the following connection parameters for your
+AMQP broker:
+
+ -host host
+ -port port