diff options
author | hypnotoad <yoda@etoyoc.com> | 2014-09-06 00:58:23 (GMT) |
---|---|---|
committer | hypnotoad <yoda@etoyoc.com> | 2014-09-06 00:58:23 (GMT) |
commit | 09802f5c0e9e8852337e3835478562cfda405012 (patch) | |
tree | f51edbc0656b4da14c9292054d33c2b16bf32cdd /unix | |
parent | a49a5d69b08fbabb66cb54a72505e1df23c973d7 (diff) | |
download | tcl-09802f5c0e9e8852337e3835478562cfda405012.zip tcl-09802f5c0e9e8852337e3835478562cfda405012.tar.gz tcl-09802f5c0e9e8852337e3835478562cfda405012.tar.bz2 |
New build process for Tcl kits in Unix (Windows port to follow...)
Rather than force a "make install" to build the vfs, the tclkit now
performs it's own "install" to a subdirectory (using destdir) to collect
the files it needs for its vfs.
tclkits no longer link to the tcl library. Instead, all of the obj files that
are used to assemble the lib are instead packed into the executable. Thus,
"make tclkit" produces the tclkit. That's it. No dlls. No tclsh. Makes no
other mark on the file system save the bare essentials it needs. It uses the
same variables in the makefile as the tcl libraries, so as they are updated
so too is tclkit.
Zlib files are *always* build for tclkits. Tclkits can never rely on the
presence of zlib on the systems in which they will be installed.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile.in | 33 | ||||
-rw-r--r-- | unix/tclKitInit.c | 86 |
2 files changed, 108 insertions, 11 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index 9310753..30e7109 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -285,9 +285,6 @@ ${AC_FLAGS} ${PROTO_FLAGS} ${EXTRA_CFLAGS} @EXTRA_CC_SWITCHES@ TCLSH_OBJS = tclAppInit.o -TCLKIT_OBJS = tclKitInit.o - - TCLTEST_OBJS = tclTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ tclThreadTest.o tclUnixTest.o @@ -363,6 +360,8 @@ ZLIB_OBJS = Zadler32.o Zcompress.o Zcrc32.o Zdeflate.o Zinfback.o \ TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} \ ${OO_OBJS} @DL_OBJS@ @PLAT_OBJS@ +TCLKIT_OBJS = tclKitInit.o + OBJS = ${TCL_OBJS} ${TOMMATH_OBJS} @DTRACE_OBJ@ @ZLIB_OBJS@ TCL_DECLS = \ @@ -555,6 +554,7 @@ UNIX_HDRS = \ UNIX_SRCS = \ $(UNIX_DIR)/tclAppInit.c \ + $(UNIX_DIR)/tclKitInit.c \ $(UNIX_DIR)/tclUnixChan.c \ $(UNIX_DIR)/tclUnixEvent.c \ $(UNIX_DIR)/tclUnixFCmd.c \ @@ -612,6 +612,9 @@ ZLIB_SRCS = \ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ $(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@ +PWD=`pwd` +VFS_INSTALL_DIR=${PWD}/tclkit.vfs/tcl8.6 + #-------------------------------------------------------------------------- # Start of rules #-------------------------------------------------------------------------- @@ -659,15 +662,21 @@ null.zip: touch .empty zip null.zip .empty -${TCLKIT_EXE}: ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip - $(CC) -c $(APP_CC_SWITCHES) \ - -DTCL_KIT $(UNIX_DIR)/tclAppInit.c -o tclKitInit.o - ${CC} ${CFLAGS} ${LDFLAGS} tclKitInit.o \ - @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ +# Rather than force an install, pack the files we need into a +# file system under our control +tclkit.vfs: + make install-libraries DESTDIR=tclkit.vfs + make install-tzdata DESTDIR=tclkit.vfs + make install-packages DESTDIR=tclkit.vfs + +# Assemble all of the tcl sources into a single executable +${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs + ${CC} ${CFLAGS} ${LDFLAGS} \ + ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} \ + ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} - PWD=`pwd` cat null.zip >> ${TCLKIT_EXE} - cd ${prefix}/lib ; zip -rAq ${PWD}/${TCLKIT_EXE} tcl8 tcl8.6 + cd tclkit.vfs${prefix}/lib ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -676,7 +685,9 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in clean: clean-packages rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ - errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ + errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ + ${TCLKIT_EXE} + rm -rf tclkit.vfs null.zip cd dltest ; $(MAKE) clean distclean: distclean-packages clean diff --git a/unix/tclKitInit.c b/unix/tclKitInit.c new file mode 100644 index 0000000..96861de --- /dev/null +++ b/unix/tclKitInit.c @@ -0,0 +1,86 @@ +/*
+** This file implements the main routine for a standalone Tcl/Tk shell.
+*/
+#include <tcl.h>
+#include "tclInt.h"
+#define TCLKIT_INIT "main.tcl"
+#define TCLKIT_VFSMOUNT "/zvfs"
+
+#define TCL_LOCAL_APPINIT Tclkit_AppInit
+MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *);
+MODULE_SCOPE int main(int, char **);
+
+/*
+** This routine runs first.
+*/
+int main(int argc, char **argv){
+ Tcl_FindExecutable(argv[0]);
+ Tcl_SetStartupScript(Tcl_NewStringObj("noop",-1),NULL);
+ Tcl_Main(argc,argv,&Tclkit_AppInit);
+ return TCL_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tclkit_AppInit --
+ *
+ * This procedure performs application-specific initialization. Most
+ * applications, especially those that incorporate additional packages,
+ * will have their own version of this procedure.
+ *
+ * Results:
+ * Returns a standard Tcl completion code, and leaves an error message in
+ * the interp's result if an error occurs.
+ *
+ * Side effects:
+ * Depends on the startup script.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tclkit_AppInit(
+ Tcl_Interp *interp) /* Interpreter for application. */
+{
+ Tcl_Zvfs_Boot(interp,TCLKIT_VFSMOUNT,TCLKIT_INIT);
+
+ if ((Tcl_Init)(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Call the init procedures for included packages. Each call should look
+ * like this:
+ *
+ * if (Mod_Init(interp) == TCL_ERROR) {
+ * return TCL_ERROR;
+ * }
+ *
+ * where "Mod" is the name of the module. (Dynamically-loadable packages
+ * should have the same entry-point name.)
+ */
+
+ /*
+ * Call Tcl_CreateCommand for application-specific commands, if they
+ * weren't already created by the init procedures called above.
+ */
+
+ /*
+ * Specify a user-specific startup file to invoke if the application is
+ * run interactively. Typically the startup file is "~/.apprc" where "app"
+ * is the name of the application. If this line is deleted then no
+ * user-specific startup file will be run under any conditions.
+ */
+
+#ifdef DJGPP
+ (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL,
+ Tcl_NewStringObj("~/tclsh.rc", -1), TCL_GLOBAL_ONLY);
+#else
+ (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL,
+ Tcl_NewStringObj("~/.tclshrc", -1), TCL_GLOBAL_ONLY);
+#endif
+
+ return TCL_OK;
+}
\ No newline at end of file |