Bugfixing in library module instantitation.

This commit is contained in:
Laurence Withers 2006-07-24 22:20:28 +01:00
parent 0fdad0a35a
commit 7a3fbaec1f
10 changed files with 58 additions and 63 deletions

View File

@ -1,4 +1,4 @@
build_target lib
build_target @NAME@
# make paths (this is for Gentoo in particular)
build_dir_tree "${LIBDIR}" || return 1
@ -7,8 +7,8 @@ build_dir_tree "${INCLUDEDIR}" || return 1
# install library
echo "Installing libraries into '${LIBDIR}'"
install_file ${@NAME@} ${LIBDIR} 0755 || return 1
BASE="${@NAME@_BASE}.so"
install_file ${@PNAME@} ${LIBDIR} 0755 || return 1
BASE="${@PNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}"
@ -17,12 +17,12 @@ install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
# install header
echo "Installing header file '${@NAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@NAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
echo "Installing header file '${@PNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@PNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@P@.pc
PKGCONFFILE=${PKGCONFDIR}/@PNAME@.pc
do_cmd rm -f ${PKGCONFFILE}
do_cmd_redir ${PKGCONFFILE} sed \
-e "s,@VERSION@,${VERSION}," \

View File

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

View File

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

View File

@ -17,7 +17,7 @@ then
exit 1
fi
if [ "$(echo ${NAME} | cut -b1-3)" -ne "lib" ]
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."

View File

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

View File

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

View File

@ -1,4 +1,4 @@
build_target lib
build_target @NAME@
# make paths (this is for Gentoo in particular)
build_dir_tree "${LIBDIR}" || return 1
@ -7,8 +7,8 @@ build_dir_tree "${INCLUDEDIR}" || return 1
# install library
echo "Installing libraries into '${LIBDIR}'"
install_file ${LIBC} ${LIBDIR} 0755 || return 1
BASE="${LIBC_BASE}.so"
install_file ${@PNAME@} ${LIBDIR} 0755 || return 1
BASE="${@PNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}"
@ -17,18 +17,18 @@ 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
echo "Installing header file '${@PNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@PNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@P@.pc
PKGCONFFILE=${PKGCONFDIR}/@PNAME@.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
src/@NAME@/pkgconf.in
do_cmd chmod 0644 ${PKGCONFFILE}
print_success "Done"

View File

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

View File

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

View File

@ -17,7 +17,7 @@ then
exit 1
fi
if [ "$(echo ${NAME} | cut -b1-3)" -ne "lib" ]
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."