Skip to content

Commit

Permalink
Merge branch 'release-0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
timdawborn committed Apr 7, 2014
2 parents fcafbaa + 935b046 commit a87d7ea
Show file tree
Hide file tree
Showing 100 changed files with 90,696 additions and 88,032 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
0.2.2
* Added an explicit include check in configure.ac for all used C++11 header files.
* The special command-line flags --help and --version no longer result in a non-zero exit status.
* Removed the need for dr::Pointer<T> and dr::Pointers<T>.
* Added the ability for command-line options to optionally fallback to a positional argument value for filling if an explicit flag was not provided.

0.2.1
* Initial public release.
9 changes: 9 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2012. Tim Dawborn, James Curran, The University of Sydney.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5 changes: 3 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ SUBDIRS = src/third-party src/lib src/apps
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dist/libschwa.pc

EXTRA_DIST = doc
EXTRA_DIST = LICENCE doc src/ragel
dist-hook: clean-docs


# =============================================================================
# Custom targets.
# =============================================================================
Expand All @@ -26,5 +27,5 @@ clean-docs:

wc:
for d in src/lib src/apps; do \
find $${d} \( -name "*.cc" -or -name "*.h" \) | grep -v '_test\.cc' | grep -v ^src/lib/schwa/tokenizer/tokenizer.cc | xargs wc -l; \
find $${d} \( -name "*.cc" -or -name "*.h" \) | egrep -v '_(gen|test)\.cc' | xargs wc -l; \
done
25 changes: 1 addition & 24 deletions README
Original file line number Diff line number Diff line change
@@ -1,24 +1 @@
1: Compile

$ make depends
$ make

= Gotchas =

* Running on versions of Mac OS X may mean you don't have clang available in xcode.
* Download binary (tested with LLVM 3.1) from http://llvm.org/releases/download.html#3.1
* Unpack and add the bin directory to $PATH

= Building, deploying and installing source distributions =

1: Build a virtualenv
virtualenv --distribute ve
source ve/bin/activate

2: Build the source distribution (or just run publish.sh)
./ve/bin/python setup.py clean sdist
cp dist/*gz /n/ch2/var/www/sites/downloads/packages/pypi/schwa
./ve/bin/python setup.py clean --all

3: This can be installed in another virtualenv directly or as a "requires" item by pip from the schwa index.
./ve/bin/pip install schwa --extra-index-url http://downloads.schwa.org/packages/pypi --upgrade
Documentation can be found on the GitHub wiki page: https://github.com/schwa-lab/libschwa/wiki
94 changes: 79 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([README])

# Initialise automake.
dnl Initialise automake.
AM_INIT_AUTOMAKE([1.11 foreign -Wall -Werror parallel-tests subdir-objects])
AM_OPTIONS
AM_PROG_AR

# If CXXFLAGS was not set on entry and we are not debugging, default to -O4.
dnl Check if we're compiling with clang.
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])], [CLANG=yes], [CLANG=no])
AC_MSG_RESULT([$CLANG])

dnl If CXXFLAGS was not set on entry and we are not debugging, default to -O4.
libschwa_test_CXXFLAGS="${CXXFLAGS+set}"
if test "$libschwa_test_CXXFLAGS" = "set"; then
if test "$libschwa_cv_enable_debug" != "yes"; then
Expand All @@ -23,32 +33,71 @@ if test "$libschwa_test_CXXFLAGS" = "set"; then
fi
fi

# Add debugging flags if requested and not already in CFLAGS.
dnl Add debugging flags if requested and not already in CXXFLAGS.
if test "$libschwa_cv_enable_debug" = "yes"; then
case "${CXXFLAGS}" in
*-g*) ;;
*) CXXFLAGS="${CXXFLAGS} -g" ;;
*) CXXFLAGS="${CXXFLAGS} -g -g3" ;;
esac
fi
AM_CONDITIONAL([ENABLE_DEBUG], [test "$libschwa_cv_enable_debug" = "yes"])

# Initialise libtool (platform independant shared library generation).
dnl Initialise libtool (platform independant shared library generation).
LT_INIT
AC_SUBST([LIBTOOL_DEPS])

# Ensure we have a C++ compiler and we have C++11 support.
dnl Ensure we have a C++ compiler and we have C++11 support.
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])

# Initialise pkg-config.
dnl Initialise pkg-config.
PKG_PROG_PKG_CONFIG

# Check for headers.
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([cxxabi.h endian.h libgen.h libproc.h limits.h machine/byte_order.h]) # <schwa/port.{h,cc}>
dnl Check for headers.
AC_CHECK_HEADER([algorithm], , AC_MSG_ERROR([C++11 algorithm header not found]))
AC_CHECK_HEADER([array], , AC_MSG_ERROR([C++11 array header not found]))
AC_CHECK_HEADER([cassert], , AC_MSG_ERROR([C++11 cassert header not found]))
AC_CHECK_HEADER([cctype], , AC_MSG_ERROR([C++11 cctype header not found]))
AC_CHECK_HEADER([cerrno], , AC_MSG_ERROR([C++11 cerrno header not found]))
AC_CHECK_HEADER([chrono], , AC_MSG_ERROR([C++11 chrono header not found]))
AC_CHECK_HEADER([cinttypes], , AC_MSG_ERROR([C++11 cinttypes header not found]))
AC_CHECK_HEADER([cstddef], , AC_MSG_ERROR([C++11 cstddef header not found]))
AC_CHECK_HEADER([cstdint], , AC_MSG_ERROR([C++11 cstdint header not found]))
AC_CHECK_HEADER([cstdio], , AC_MSG_ERROR([C++11 cstdio header not found]))
AC_CHECK_HEADER([cstdlib], , AC_MSG_ERROR([C++11 cstdlib header not found]))
AC_CHECK_HEADER([cstring], , AC_MSG_ERROR([C++11 cstring header not found]))
AC_CHECK_HEADER([ctime], , AC_MSG_ERROR([C++11 ctime header not found]))
AC_CHECK_HEADER([deque], , AC_MSG_ERROR([C++11 deque header not found]))
AC_CHECK_HEADER([exception], , AC_MSG_ERROR([C++11 exception header not found]))
AC_CHECK_HEADER([fstream], , AC_MSG_ERROR([C++11 fstream header not found]))
AC_CHECK_HEADER([functional], , AC_MSG_ERROR([C++11 functional header not found]))
AC_CHECK_HEADER([iomanip], , AC_MSG_ERROR([C++11 iomanip header not found]))
AC_CHECK_HEADER([iosfwd], , AC_MSG_ERROR([C++11 iosfwd header not found]))
AC_CHECK_HEADER([iostream], , AC_MSG_ERROR([C++11 iostream header not found]))
AC_CHECK_HEADER([iterator], , AC_MSG_ERROR([C++11 iterator header not found]))
AC_CHECK_HEADER([limits], , AC_MSG_ERROR([C++11 limits header not found]))
AC_CHECK_HEADER([map], , AC_MSG_ERROR([C++11 map header not found]))
AC_CHECK_HEADER([memory], , AC_MSG_ERROR([C++11 memory header not found]))
AC_CHECK_HEADER([mutex], , AC_MSG_ERROR([C++11 mutex header not found]))
AC_CHECK_HEADER([new], , AC_MSG_ERROR([C++11 new header not found]))
AC_CHECK_HEADER([ostream], , AC_MSG_ERROR([C++11 ostream header not found]))
AC_CHECK_HEADER([random], , AC_MSG_ERROR([C++11 random header not found]))
AC_CHECK_HEADER([regex], , AC_MSG_ERROR([C++11 regex header not found]))
AC_CHECK_HEADER([set], , AC_MSG_ERROR([C++11 set header not found]))
AC_CHECK_HEADER([sstream], , AC_MSG_ERROR([C++11 sstream header not found]))
AC_CHECK_HEADER([stack], , AC_MSG_ERROR([C++11 stack header not found]))
AC_CHECK_HEADER([string], , AC_MSG_ERROR([C++11 string header not found]))
AC_CHECK_HEADER([thread], , AC_MSG_ERROR([C++11 thread header not found]))
AC_CHECK_HEADER([typeinfo], , AC_MSG_ERROR([C++11 typeinfo header not found]))
AC_CHECK_HEADER([utility], , AC_MSG_ERROR([C++11 utility header not found]))
AC_CHECK_HEADER([vector], , AC_MSG_ERROR([C++11 vector header not found]))
AC_CHECK_HEADER([fcntl.h], , AC_MSG_ERROR([POSIX fcntl.h header not found]))
AC_CHECK_HEADER([unistd.h], , AC_MSG_ERROR([POSIX unistd.h header not found]))
AC_CHECK_HEADERS([cxxabi.h endian.h libgen.h libproc.h limits.h machine/byte_order.h]) dnl <schwa/port.{h,cc}>

# Work out how to inline the "host to big endian" functions for various based on what headers we found.
dnl Work out how to inline the "host to big endian" functions for various based on what headers we found.
if test "$ac_cv_header_endian_h" = "yes"; then
AC_SUBST([ENDIAN_CONVERSION_HEADER], [endian.h])
AC_SUBST([ENDIAN_CONVERSION_H_TO_BE16], [htobe16])
Expand All @@ -69,25 +118,40 @@ else
AC_MSG_ERROR([Could not work out how to deal with endianness conversion on your platform])
fi

# Check for Google perftools to link against.
dnl Check for Google perftools to link against.
AC_CHECK_LIB([profiler], [ProfilerStart], [PROFILERLIB=-lprofiler])
AC_SUBST([PROFILERLIB])
AC_CHECK_LIB([tcmalloc], [malloc], [TCMALLOCLIB=-ltcmalloc])
AC_SUBST([TCMALLOCLIB])

# Check if we have ØMQ >= 3.
dnl Check if we have ØMQ >= 3.
PKG_CHECK_MODULES([ZMQLIB], [libzmq >= 3], [have_libzmq=yes], [have_libzmq=no])
AM_CONDITIONAL([HAVE_LIBZMQ], [test "$have_libzmq" = "yes" && test "$libschwa_cv_enable_libzmq" = "yes"])

# Configure autoconf inputs and outputs.
dnl Construct our base set of CXXFLAGS, depending on the compiler.
LIBSCHWA_BASE_CXXFLAGS='-Wall -Wextra -Werror -pedantic -Wformat-security -Wpointer-arith -Wformat-nonliteral -Winit-self -Wfloat-equal -ffast-math -fstack-protector'
if test "x$GXX" = xyes; then
dnl Add compiler specific flags.
if test "x$CLANG" = xyes; then
LIBSCHWA_BASE_CXXFLAGS="$LIBSCHWA_BASE_CXXFLAGS -fdiagnostics-show-option -fdiagnostics-show-template-tree -pedantic-errors"
else
LIBSCHWA_BASE_CXXFLAGS="$LIBSCHWA_BASE_CXXFLAGS -Wdouble-promotion"
fi
fi
AC_SUBST([LIBSCHWA_BASE_CXXFLAGS])

dnl Configure autoconf inputs and outputs.
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
src/apps/Makefile
src/apps/ccg-pprint/Makefile
src/apps/dr/Makefile
src/apps/dr-count/Makefile
src/apps/dr-dist/Makefile
src/apps/dr-grep/Makefile
src/apps/dr-head/Makefile
src/apps/dr-sample/Makefile
src/apps/dr-tail/Makefile
src/apps/dr-ui/Makefile
src/apps/dr-worker-example/Makefile
Expand All @@ -99,7 +163,7 @@ AC_CONFIG_FILES([
dist/libschwa.pc:dist/libschwa.pc.in
])

# Configure third party modules
dnl Configure third party modules
AC_CONFIG_SUBDIRS([
src/third-party/unittest-cpp
])
Expand Down
39 changes: 39 additions & 0 deletions dist/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# http://nvie.com/posts/a-successful-git-branching-model/
set -e

M4_VERSION_FILE='m4/version.m4'
M4_VERSION_SET_FILE='m4/version-set.m4'


if [[ ${#} -ne 4 ]]; then
echo "Usage: ${0} major minor patch date"
echo "This script should be called by dist/create-release-branch.sh"
exit 1
fi

# Relocate to the top level project directory.
cd $(dirname ${0})/..

# Create the version.m4 file.
cat > ${M4_VERSION_FILE} <<EOF
dnl Product version for AC_INIT. Maintained by dist/bump-version.sh
${1}.${2}.${3}
EOF

# Create the version-set.m4 file.
cat > ${M4_VERSION_SET_FILE} <<EOF
dnl Product version for header files. Maintained by dist/bump-version.sh
VERSION_MAJOR=${1}
VERSION_MINOR=${2}
VERSION_PATCH=${3}
VERSION_STRING='"${1}.${2}.${3} (${4})"'
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_PATCH)
AC_SUBST(VERSION_STRING)
VERSION_NOPATCH=${1}.${2}
AC_SUBST(VERSION_NOPATCH)
EOF
59 changes: 59 additions & 0 deletions dist/create-deb-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# http://www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html
set -e

MAINTAINER_NAME='Tim Dawborn'
MAINTAINER_EMAIL='[email protected]'
WORKING_DIR=/tmp/create-deb-package


# Relocate to the top level project directory.
cd $(dirname ${0})/..

# Check required dependencies for building a deb file.
sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder

# Create the distribution.
make dist
version=$(tail -n +2 m4/version.m4)

# Create and relocate to the working directory.
rm -rf ${WORKING_DIR}
mkdir -p ${WORKING_DIR}
cp libschwa-${version}.tar.gz ${WORKING_DIR}
cd ${WORKING_DIR}

# Extract the tarball and go into the extracted folder.
tar xzf libschwa-${version}.tar.gz
cd libschwa-${version}

# Start the debianisation.
dh_make --email "${MAINTAINER_EMAIL}" --multi --file ../libschwa-${version}.tar.gz

# Update the generated debian files.
cat > debian/control <<EOF
Source: libschwa
Section: unknown
Priority: extra
Maintainer: ${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>
Build-Depends: debhelper (>= 8.0.0), autotools-dev, libgcc-4.8-dev, libzmq3-dev
Standards-Version: 3.9.2
Homepage: https://github.com/schwa-lab/libschwa
Package: libschwa
Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: Schwa Lab core NLP tools.
Schwa Lab core NLP tools.
EOF
cp LICENCE debian/copyright

# Build the source as a debian package.
dpkg-buildpackage -rfakeroot

# Install the generated deb file on packages.schwa.org.
read -r -p 'Copy deb file to packages.schwa.org? [y/N] ' response
if [[ ${response} =~ ^([yY][eE][sS]|[yY])$ ]]; then
scp ../libschwa*.deb deb@ch2:packages/ubuntu/pool/main/precise
ssh deb@ch2 'packages/ubuntu/update-amd64.sh precise'
fi
57 changes: 57 additions & 0 deletions dist/create-release-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
# http://nvie.com/posts/a-successful-git-branching-model/
set -e

M4_VERSION_FILE='m4/version.m4'
M4_VERSION_SET_FILE='m4/version-set.m4'


# Relocate to the top level project directory.
cd $(dirname ${0})/..

# Try and work out what the new version should be.
version_major=0
version_minor=0
version_patch=0
current_version_string='unknown'
if test -f ${M4_VERSION_SET_FILE}; then
version_major=$(grep '^VERSION_MAJOR=' ${M4_VERSION_SET_FILE} | cut -d = -f 2)
version_minor=$(($(grep '^VERSION_MINOR=' ${M4_VERSION_SET_FILE} | cut -d = -f 2) + 1))
version_patch=0
current_version_string=$(grep '^VERSION_STRING=' ${M4_VERSION_SET_FILE} | cut -d = -f 2)
fi
if [[ ${#} -ne 0 ]]; then
version_major=${1}
shift
fi
if [[ ${#} -ne 0 ]]; then
version_minor=${1}
shift
fi
if [[ ${#} -ne 0 ]]; then
version_patch=${1}
shift
fi
version_date="$(date +%Y-%m-%d)"
version="${version_major}.${version_minor}.${version_patch}"
version_string="'\"${version} (${version_date})\"'"

# Confirm before going ahead.
echo "Current version: ${current_version_string}"
echo " New version: ${version_string}"
read -r -p 'Are you sure? [y/N] ' response
if [[ ${response} =~ ^([yY][eE][sS]|[yY])$ ]]; then
true
else
exit 0
fi

# Create the release branch.
git checkout -b release-${version} develop

# Bump the version and commit the change.
./dist/bump-version.sh ${version_major} ${version_minor} ${version_patch} "${version_date}"
git commit -a -m "Bumped version to ${version}."

echo "Release branch successfully created and the version has been bumped to ${version}."
echo "Once you're ready to release, call dist/finish-release-branch.sh."
Loading

0 comments on commit a87d7ea

Please sign in to comment.