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) # make paths (this is for Gentoo in particular)
build_dir_tree "${LIBDIR}" || return 1 build_dir_tree "${LIBDIR}" || return 1
@ -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 ${@NAME@} ${LIBDIR} 0755 || return 1 install_file ${@PNAME@} ${LIBDIR} 0755 || return 1
BASE="${@NAME@_BASE}.so" BASE="${@PNAME@_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 '${@NAME@_HEADER}' into ${INCLUDEDIR}" echo "Installing header file '${@PNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@NAME@_HEADER} ${INCLUDEDIR} 0644 || return 1 install_header ${@PNAME@_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}/@P@.pc PKGCONFFILE=${PKGCONFDIR}/@PNAME@.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
# @NAME@ # @PNAME@
# @NAME@_BUILT # @PNAME@_BUILT
# @NAME@_HEADER # @PNAME@_HEADER
# @NAME@_BASE # @PNAME@_BASE
if [ -z ${@NAME@_BUILT} ] if [ -z ${@PNAME@_BUILT} ]
then then
@NAME@_BASE=@NAME@ @PNAME@_BASE=@NAME@
source src/@NAME@/soversion 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 SO_EXTRA="-lstdc++ -lc" # @TODO@ libs, cflags
echo "Building library ${@NAME@}..." echo "Building library ${@PNAME@}..."
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 ${@NAME@} ] if [ ${test} -nt ${@PNAME@} ]
then then
MODIFIED=1 MODIFIED=1
break break
@ -30,8 +30,8 @@ then
then then
echo " Compiling" echo " Compiling"
SONAME="${@NAME@_BASE}.so.${SOMAJOR}.${SOMINOR}" SONAME="${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@NAME@}" \ do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@PNAME@}" \
-Wl,-soname,${SONAME} \ -Wl,-soname,${SONAME} \
${SRC} ${SO_EXTRA} || return 1 ${SRC} ${SO_EXTRA} || return 1
@ -43,8 +43,8 @@ then
print_success "Library up to date" print_success "Library up to date"
fi fi
@NAME@_BUILT=1 @PNAME@_BUILT=1
@NAME@_HEADER=${HDR} @PNAME@_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,9 +1,9 @@
# These are external variables, and shouldn't clash with anything else # These are external variables, and shouldn't clash with anything else
# @NAME@_MONOLITHIC # @PNAME@_MONOLITHIC
if [ -z "${@NAME@_MONOLITHIC}" ] if [ -z "${@PNAME@_MONOLITHIC}" ]
then then
SRC="obj/lib.cpp" SRC="obj/@NAME@.cpp"
HDR="obj/@HEADER_NAME@" HDR="obj/@HEADER_NAME@"
MONOLITHIC_TESTS="src/@NAME@/build.lib src/@NAME@/build.monolithic" MONOLITHIC_TESTS="src/@NAME@/build.lib src/@NAME@/build.monolithic"
@ -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
@NAME@_MONOLITHIC=1 @PNAME@_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

@ -17,7 +17,7 @@ then
exit 1 exit 1
fi fi
if [ "$(echo ${NAME} | cut -b1-3)" -ne "lib" ] if [ "$(echo ${NAME} | cut -b1-3)" != "lib" ]
then then
echo "Warning: your module name does not begin with 'lib'. You will" echo "Warning: your module name does not begin with 'lib'. You will"
echo "have to fix up your pkgconfig file manually, etc." echo "have to fix up your pkgconfig file manually, etc."

View File

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

View File

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

View File

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

View File

@ -1,24 +1,25 @@
# These are external variables, and shouldn't clash with anything else # These are external variables, and shouldn't clash with anything else
# LIBC # @PNAME@
# LIBC_BUILT # @PNAME@_BUILT
# LIBC_HEADER # @PNAME@_HEADER
# LIBC_BASE # @PNAME@_BASE
if [ -z ${LIBC_BUILT} ] if [ -z ${@PNAME@_BUILT} ]
then then
@PNAME@_BASE=@NAME@
source src/@NAME@/soversion
LIB_BASE="@P@" @NAME@="obj/${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
LIB="obj/${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}" SO_EXTRA="-lc" # @TODO@ libs, cflags
SO_LIBS="-lc"
echo "Building library ${LIB}..." echo "Building library ${@PNAME@}..."
source src/clib/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 ${LIB} ] if [ ${test} -nt ${@PNAME@} ]
then then
MODIFIED=1 MODIFIED=1
break break
@ -29,10 +30,10 @@ then
then then
echo " Compiling" echo " Compiling"
SONAME="${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}" SONAME="${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CC} ${CFLAGS} -shared -fpic -o "${LIB}" \ do_cmd ${CC} ${CFLAGS} -shared -fpic -o "${@PNAME@}" \
-Wl,-soname,${SONAME} \ -Wl,-soname,${SONAME} \
${SRC} ${SO_LIBS} || 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 ${LIB}) obj/${SONAME} || return 1
@ -42,10 +43,8 @@ then
print_success "Library up to date" print_success "Library up to date"
fi fi
LIBC=${LIB} @PNAME@_BUILT=1
LIBC_BUILT=1 @PNAME@_HEADER=${HDR}
LIBC_HEADER=${HDR}
LIBC_BASE=${LIB_BASE}
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,19 +1,19 @@
# These are external variables, and shouldn't clash with anything else # These are external variables, and shouldn't clash with anything else
# LIBC_MONOLITHIC # @PNAME@_MONOLITHIC
if [ -z "${LIBC_MONOLITHIC}" ] if [ -z "${@PNAME@_MONOLITHIC}" ]
then then
SRC="obj/lib.c" SRC="obj/@NAME@.c"
HDR="obj/@HEADER_NAME@" HDR="obj/@HEADER_NAME@"
MONOLITHIC_TESTS="src/clib/build.lib src/clib/build.monolithic" MONOLITHIC_TESTS="src/@NAME@/build.lib src/@NAME@/build.monolithic"
MONOLITHIC_SOURCE="$(echo src/clib/{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/clib/TopSource.c)" MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)"
make_monolithic ${SRC} C || return 1 make_monolithic ${SRC} C || return 1
LIBC_MONOLITHIC=1 @PNAME@_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

@ -17,7 +17,7 @@ then
exit 1 exit 1
fi fi
if [ "$(echo ${NAME} | cut -b1-3)" -ne "lib" ] if [ "$(echo ${NAME} | cut -b1-3)" != "lib" ]
then then
echo "Warning: your module name does not begin with 'lib'. You will" echo "Warning: your module name does not begin with 'lib'. You will"
echo "have to fix up your pkgconfig file manually, etc." echo "have to fix up your pkgconfig file manually, etc."