libnfc/make_release.sh

87 lines
2.2 KiB
Bash
Raw Normal View History

#! /bin/sh
# Stop script on first error.
set -e
# Retrieve libnfc version from configure.ac
LIBNFC_VERSION=$(grep AC_INIT configure.ac | sed 's/^.*(\(.*\))/\1/g' | awk -F', ' '{ print $2 }')
# Easiest part: GNU/linux, BSD and other POSIX systems.
LIBNFC_AUTOTOOLS_ARCHIVE=libnfc-$LIBNFC_VERSION.tar.gz
if [ ! -f $LIBNFC_AUTOTOOLS_ARCHIVE ]; then
2010-03-31 15:54:31 +02:00
echo "Autotooled archive generation..."
# First, clean what we can
autoreconf -is && ./configure && make distclean
2010-01-14 16:54:55 +01:00
2010-03-31 15:54:31 +02:00
# Second, generate dist archive (and test it)
autoreconf -is && ./configure && make distcheck
2010-03-31 15:54:31 +02:00
# Finally, clean up
2010-01-18 12:20:38 +01:00
make distclean
2010-03-31 15:54:31 +02:00
echo "Autotooled archive generate."
else
echo "Autotooled archive (GNU/Linux, BSD, etc.) is already done: skipped."
fi
# Documentation part
LIBNFC_DOC_DIR=libnfc-doc-$LIBNFC_VERSION
LIBNFC_DOC_ARCHIVE=$LIBNFC_DOC_DIR.zip
if [ ! -f $LIBNFC_DOC_ARCHIVE ]; then
2010-03-31 15:54:31 +02:00
echo "Documentation archive generation..."
2010-01-18 12:20:38 +01:00
if [ -d $LIBNFC_DOC_DIR ]; then
rm -rf $LIBNFC_DOC_DIR
fi
# Build documentation
2010-03-31 15:54:31 +02:00
autoreconf -is && ./configure --enable-doc && make doc || false
# Create archive
cp -r doc/html $LIBNFC_DOC_DIR
zip -r $LIBNFC_DOC_ARCHIVE $LIBNFC_DOC_DIR
# Clean up
2010-01-18 12:20:38 +01:00
rm -rf $LIBNFC_DOC_DIR
make distclean
2010-03-31 15:54:31 +02:00
echo "Documentation archive generated."
else
echo "Documentation archive is already done: skipped."
fi
# Windows part
2010-01-14 16:54:55 +01:00
LIBNFC_WINDOWS_DIR=libnfc-$LIBNFC_VERSION-winsdk
LIBNFC_WINDOWS_ARCHIVE=$LIBNFC_WINDOWS_DIR.zip
if [ ! -f $LIBNFC_WINDOWS_ARCHIVE ]; then
2010-03-31 15:54:31 +02:00
echo "Windows archive generation..."
if [ -d $LIBNFC_WINDOWS_DIR ]; then
rm -rf $LIBNFC_WINDOWS_DIR
fi
2010-01-14 16:54:55 +01:00
mkdir -p $LIBNFC_WINDOWS_DIR
2010-01-14 16:54:55 +01:00
# Export sources
svn export src $LIBNFC_WINDOWS_DIR/src
# Export windows files
svn export win32 $LIBNFC_WINDOWS_DIR/win32
2010-01-14 17:04:48 +01:00
# Copy important files
cp AUTHORS $LIBNFC_WINDOWS_DIR/AUTHORS.txt
cp LICENSE $LIBNFC_WINDOWS_DIR/LICENSE.txt
2010-01-14 17:04:48 +01:00
# Remove Autotools Makefile.am
find $LIBNFC_WINDOWS_DIR/ -name Makefile.am | xargs rm -f
# Remove CMakeLists.txt
find $LIBNFC_WINDOWS_DIR/ -name CMakeLists.txt | xargs rm -f
# Build archive
zip -r $LIBNFC_WINDOWS_ARCHIVE $LIBNFC_WINDOWS_DIR
rm -rf $LIBNFC_WINDOWS_DIR
2010-03-31 15:54:31 +02:00
echo "Windows archive generated."
else
echo "Windows archive is already done: skipped."
fi