Index: README ================================================================== --- README +++ README @@ -139,10 +139,40 @@ Kitsh Configure Options: 1. --enable-kit-storage={zip|mk4|auto} Specify which type of storage to use with the Tclkit. The default is to auto-detect. Auto-detection uses Mk4 if available and built statically, otherwise it falls back to Zip. + +-------------------- +Using the KitDLL SDK +-------------------- +When you build a KitDLL, a "kitdll-sdk-.tar.gz" tarball is also +produced. This tarball contains the Tcl (and Tk, if compiled) stubs libraries, +and Tcl (and Tk, if compiled) header files needed to compile and link things +against Tcl (and Tk). It also includes "tclConfig.sh" (and "tkConfig.sh", if +Tk was compiled). + +The purpose for this tarball is to be used to build Tcl extensions or +applications that rely on Tcl/Tk using the KitDLL. + +To use it, one first must extract the tarball. After that the environment +variable "TCLKIT_SDK_DIR" must be set to the directory that was created in +order to make most of the variables contain useful values. + +For example, to build an extension using the KitDLL SDK one would typically do +something like: + 1. Compile KitDLL (may be omitted if the KitDLL SDK is already + available) + a. $ KITCREATOR_PKGS='tk itcl kitdll' + b. $ export KITCREATOR_PKGS + c. $ ./kitcreator + 2. Compile the Extension + a. $ tar -xf /path/to/libtclkit-sdk-8.4.19.tar.gz + b. $ TCLKIT_SDK_DIR="$(pwd)/libtclkit-sdk-8.4.19" + c. $ export TCLKIT_SDK_DIR + d. $ ./configure --with-tcl="${TCLKIT_SDK_DIR}/lib" + e. $ make ------------------- Method of Operation ------------------- Summary: Index: build/test/test ================================================================== --- build/test/test +++ build/test/test @@ -201,14 +201,16 @@ # Create Tclkit if [ "${kitdll}" = "1" ]; then createdkit="libtclkit*.dll libtclkit*.*" outputname="${TESTDIR}/kits/libtclkit-${version}-${kit}" failoutputname="${TESTDIR}/kits/failed/libtclkit-${version}-${kit}" + sdk="$(echo libtclkit-sdk-*.tar.gz)" else createdkit="tclkit-${version}" outputname="${TESTDIR}/kits/tclkit-${version}-${kit}" failoutputname="${TESTDIR}/kits/failed/tclkit-${version}-${kit}" + sdk='' fi buildlog="${outputname}-build.log" failbuildlog="${failoutputname}-build.log" testresultslog="${outputname}-tests.log" @@ -323,11 +325,11 @@ cp tclsh ../../../ ) >> "${buildlog}" 2>&1 fi # Perform wildcard expansion - createdkit="$(ls -f1 ${createdkit} 2>/dev/null | head -n 1)" + createdkit="$(ls -f1 ${createdkit} 2>/dev/null | grep -v '\.tar\.gz$' | head -n 1)" if [ ! -f "${createdkit}" ]; then echo "Failed to create kit ${version}/${kit}" >&2 failed="${failed} ${version}/${kit}-build" ADDED common/post/sdk.sh Index: common/post/sdk.sh ================================================================== --- common/post/sdk.sh +++ common/post/sdk.sh @@ -0,0 +1,91 @@ +#! /bin/bash + +if [ -z "${TCLVERS}" ]; then + echo 'This script is not meant to be run directly.' >&2 + + exit 1 +fi + +if [ "${KITTARGET}" != "kitdll" ]; then + exit 0 +fi + +rm -rf '__tmp__' +mkdir '__tmp__' +mkdir '__tmp__/include' +mkdir '__tmp__/lib' + +cp 'tcl/inst/lib/tclConfig.sh' '__tmp__/lib/' +cp 'tcl/inst/include'/* '__tmp__/include/' +cp 'tcl/inst/lib'/libtclstub* '__tmp__/lib/' + +if [ -f 'tk/inst/lib/tkConfig.sh' ]; then + cp 'tk/inst/lib/tkConfig.sh' '__tmp__/lib/' + cp 'tk/inst/include'/* '__tmp__/include/' + cp 'tk/inst/lib'/libtkstub* '__tmp__/lib/' +fi + +cp libtclkit* '__tmp__/lib/' + +( + cd '__tmp__/lib' || exit 1 + + for libfile in *.dll.a; do + if [ ! -f "${libfile}" ]; then + continue + fi + + newlibfile="$(basename "${libfile}" .dll.a).lib" + + mv "${libfile}" "${newlibfile}" + done + + for kitlibfile in libtclkit*; do + if echo "${kitlibfile}" | grep '\.tar\.gz' >/dev/null; then + continue + fi + + break + done + kitlinker="$(echo "${kitlibfile}" | sed 's@^lib@-l@;s@\.[^\.]*$@@')" + + sed 's|'"$(dirname "$(dirname "$(pwd)")")"'/tcl/inst|${TCLKIT_SDK_DIR}|g;s|^TCL_SHARED_BUILD=.*$|TCL_SHARED_BUILD=1|;s|^TCL_LIB_FILE=.*$|TCL_LIB_FILE='"${kitlibfile}"'|;s|-ltcl[^s][a-fA-F0-9\.]*|'"${kitlinker}"'|' 'tclConfig.sh' > 'tclConfig.sh.new' + ( + cat << _EOF_ +if [ -z "\${TCLKIT_SDK_DIR}" ]; then + TCLKIT_SDK_DIR="./libtclkit-sdk-${TCLVERS}" +fi + +_EOF_ + cat 'tclConfig.sh.new' + ) > 'tclConfig.sh' + rm -f 'tclConfig.sh.new' + + if [ -f 'tkConfig.sh' ]; then + sed 's|'"$(dirname "$(dirname "$(pwd)")")"'/tk/inst|${TCLKIT_SDK_DIR}|g;s|^TK_SHARED_BUILD=.*$|TK_SHARED_BUILD=1|;s|^TK_LIB_FILE=.*$|TK_LIB_FILE='"${kitlibfile}"'|;s|-ltk[^s][a-fA-F0-9\.]*|'"${kitlinker}"'|' 'tkConfig.sh' > 'tkConfig.sh.new' + ( + cat << _EOF_ +if [ -z "\${TCLKIT_SDK_DIR}" ]; then + TCLKIT_SDK_DIR="./libtclkit-sdk-${TCLVERS}" +fi + +_EOF_ + cat 'tkConfig.sh.new' + ) > 'tkConfig.sh' + rm -f 'tkConfig.sh.new' + fi +) + +( + cd '__tmp__' || exit 1 + + mkdir "libtclkit-sdk-${TCLVERS}" + + mv 'lib' 'include' "libtclkit-sdk-${TCLVERS}/" + + tar -cf - "libtclkit-sdk-${TCLVERS}" | gzip -9c > "../libtclkit-sdk-${TCLVERS}.tar.gz" +) + +rm -rf '__tmp__' + +exit 0 Index: kitcreator ================================================================== --- kitcreator +++ kitcreator @@ -167,7 +167,15 @@ echo 'WARNING: Build is likely incomplete or failed.' >&2 fi cp 'kitsh/build'/kitsh-*/libtclkit* . >/dev/null 2>/dev/null cp 'kitsh/build'/kitsh-*/kit "tclkit-${TCLVERS}" >/dev/null 2>/dev/null + +for postscript in common/post/*; do + if [ ! -f "${postscript}" ]; then + continue + fi + + "${postscript}" +done exit "${buildfailed}"