From 076e58ccd7a69090ea258a8c51a4cd9af7db2cfa Mon Sep 17 00:00:00 2001 From: Laurence Withers Date: Fri, 15 Dec 2006 16:39:58 +0000 Subject: [PATCH] Upgrade to new build system --- README | 4 +- config | 19 ++++++ make.sh | 28 +++----- scripts/.gitignore | 21 +++--- src/docs/.params | 2 +- src/libCStreamedXML/.params | 2 +- src/libCStreamedXML/build.install-lib | 24 ++++--- src/libCStreamedXML/build.lib | 6 +- src/libCStreamedXML/config-script | 98 +++++++++++++++++++++++++++ src/libCStreamedXML/pkgconf.in | 21 ------ src/tests/.params | 2 +- src/tests/template | 5 +- 12 files changed, 165 insertions(+), 67 deletions(-) create mode 100644 config create mode 100644 src/libCStreamedXML/config-script delete mode 100644 src/libCStreamedXML/pkgconf.in diff --git a/README b/README index f945cb8..f62f76a 100644 --- a/README +++ b/README @@ -9,6 +9,8 @@ Really Quick Instructions To build: ./make.sh To install: ./make.sh install - (you might want to set PREFIX, by default it's /usr/local) This library has no dependencies other than the C library. +You might want to edit 'config' first. + +@TODO@ diff --git a/config b/config new file mode 100644 index 0000000..86b807b --- /dev/null +++ b/config @@ -0,0 +1,19 @@ +# libCStreamedXML/config +# kate: replace-trailing-space-save true; space-indent true; tab-width 4; +# vim: expandtab:ts=4:sw=4 +# +# (c)2006, Laurence Withers, . +# Released under the GNU GPLv2. See file COPYING or +# http://www.gnu.org/copyleft/gpl.html for details. +# +# This file contains options used to build libCStreamedXML. +# + +[ -z "${PREFIX}" ] && PREFIX="/usr/local" +[ -z "${CC}" ] && CC="gcc" +[ -z "${CFLAGS}" ] && CFLAGS="-g -O2 -W -Wall" +[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin" +[ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib" +[ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include" +[ -z "${FINALLIBDIR}" ] && FINALLIBDIR="${LIBDIR}" +[ -z "${FINALINCLUDEDIR}" ] && FINALINCLUDEDIR="${INCLUDEDIR}" diff --git a/make.sh b/make.sh index b1687fc..a0be209 100755 --- a/make.sh +++ b/make.sh @@ -8,25 +8,14 @@ # This file is the script used to build libCStreamedXML. There are some -# options that can be edited; these are set below (or you can pass them -# in as variables). -[ -z "${CC}" ] && CC="gcc" -[ -z "${CXX}" ] && CXX="g++" -[ -z "${CFLAGS}" ] && CFLAGS="-g -O2 -W -Wall" -[ -z "${PREFIX}" ] && PREFIX="/usr/local" -[ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib" -[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin" -[ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include" -[ -z "${DOCSDIR}" ] && DOCSDIR="${PREFIX}/share/doc/libCStreamedXML" - -# for pkg-config -[ -z "${PKGCONFDIR}" ] && PKGCONFDIR="${LIBDIR}/pkgconfig" -[ -z "${FINALLIBDIR}" ] && FINALLIBDIR="${LIBDIR}" -[ -z "${FINALINCLUDEDIR}" ] && FINALINCLUDEDIR="${INCLUDEDIR}" - -# for SDCC-built firmware -[ -z "${HEXDIR}" ] && HEXDIR="${PREFIX}/share/firmware" -[ -z "${SDCC}" ] && SDCC="sdcc" +# options that can be edited; these are set in the file 'config' (or you +# can pass them in as environment variables). +if [ ! -e "config" ] +then + echo "Configuration file not found???" + exit 1 +fi +source "config" # don't fail on error, since last command in config might return false @@ -272,6 +261,7 @@ do echo "Cleaning..." rm -rf ${OUTPUT_DIRS} print_success "Done" + true ;; # bad Kdevelop! bad! diff --git a/scripts/.gitignore b/scripts/.gitignore index a540f48..8e5e559 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,12 +1,13 @@ -build.c++.app -build.c++.lib -build.c++.qtapp -build.c++.tests -build.c.app -build.c.lib -build.c.tests -build.doxygen.docs -build.none.files -build.sdcc.firmware +build.app.c +build.app.c++ +build.app.c++-qt +build.docs.doxygen +build.files.none +build.firmware.gpasm +build.firmware.sdcc +build.lib.c +build.lib.c++ +build.tests.c +build.tests.c++ module-create.sh release.sh diff --git a/src/docs/.params b/src/docs/.params index efd9ae0..30ca609 100644 --- a/src/docs/.params +++ b/src/docs/.params @@ -1 +1 @@ -doxygen docs docs +docs doxygen docs diff --git a/src/libCStreamedXML/.params b/src/libCStreamedXML/.params index eca3504..cb34b9f 100644 --- a/src/libCStreamedXML/.params +++ b/src/libCStreamedXML/.params @@ -1 +1 @@ -c lib libCStreamedXML StreamedXML.h +lib c libCStreamedXML StreamedXML.h diff --git a/src/libCStreamedXML/build.install-lib b/src/libCStreamedXML/build.install-lib index beec81b..288ed9f 100644 --- a/src/libCStreamedXML/build.install-lib +++ b/src/libCStreamedXML/build.install-lib @@ -2,7 +2,7 @@ build_target libCStreamedXML # make paths (this is for Gentoo in particular) build_dir_tree "${LIBDIR}" || return 1 -build_dir_tree "${PKGCONFDIR}" || return 1 +build_dir_tree "${BINDIR}" || return 1 build_dir_tree "${INCLUDEDIR}" || return 1 # install library @@ -20,16 +20,20 @@ install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}" echo "Installing header file '${libCStreamedXML_HEADER}' into ${INCLUDEDIR}" install_header ${libCStreamedXML_HEADER} ${INCLUDEDIR} 0644 || return 1 -# install pkgconfig file -echo "Installing package config file into ${PKGCONFDIR}" -PKGCONFFILE=${PKGCONFDIR}/libCStreamedXML.pc -do_cmd rm -f ${PKGCONFFILE} -do_cmd_redir ${PKGCONFFILE} sed \ +# install config script +echo "Installing config script into ${BINDIR}" +CONFFILE="${BINDIR}/libCStreamedXML-config" + +do_cmd rm -f "${CONFFILE}" +do_cmd_redir "${CONFFILE}" sed \ -e "s,@VERSION@,${VERSION}," \ - -e "s,@LIBDIR@,${FINALLIBDIR}," \ - -e "s,@INCLUDEDIR@,${FINALINCLUDEDIR}," \ - src/libCStreamedXML/pkgconf.in -do_cmd chmod 0644 ${PKGCONFFILE} + -e "s,@DEP_CFLAGS@,${libCStreamedXML_DEP_CFLAGS}," \ + -e "s,@DEP_LIBS@,${libCStreamedXML_DEP_LIBS}," \ + -e "s,@LIB_DIR@,${FINALLIBDIR}," \ + -e "s,@INCLUDE_DIR@,${FINALINCLUDEDIR}," \ + src/libCStreamedXML/config-script + +do_cmd chmod 0755 "${CONFFILE}" print_success "Done" # kate: replace-trailing-space-save true; space-indent true; tab-width 4; diff --git a/src/libCStreamedXML/build.lib b/src/libCStreamedXML/build.lib index 8bcd6a5..a2ce455 100644 --- a/src/libCStreamedXML/build.lib +++ b/src/libCStreamedXML/build.lib @@ -3,6 +3,8 @@ # libCStreamedXML_BUILT # libCStreamedXML_HEADER # libCStreamedXML_BASE +# libCStreamedXML_DEP_CFLAGS +# libCStreamedXML_DEP_LIBS if [ -z ${libCStreamedXML_BUILT} ] then @@ -10,7 +12,9 @@ then source src/libCStreamedXML/soversion libCStreamedXML="obj/${libCStreamedXML_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}" - SO_EXTRA="-lc" + libCStreamedXML_DEP_CFLAGS="" + libCStreamedXML_DEP_LIBS="" + SO_EXTRA="${libCStreamedXML_DEP_CFLAGS} ${libCStreamedXML_DEP_LIBS} -lc" echo "Building library ${libCStreamedXML}..." diff --git a/src/libCStreamedXML/config-script b/src/libCStreamedXML/config-script new file mode 100644 index 0000000..e27a6a8 --- /dev/null +++ b/src/libCStreamedXML/config-script @@ -0,0 +1,98 @@ +#!/bin/bash +# libCStreamedXML/src/libCStreamedXML/config-script +# +# libCStreamedXML-config template. Variables are finalised at install time. +# +dep_cflags="@DEP_CFLAGS@" +dep_libs="@DEP_LIBS@" +include_dir="@INCLUDE_DIR@" +include_dir_set="no" +lib_dir="@LIB_DIR@" +lib_dir_set="no" + + + +usage() { + cat <&2 + + + +while [ $# -gt 0 ] +do + case "$1" in + -*=*) + optarg="$(echo "$1" | sed 's/[-_a-zA-Z0-9]*=//')" + ;; + + *) + optarg="" + ;; + esac + + case "$1" in + --libdir=*) + lib_dir="${optarg}" + lib_dir_set="yes" + ;; + + --libdir) + echo_lib_dir="yes" + ;; + + --includedir=*) + include_dir="${optarg}" + include_dir_set="yes" + ;; + + --includedir) + echo_include_dir="yes" + ;; + + --version) + echo "@VERSION@" + exit 0 + ;; + + --cflags) + [ "${include_dir}" != "/usr/include" ] && includes="-I${include_dir}" + echo_cflags="yes" + ;; + + --libs) + echo_libs="yes" + ;; + + *) + usage 1 1>&2 + ;; + esac + + shift +done + + + +[ "${echo_prefix}" == "yes" ] && echo "${prefix}" +[ "${echo_exec_prefix}" == "yes" ] && echo "${exec_prefix}" +[ "${echo_cflags}" == "yes" ] && echo "${dep_cflags} ${includes}" +[ "${echo_libs}" == "yes" ] && echo "${dep_libs} -L${lib_dir} -lCStreamedXML" +true + + + +# vim: expandtab:ts=4:sw=4 +# kate: replace-trailing-space-save true; space-indent true; tab-width 4; diff --git a/src/libCStreamedXML/pkgconf.in b/src/libCStreamedXML/pkgconf.in deleted file mode 100644 index 0b5ddf5..0000000 --- a/src/libCStreamedXML/pkgconf.in +++ /dev/null @@ -1,21 +0,0 @@ -# libCStreamedXML/src/lib/libCStreamedXML/pkgconf.in -# -# Metadata file for pkg-config -# ( http://www.freedesktop.org/software/pkgconfig/ ) -# -# (c)2006, Laurence Withers, . -# Released under the GNU GPLv2. See file COPYING or -# http://www.gnu.org/copyleft/gpl.html for details. -# - -# Name, description -Name: libCStreamedXML -Description: C library for parsing Streamed XML -Version: @VERSION@ - -# Requirements -Requires: - -# Compilation information -Libs: -L@LIBDIR@ -lCStreamedXML -Cflags: -I@INCLUDEDIR@ diff --git a/src/tests/.params b/src/tests/.params index 7be9ebb..2558709 100644 --- a/src/tests/.params +++ b/src/tests/.params @@ -1 +1 @@ -c tests tests libCStreamedXML +tests c tests libCStreamedXML diff --git a/src/tests/template b/src/tests/template index c02cdfb..b47ab10 100644 --- a/src/tests/template +++ b/src/tests/template @@ -8,11 +8,14 @@ #include "StreamedXML.h" #include +#include int main(int argc, char* argv[]) { + int ret = 0; + if(argc == 2 && !strcmp(argv[1], "--print-summary")) { printf("One line summary.\n"); return 0; @@ -22,8 +25,6 @@ int main(int argc, char* argv[]) // empty argument list } - int ret = 0; - // TODO return ret;