diff --git a/skel/scripts/build.c++.app/TopHeader.h b/skel/scripts/build.c++.app/TopHeader.h new file mode 100644 index 0000000..e58b773 --- /dev/null +++ b/skel/scripts/build.c++.app/TopHeader.h @@ -0,0 +1,11 @@ +/* @P@/src/@NAME@/TopHeader.h + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +// standard includes, or includes needed for type declarations + +/* options for text editors +kate: replace-trailing-space-save true; space-indent true; tab-width 4; +*/ diff --git a/skel/scripts/build.c++.app/TopSource.cpp b/skel/scripts/build.c++.app/TopSource.cpp new file mode 100644 index 0000000..1695099 --- /dev/null +++ b/skel/scripts/build.c++.app/TopSource.cpp @@ -0,0 +1,11 @@ +/* @P@/src/@NAME@/TopSource.cpp + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +// 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; +*/ diff --git a/skel/scripts/build.c++.app/build.app b/skel/scripts/build.c++.app/build.app new file mode 100644 index 0000000..adfb8ae --- /dev/null +++ b/skel/scripts/build.c++.app/build.app @@ -0,0 +1,38 @@ +# 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@}..." + + source src/cppapp/build.monolithic + + 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 diff --git a/skel/scripts/build.c++.app/build.default b/skel/scripts/build.c++.app/build.default new file mode 100644 index 0000000..5f2b4b0 --- /dev/null +++ b/skel/scripts/build.c++.app/build.default @@ -0,0 +1 @@ +source src/@NAME@/build.app diff --git a/skel/scripts/build.c++.app/build.install b/skel/scripts/build.c++.app/build.install new file mode 100644 index 0000000..ef2021c --- /dev/null +++ b/skel/scripts/build.c++.app/build.install @@ -0,0 +1 @@ +source src/@NAME@/build.install-app diff --git a/skel/scripts/build.c++.app/build.install-app b/skel/scripts/build.c++.app/build.install-app new file mode 100644 index 0000000..0d9a9c3 --- /dev/null +++ b/skel/scripts/build.c++.app/build.install-app @@ -0,0 +1,9 @@ +build_target app + +# 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" diff --git a/skel/scripts/build.c++.app/build.monolithic b/skel/scripts/build.c++.app/build.monolithic new file mode 100644 index 0000000..ef2fe22 --- /dev/null +++ b/skel/scripts/build.c++.app/build.monolithic @@ -0,0 +1,15 @@ +# These are external variables, and shouldn't clash with anything else +# @NAME@_MONOLITHIC +# + +if [ -z "${@NAME@_MONOLITHIC}" ] +then + SRC="obj/@NAME@.cpp" + + MONOLITHIC_TESTS="src/@NAME@/build.app src/@NAME@/build.monolithic" + 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 diff --git a/skel/scripts/build.c++.app/instantiate b/skel/scripts/build.c++.app/instantiate new file mode 100644 index 0000000..2e3b225 --- /dev/null +++ b/skel/scripts/build.c++.app/instantiate @@ -0,0 +1,21 @@ +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 rm src/${NAME}/instantiate || exit 1 + +do_cmd find src/${NAME} -type f -exec sed -e "s,@NAME@,${NAME},g" -i {} \; || exit 1 +print_success "Module instantiated." + diff --git a/skel/scripts/build.c++.lib/BottomHeader.h b/skel/scripts/build.c++.lib/BottomHeader.h new file mode 100644 index 0000000..129c84f --- /dev/null +++ b/skel/scripts/build.c++.lib/BottomHeader.h @@ -0,0 +1,11 @@ +/* @P@/src/cpplib/BottomHeader.h + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#endif + +/* options for text editors +kate: replace-trailing-space-save true; space-indent true; tab-width 4; +*/ diff --git a/skel/scripts/build.c++.lib/TopHeader.h b/skel/scripts/build.c++.lib/TopHeader.h new file mode 100644 index 0000000..ac478fc --- /dev/null +++ b/skel/scripts/build.c++.lib/TopHeader.h @@ -0,0 +1,14 @@ +/* @P@/src/cpplib/TopHeader.h + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#ifndef HEADER_@PC@ +#define HEADER_@PC@ + +// standard includes, or includes needed for type declarations + +/* options for text editors +kate: replace-trailing-space-save true; space-indent true; tab-width 4; +*/ diff --git a/skel/scripts/build.c++.lib/TopSource.cpp b/skel/scripts/build.c++.lib/TopSource.cpp new file mode 100644 index 0000000..ace6352 --- /dev/null +++ b/skel/scripts/build.c++.lib/TopSource.cpp @@ -0,0 +1,13 @@ +/* @P@/src/cpplib/TopSource.cpp + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#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; +*/ diff --git a/skel/scripts/build.c++.lib/build.default b/skel/scripts/build.c++.lib/build.default new file mode 100644 index 0000000..84b57d8 --- /dev/null +++ b/skel/scripts/build.c++.lib/build.default @@ -0,0 +1 @@ +source src/cpplib/build.lib diff --git a/skel/scripts/build.c++.lib/build.install b/skel/scripts/build.c++.lib/build.install new file mode 100644 index 0000000..bbb5a2a --- /dev/null +++ b/skel/scripts/build.c++.lib/build.install @@ -0,0 +1 @@ +source src/cpplib/build.install-lib diff --git a/skel/scripts/build.c++.lib/build.install-lib b/skel/scripts/build.c++.lib/build.install-lib new file mode 100644 index 0000000..a4a9a18 --- /dev/null +++ b/skel/scripts/build.c++.lib/build.install-lib @@ -0,0 +1,34 @@ +build_target lib + +# 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 ${LIBCPP} ${LIBDIR} 0755 || return 1 +BASE="${LIBCPP_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 '${LIBCPP_HEADER}' into ${INCLUDEDIR}" +install_header ${LIBCPP_HEADER} ${INCLUDEDIR} 0644 || return 1 + +# install pkgconfig file +echo "Installing package config file into ${PKGCONFDIR}" +PKGCONFFILE=${PKGCONFDIR}/@P@.pc +do_cmd rm -f ${PKGCONFFILE} +do_cmd_redir ${PKGCONFFILE} sed \ + -e "s,@VERSION@,${VERSION}," \ + -e "s,@LIBDIR@,${FINALLIBDIR}," \ + -e "s,@INCLUDEDIR@,${FINALINCLUDEDIR}," \ + src/cpplib/pkgconf.in +do_cmd chmod 0644 ${PKGCONFFILE} +print_success "Done" + diff --git a/skel/scripts/build.c++.lib/build.lib b/skel/scripts/build.c++.lib/build.lib new file mode 100644 index 0000000..2f357e0 --- /dev/null +++ b/skel/scripts/build.c++.lib/build.lib @@ -0,0 +1,50 @@ +# These are external variables, and shouldn't clash with anything else +# LIBCPP +# LIBCPP_BUILT +# LIBCPP_HEADER +# LIBCPP_BASE + +if [ -z ${LIBCPP_BUILT} ] +then + + LIB_BASE="@P@" + LIB="obj/${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}" + SO_LIBS="-lstdc++ -lc" + + echo "Building library ${LIB}..." + + source src/cpplib/build.monolithic + + MODIFIED=0 + for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC} + do + if [ ${test} -nt ${LIB} ] + then + MODIFIED=1 + break + fi + done + + if [ ${MODIFIED} -ne 0 ] + then + echo " Compiling" + + SONAME="${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}" + do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${LIB}" \ + -Wl,-soname,${SONAME} \ + ${SRC} ${SO_LIBS} || return 1 + + # make tests work + do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1 + + print_success "Library built" + else + print_success "Library up to date" + fi + + LIBCPP=${LIB} + LIBCPP_BUILT=1 + LIBCPP_HEADER=${HDR} + LIBCPP_BASE=${LIB_BASE} + +fi diff --git a/skel/scripts/build.c++.lib/build.monolithic b/skel/scripts/build.c++.lib/build.monolithic new file mode 100644 index 0000000..61db6aa --- /dev/null +++ b/skel/scripts/build.c++.lib/build.monolithic @@ -0,0 +1,18 @@ +# These are external variables, and shouldn't clash with anything else +# LIBCPP_MONOLITHIC + +if [ -z "${LIBCPP_MONOLITHIC}" ] +then + SRC="obj/lib.cpp" + HDR="obj/@HEADER_NAME@" + + MONOLITHIC_TESTS="src/cpplib/build.lib src/cpplib/build.monolithic" + MONOLITHIC_SOURCE="$(echo src/cpplib/{TopHeader,BottomHeader}.h)" + make_monolithic ${HDR} C || return 1 + + MONOLITHIC_SOURCE="$(echo src/cpplib/TopSource.cpp)" + make_monolithic ${SRC} C || return 1 + + LIBCPP_MONOLITHIC=1 + MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}" +fi diff --git a/skel/scripts/build.c++.lib/pkgconf.in b/skel/scripts/build.c++.lib/pkgconf.in new file mode 100644 index 0000000..db537cc --- /dev/null +++ b/skel/scripts/build.c++.lib/pkgconf.in @@ -0,0 +1,20 @@ +# @P@/src/lib/cpplib/pkgconf.in +# +# Metadata file for pkg-config +# ( http://www.freedesktop.org/software/pkgconfig/ ) +# +# (c)2006, Laurence Withers. Released under the GNU GPL. See file +# COPYING for details. +# + +# Name, description +Name: @TODO@ +Description: @TODO@ +Version: @VERSION@ + +# Requirements +Requires: + +# Compilation information +Libs: -L@LIBDIR@ @PMINUSL@ +Cflags: -I@INCLUDEDIR@ diff --git a/skel/scripts/build.c++.tests/build.default b/skel/scripts/build.c++.tests/build.default new file mode 100644 index 0000000..1ae62a2 --- /dev/null +++ b/skel/scripts/build.c++.tests/build.default @@ -0,0 +1 @@ +source src/tests/build.tests diff --git a/skel/scripts/build.c++.tests/build.tests b/skel/scripts/build.c++.tests/build.tests new file mode 100644 index 0000000..9eb7ed6 --- /dev/null +++ b/skel/scripts/build.c++.tests/build.tests @@ -0,0 +1,39 @@ +# These are external variables, and shouldn't clash with anything else +# TESTS_BUILT +# + +build_target lib +LIBS="${LIBCPP}" + +if [ -z ${TESTS_BUILT} ] +then + echo "Building test programs..." + do_cmd mkdir -p obj/tests || return 1 + + for SRC in src/tests/*.cpp + do + TEST="obj/tests/$(basename ${SRC} | sed -e 's,.cpp$,,')" + MODIFIED=0 + for file in ${LIBCPP} ${SRC} + 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} || return 1 + print_success "Built ${TEST}" + else + print_success "${TEST} is up to date" + fi + done + + print_success "All tests built" + + TESTS_BUILT=1 +fi + diff --git a/skel/scripts/build.c++.tests/template b/skel/scripts/build.c++.tests/template new file mode 100644 index 0000000..962d7a1 --- /dev/null +++ b/skel/scripts/build.c++.tests/template @@ -0,0 +1,42 @@ +/* @P@/src/tests/???.cpp + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#include "@HEADER_NAME@" + +#include + + + +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; +*/ diff --git a/skel/scripts/build.c.app/TopHeader.h b/skel/scripts/build.c.app/TopHeader.h new file mode 100644 index 0000000..4a1d4c4 --- /dev/null +++ b/skel/scripts/build.c.app/TopHeader.h @@ -0,0 +1,11 @@ +/* @P@/src/capp/TopHeader.h + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +// standard includes, or includes needed for type declarations + +/* options for text editors +kate: replace-trailing-space-save true; space-indent true; tab-width 4; +*/ diff --git a/skel/scripts/build.c.app/TopSource.c b/skel/scripts/build.c.app/TopSource.c new file mode 100644 index 0000000..15b96e9 --- /dev/null +++ b/skel/scripts/build.c.app/TopSource.c @@ -0,0 +1,11 @@ +/* @P@/src/capp/TopSource.c + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +// 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; +*/ diff --git a/skel/scripts/build.c.app/build.app b/skel/scripts/build.c.app/build.app new file mode 100644 index 0000000..096817d --- /dev/null +++ b/skel/scripts/build.c.app/build.app @@ -0,0 +1,40 @@ +# These are external variables, and shouldn't clash with anything else +# APPC +# APPC_BUILT +# + +if [ -z ${APPC_BUILT} ] +then + APP="obj/@P@" + LIBS="" + + echo "Building application ${APP}..." + + source src/capp/build.monolithic + + MODIFIED=0 + for test in ${MONOLITHIC_TESTS} ${SRC} + do + if [ ${test} -nt ${APP} ] + then + MODIFIED=1 + break + fi + done + + if [ ${MODIFIED} -ne 0 ] + then + echo " Compiling" + + do_cmd ${CC} ${CFLAGS} -o "${APP}" \ + ${SRC} ${LIBS} || return 1 + + print_success "Application built" + else + print_success "Application up to date" + fi + + APPC=${APP} + APPC_BUILT=1 + +fi diff --git a/skel/scripts/build.c.app/build.default b/skel/scripts/build.c.app/build.default new file mode 100644 index 0000000..a737154 --- /dev/null +++ b/skel/scripts/build.c.app/build.default @@ -0,0 +1 @@ +source src/capp/build.app diff --git a/skel/scripts/build.c.app/build.install b/skel/scripts/build.c.app/build.install new file mode 100644 index 0000000..6809ef3 --- /dev/null +++ b/skel/scripts/build.c.app/build.install @@ -0,0 +1 @@ +source src/capp/build.install-app diff --git a/skel/scripts/build.c.app/build.install-app b/skel/scripts/build.c.app/build.install-app new file mode 100644 index 0000000..fa6d854 --- /dev/null +++ b/skel/scripts/build.c.app/build.install-app @@ -0,0 +1,9 @@ +build_target app + +# make paths (this is for Gentoo in particular) +build_dir_tree "${BINDIR}" || return 1 + +# install binary +echo "Installing binaries into '${BINDIR}'" +install_file "${APPC}" "${BINDIR}" 0755 || return 1 +print_success "Done" diff --git a/skel/scripts/build.c.app/build.monolithic b/skel/scripts/build.c.app/build.monolithic new file mode 100644 index 0000000..2271f17 --- /dev/null +++ b/skel/scripts/build.c.app/build.monolithic @@ -0,0 +1,15 @@ +# These are external variables, and shouldn't clash with anything else +# APPC_MONOLITHIC +# + +if [ -z "${APPC_MONOLITHIC}" ] +then + SRC="obj/app.c" + + MONOLITHIC_TESTS="src/capp/build.app src/capp/build.monolithic" + MONOLITHIC_SOURCE="$(echo src/capp/TopHeader.h) $(echo src/capp/TopSource.c)" + make_monolithic ${SRC} C || return 1 + + APPC_MONOLITHIC=1 + MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}" +fi diff --git a/skel/scripts/build.c.lib/BottomHeader.h b/skel/scripts/build.c.lib/BottomHeader.h new file mode 100644 index 0000000..702d660 --- /dev/null +++ b/skel/scripts/build.c.lib/BottomHeader.h @@ -0,0 +1,11 @@ +/* @P@/src/clib/BottomHeader.h + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#endif + +/* options for text editors +kate: replace-trailing-space-save true; space-indent true; tab-width 4; +*/ diff --git a/skel/scripts/build.c.lib/TopHeader.h b/skel/scripts/build.c.lib/TopHeader.h new file mode 100644 index 0000000..b0591f2 --- /dev/null +++ b/skel/scripts/build.c.lib/TopHeader.h @@ -0,0 +1,14 @@ +/* @P@/src/clib/TopHeader.h + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#ifndef HEADER_lib@PC@ +#define HEADER_lib@PC@ + +// standard includes, or includes needed for type declarations + +/* options for text editors +kate: replace-trailing-space-save true; space-indent true; tab-width 4; +*/ diff --git a/skel/scripts/build.c.lib/TopSource.c b/skel/scripts/build.c.lib/TopSource.c new file mode 100644 index 0000000..0213c1f --- /dev/null +++ b/skel/scripts/build.c.lib/TopSource.c @@ -0,0 +1,13 @@ +/* @P@/src/clib/TopSource.c + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#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; +*/ diff --git a/skel/scripts/build.c.lib/build.default b/skel/scripts/build.c.lib/build.default new file mode 100644 index 0000000..f0a10de --- /dev/null +++ b/skel/scripts/build.c.lib/build.default @@ -0,0 +1 @@ +source src/clib/build.lib diff --git a/skel/scripts/build.c.lib/build.install b/skel/scripts/build.c.lib/build.install new file mode 100644 index 0000000..0b0018f --- /dev/null +++ b/skel/scripts/build.c.lib/build.install @@ -0,0 +1 @@ +source src/clib/build.install-lib diff --git a/skel/scripts/build.c.lib/build.install-lib b/skel/scripts/build.c.lib/build.install-lib new file mode 100644 index 0000000..6e338f2 --- /dev/null +++ b/skel/scripts/build.c.lib/build.install-lib @@ -0,0 +1,34 @@ +build_target lib + +# 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 ${LIBC} ${LIBDIR} 0755 || return 1 +BASE="${LIBC_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 '${LIBC_HEADER}' into ${INCLUDEDIR}" +install_header ${LIBC_HEADER} ${INCLUDEDIR} 0644 || return 1 + +# install pkgconfig file +echo "Installing package config file into ${PKGCONFDIR}" +PKGCONFFILE=${PKGCONFDIR}/@P@.pc +do_cmd rm -f ${PKGCONFFILE} +do_cmd_redir ${PKGCONFFILE} sed \ + -e "s,@VERSION@,${VERSION}," \ + -e "s,@LIBDIR@,${FINALLIBDIR}," \ + -e "s,@INCLUDEDIR@,${FINALINCLUDEDIR}," \ + src/clib/pkgconf.in +do_cmd chmod 0644 ${PKGCONFFILE} +print_success "Done" + diff --git a/skel/scripts/build.c.lib/build.lib b/skel/scripts/build.c.lib/build.lib new file mode 100644 index 0000000..ee0df40 --- /dev/null +++ b/skel/scripts/build.c.lib/build.lib @@ -0,0 +1,50 @@ +# These are external variables, and shouldn't clash with anything else +# LIBC +# LIBC_BUILT +# LIBC_HEADER +# LIBC_BASE + +if [ -z ${LIBC_BUILT} ] +then + + LIB_BASE="@P@" + LIB="obj/${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}" + SO_LIBS="-lc" + + echo "Building library ${LIB}..." + + source src/clib/build.monolithic + + MODIFIED=0 + for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC} + do + if [ ${test} -nt ${LIB} ] + then + MODIFIED=1 + break + fi + done + + if [ ${MODIFIED} -ne 0 ] + then + echo " Compiling" + + SONAME="${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}" + do_cmd ${CC} ${CFLAGS} -shared -fpic -o "${LIB}" \ + -Wl,-soname,${SONAME} \ + ${SRC} ${SO_LIBS} || return 1 + + # make tests work + do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1 + + print_success "Library built" + else + print_success "Library up to date" + fi + + LIBC=${LIB} + LIBC_BUILT=1 + LIBC_HEADER=${HDR} + LIBC_BASE=${LIB_BASE} + +fi diff --git a/skel/scripts/build.c.lib/build.monolithic b/skel/scripts/build.c.lib/build.monolithic new file mode 100644 index 0000000..57d8c36 --- /dev/null +++ b/skel/scripts/build.c.lib/build.monolithic @@ -0,0 +1,18 @@ +# These are external variables, and shouldn't clash with anything else +# LIBC_MONOLITHIC + +if [ -z "${LIBC_MONOLITHIC}" ] +then + SRC="obj/lib.c" + HDR="obj/@HEADER_NAME@" + + MONOLITHIC_TESTS="src/clib/build.lib src/clib/build.monolithic" + MONOLITHIC_SOURCE="$(echo src/clib/{TopHeader,BottomHeader}.h)" + make_monolithic ${HDR} C || return 1 + + MONOLITHIC_SOURCE="$(echo src/clib/TopSource.c)" + make_monolithic ${SRC} C || return 1 + + LIBC_MONOLITHIC=1 + MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}" +fi diff --git a/skel/scripts/build.c.lib/pkgconf.in b/skel/scripts/build.c.lib/pkgconf.in new file mode 100644 index 0000000..1c3ab6a --- /dev/null +++ b/skel/scripts/build.c.lib/pkgconf.in @@ -0,0 +1,20 @@ +# @P@/src/lib/clib/pkgconf.in +# +# Metadata file for pkg-config +# ( http://www.freedesktop.org/software/pkgconfig/ ) +# +# (c)2006, Laurence Withers. Released under the GNU GPL. See file +# COPYING for details. +# + +# Name, description +Name: @TODO@ +Description: @TODO@ +Version: @VERSION@ + +# Requirements +Requires: + +# Compilation information +Libs: -L@LIBDIR@ @PMINUSL@ +Cflags: -I@INCLUDEDIR@ diff --git a/skel/scripts/build.c.tests/build.default b/skel/scripts/build.c.tests/build.default new file mode 100644 index 0000000..1ae62a2 --- /dev/null +++ b/skel/scripts/build.c.tests/build.default @@ -0,0 +1 @@ +source src/tests/build.tests diff --git a/skel/scripts/build.c.tests/build.tests b/skel/scripts/build.c.tests/build.tests new file mode 100644 index 0000000..9eb7ed6 --- /dev/null +++ b/skel/scripts/build.c.tests/build.tests @@ -0,0 +1,39 @@ +# These are external variables, and shouldn't clash with anything else +# TESTS_BUILT +# + +build_target lib +LIBS="${LIBCPP}" + +if [ -z ${TESTS_BUILT} ] +then + echo "Building test programs..." + do_cmd mkdir -p obj/tests || return 1 + + for SRC in src/tests/*.cpp + do + TEST="obj/tests/$(basename ${SRC} | sed -e 's,.cpp$,,')" + MODIFIED=0 + for file in ${LIBCPP} ${SRC} + 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} || return 1 + print_success "Built ${TEST}" + else + print_success "${TEST} is up to date" + fi + done + + print_success "All tests built" + + TESTS_BUILT=1 +fi + diff --git a/skel/scripts/build.c.tests/template b/skel/scripts/build.c.tests/template new file mode 100644 index 0000000..962d7a1 --- /dev/null +++ b/skel/scripts/build.c.tests/template @@ -0,0 +1,42 @@ +/* @P@/src/tests/???.cpp + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +#include "@HEADER_NAME@" + +#include + + + +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; +*/ diff --git a/skel/scripts/build.doxygen.docs/Doxyfile.in b/skel/scripts/build.doxygen.docs/Doxyfile.in new file mode 100644 index 0000000..45ca5ef --- /dev/null +++ b/skel/scripts/build.doxygen.docs/Doxyfile.in @@ -0,0 +1,145 @@ +# @P@/src/docs/Doxyfile.in +# +# (c)2006, Laurence Withers. Released under the GNU GPL. See file +# COPYING for more information / terms of license. +# + +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 diff --git a/skel/scripts/build.doxygen.docs/MainPage.dox b/skel/scripts/build.doxygen.docs/MainPage.dox new file mode 100644 index 0000000..49431ce --- /dev/null +++ b/skel/scripts/build.doxygen.docs/MainPage.dox @@ -0,0 +1,13 @@ +/* @P@/src/docs/MainPage.dox + * + * (c)2006, Laurence Withers. Released under the GNU GPL. See file + * COPYING for more information / terms of license. +*/ + +/*! \mainpage + +*/ + +/* options for text editors +kate: replace-trailing-space-save true; space-indent true; tab-width 4; +*/ diff --git a/skel/scripts/build.doxygen.docs/build.default b/skel/scripts/build.doxygen.docs/build.default new file mode 100644 index 0000000..ca22639 --- /dev/null +++ b/skel/scripts/build.doxygen.docs/build.default @@ -0,0 +1 @@ +source src/docs/build.docs diff --git a/skel/scripts/build.doxygen.docs/build.docs b/skel/scripts/build.doxygen.docs/build.docs new file mode 100644 index 0000000..c860a91 --- /dev/null +++ b/skel/scripts/build.doxygen.docs/build.docs @@ -0,0 +1,41 @@ +# These are external variables, and shouldn't clash with anything else +# DOCS_BUILT +# + +MONOLITHIC_DOC="${MONOLITHIC_DOC} $(echo src/docs/*.dox)" +build_target monolithic + +if [ -z ${DOCS_BUILT} ] +then + echo "Building documentation with Doxygen..." + + DOXYFILE=obj/Doxyfile + + 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_DOC} + 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 + + DOCS_BUILT=1 +fi + diff --git a/skel/scripts/build.doxygen.docs/build.install b/skel/scripts/build.doxygen.docs/build.install new file mode 100644 index 0000000..016c75c --- /dev/null +++ b/skel/scripts/build.doxygen.docs/build.install @@ -0,0 +1 @@ +source src/docs/build.install-docs diff --git a/skel/scripts/build.doxygen.docs/build.install-docs b/skel/scripts/build.doxygen.docs/build.install-docs new file mode 100644 index 0000000..9af0931 --- /dev/null +++ b/skel/scripts/build.doxygen.docs/build.install-docs @@ -0,0 +1,19 @@ +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" diff --git a/skel/scripts/module-create.sh b/skel/scripts/module-create.sh new file mode 100755 index 0000000..316a762 --- /dev/null +++ b/skel/scripts/module-create.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# @P@/scripts/module-create.sh +# +# (c)2006, Laurence Withers. Released under the GNU GPL. See file +# COPYING for more information / terms of license. +# + +# 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 [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 +