Create a local copy of the scripts directory.

The idea is to move the build system out of the project tree as much as
possible. This has two benefits:
 - it does not add any baggage to somebody who just wants to compile the
   project, and doesn't want to create any new modules,
 - it means that project trees don't have to be updated every time a
   change is made to the module instantiation stuff.
This commit is contained in:
Laurence Withers 2006-07-25 19:00:04 +01:00
parent 201586b051
commit 87272247fb
65 changed files with 1561 additions and 0 deletions

View File

@ -0,0 +1,13 @@
/* @P@/src/@NAME@/TopHeader.h
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
// standard includes, or includes needed for type declarations
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,13 @@
/* @P@/src/@NAME@/TopSource.cpp
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
// Below are all the includes used throughout the application.
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,41 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@
# @NAME@_BUILT
#
if [ -z ${@NAME@_BUILT} ]
then
@NAME@="obj/@NAME@"
EXTRAS="@TODO@" # cflags, libs
echo "Building application ${@NAME@}..."
do_cmd source src/@NAME@/build.monolithic || return 1
MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${SRC}
do
if [ ${test} -nt ${@NAME@} ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
echo " Compiling..."
do_cmd ${CXX} ${CFLAGS} -o "${@NAME@}" ${SRC} ${EXTRAS} || return 1
print_success "Application built"
else
print_success "Application up to date"
fi
@NAME@_BUILT=1
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1 @@
source src/@NAME@/build.app

View File

@ -0,0 +1 @@
source src/@NAME@/build.install-app

View File

@ -0,0 +1,12 @@
build_target @NAME@
# make paths (this is for Gentoo in particular)
build_dir_tree "${BINDIR}" || return 1
# install binary
echo "Installing binaries into '${BINDIR}'"
install_file "${@NAME@}" "${BINDIR}" 0755 || return 1
print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,18 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@_MONOLITHIC
#
SRC="obj/@NAME@.cpp"
MONOLITHIC_TESTS="src/@NAME@/build.app src/@NAME@/build.monolithic"
if [ -z "${@NAME@_MONOLITHIC}" ]
then
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopHeader.h) $(echo src/@NAME@/TopSource.cpp)"
make_monolithic ${SRC} C || return 1
@NAME@_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,25 @@
if [ $# -ne 0 ]
then
print_failure "Too many arguments. None required for this module."
exit 1
fi
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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 grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,13 @@
/* @P@/src/@NAME@/BottomHeader.h
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
#endif
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,16 @@
/* @P@/src/@NAME@/TopHeader.h
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
#ifndef HEADER_@CNAME@
#define HEADER_@CNAME@
// standard includes, or includes needed for type declarations
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,15 @@
/* @P@/src/@NAME@/TopSource.cpp
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
#include "@HEADER_NAME@"
// Below are all the includes used throughout the library.
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1 @@
source src/@NAME@/build.lib

View File

@ -0,0 +1 @@
source src/@NAME@/build.install-lib

View File

@ -0,0 +1,36 @@
build_target @NAME@
# make paths (this is for Gentoo in particular)
build_dir_tree "${LIBDIR}" || return 1
build_dir_tree "${PKGCONFDIR}" || return 1
build_dir_tree "${INCLUDEDIR}" || return 1
# install library
echo "Installing libraries into '${LIBDIR}'"
install_file ${@CNAME@} ${LIBDIR} 0755 || return 1
BASE="${@CNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}"
install_symlink "${MINOR}" "${MICRO}" "${LIBDIR}"
install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
# install header
echo "Installing header file '${@CNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@CNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@CNAME@.pc
do_cmd rm -f ${PKGCONFFILE}
do_cmd_redir ${PKGCONFFILE} sed \
-e "s,@VERSION@,${VERSION}," \
-e "s,@LIBDIR@,${FINALLIBDIR}," \
-e "s,@INCLUDEDIR@,${FINALINCLUDEDIR}," \
src/@NAME@/pkgconf.in
do_cmd chmod 0644 ${PKGCONFFILE}
print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

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

View File

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

View File

@ -0,0 +1,44 @@
if [ $# -ne 2 ]
then
print_failure "Not enough arguments after module; need CNAME HEADER_NAME."
echo "CNAME is the C identifier version of the module name."
echo "HEADER_NAME is the name of the header file."
exit 1
fi
CNAME=$1
shift
HEADER_NAME=$1
shift
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
if [ "$(echo ${NAME} | cut -b1-3)" != "lib" ]
then
echo "Warning: your module name does not begin with 'lib'. You will"
echo "have to fix up your pkgconfig file manually, etc."
NAMEMINUSL="@TODO@"
else
NAMEMINUSL="-l$(echo ${NAME} | sed -e 's,^lib,,')"
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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,@CNAME@,${CNAME},g" -i {} \; || exit 1
do_cmd find . -type f -exec sed -e "s,@NAMEMINUSL@,${NAMEMINUSL},g" -i {} \; || exit 1
do_cmd find . -type f -exec sed -e "s,@HEADER_NAME@,${HEADER_NAME},g" -i {} \; || exit 1
do_cmd grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,21 @@
# @P@/src/lib/@NAME@/pkgconf.in
#
# Metadata file for pkg-config
# ( http://www.freedesktop.org/software/pkgconfig/ )
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# Name, description
Name: @TODO@
Description: @TODO@
Version: @VERSION@
# Requirements
Requires:
# Compilation information
Libs: -L@LIBDIR@ @NAMEMINUSL@
Cflags: -I@INCLUDEDIR@

View File

@ -0,0 +1,17 @@
# @P@/src/@NAME@/soversion
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# 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

@ -0,0 +1,3 @@
source src/@NAME@/build.tests
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,43 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@_BUILT
#
#@TODO@ build_target libs || return 1
if [ -z ${@NAME@_BUILT} ]
then
LIBS="" # @TODO@ internal libs
EXTRAS="" # @TODO@ libs, cflags
echo "Building test programs..."
do_cmd mkdir -p obj/tests || return 1
for SRC in src/@NAME@/*.cpp
do
TEST="obj/tests/$(basename ${SRC} | sed -e 's,.cpp$,,')"
MODIFIED=0
for file in ${LIBS} ${SRC} src/@NAME@/build.tests
do
if [ ${file} -nt ${TEST} ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
do_cmd ${CXX} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} ${EXTRAS} || return 1
print_success "Built ${TEST}"
else
print_success "${TEST} is up to date"
fi
done
print_success "All tests built"
@NAME@_BUILT=1
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,25 @@
if [ $# -ne 0 ]
then
print_failure "Unexpected extra parameters."
exit 1
fi
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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 grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,44 @@
/* @P@/src/@NAME@/???.cpp
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
@TODO@ includes
#include <iostream>
int main(int argc, char* argv[])
{
if(argc == 2 && !strcmp(argv[1], "--print-summary")) {
std::cout << "One line summary.\n";
return 0;
}
if(argc == 1) {
// empty argument list
}
int ret = 0;
try {
// TODO
}
catch(std::exception& e) {
std::cerr << e.what() << std::endl;
ret = 1;
}
catch(...) {
std::cerr << "Unknown exception caught." << std::endl;
ret = 1;
}
return ret;
}
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,13 @@
/* @P@/src/capp/TopHeader.h
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
// standard includes, or includes needed for type declarations
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,13 @@
/* @P@/src/capp/TopSource.c
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
// Below are all the includes used throughout the application.
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,41 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@
# @NAME@_BUILT
#
if [ -z ${@NAME@_BUILT} ]
then
@NAME@="obj/@NAME@"
EXTRAS="@TODO@" # cflags, libs
echo "Building application ${@NAME@}..."
do_cmd source src/@NAME@/build.monolithic || return 1
MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${SRC}
do
if [ ${test} -nt ${@NAME@} ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
echo " Compiling..."
do_cmd ${CC} ${CFLAGS} -o "${@NAME@}" ${SRC} ${EXTRAS} || return 1
print_success "Application built"
else
print_success "Application up to date"
fi
@NAME@_BUILT=1
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1 @@
source src/@NAME@/build.app

View File

@ -0,0 +1 @@
source src/@NAME@/build.install-app

View File

@ -0,0 +1,12 @@
build_target @NAME@
# make paths (this is for Gentoo in particular)
build_dir_tree "${BINDIR}" || return 1
# install binary
echo "Installing binaries into '${BINDIR}'"
install_file "${@NAME@}" "${BINDIR}" 0755 || return 1
print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,18 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@_MONOLITHIC
#
SRC="obj/@NAME@.c"
MONOLITHIC_TESTS="src/@NAME@/build.app src/@NAME@/build.monolithic"
if [ -z "${@NAME@_MONOLITHIC}" ]
then
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopHeader.h) $(echo src/@NAME@/TopSource.c)"
make_monolithic ${SRC} C || return 1
@NAME@_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,25 @@
if [ $# -ne 0 ]
then
print_failure "Too many arguments. None required for this module."
exit 1
fi
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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 grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,12 @@
/* @P@/src/clib/BottomHeader.h
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
#endif
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
*/

View File

@ -0,0 +1,15 @@
/* @P@/src/@NAME@/TopHeader.h
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
#ifndef HEADER_@CNAME@
#define HEADER_@CNAME@
// standard includes, or includes needed for type declarations
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
*/

View File

@ -0,0 +1,14 @@
/* @P@/src/@NAME@@NAME@/TopSource.c
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
#include "@HEADER_NAME@"
// Below are all the includes used throughout the library.
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
*/

View File

@ -0,0 +1 @@
source src/@NAME@/build.lib

View File

@ -0,0 +1 @@
source src/@NAME@/build.install-lib

View File

@ -0,0 +1,36 @@
build_target @NAME@
# make paths (this is for Gentoo in particular)
build_dir_tree "${LIBDIR}" || return 1
build_dir_tree "${PKGCONFDIR}" || return 1
build_dir_tree "${INCLUDEDIR}" || return 1
# install library
echo "Installing libraries into '${LIBDIR}'"
install_file ${@CNAME@} ${LIBDIR} 0755 || return 1
BASE="${@CNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}"
install_symlink "${MINOR}" "${MICRO}" "${LIBDIR}"
install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
# install header
echo "Installing header file '${@CNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@CNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@CNAME@.pc
do_cmd rm -f ${PKGCONFFILE}
do_cmd_redir ${PKGCONFFILE} sed \
-e "s,@VERSION@,${VERSION}," \
-e "s,@LIBDIR@,${FINALLIBDIR}," \
-e "s,@INCLUDEDIR@,${FINALINCLUDEDIR}," \
src/@NAME@/pkgconf.in
do_cmd chmod 0644 ${PKGCONFFILE}
print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

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

View File

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

View File

@ -0,0 +1,44 @@
if [ $# -ne 2 ]
then
print_failure "Not enough arguments after module; need CNAME HEADER_NAME."
echo "CNAME is the C identifier version of the module name."
echo "HEADER_NAME is the name of the header file."
exit 1
fi
CNAME=$1
shift
HEADER_NAME=$1
shift
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
if [ "$(echo ${NAME} | cut -b1-3)" != "lib" ]
then
echo "Warning: your module name does not begin with 'lib'. You will"
echo "have to fix up your pkgconfig file manually, etc."
NAMEMINUSL="@TODO@"
else
NAMEMINUSL="-l$(echo ${NAME} | sed -e 's,^lib,,')"
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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,@CNAME@,${CNAME},g" -i {} \; || exit 1
do_cmd find . -type f -exec sed -e "s,@NAMEMINUSL@,${NAMEMINUSL},g" -i {} \; || exit 1
do_cmd find . -type f -exec sed -e "s,@HEADER_NAME@,${HEADER_NAME},g" -i {} \; || exit 1
do_cmd grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,21 @@
# @P@/src/lib/clib/pkgconf.in
#
# Metadata file for pkg-config
# ( http://www.freedesktop.org/software/pkgconfig/ )
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# Name, description
Name: @TODO@
Description: @TODO@
Version: @VERSION@
# Requirements
Requires:
# Compilation information
Libs: -L@LIBDIR@ @NAMEMINUSL@
Cflags: -I@INCLUDEDIR@

View File

@ -0,0 +1,17 @@
# @P@/src/@NAME@/soversion
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# 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

@ -0,0 +1,3 @@
source src/@NAME@/build.tests
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,43 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@_BUILT
#
#@TODO@ build_target libs || return 1
if [ -z ${@NAME@_BUILT} ]
then
LIBS="" # @TODO@ internal libs
EXTRAS="" # @TODO@ libs, cflags
echo "Building test programs..."
do_cmd mkdir -p obj/tests || return 1
for SRC in src/@NAME@/*.c
do
TEST="obj/tests/$(basename ${SRC} | sed -e 's,.c$,,')"
MODIFIED=0
for file in ${LIBS} ${SRC} src/@NAME@/build.tests
do
if [ ${file} -nt ${TEST} ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
do_cmd ${CC} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} ${EXTRAS} || return 1
print_success "Built ${TEST}"
else
print_success "${TEST} is up to date"
fi
done
print_success "All tests built"
@NAME@_BUILT=1
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,25 @@
if [ $# -ne 0 ]
then
print_failure "Unexpected extra parameters."
exit 1
fi
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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 grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,34 @@
/* @P@/src/@NAME@/???.c
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
@TODO@ includes
#include "stdio.h"
int main(int argc, char* argv[])
{
if(argc == 2 && !strcmp(argv[1], "--print-summary")) {
printf("One line summary.\n");
return 0;
}
if(argc == 1) {
// empty argument list
}
int ret = 0;
// TODO
return ret;
}
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,146 @@
# @P@/src/@NAME@/Doxyfile.in
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
PROJECT_NAME = @P@
OUTPUT_DIRECTORY =
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = YES
DETAILS_AT_TOP = YES
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = YES
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = src/docs
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
VERBATIM_HEADERS = NO
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_MAN = NO
GENERATE_XML = NO
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = NO
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = NO
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = YES
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
SEARCHENGINE = NO

View File

@ -0,0 +1,15 @@
/* @P@/src/@NAME@/MainPage.dox
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
/*! \mainpage
*/
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1 @@
source src/@NAME@/build.docs

View File

@ -0,0 +1,43 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@_BUILT
#
MONOLITHIC_@NAME@="${MONOLITHIC_DOC} $(echo src/@NAME@/*.dox)"
build_target monolithic
if [ -z ${@NAME@_BUILT} ]
then
echo "Building documentation with Doxygen..."
DOXYFILE=obj/Doxyfile.@NAME@
if [ ! -e ${DOXYFILE} ]
then
do_cmd cp src/docs/Doxyfile.in ${DOXYFILE} || return 1
echo "INPUT = ${MONOLITHIC_DOC}" >> ${DOXYFILE}
echo "PROJECT_NUMBER = ${VERSION}" >> ${DOXYFILE}
fi
MODIFIED=0
for file in ${MONOLITHIC_@NAME@}
do
if [ ${file} -nt html/index.html ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
do_cmd doxygen ${DOXYFILE} || return 1
print_success "Documentation built"
else
print_success "Documentation is up to date"
fi
@NAME@_BUILT=1
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1 @@
source src/@NAME@/build.install-docs

View File

@ -0,0 +1,21 @@
build_target docs
# create documentation directories
echo "Installing documentation into ${DOCSDIR}"
build_dir_tree "${DOCSDIR}/html" || return 1
# copy across the Doxygen-generated documentation
for file in html/*
do
install_file ${file} ${DOCSDIR}/html 0644 || return 1
done
# copy across the generic files
for file in COPYING README
do
install_file ${file} ${DOCSDIR} 0644 || return 1
done
print_success "Documentation installed"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,25 @@
if [ $# -ne 0 ]
then
print_failure "Too many arguments. None required for this module."
exit 1
fi
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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 grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,13 @@
/* @P@/src/capp/TopHeader.h
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
// standard includes, or includes needed for type declarations
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1,13 @@
/* @P@/src/capp/TopSource.c
*
* (c)2006, @AUTHOR@, <@EMAIL@>.
* Released under the GNU GPLv2. See file COPYING or
* http://www.gnu.org/copyleft/gpl.html for details.
*/
// Below are all the includes used throughout the application.
/* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4
*/

View File

@ -0,0 +1 @@
source src/@NAME@/build.firmware

View File

@ -0,0 +1,41 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@
# @NAME@_BUILT
#
if [ -z ${@NAME@_BUILT} ]
then
@NAME@="obj/@NAME@.hex"
EXTRAS="@TODO@" # cflags, libs
echo "Building firmware ${@NAME@}..."
do_cmd source src/@NAME@/build.monolithic || return 1
MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${SRC}
do
if [ ${test} -nt ${@NAME@} ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
echo " Compiling..."
do_cmd ${SDCC} ${SDCCFLAGS} -o "${@NAME@}" ${SRC} ${EXTRAS} || return 1
print_success "Firmware built"
else
print_success "Firmware up to date"
fi
@NAME@_BUILT=1
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1 @@
source src/@NAME@/build.install-firmware

View File

@ -0,0 +1,12 @@
build_target @NAME@
# make paths (this is for Gentoo in particular)
build_dir_tree "${HEXDIR}" || return 1
# install binary
echo "Installing firmware into '${HEXDIR}'"
install_file "${@NAME@}" "${HEXDIR}" 0755 || return 1
print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,18 @@
# These are external variables, and shouldn't clash with anything else
# @NAME@_MONOLITHIC
#
SRC="obj/@NAME@.c"
MONOLITHIC_TESTS="src/@NAME@/build.firmware src/@NAME@/build.monolithic"
if [ -z "${@NAME@_MONOLITHIC}" ]
then
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopHeader.h) $(echo src/@NAME@/TopSource.c)"
make_monolithic ${SRC} C || return 1
@NAME@_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

View File

@ -0,0 +1,25 @@
if [ $# -ne 0 ]
then
print_failure "Too many arguments. None required for this module."
exit 1
fi
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
echo "Instantiating module src/${NAME}..."
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || 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 grep "@TODO@" * || exit 1
print_success "Module instantiated."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

68
scripts/functions.sh Executable file
View File

@ -0,0 +1,68 @@
#!/bin/bash
# @P@/scripts/functions.sh
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# Common functions
# Print a success message
print_success() {
if [ -z "${TERM}" -o "${TERM}" == "dumb" ]
then
echo -n " - "
else
(echo -n -e " \E[32m* "; tput sgr0)
fi
echo $*
}
# Print a failure message
print_failure() {
if [ -z "${TERM}" -o "${TERM}" == "dumb" ]
then
echo -n " *** "
else
(echo -n -e " \E[31m*** "; tput sgr0)
fi
echo $*
}
# This function carries out a command, but reports its failure if
# necessary.
do_cmd() {
[ "${VERBOSE}" != "0" ] && echo "$@"
"$@"
if [ $? -ne 0 ]
then
print_failure "'$@' failed."
return 1
fi
}
# This function carries out a command, but reports its failure if
# necessary.
do_cmd_redir() {
DEST=$1
shift
[ "${VERBOSE}" != "0" ] && echo "$@ >> ${DEST}"
"$@" >> ${DEST}
if [ $? -ne 0 ]
then
print_failure "'$@' failed."
return 1
fi
}
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

50
scripts/module-create.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# @P@/scripts/module-create.sh
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# Creates a new source module.
# Get the directory of the repository (needed to include functions file)
cd $(dirname $0)
cd $(dirname $(pwd))
[ -z "${VERBOSE}" ] && VERBOSE="0"
source scripts/functions.sh || exit 1
# Get arguments.
if [ $# -lt 3 ]
then
echo "Usage: scripts/module-create.sh <lang> <type> <name> [args]"
echo " available modules:"
for i in scripts/build.*
do
echo $i | sed "s,scripts/build\.\([^.]*\)\.\(.*\), lang: \1 type: \2,"
done
exit 1
fi
LANG=$1
shift
TYPE=$1
shift
NAME=$1
shift
TEMPLATE=scripts/build.${LANG}.${TYPE}
if [ ! -e ${TEMPLATE}/instantiate ]
then
echo "No such module type."
exit 1
fi
source ${TEMPLATE}/instantiate
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

50
scripts/module-rename.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# @P@/scripts/module-rename.sh
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# Renames a source module (e.g. "src/oldlib" -> "src/newlib") by running
# a sed script on all files to change filenames / headers.
# Get the directory of the repository (needed to include functions file)
cd $(dirname $0)
cd $(dirname $(pwd))
[ -z "${VERBOSE}" ] && VERBOSE="0"
source scripts/functions.sh || exit 1
# Get version etc.
if [ $# -ne 2 ]
then
echo "Usage: scripts/module-rename.sh <old> <new>"
exit 1
fi
OLD="src/$1"
NEW="src/$2"
if [ ! -e ${OLD} ]
then
print_failure "${OLD} does not exist"
exit 1
fi
if [ -e ${NEW} ]
then
print_failure "${NEW} already exists"
exit 1
fi
echo "Moving ${OLD} -> ${NEW}"
do_cmd mv ${OLD} ${NEW} || exit 1
do_cmd find ${NEW} -type f -exec sed -e "s,${OLD},${NEW},g" -i {} \; || exit 1
print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4

80
scripts/release.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/bash
# @P@/scripts/release.sh
#
# (c)2006, @AUTHOR@, <@EMAIL@>.
# Released under the GNU GPLv2. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
#
# Prepares package for release. Expects the version number on the
# command line.
# Get the directory of the repository (needed to include functions file)
cd "$(dirname $0)"
REPOS=$(dirname "$(pwd)")
[ -z "${VERBOSE}" ] && VERBOSE=0
source "${REPOS}/scripts/functions.sh" || exit 1
# Get version etc.
if [ $# -ne 2 ]
then
echo "Usage: scripts/release.sh <version> <output_dir>"
exit 1
fi
VER=$1
DIR=$2
PKGNAME="@P@-${VER}"
# move to output directory and clone git repository
echo "Cloning repository..."
do_cmd cd "${DIR}" || exit 1
do_cmd rm -rf "${PKGNAME}" "${PKGNAME}-doc" || exit 1
do_cmd git-clone --local --shared -n "${REPOS}" "${PKGNAME}" || exit 1
do_cmd cd "${PKGNAME}" || exit 1
print_success "Done"
# Check out a new copy of the library from git
echo "Checking out tag ${VER}..."
do_cmd git-checkout -b releaseprivate "${VER}" || exit 1
print_success "Done"
# Check that the default build operation runs; also, build and save the
# documentation whilst we're at it
do_cmd ./make.sh default docs || exit 1
do_cmd mv html "../${PKGNAME}-doc" || exit 1
# Clean up
do_cmd ./make.sh clean || exit 1
do_cmd rm -rf .git || exit 1
# Build archive, md5sum and signature
cd ..
tar c "${PKGNAME}" | bzip2 > "${PKGNAME}.tar.bz2"
tar c "${PKGNAME}-doc" | bzip2 > "${PKGNAME}-doc.tar.bz2"
sha1sum "${PKGNAME}.tar.bz2" > "${PKGNAME}.sha1"
sha1sum "${PKGNAME}-doc.tar.bz2" > "${PKGNAME}-doc.sha1"
gpg -a -b "${PKGNAME}.tar.bz2"
gpg -a -b "${PKGNAME}-doc.tar.bz2"
# clean up
rm -rf "${PKGNAME}" "${PKGNAME}-doc"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4