Tcl Extension Architecture (TEA) Sample Extension

Check-in [746f2b387e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Updated TEA

Added a "teapot" build target as a reference example

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | practcl
Files: files | file ages | folders
SHA3-256: 746f2b387ec08391f960fdf5d46f757018df591e88aa8191a49a02283699bda9
User & Date: seandeelywoods 2018-01-18 00:32:19
Context
2018-01-25
18:33
Improvements to the practcl project builder. Added a new facility to pull authors from Changelog check-in: 9b70b161ae user: seandeelywoods tags: practcl
2018-01-18
00:32
Updated TEA

Added a "teapot" build target as a reference example check-in: 746f2b387e user: seandeelywoods tags: practcl

2018-01-17
20:23
Updated the practcl version of the sample extension to use the newest version of practcl check-in: 8e7886ba94 user: seandeelywoods tags: practcl
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to configure.

616
617
618
619
620
621
622







623
624
625
626
627
628
629
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"

ac_subst_vars='LTLIBOBJS
LIBOBJS







TCLSH_PROG
PRACTCL_NAME_LIBRARY
PRACTCL_VC_MANIFEST_EMBED_EXE
PRACTCL_VC_MANIFEST_EMBED_DLL
PRACTCL_STUB_LIB
PRACTCL_STATIC_LIB
PRACTCL_SHARED_LIB







>
>
>
>
>
>
>







616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"

ac_subst_vars='LTLIBOBJS
LIBOBJS
TEACUP_PROFILE
TEACUP_TOOLSET
TEACUP_ARCH
TEACUP_OS
TEA_WINDOWINGSYSTEM
TEA_PLATFORM
TEA_SYSTEM
TCLSH_PROG
PRACTCL_NAME_LIBRARY
PRACTCL_VC_MANIFEST_EMBED_EXE
PRACTCL_VC_MANIFEST_EMBED_DLL
PRACTCL_STUB_LIB
PRACTCL_STATIC_LIB
PRACTCL_SHARED_LIB
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
    TEA_VERSION="3.10"
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5
    fi
    if test x"3.10" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "3.10" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&5
$as_echo "warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".







|


|
|
|







2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
    TEA_VERSION="3.10"
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5
    fi
    if test x"4.0]" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "4.0]" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"4.0\"" >&5
$as_echo "warning: requested TEA version \"4.0\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
5417
5418
5419
5420
5421
5422
5423


5424
5425


5426
5427
5428
5429
5430
5431
5432
    done



    vars=""
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then


	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`


	fi
	PKG_LIBS="$PKG_LIBS $i"
    done



    PKG_CFLAGS="$PKG_CFLAGS "







>
>
|
|
>
>







5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
    done



    vars=""
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
          case $i in
            *.lib)
              # Convert foo.lib to -lfoo for GCC
                i=-l`echo "$i" | sed -e 's/\.[^.]*$//' -e 's/\.lib.*//'`
            ;;
          esac
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done



    PKG_CFLAGS="$PKG_CFLAGS "
6532
6533
6534
6535
6536
6537
6538


6539
6540


6541
6542
6543
6544
6545
6546
6547
	        case "x`echo \${VisualStudioVersion}`" in
	            x1[4-9]*)
		        lflags="${lflags} -nodefaultlib:libucrt.lib"

    vars="ucrt.lib"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then


	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`


	fi
	PKG_LIBS="$PKG_LIBS $i"
    done


	            ;;
	            *)







>
>
|
|
>
>







6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
	        case "x`echo \${VisualStudioVersion}`" in
	            x1[4-9]*)
		        lflags="${lflags} -nodefaultlib:libucrt.lib"

    vars="ucrt.lib"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
          case $i in
            *.lib)
              # Convert foo.lib to -lfoo for GCC
                i=-l`echo "$i" | sed -e 's/\.[^.]*$//' -e 's/\.lib.*//'`
            ;;
          esac
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done


	            ;;
	            *)
6559
6560
6561
6562
6563
6564
6565


6566
6567


6568
6569
6570
6571
6572
6573
6574
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		    # Avoid 'unresolved external symbol __security_cookie'
		    # errors, c.f. http://support.microsoft.com/?id=894573

    vars="bufferoverflowU.lib"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then


	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`


	fi
	PKG_LIBS="$PKG_LIBS $i"
    done


		elif test "$doWince" != "no" ; then
		    CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"







>
>
|
|
>
>







6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		    # Avoid 'unresolved external symbol __security_cookie'
		    # errors, c.f. http://support.microsoft.com/?id=894573

    vars="bufferoverflowU.lib"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
          case $i in
            *.lib)
              # Convert foo.lib to -lfoo for GCC
                i=-l`echo "$i" | sed -e 's/\.[^.]*$//' -e 's/\.lib.*//'`
            ;;
          esac
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done


		elif test "$doWince" != "no" ; then
		    CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
  RC="$ac_cv_prog_RC"
fi

		CFLAGS_DEBUG="-g"
		CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
		SHLIB_LD='${CC} -shared'
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  	PRACTCL_UNSHARED_LIB_SUFFIX='.a'

		LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
		LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"

		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5
$as_echo_n "checking for cross-compile version of gcc... " >&6; }
if ${ac_cv_cross+:} false; then :







|







6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
  RC="$ac_cv_prog_RC"
fi

		CFLAGS_DEBUG="-g"
		CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
		SHLIB_LD='${CC} -shared'
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
		PRACTCL_UNSHARED_LIB_SUFFIX='.a'

		LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
		LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"

		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5
$as_echo_n "checking for cross-compile version of gcc... " >&6; }
if ${ac_cv_cross+:} false; then :
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    ;;
	OpenBSD-*)
	    arch=`arch -s`
	    case "$arch" in
	    vax)
		SHLIB_SUFFIX=""
		SHARED_LIB_SUFFIX=""
		LDFLAGS=""
		;;
	    *)
		case "$arch" in
		alpha|sparc64)
		    SHLIB_CFLAGS="-fPIC"
		    ;;
		*)
		    SHLIB_CFLAGS="-fpic"
		    ;;
		esac
		SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
		SHLIB_SUFFIX=".so"
		if test $doRpath = yes; then :

		    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
		LDFLAGS="-Wl,-export-dynamic"
		;;
	    esac
	    case "$arch" in
	    vax)
		CFLAGS_OPTIMIZE="-O1"
		;;
	    *)
		CFLAGS_OPTIMIZE="-O2"
		;;
	    esac
	    if test "${TCL_THREADS}" = "1"; then :

		# On OpenBSD:	Compile with -pthread
		#		Don't link with -lpthread
		LIBS=`echo $LIBS | sed s/-lpthread//`
		CFLAGS="$CFLAGS -pthread"








<
<
<
<
<
<
<
|
|
|
|
|
|
|
|
|
|

|

|
|
|
<
<
<
<
<
<
<
|
<
<







7264
7265
7266
7267
7268
7269
7270







7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286







7287


7288
7289
7290
7291
7292
7293
7294
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    ;;
	OpenBSD-*)
	    arch=`arch -s`
	    case "$arch" in







	    alpha|sparc64)
		SHLIB_CFLAGS="-fPIC"
		;;
	    *)
		SHLIB_CFLAGS="-fpic"
		;;
	    esac
	    SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
	    SHLIB_SUFFIX=".so"
	    if test $doRpath = yes; then :

		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
	    LDFLAGS="-Wl,-export-dynamic"







	    CFLAGS_OPTIMIZE="-O2"


	    if test "${TCL_THREADS}" = "1"; then :

		# On OpenBSD:	Compile with -pthread
		#		Don't link with -lpthread
		LIBS=`echo $LIBS | sed s/-lpthread//`
		CFLAGS="$CFLAGS -pthread"

8736
8737
8738
8739
8740
8741
8742


8743
8744
8745
8746
8747
8748
8749
	    fi
		else
      if test -f "${TCL_BIN_DIR}/Makefile" ; then
        # tclConfig.sh is in Tcl build directory
        if test "${TEA_PLATFORM}" = "windows"; then
          if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"


          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}"
          fi







>
>







8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
	    fi
		else
      if test -f "${TCL_BIN_DIR}/Makefile" ; then
        # tclConfig.sh is in Tcl build directory
        if test "${TEA_PLATFORM}" = "windows"; then
          if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}sg${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}sg${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}"
          fi
8770
8771
8772
8773
8774
8775
8776


































































































8777
8778
8779
8780
8781
8782
8783
      fi
		fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${TCLSH_PROG}" >&5
$as_echo "${TCLSH_PROG}" >&6; }


#TEA_PROG_WISH



































































































#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting th AC variables in.  Include these here.
#--------------------------------------------------------------------








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
      fi
		fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${TCLSH_PROG}" >&5
$as_echo "${TCLSH_PROG}" >&6; }


#TEA_PROG_WISH



  TEACUP_OS=$system
  TEACUP_ARCH="unknown"
  TEACUP_TOOLSET="gcc"
  TEACUP_PROFILE="unknown"
  arch="unknown"
  case ${host_alias} in
    *mingw32*)
      arch="ix86"
      TEACUP_PROFILE="win32-ix86"
    ;;
    *mingw64*)
      arch="x86_64"
      TEACUP_PROFILE="win32-x86_64"
    ;;
  esac
  if test "${arch}" = "unknown" ; then
    if test "${TEA_PLATFORM}" = "windows" ; then
      if test "$GCC" = "yes" ; then
        TEACUP_TOOLSET="gcc"
      else
        TEACUP_TOOLSET="msvc"
      fi
      if test "$do64bit" != "no" ; then
        case "$do64bit" in
          amd64|x64|yes)
            arch="x86_64"
            TEACUP_PROFILE="win32-x86_64"
          ;;
          ia64)
            arch="ia64"
            TEACUP_PROFILE="win32-ia64"
          ;;
        esac
      else
        arch="ix86"
        TEACUP_PROFILE="win32-ix86"
      fi
    else
      case $system in
        Linux*)
                TEACUP_OS="linux"
                arch=`uname -m`
                TEACUP_PROFILE="linux-glibc2.3-$arch"
        ;;
        GNU*)
                TEACUP_OS="gnu"
                arch=`uname -m`
        ;;
        NetBSD-Debian)
                TEACUP_OS="netbsd-debian"
                arch=`uname -m`
        ;;
        OpenBSD-*)
                TEACUP_OS="openbsd"
                arch=`arch -s`
        ;;
        Darwin*)
                TEACUP_OS="macosx"
                TEACUP_PROFILE="macosx-universal"
                arch=`uname -m`
                if test $arch = "x86_64"; then
                        TEACUP_PROFILE="macosx10.5-i386-x86_84"
                fi
        ;;
        OpenBSD*)
                TEACUP_OS="openbsd"
                arch=`arch -s`
        ;;
      esac
    fi
  fi
  TEACUP_ARCH=$arch
  if test "$TEACUP_PROFILE" = "unknown"; then
    if test $arch = "unknown"; then
      arch=`uname -m`
    fi
    case $arch in
      i*86)
        arch="ix86"
      ;;
      amd64)
        arch="x86_64"
      ;;
    esac
    TEACUP_PROFILE="$TEACUP_OS-$arch"
  fi
  TEA_SYSTEM=$system









#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting th AC variables in.  Include these here.
#--------------------------------------------------------------------

Changes to configure.ac.

170
171
172
173
174
175
176

177
178
179
180
181
182
183
# into. These paths are used to support running test cases only,
# the Makefile should not be making use of these paths to generate
# a pkgIndex.tcl file or anything else at extension build time.
#--------------------------------------------------------------------

TEA_PROG_TCLSH
#TEA_PROG_WISH


#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting th AC variables in.  Include these here.
#--------------------------------------------------------------------








>







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# into. These paths are used to support running test cases only,
# the Makefile should not be making use of these paths to generate
# a pkgIndex.tcl file or anything else at extension build time.
#--------------------------------------------------------------------

TEA_PROG_TCLSH
#TEA_PROG_WISH
TEA_CONFIG_TEAPOT

#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting th AC variables in.  Include these here.
#--------------------------------------------------------------------

Changes to make.tcl.

9
10
11
12
13
14
15


16
17
18
19
20
21
22
  source [file join $SRCDIR tclconfig practcl.tcl]
}

array set ::project [::practcl::config.tcl $CWD]
::practcl::library create LIBRARY [array get ::project]
LIBRARY define set builddir $CWD
LIBRARY define set srcdir $SRCDIR


LIBRARY add [file join $::SRCDIR generic sample.c]
LIBRARY add [file join $::SRCDIR generic sample.tcl]
LIBRARY define add public-verbatim [file join $::SRCDIR generic sample.h]

if {![LIBRARY define exists TCL_SRC_DIR]} {
  # Did not detect the Tcl source directory. Run autoconf
  ::practcl::doexec sh [file join $::SRCDIR configure]







>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  source [file join $SRCDIR tclconfig practcl.tcl]
}

array set ::project [::practcl::config.tcl $CWD]
::practcl::library create LIBRARY [array get ::project]
LIBRARY define set builddir $CWD
LIBRARY define set srcdir $SRCDIR
LIBRARY define set author {{Tcl Core}}
LIBRARY define set license BSD
LIBRARY add [file join $::SRCDIR generic sample.c]
LIBRARY add [file join $::SRCDIR generic sample.tcl]
LIBRARY define add public-verbatim [file join $::SRCDIR generic sample.h]

if {![LIBRARY define exists TCL_SRC_DIR]} {
  # Did not detect the Tcl source directory. Run autoconf
  ::practcl::doexec sh [file join $::SRCDIR configure]
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145




146

147
148
















































149




150

















151





















































152
153
154

155
156
157
  triggers implement
  filename [LIBRARY define get libfile]
} {
  puts "BUILDING [my define get libfile]"
  my build-library [my define get libfile] [self]
}

LIBRARY target add install-info {
} {
  ###
  # Build local variables needed for install
  ###
  
  set dat [my define dump]
  set PKG_DIR [dict get $dat name][dict get $dat version]
  
  dict with dat {}
  if {$DESTDIR ne {}} {
    foreach path {
      includedir
      mandir
      datadir
      libdir
    } {
      set $path [file join [string trimright $DESTDIR /] [string trimleft [set $path] /]]
    }
  }
  
  set pkgdatadir [file join $datadir $PKG_DIR]
  set pkglibdir [file join $libdir $PKG_DIR]
  set pkgincludedir [file join $includedir $PKG_DIR]
}

LIBRARY target add install {
  depends {library doc}
  triggers {install-info install-package}
} {
  #========================================================================
  # This rule installs platform-independent files, such as header files.
  #========================================================================
  puts "Installing header files in ${includedir}"
  set result {}
  foreach hfile [my install-headers] {
    ::practcl::installDir [file join $srcdir $hfile] ${includedir}
  }
  #========================================================================
  # Install documentation.  Unix manpages should go in the $(mandir)
  # directory.
  #========================================================================
  puts "Installing documentation in ${mandir}"
  foreach file [glob -nocomplain [file join $srcdir doc *.n]] {
    ::practcl::installDir $file [file join ${mandir} mann]
  }
}

LIBRARY target add install-package {
  depends {library doc}
  triggers {install-info}
} {
  #========================================================================
  # Install binary object libraries.  On Windows this includes both .dll and
  # .lib files.  Because the .lib files are not explicitly listed anywhere,
  # we need to deduce their existence from the .dll file of the same name.
  # Library files go into the lib directory.
  # In addition, this will generate the pkgIndex.tcl
  # file in the install location (assuming it can find a usable tclsh shell)
  #
  # You should not have to modify this target.
  #========================================================================
  puts "Installing Library to ${pkglibdir}"
  ::practcl::installDir [my define get libfile] $pkglibdir
  foreach file [glob -nocomplain *.lib] {
    ::practcl::installDir $file $pkglibdir
  }
  ::practcl::installDir pkgIndex.tcl $pkglibdir
  if {[my define get output_tcl] ne {}} {
    ::practcl::installDir [my define get output_tcl] $pkglibdir
  }
}


if {[info exists ::env(DESTDIR)]} {
  LIBRARY define set DESTDIR $::env(DESTDIR)
}
switch [lindex $argv 0] {
  install {




    LIBRARY target trigger install

    LIBRARY define set DESTDIR [file normalize [string trimright [lindex $argv 1]]]
  }
















































  install-package {




    LIBRARY target trigger install

















    LIBRARY define set DESTDIR [file normalize [string trimright [lindex $argv 1]]]





















































  }
  default {
    LIBRARY target trigger {*}$argv

  }
}
LIBRARY target do







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


>
>
>
>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>


<
62
63
64
65
66
67
68













































































69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209

  triggers implement
  filename [LIBRARY define get libfile]
} {
  puts "BUILDING [my define get libfile]"
  my build-library [my define get libfile] [self]
}














































































switch [lindex $argv 0] {
  install {
    if {[info exists ::env(DESTDIR)]} {
      set DESTDIR $::env(DESTDIR)
    }
    LIBRARY target depends library doc
    LIBRARY target do
    if {[llength $argv]>1} {
      set DESTDIR [file normalize [string trimright [lindex $argv 1]]]
    }
    set dat [LIBRARY target pkginfo]
    dict with dat {}
    if {$DESTDIR ne {}} {
      foreach path {
        includedir
        mandir
        datadir
        libdir
      } {
        set $path [file join [string trimright $DESTDIR /] [string trimleft [set $path] /]]
      }
    }
    set pkgdatadir [file join $datadir $PKG_DIR]
    set pkglibdir [file join $libdir $PKG_DIR]
    set pkgincludedir [file join $includedir $PKG_DIR]
    #========================================================================
    # This rule installs platform-independent files, such as header files.
    #========================================================================
    puts "Installing header files in ${includedir}"
    foreach hfile [LIBRARY install-headers] {
      ::practcl::copyDir [file join $srcdir $hfile] ${includedir}
    }
    #========================================================================
    # Install documentation.  Unix manpages should go in the $(mandir)
    # directory.
    #========================================================================
    puts "Installing documentation in ${mandir}"
    foreach file [glob -nocomplain [file join $srcdir doc *.n]] {
      ::practcl::copyDir $file [file join ${mandir} mann]
    }
    #========================================================================
    # Install binary object libraries.  On Windows this includes both .dll and
    # .lib files.  Because the .lib files are not explicitly listed anywhere,
    # we need to deduce their existence from the .dll file of the same name.
    # Library files go into the lib directory.
    # In addition, this will generate the pkgIndex.tcl
    # file in the install location (assuming it can find a usable tclsh shell)
    #========================================================================
    puts "Installing Package to ${pkglibdir}"
    ::practcl::copyDir [LIBRARY define get libfile] $pkglibdir
    foreach file [glob -nocomplain *.lib] {
      ::practcl::copyDir $file $pkglibdir
    }
    ::practcl::copyDir pkgIndex.tcl $pkglibdir
    if {[LIBRARY define get output_tcl] ne {}} {
      ::practcl::copyDir [LIBRARY define get output_tcl] $pkglibdir
    }
  }
  install-package {
    if {[llength $argv]<1} {
      error "Usage: install DESTINATION"
    }
    LIBRARY target depends library doc
    LIBRARY target do
    set dat [LIBRARY target pkginfo]
    dict with dat {}
    set pkglibdir [file join [lindex $argv 1] $PKG_DIR]
    #========================================================================
    # Install binary object libraries.  On Windows this includes both .dll and
    # .lib files.  Because the .lib files are not explicitly listed anywhere,
    # we need to deduce their existence from the .dll file of the same name.
    # Library files go into the lib directory.
    # In addition, this will generate the pkgIndex.tcl
    # file in the install location (assuming it can find a usable tclsh shell)
    #========================================================================
    puts "Installing Package to ${pkglibdir}"
    ::practcl::copyDir [LIBRARY define get libfile] $pkglibdir
    foreach file [glob -nocomplain *.lib] {
      ::practcl::copyDir $file $pkglibdir
    }
    ::practcl::copyDir pkgIndex.tcl $pkglibdir
    if {[LIBRARY define get output_tcl] ne {}} {
      ::practcl::copyDir [LIBRARY define get output_tcl] $pkglibdir
    }
  }
  info {
    set dat [LIBRARY target pkginfo]
    foreach {field value} $dat {
      puts [list $field: $value]
    }
    exit 0
  }
  teapot {
    LIBRARY target depends library doc
    LIBRARY target do
    set dat [LIBRARY target pkginfo]
    dict with dat {}
    set teapotvfs [file join $CWD teapot.vfs]
    if {[file exists $teapotvfs]} {
      file delete -force $teapotvfs
    }
    file mkdir $teapotvfs
    file copy -force [LIBRARY define get libfile] $teapotvfs
    foreach file [glob -nocomplain *.lib] {
      file copy -force $file $teapotvfs
    }
    file copy -force pkgIndex.tcl $teapotvfs
    if {[LIBRARY define get output_tcl] ne {}} {
      file copy -force [LIBRARY define get output_tcl] $teapotvfs
    }
    ###
    # Generate the teapot meta file
    ###
    set fout [open [file join $teapotvfs teapot.txt] w]
    puts $fout [list Package $name $version]
    puts $fout [list Meta platform [LIBRARY define get TEACUP_PROFILE]]
    foreach field {
      description license platform subject summary
    } {
      if {[dict exists $dat $field]} {
        puts $fout [list Meta $field [dict get $dat $field]]
      }
    }
    foreach field {
      author category require
    } {
      if {[dict exists $dat $field]} {
        foreach entry [dict get $dat $field] {
          puts $fout [list Meta $field $entry]
        }
      }
    }
    close $fout
    ::practcl::tcllib_require zipfile::mkzip
    ::zipfile::mkzip::mkzip ${name}-${version}-[LIBRARY define get TEACUP_PROFILE].zip -directory $teapotvfs
  }
  default {
    LIBRARY target trigger {*}$argv
    LIBRARY target do
  }
}