Further work in progress.

This commit is contained in:
Laurence Withers 2006-07-24 22:37:26 +01:00
parent 7a3fbaec1f
commit 587981015f
15 changed files with 86 additions and 92 deletions

View File

@ -4,7 +4,7 @@
* COPYING for more information / terms of license. * COPYING for more information / terms of license.
*/ */
#include "@HEADER@" #include "@HEADER_NAME@"
// Below are all the includes used throughout the library. // Below are all the includes used throughout the library.

View File

@ -7,8 +7,8 @@ build_dir_tree "${INCLUDEDIR}" || return 1
# install library # install library
echo "Installing libraries into '${LIBDIR}'" echo "Installing libraries into '${LIBDIR}'"
install_file ${@PNAME@} ${LIBDIR} 0755 || return 1 install_file ${@CNAME@} ${LIBDIR} 0755 || return 1
BASE="${@PNAME@_BASE}.so" BASE="${@CNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}" MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}" MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}" MICRO="${MINOR}.${SOMICRO}"
@ -17,12 +17,12 @@ install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}" install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
# install header # install header
echo "Installing header file '${@PNAME@_HEADER}' into ${INCLUDEDIR}" echo "Installing header file '${@CNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@PNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1 install_header ${@CNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file # install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}" echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@PNAME@.pc PKGCONFFILE=${PKGCONFDIR}/@CNAME@.pc
do_cmd rm -f ${PKGCONFFILE} do_cmd rm -f ${PKGCONFFILE}
do_cmd_redir ${PKGCONFFILE} sed \ do_cmd_redir ${PKGCONFFILE} sed \
-e "s,@VERSION@,${VERSION}," \ -e "s,@VERSION@,${VERSION}," \

View File

@ -1,25 +1,25 @@
# These are external variables, and shouldn't clash with anything else # These are external variables, and shouldn't clash with anything else
# @PNAME@ # @CNAME@
# @PNAME@_BUILT # @CNAME@_BUILT
# @PNAME@_HEADER # @CNAME@_HEADER
# @PNAME@_BASE # @CNAME@_BASE
if [ -z ${@PNAME@_BUILT} ] if [ -z ${@CNAME@_BUILT} ]
then then
@PNAME@_BASE=@NAME@ @CNAME@_BASE=@NAME@
source src/@NAME@/soversion source src/@NAME@/soversion
@NAME@="obj/${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}" @CNAME@="obj/${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
SO_EXTRA="-lstdc++ -lc" # @TODO@ libs, cflags SO_EXTRA="-lstdc++ -lc" # @TODO@ libs, cflags
echo "Building library ${@PNAME@}..." echo "Building library ${@CNAME@}..."
source src/@NAME@/build.monolithic source src/@NAME@/build.monolithic
MODIFIED=0 MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC} for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC}
do do
if [ ${test} -nt ${@PNAME@} ] if [ ${test} -nt ${@CNAME@} ]
then then
MODIFIED=1 MODIFIED=1
break break
@ -30,21 +30,21 @@ then
then then
echo " Compiling" echo " Compiling"
SONAME="${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}" SONAME="${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@PNAME@}" \ do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@CNAME@}" \
-Wl,-soname,${SONAME} \ -Wl,-soname,${SONAME} \
${SRC} ${SO_EXTRA} || return 1 ${SRC} ${SO_EXTRA} || return 1
# make tests work # make tests work
do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1 do_cmd ln -sf $(basename ${@CNAME@}) obj/${SONAME} || return 1
print_success "Library built" print_success "Library built"
else else
print_success "Library up to date" print_success "Library up to date"
fi fi
@PNAME@_BUILT=1 @CNAME@_BUILT=1
@PNAME@_HEADER=${HDR} @CNAME@_HEADER=${HDR}
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,7 +1,7 @@
# These are external variables, and shouldn't clash with anything else # These are external variables, and shouldn't clash with anything else
# @PNAME@_MONOLITHIC # @CNAME@_MONOLITHIC
if [ -z "${@PNAME@_MONOLITHIC}" ] if [ -z "${@CNAME@_MONOLITHIC}" ]
then then
SRC="obj/@NAME@.cpp" SRC="obj/@NAME@.cpp"
HDR="obj/@HEADER_NAME@" HDR="obj/@HEADER_NAME@"
@ -13,7 +13,7 @@ then
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)" MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)"
make_monolithic ${SRC} C || return 1 make_monolithic ${SRC} C || return 1
@PNAME@_MONOLITHIC=1 @CNAME@_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}" MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}"
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -0,0 +1,13 @@
# @P@/src/@NAME@/soversion
#
# SOMAJOR and SOMINOR are included in the library's soname. They need to
# be bumped on a binary-incompatible release. They are both single
# integers.
SOMAJOR=0
SOMINOR=0
# SOMICRO is bumped every time there is a binary-compatible release.
SOMICRO=0

View File

@ -2,23 +2,19 @@
# @NAME@_BUILT # @NAME@_BUILT
# #
build_target @LIBS@ #@TODO@ build_target libs
if [ -z ${@NAME@_BUILT} ] if [ -z ${@NAME@_BUILT} ]
then then
LIBS="" LIBS="" # @TODO@ internal libs
for lib in @LIBS@
do
LIBS="${LIBS} ${!${lib}}"
done
EXTRAS="" # @TODO@ libs, cflags EXTRAS="" # @TODO@ libs, cflags
echo "Building test programs..." echo "Building test programs..."
do_cmd mkdir -p obj/@NAME@ || return 1 do_cmd mkdir -p obj/tests || return 1
for SRC in src/@NAME@/*.cpp for SRC in src/@NAME@/*.cpp
do do
TEST="obj/@NAME@/$(basename ${SRC} | sed -e 's,.cpp$,,')" TEST="obj/tests/$(basename ${SRC} | sed -e 's,.cpp$,,')"
MODIFIED=0 MODIFIED=0
for file in ${LIBS} ${SRC} src/@NAME@/build.tests for file in ${LIBS} ${SRC} src/@NAME@/build.tests
do do

View File

@ -1,21 +1,9 @@
if [ $# -lt 1 ] if [ $# -ne 0 ]
then then
print_failure "Not enough arguments after module; need LIBS." print_failure "Unexpected extra parameters."
echo "LIBS are the library module names for these test programs."
exit 1 exit 1
fi fi
LIBS="$@"
for lib in ${LIBS}
do
if [ ! -e src/${lib} ]
then
print_failure "src/${lib} does not exist"
exit 1
fi
done
if [ -e src/${NAME} ] if [ -e src/${NAME} ]
then then
print_failure "src/${NAME} already exists." print_failure "src/${NAME} already exists."
@ -30,7 +18,6 @@ do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || exit 1 do_cmd cd src/${NAME} || exit 1
do_cmd rm instantiate || exit 1 do_cmd rm instantiate || exit 1
do_cmd find . -type f -exec sed -e "s,@NAME@,${NAME},g" -i {} \; || exit 1 do_cmd find . -type f -exec sed -e "s,@NAME@,${NAME},g" -i {} \; || exit 1
do_cmd find . -type f -exec sed -e "s,@LIBS@,${LIBS},g" -i {} \; || exit 1
do_cmd grep "@TODO@" * || exit 1 do_cmd grep "@TODO@" * || exit 1
print_success "Module instantiated." print_success "Module instantiated."

View File

@ -1,11 +1,11 @@
/* @P@/src/clib/TopHeader.h /* @P@/src/@NAME@/TopHeader.h
* *
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file * (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license. * COPYING for more information / terms of license.
*/ */
#ifndef HEADER_lib@PC@ #ifndef HEADER_@CNAME@
#define HEADER_lib@PC@ #define HEADER_@CNAME@
// standard includes, or includes needed for type declarations // standard includes, or includes needed for type declarations

View File

@ -1,4 +1,4 @@
/* @P@/src/clib/TopSource.c /* @P@/src/@NAME@@NAME@/TopSource.c
* *
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file * (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license. * COPYING for more information / terms of license.

View File

@ -7,8 +7,8 @@ build_dir_tree "${INCLUDEDIR}" || return 1
# install library # install library
echo "Installing libraries into '${LIBDIR}'" echo "Installing libraries into '${LIBDIR}'"
install_file ${@PNAME@} ${LIBDIR} 0755 || return 1 install_file ${@CNAME@} ${LIBDIR} 0755 || return 1
BASE="${@PNAME@_BASE}.so" BASE="${@CNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}" MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}" MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}" MICRO="${MINOR}.${SOMICRO}"
@ -17,12 +17,12 @@ install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}" install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
# install header # install header
echo "Installing header file '${@PNAME@_HEADER}' into ${INCLUDEDIR}" echo "Installing header file '${@CNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@PNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1 install_header ${@CNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file # install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}" echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@PNAME@.pc PKGCONFFILE=${PKGCONFDIR}/@CNAME@.pc
do_cmd rm -f ${PKGCONFFILE} do_cmd rm -f ${PKGCONFFILE}
do_cmd_redir ${PKGCONFFILE} sed \ do_cmd_redir ${PKGCONFFILE} sed \
-e "s,@VERSION@,${VERSION}," \ -e "s,@VERSION@,${VERSION}," \

View File

@ -1,25 +1,25 @@
# These are external variables, and shouldn't clash with anything else # These are external variables, and shouldn't clash with anything else
# @PNAME@ # @CNAME@
# @PNAME@_BUILT # @CNAME@_BUILT
# @PNAME@_HEADER # @CNAME@_HEADER
# @PNAME@_BASE # @CNAME@_BASE
if [ -z ${@PNAME@_BUILT} ] if [ -z ${@CNAME@_BUILT} ]
then then
@PNAME@_BASE=@NAME@ @CNAME@_BASE=@NAME@
source src/@NAME@/soversion source src/@NAME@/soversion
@NAME@="obj/${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}" @CNAME@="obj/${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
SO_EXTRA="-lc" # @TODO@ libs, cflags SO_EXTRA="-lc" # @TODO@ libs, cflags
echo "Building library ${@PNAME@}..." echo "Building library ${@CNAME@}..."
source src/@NAME@/build.monolithic source src/@NAME@/build.monolithic
MODIFIED=0 MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC} for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC}
do do
if [ ${test} -nt ${@PNAME@} ] if [ ${test} -nt ${@CNAME@} ]
then then
MODIFIED=1 MODIFIED=1
break break
@ -30,21 +30,21 @@ then
then then
echo " Compiling" echo " Compiling"
SONAME="${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}" SONAME="${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CC} ${CFLAGS} -shared -fpic -o "${@PNAME@}" \ do_cmd ${CC} ${CFLAGS} -shared -fpic -o "${@CNAME@}" \
-Wl,-soname,${SONAME} \ -Wl,-soname,${SONAME} \
${SRC} ${SO_EXTRA} || return 1 ${SRC} ${SO_EXTRA} || return 1
# make tests work # make tests work
do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1 do_cmd ln -sf $(basename ${@CNAME@}) obj/${SONAME} || return 1
print_success "Library built" print_success "Library built"
else else
print_success "Library up to date" print_success "Library up to date"
fi fi
@PNAME@_BUILT=1 @CNAME@_BUILT=1
@PNAME@_HEADER=${HDR} @CNAME@_HEADER=${HDR}
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,7 +1,7 @@
# These are external variables, and shouldn't clash with anything else # These are external variables, and shouldn't clash with anything else
# @PNAME@_MONOLITHIC # @CNAME@_MONOLITHIC
if [ -z "${@PNAME@_MONOLITHIC}" ] if [ -z "${@CNAME@_MONOLITHIC}" ]
then then
SRC="obj/@NAME@.c" SRC="obj/@NAME@.c"
HDR="obj/@HEADER_NAME@" HDR="obj/@HEADER_NAME@"
@ -10,10 +10,10 @@ then
MONOLITHIC_SOURCE="$(echo src/@NAME@/{TopHeader,BottomHeader}.h)" MONOLITHIC_SOURCE="$(echo src/@NAME@/{TopHeader,BottomHeader}.h)"
make_monolithic ${HDR} C || return 1 make_monolithic ${HDR} C || return 1
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)" MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.c)"
make_monolithic ${SRC} C || return 1 make_monolithic ${SRC} C || return 1
@PNAME@_MONOLITHIC=1 @CNAME@_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}" MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}"
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -0,0 +1,13 @@
# @P@/src/@NAME@/soversion
#
# SOMAJOR and SOMINOR are included in the library's soname. They need to
# be bumped on a binary-incompatible release. They are both single
# integers.
SOMAJOR=0
SOMINOR=0
# SOMICRO is bumped every time there is a binary-compatible release.
SOMICRO=0

View File

@ -2,23 +2,19 @@
# @NAME@_BUILT # @NAME@_BUILT
# #
build_target @LIBS@ #@TODO@ build_target libs
if [ -z ${@NAME@_BUILT} ] if [ -z ${@NAME@_BUILT} ]
then then
LIBS="" LIBS="" # @TODO@ internal libs
for lib in @LIBS@
do
LIBS="${LIBS} ${!${lib}}"
done
EXTRAS="" # @TODO@ libs, cflags EXTRAS="" # @TODO@ libs, cflags
echo "Building test programs..." echo "Building test programs..."
do_cmd mkdir -p obj/@NAME@ || return 1 do_cmd mkdir -p obj/tests || return 1
for SRC in src/@NAME@/*.c for SRC in src/@NAME@/*.c
do do
TEST="obj/@NAME@/$(basename ${SRC} | sed -e 's,.c$,,')" TEST="obj/tests/$(basename ${SRC} | sed -e 's,.c$,,')"
MODIFIED=0 MODIFIED=0
for file in ${LIBS} ${SRC} src/@NAME@/build.tests for file in ${LIBS} ${SRC} src/@NAME@/build.tests
do do

View File

@ -10,14 +10,3 @@ VERMAJOR=1
VERMINOR=0 VERMINOR=0
VERMICRO=2 VERMICRO=2
VEREXTRA="" VEREXTRA=""
# SOMAJOR and SOMINOR are included in the library's soname. They need to
# be bumped on a binary-incompatible release. They are both single
# integers.
SOMAJOR=0
SOMINOR=0
# SOMICRO is bumped every time there is a binary-compatible release.
SOMICRO=0