mirror of
git://git.gnu.org.ua/wordsplit.git
synced 2025-04-26 00:29:54 +03:00

* .gitignore: New file. * bootstrap: New file. * wordsplit.at: Convert to stand-alone script. * wsp.c: Support the --version option.
162 lines
3.4 KiB
Bash
Executable file
162 lines
3.4 KiB
Bash
Executable file
#! /bin/sh
|
|
cd $(dirname $0)
|
|
version=$(git describe)
|
|
|
|
function genfiles() {
|
|
cat > wordsplit-version.h <<EOF
|
|
#define WORDSPLIT_VERSION "$version"
|
|
EOF
|
|
cat > package.m4 <<EOF
|
|
m4_define([AT_PACKAGE_NAME], [wordsplit])
|
|
m4_define([AT_PACKAGE_TARNAME], [wordsplit])
|
|
m4_define([AT_PACKAGE_VERSION], [$version])
|
|
m4_define([AT_PACKAGE_STRING], [AT_PACKAGE_NAME AT_PACKAGE_VERSION])
|
|
m4_define([AT_PACKAGE_BUGREPORT], [gray@gnu.org])
|
|
EOF
|
|
}
|
|
|
|
function mk_atlocal() {
|
|
cat <<\EOF
|
|
# @configure_input@ -*- shell-script -*-
|
|
# Configurable variable values for wordsplit test suite.
|
|
# Copyright (C) 2016-2019 Sergey Poznyakoff
|
|
|
|
PATH=@abs_builddir@:$srcdir:$PATH
|
|
EOF
|
|
} > atlocal.in
|
|
|
|
|
|
function mk_testsuite() {
|
|
sed -e 's|MODDIR|$moddir|' <<\EOF
|
|
# ##################
|
|
# Testsuite
|
|
# ##################
|
|
EXTRA_DIST = testsuite wordsplit.at package.m4
|
|
DISTCLEANFILES = atconfig
|
|
MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
|
|
|
|
TESTSUITE = $(srcdir)/testsuite
|
|
M4=m4
|
|
AUTOTEST = $(AUTOM4TE) --language=autotest
|
|
$(TESTSUITE): wordsplit.at
|
|
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) wordsplit.at -o $(TESTSUITE).tmp
|
|
$(AM_V_at)mv $(TESTSUITE).tmp $(TESTSUITE)
|
|
|
|
atconfig: $(top_builddir)/config.status
|
|
cd $(top_builddir) && ./config.status MODDIR/$@
|
|
|
|
clean-local:
|
|
@test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
|
|
|
|
check-local: atconfig atlocal $(TESTSUITE)
|
|
@$(SHELL) $(TESTSUITE)
|
|
|
|
noinst_PROGRAMS = wsp
|
|
wsp_SOURCES = wsp.c wordsplit-version.h
|
|
EOF
|
|
echo "wsp_LDADD = $1"
|
|
}
|
|
|
|
function common_notice() {
|
|
cat <<EOF
|
|
Add the following to your configure.ac:
|
|
|
|
AC_CONFIG_TESTDIR($moddir)
|
|
AC_CONFIG_FILES([$moddir/Makefile $moddir/atlocal])
|
|
|
|
EOF
|
|
}
|
|
|
|
function mk_installed() {
|
|
(cat <<EOF
|
|
lib_LTLIBRARIES = libwordsplit.la
|
|
libwordsplit_la_SOURCES = wordsplit.c
|
|
include_HEADERS = wordsplit.h
|
|
|
|
EOF
|
|
mk_testsuite ./libwordsplit.la) > Makefile.am
|
|
mk_atlocal
|
|
common_notice
|
|
}
|
|
|
|
function mk_shared() {
|
|
(cat <<EOF
|
|
noinst_LTLIBRARIES = libwordsplit.la
|
|
libwordsplit_la_SOURCES = wordsplit.c wordsplit.h
|
|
|
|
EOF
|
|
mk_testsuite ./libwordsplit.la) > Makefile.am
|
|
mk_atlocal
|
|
common_notice
|
|
}
|
|
|
|
function mk_static() {
|
|
(cat <<EOF
|
|
noinst_LIBRARIES = libwordsplit.a
|
|
libwordsplit_a_SOURCES = wordsplit.c wordsplit.h
|
|
|
|
EOF
|
|
mk_testsuite ./libwordsplit.a) > Makefile.am
|
|
mk_atlocal
|
|
common_notice
|
|
}
|
|
|
|
function mk_embedded() {
|
|
(mk_testsuite wordsplit.o
|
|
echo "AM_CPPFLAGS = "
|
|
)> Makefile.am
|
|
mk_atlocal
|
|
cat <<EOF
|
|
Add the following to the _SOURCES variable of your top-level Makefile.am:
|
|
|
|
wordsplit/wordsplit.c\\
|
|
wordsplit/wordsplit.h
|
|
|
|
If test framework is enabled, add also the line
|
|
|
|
SUBDIRS = . wordsplit
|
|
|
|
and the following lines to your configure.ac:
|
|
|
|
AC_CONFIG_TESTDIR($moddir)
|
|
AC_CONFIG_FILES([$moddir/Makefile $moddir/atlocal])
|
|
|
|
Replace ellipsis with the leading path components to the embedded wordsplit
|
|
sources.
|
|
EOF
|
|
}
|
|
|
|
function usage() {
|
|
cat <<EOF
|
|
usage: $0 MODE MODDIR
|
|
|
|
MODE is any of:
|
|
installed standalone installable library
|
|
shared shared convenience library (lt)
|
|
static static convenience library
|
|
embedded embedded into another library
|
|
|
|
EOF
|
|
}
|
|
#
|
|
if [ $# -ne 2 ]; then
|
|
usage >&2
|
|
exit 1
|
|
fi
|
|
|
|
moddir=$2
|
|
|
|
case $1 in
|
|
installed|shared|static|standalone|embedded)
|
|
genfiles
|
|
mk_$1
|
|
;;
|
|
clean)
|
|
rm -f Makefile.am package.m4 wordsplit-version.h atlocal.in
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
|
|
|