Comment: | Integrated KitDLL into KitSH |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | merge-kitdll-kitsh-common |
Files: | files | file ages | folders |
SHA1: | a1a14e0aba5acda6ae55d5e56f2646cb7fb327b8 |
User & Date: | rkeene on 2011-05-23 10:53:53 |
Other Links: | manifest | tags |
2011-05-23
| ||
15:33 |
Corrected typo
Updated to weak zlib symbols Updated to not link against stub archives for Tk as well as Tcl check-in: 75fa17d1eb user: rkeene tags: merge-kitdll-kitsh-common | |
10:53 | Integrated KitDLL into KitSH check-in: a1a14e0aba user: rkeene tags: merge-kitdll-kitsh-common | |
03:14 | More work on consolidating KitSH and KitDLL and supporting C-VFS check-in: df550ab43e user: rkeene tags: merge-kitdll-kitsh-common | |
Modified README from [6e46265709] to [f55796d36b].
57 57 a. KITCREATOR_PKGS='tk itcl' 58 58 b. export KITCREATOR_PKGS 59 59 c. ./kitcreator 60 60 61 61 9. Create a Tclkit with Metakit4 support, but using Zip for storage: 62 62 a. $ ./kitcreator --enable-kit-storage=zip 63 63 64 - 10. Create a KitDLL without Metakit support (will not create a Tclkit 64 + 10. Create a Tclkit with Metakit4 support, but using C-VFS for storage 65 + a. $ ./kitcreator --enable-kit-storage=cvfs 66 + 67 + 11. Create a KitDLL without Metakit support (will not create a Tclkit 65 68 binary, just the library): 66 69 a. $ KITCREATOR_PKGS='tk itcl kitdll' 67 70 b. $ export KITCREATOR_PKGS 68 71 c. $ ./kitcreator 69 72 70 73 Environment variables: 71 74 1. MAKE
Modified kitcreator from [fb76c24536] to [2e933cc686].
18 18 if [ "$1" = "distclean" ]; then 19 19 shift 20 20 21 21 mode="distclean" 22 22 fi 23 23 24 24 # Define the list of all packages, for cleaning purposes 25 -KITCREATOR_ALLPKGS="kitsh tcl tclvfs zlib tk itcl mk4tcl thread kitdll" 25 +KITCREATOR_ALLPKGS="kitsh tcl tclvfs zlib tk itcl mk4tcl thread" 26 26 for pkg in ${KITCREATOR_ALLPKGS}; do 27 27 rm -f "${pkg}/build.log" 28 28 rm -rf "${pkg}/out" "${pkg}/inst" "${pkg}/build" 29 29 30 30 rm -rf "${pkg}/src"/tmp-* 31 31 32 32 if [ "${mode}" = "distclean" ]; then ................................................................................ 98 98 else 99 99 KITCREATOR_RC="$(echo "$(pwd)/kitsh/buildsrc"/kitsh-*/kit.rc)" 100 100 fi 101 101 export KITCREATOR_ICON KITCREATOR_RC 102 102 103 103 failedpkgs="" 104 104 buildfailed="0" 105 -for pkg in tcl tclvfs zlib ${KITCREATOR_PKGS} "${KITTARGET}"; do 105 +for pkg in tcl tclvfs zlib ${KITCREATOR_PKGS} kitsh; do 106 106 echo -n "Building ${pkg} ..." 107 107 108 108 failed="0" 109 109 ( 110 110 cd "${pkg}" >/dev/null 2>/dev/null || exit 1 111 111 112 112 ./build.sh > build.log 2>&1 || exit 1 ................................................................................ 135 135 echo "Failed to build:${failedpkgs}" 136 136 fi 137 137 138 138 if [ "${buildfailed}" != "0" ]; then 139 139 echo 'WARNING: Build is likely incomplete or failed.' >&2 140 140 fi 141 141 142 -cp 'kitdll/build'/kitdll-*/libtclkit* . >/dev/null 2>/dev/null 142 +cp 'kitsh/build'/kitsh-*/libtclkit* . >/dev/null 2>/dev/null 143 143 cp 'kitsh/build'/kitsh-*/kit "tclkit-${TCLVERS}" >/dev/null 2>/dev/null 144 144 145 145 exit "${buildfailed}"
Deleted kitdll/build.sh version [9d057a0710].
1 -#! /bin/bash 2 - 3 -if [ ! -f 'build.sh' ]; then 4 - echo 'ERROR: This script must be run from the directory it is in' >&2 5 - 6 - exit 1 7 -fi 8 -if [ -z "${TCLVERS}" ]; then 9 - echo 'ERROR: The TCLVERS environment variable is not set' >&2 10 - 11 - exit 1 12 -fi 13 - 14 -KITDLLVERS="0.0" 15 -BUILDDIR="$(pwd)/build/kitdll-${KITDLLVERS}" 16 -OUTDIR="$(pwd)/out" 17 -INSTDIR="$(pwd)/inst" 18 -OTHERPKGSDIR="$(pwd)/../" 19 -export KITDLLVERS BUILDDIR OUTDIR INSTDIR OTHERPKGSDIR 20 - 21 -rm -rf 'build' 'out' 'inst' 22 -mkdir 'out' 'inst' || exit 1 23 - 24 -( 25 - cp -r 'buildsrc' 'build' 26 - cd "${BUILDDIR}" || exit 1 27 - 28 - # Fix up archives that Tcl gets wrong 29 - for archive in ../../../tcl/inst/lib/dde*/tcldde*.a ../../../tcl/inst/lib/reg*/tclreg*.a; do 30 - if [ ! -f "${archive}" ]; then 31 - continue 32 - fi 33 - 34 - rm -rf __TEMP__ 35 - ( 36 - mkdir __TEMP__ || exit 1 37 - cd __TEMP__ 38 - 39 - ## Patch archive name 40 - archive="../${archive}" 41 - 42 - "${AR:-ar}" x "${archive}" || exit 1 43 - 44 - rm -f "${archive}" 45 - 46 - "${AR:-ar}" cr "${archive}" *.o || exit 1 47 - "${RANLIB:-ranlib}" "${archive}" || true 48 - ) 49 - done 50 - 51 - # Determine how we invoke a Tcl interpreter 52 - for testsh in "${TCLSH_NATIVE:-false}" "${TCLKIT:-tclkit}"; do 53 - if echo 'exit 0' | "${testsh}" >/dev/null 2>/dev/null; then 54 - TCLSH_NATIVE="${testsh}" 55 - 56 - break 57 - fi 58 - done 59 - 60 - # Cleanup, just incase the incoming directory was not pre-cleaned 61 - ${MAKE:-make} distclean >/dev/null 2>/dev/null 62 - rm -rf "starpack.vfs" 63 - 64 - # Create VFS directory 65 - mkdir "starpack.vfs" 66 - mkdir "starpack.vfs/lib" 67 - 68 - ## Copy in required built directories 69 - cp -r "${OTHERPKGSDIR}"/*/out/* 'starpack.vfs/' 70 - 71 - ## Rename the "vfs" package directory to what "boot.tcl" expects 72 - mv 'starpack.vfs/lib'/vfs* 'starpack.vfs/lib/vfs' 73 - 74 - ## Install "boot.tcl" 75 - cp 'boot.tcl' 'starpack.vfs/' 76 - 77 - # Include extra objects as required 78 - ## Initialize list of extra objects 79 - EXTRA_OBJS="" 80 - 81 - ## Figure out if zlib compiled (if not, the system zlib will be used and we 82 - ## will need to have that present) 83 - ZLIBDIR="$(cd "${OTHERPKGSDIR}/zlib/inst" 2>/dev/null && pwd)" 84 - export ZLIBDIR 85 - if [ -n "${ZLIBDIR}" -a -f "${ZLIBDIR}/lib/libz.a" ]; then 86 - EXTRA_OBJS="${EXTRA_OBJS} ${ZLIBDIR}/lib/libz.a" 87 - 88 - ### Add lib directory for zlib 89 - LDFLAGS="${LDFLAGS} -L${ZLIBDIR}/lib" 90 - export LDFLAGS 91 - 92 - ### Add include directory for zlib 93 - CFLAGS="${CFLAGS} -I${ZLIBDIR}/include" 94 - CPPFLAGS="${CPPFLAGS} -I${ZLIBDIR}/include" 95 - export CFLAGS CPPFLAGS 96 - fi 97 - 98 - ## Tk Resources (needed for Win32 support) 99 - TKDIR="$(cd "${OTHERPKGSDIR}/tk/inst" && pwd)" 100 - TKRSRC="${TKDIR}/lib/tkbase.res.o" 101 - if [ -n "${TKDIR}" -a -f "${TKRSRC}" ]; then 102 - EXTRA_OBJS="${EXTRA_OBJS} ${TKRSRC}" 103 - fi 104 - 105 - ## Export to the environment, to be picked up by the "configure" script 106 - export EXTRA_OBJS 107 - 108 - # Build KitDLL 109 - echo "Running: ./configure --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}" 110 - ./configure --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA} 111 - 112 - echo "Running: ${MAKE:-make}" 113 - ${MAKE:-make} TCLSH_NATIVE="${TCLSH_NATIVE}" || exit 1 114 - 115 - # Strip the KitDLL of debugging symbols, if possible 116 - "${STRIP:-strip}" -g libtclkit* >/dev/null 2>/dev/null 117 - 118 - # Fix up Win32 DLL names 119 - ## .DLL.A -> .LIB 120 - for file in libtclkit*.dll.a; do 121 - if [ ! -f "${file}" ]; then 122 - continue 123 - fi 124 - 125 - newfile="$(basename "${file}" .dll.a).lib" 126 - mv "${file}" "${newfile}" 127 - done 128 - 129 - ## .DLL.DEF -> .DEF 130 - for file in libtclkit*.dll.def; do 131 - if [ ! -f "${file}" ]; then 132 - continue 133 - fi 134 - 135 - newfile="$(basename "${file}" .dll.def).def" 136 - mv "${file}" "${newfile}" 137 - done 138 - 139 - exit 0 140 -) || exit 1 141 - 142 -exit 0
Deleted kitdll/buildsrc/kitdll-0.0/boot.tcl version [fdb0ceb95b].
1 -proc tclInit {} { 2 - rename tclInit {} 3 - 4 - global auto_path tcl_library tcl_libPath 5 - global tcl_version 6 - 7 - # Set path where to mount VFS 8 - set tcl_mountpoint "/.KITDLL_TCL" 9 - 10 - set tcl_library [file join $tcl_mountpoint lib tcl$tcl_version] 11 - set tcl_libPath [list $tcl_library [file join $tcl_mountpoint lib]] 12 - 13 - # get rid of a build residue 14 - unset -nocomplain ::tclDefaultLibrary 15 - 16 - # the following code only gets executed once on startup 17 - if {[info exists ::initVFS]} { 18 - set vfsHandler [list ::vfs::kitdll::vfshandler tcl] 19 - 20 - # alter path to find encodings 21 - if {[info tclversion] eq "8.4"} { 22 - load {} pwb 23 - librarypath [info library] 24 - } else { 25 - encoding dirs [list [file join [info library] encoding]] ;# TIP 258 26 - } 27 - 28 - # fix system encoding, if it wasn't properly set up (200207.004 bug) 29 - if {[encoding system] eq "identity"} { 30 - if {[info exists ::tclkit_system_encoding] && $::tclkit_system_encoding != ""} { 31 - catch { 32 - encoding system $::tclkit_system_encoding 33 - } 34 - } 35 - unset -nocomplain ::tclkit_system_encoding 36 - } 37 - 38 - # If we've still not been able to set the encoding, revert to Tclkit defaults 39 - if {[encoding system] eq "identity"} { 40 - catch { 41 - switch $::tcl_platform(platform) { 42 - windows { encoding system cp1252 } 43 - macintosh { encoding system macRoman } 44 - default { encoding system iso8859-1 } 45 - } 46 - } 47 - } 48 - 49 - # now remount the executable with the correct encoding 50 - vfs::filesystem unmount [lindex [::vfs::filesystem info] 0] 51 - 52 - # Resolve symlinks 53 - set tcl_mountpoint [file dirname [file normalize [file join $tcl_mountpoint __dummy__]]] 54 - 55 - set tcl_library [file join $tcl_mountpoint lib tcl$tcl_version] 56 - set tcl_libPath [list $tcl_library [file join $tcl_mountpoint lib]] 57 - 58 - vfs::filesystem mount $tcl_mountpoint $vfsHandler 59 - 60 - } 61 - 62 - # load config settings file if present 63 - namespace eval ::vfs { variable tclkit_version 1 } 64 - catch { uplevel #0 [list source [file join $tcl_mountpoint config.tcl]] } 65 - 66 - uplevel #0 [list source [file join $tcl_library init.tcl]] 67 - 68 - # reset auto_path, so that init.tcl's search outside of tclkit is cancelled 69 - set auto_path $tcl_libPath 70 - 71 - # This loads everything needed for "clock scan" to work 72 - # "clock scan" is used within "vfs::zip", which may be 73 - # loaded before this is run causing the root VFS to break 74 - catch { clock scan } 75 - 76 - # Load these, the original Tclkit does so it should be safe. 77 - foreach vfsfile [list vfsUtils vfslib] { 78 - uplevel #0 [list source [file join $tcl_mountpoint lib vfs ${vfsfile}.tcl]] 79 - } 80 - 81 - # Set a maximum seek to avoid reading the entire DLL looking for a 82 - # zip header 83 - catch { 84 - package require vfs::zip 85 - set ::zip::max_header_seek 8192 86 - } 87 - 88 - # Now that the initialization is complete, mount the user VFS if needed 89 - ## Mount the VFS from the Shared Object 90 - if {[info exists ::initVFS] && [info exists ::tclKitFilename]} { 91 - catch { 92 - vfs::zip::Mount $::tclKitFilename "/.KITDLL_USER" 93 - 94 - lappend auto_path [file normalize "/.KITDLL_USER/lib"] 95 - } 96 - } 97 - 98 - ## Mount the VFS from executable 99 - if {[info exists ::initVFS]} { 100 - catch { 101 - vfs::zip::Mount [info nameofexecutable] "/.KITDLL_APP" 102 - 103 - lappend auto_path [file normalize "/.KITDLL_APP/lib"] 104 - } 105 - } 106 - 107 - # Clean up 108 - unset -nocomplain ::zip::max_header_seek 109 - 110 - # Clean up after the kitInit.c:preInitCmd 111 - unset -nocomplain ::initVFS ::tclKitFilename 112 -}
Deleted kitdll/buildsrc/kitdll-0.0/kitInit.c version [d13061de12].
1 -#ifdef KIT_INCLUDES_TK 2 -# include <tk.h> 3 -#else 4 -# include <tcl.h> 5 -#endif /* KIT_INCLUDES_TK */ 6 - 7 -#ifdef _WIN32 8 -# define WIN32_LEAN_AND_MEAN 9 -# include <windows.h> 10 -# undef WIN32_LEAN_AND_MEAN 11 -#endif /* _WIN32 */ 12 - 13 -#ifdef HAVE_STRING_H 14 -# include <string.h> 15 -#endif 16 -#ifdef HAVE_STRINGS_H 17 -# include <strings.h> 18 -#endif 19 -#ifdef HAVE_DLFCN_H 20 -# include <dlfcn.h> 21 -#endif 22 - 23 -#include "tclInt.h" 24 - 25 -#if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING) 26 -# define TCLKIT_CAN_SET_ENCODING 1 27 -#endif 28 -#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85 29 -# define TCLKIT_REQUIRE_TCLEXECUTABLENAME 1 30 -#endif 31 -#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85 32 -# define KIT_INCLUDES_PWB 1 33 -#endif 34 -#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86 35 -# define KIT_INCLUDES_ZLIB 1 36 -#endif 37 - 38 -Tcl_AppInitProc Vfs_Init, Rechan_Init; 39 -Tcl_AppInitProc Vfs_kitdll_data_tcl_Init; 40 -#ifdef KIT_INCLUDES_MK4TCL 41 -Tcl_AppInitProc Mk4tcl_Init; 42 -#endif 43 -#ifdef KIT_INCLUDES_PWB 44 -Tcl_AppInitProc Pwb_Init; 45 -#endif 46 -#ifdef KIT_INCLUDES_ZLIB 47 -Tcl_AppInitProc Zlib_Init; 48 -#endif 49 -#ifdef TCL_THREADS 50 -Tcl_AppInitProc Thread_Init; 51 -#endif 52 -#ifdef _WIN32 53 -Tcl_AppInitProc Dde_Init, Registry_Init; 54 -#endif 55 - 56 -/* 57 - * This Tcl code is invoked whenever Tcl_Init() is called on an 58 - * interpreter. It should mount up the VFS and make everything ready for 59 - * that interpreter to do its job. 60 - */ 61 -static char *preInitCmd = 62 -"proc tclKitInit {} {\n" 63 - "rename tclKitInit {}\n" 64 -#ifdef KIT_INCLUDES_ZLIB 65 - "catch { load {} zlib }\n" 66 -#endif 67 - "load {} tclkit::init\n" 68 - "load {} rechan\n" 69 - "load {} vfs\n" 70 - "load {} vfs_kitdll_data_tcl\n" 71 -#ifdef KIT_INCLUDES_MK4TCL 72 - "catch { load {} Mk4tcl }\n" 73 -#endif 74 -#include "vfs_kitdll.tcl.h" 75 - "if {![file exists \"/.KITDLL_TCL/boot.tcl\"]} {\n" 76 - "vfs::kitdll::Mount tcl /.KITDLL_TCL\n" 77 - "set ::initVFS 1\n" 78 - "}\n" 79 - "set f [open \"/.KITDLL_TCL/boot.tcl\"]\n" 80 - "set s [read $f]\n" 81 - "close $f\n" 82 - "::tclkit::init::initInterp\n" 83 - "rename ::tclkit::init::initInterp {}\n" 84 - "uplevel #0 $s\n" 85 -#if defined(KIT_INCLUDES_TK) && defined(KIT_TK_VERSION) 86 - "package ifneeded Tk " KIT_TK_VERSION " {\n" 87 - "load {} Tk\n" 88 - "}\n" 89 -#endif 90 -#ifdef _WIN32 91 - "catch {load {} dde}\n" 92 - "catch {load {} registry}\n" 93 -#endif /* _WIN32 */ 94 -"}\n" 95 -"tclKitInit"; 96 - 97 -#ifdef HAVE_ACCEPTABLE_DLADDR 98 -/* Symbol to resolve against dladdr() */ 99 -static void _tclkit_dummy_func(void) { 100 - return; 101 -} 102 - 103 -int main(int argc, char **argv); 104 -#endif /* HAVE_ACCEPTABLE_DLADDR */ 105 - 106 -/* 107 - * This function will return a pathname we can open() to treat as a VFS, 108 - * hopefully 109 - */ 110 -static char *find_tclkit_dll_path(void) { 111 -#ifdef HAVE_ACCEPTABLE_DLADDR 112 - Dl_info syminfo; 113 - int dladdr_ret; 114 -#endif /* HAVE_ACCEPTABLE_DLADDR */ 115 -#ifdef _WIN32 116 - TCHAR modulename[8192]; 117 - DWORD gmfn_ret; 118 -#endif /* _WIN32 */ 119 - 120 -#ifdef HAVE_ACCEPTABLE_DLADDR 121 - dladdr_ret = dladdr(&_tclkit_dummy_func, &syminfo); 122 - if (dladdr_ret != 0) { 123 - if (syminfo.dli_fname && syminfo.dli_fname[0] != '\0') { 124 - return(strdup(syminfo.dli_fname)); 125 - } 126 - } 127 -#endif /* HAVE_ACCEPTABLE_DLADDR */ 128 - 129 -#ifdef _WIN32 130 - gmfn_ret = GetModuleFileName(TclWinGetTclInstance(), modulename, sizeof(modulename) / sizeof(modulename[0]) - 1); 131 - 132 - if (gmfn_ret != 0) { 133 - return(strdup(modulename)); 134 - } 135 -#endif /* _WIN32 */ 136 - 137 - return(NULL); 138 -} 139 - 140 -/* SetExecName -- 141 - 142 - Hack to get around Tcl bug 1224888. 143 -*/ 144 -static void SetExecName(Tcl_Interp *interp, const char *path) { 145 -#ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME 146 - tclExecutableName = strdup(path); 147 -#endif 148 - Tcl_FindExecutable(path); 149 - 150 - return; 151 -} 152 - 153 -static void FindAndSetExecName(Tcl_Interp *interp) { 154 - int len = 0; 155 - Tcl_Obj *execNameObj; 156 - Tcl_Obj *lobjv[1]; 157 -#ifdef HAVE_READLINK 158 - ssize_t readlink_ret; 159 - char exe_buf[4096]; 160 -#endif /* HAVE_READLINK */ 161 -#ifdef HAVE_ACCEPTABLE_DLADDR 162 - Dl_info syminfo; 163 - int dladdr_ret; 164 -#endif /* HAVE_ACCEPTABLE_DLADDR */ 165 - 166 -#ifdef HAVE_READLINK 167 - if (Tcl_GetNameOfExecutable() == NULL) { 168 - readlink_ret = readlink("/proc/self/exe", exe_buf, sizeof(exe_buf) - 1); 169 - 170 - if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) { 171 - exe_buf[readlink_ret] = '\0'; 172 - 173 - SetExecName(interp, exe_buf); 174 - 175 - return; 176 - } 177 - } 178 - 179 - if (Tcl_GetNameOfExecutable() == NULL) { 180 - readlink_ret = readlink("/proc/curproc/file", exe_buf, sizeof(exe_buf) - 1); 181 - 182 - if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) { 183 - exe_buf[readlink_ret] = '\0'; 184 - 185 - if (strcmp(exe_buf, "unknown") != 0) { 186 - SetExecName(interp, exe_buf); 187 - 188 - return; 189 - } 190 - } 191 - } 192 -#endif /* HAVE_READLINK */ 193 - 194 -#ifdef HAVE_ACCEPTABLE_DLADDR 195 - if (Tcl_GetNameOfExecutable() == NULL) { 196 - dladdr_ret = dladdr(&main, &syminfo); 197 - if (dladdr_ret != 0) { 198 - SetExecName(interp, syminfo.dli_fname); 199 - } 200 - } 201 -#endif /* HAVE_ACCEPTABLE_DLADDR */ 202 - 203 - if (Tcl_GetNameOfExecutable() == NULL) { 204 - lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY); 205 - execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv); 206 - 207 - SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len)); 208 - 209 - return; 210 - } 211 - 212 - return; 213 -} 214 - 215 - 216 -/* 217 - * This function exists to allow C code to initialize a particular 218 - * interpreter. 219 - */ 220 -static int tclkit_init_initinterp(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { 221 - char *kitdll_path; 222 -#ifdef TCLKIT_CAN_SET_ENCODING 223 - Tcl_DString encodingName; 224 -#endif /* TCLKIT_CAN_SET_ENCODING */ 225 - 226 - 227 -#ifdef _WIN32 228 - Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY); 229 -#else 230 - Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY); 231 -#endif 232 - 233 - kitdll_path = find_tclkit_dll_path(); 234 - if (kitdll_path != NULL) { 235 - Tcl_SetVar(interp, "tclKitFilename", kitdll_path, TCL_GLOBAL_ONLY); 236 - 237 - free(kitdll_path); 238 - } 239 - 240 - FindAndSetExecName(interp); 241 - 242 -#ifdef TCLKIT_CAN_SET_ENCODING 243 - /* Set the encoding from the Environment */ 244 - Tcl_GetEncodingNameFromEnvironment(&encodingName); 245 - Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName)); 246 - Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), TCL_GLOBAL_ONLY); 247 - Tcl_DStringFree(&encodingName); 248 -#endif 249 - 250 - return(TCL_OK); 251 -} 252 - 253 -/* 254 - * Create a package for initializing a particular interpreter. This is 255 - * our hook to have Tcl invoke C commands when creating an interpreter. 256 - * The preInitCmd will load the package in the new interpreter and invoke 257 - * this function. 258 - */ 259 -int Tclkit_init_Init(Tcl_Interp *interp) { 260 - Tcl_Command tclCreatComm_ret; 261 - int tclPkgProv_ret; 262 - 263 - tclCreatComm_ret = Tcl_CreateObjCommand(interp, "::tclkit::init::initInterp", tclkit_init_initinterp, NULL, NULL); 264 - if (!tclCreatComm_ret) { 265 - return(TCL_ERROR); 266 - } 267 - 268 - tclPkgProv_ret = Tcl_PkgProvide(interp, "tclkit::init", "1.0"); 269 - 270 - return(tclPkgProv_ret); 271 -} 272 - 273 -/* 274 - * Initialize the Tcl system when we are loaded, that way Tcl functions 275 - * are ready to be used when invoked. 276 - */ 277 -void __attribute__((constructor)) _Tclkit_Init(void) { 278 - Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL); 279 - Tcl_StaticPackage(0, "rechan", Rechan_Init, NULL); 280 - Tcl_StaticPackage(0, "vfs", Vfs_Init, NULL); 281 - Tcl_StaticPackage(0, "vfs_kitdll_data_tcl", Vfs_kitdll_data_tcl_Init, NULL); 282 -#ifdef KIT_INCLUDES_ZLIB 283 - Tcl_StaticPackage(0, "zlib", Zlib_Init, NULL); 284 -#endif 285 -#ifdef KIT_INCLUDES_MK4TCL 286 - Tcl_StaticPackage(0, "Mk4tcl", Mk4tcl_Init, NULL); 287 -#endif 288 -#ifdef KIT_INCLUDES_PWB 289 - Tcl_StaticPackage(0, "pwb", Pwb_Init, NULL); 290 -#endif 291 -#ifdef TCL_THREADS 292 - Tcl_StaticPackage(0, "Thread", Thread_Init, NULL); 293 -#endif 294 -#ifdef _WIN32 295 - Tcl_StaticPackage(0, "dde", Dde_Init, NULL); 296 - Tcl_StaticPackage(0, "registry", Registry_Init, NULL); 297 -#endif 298 -#ifdef KIT_INCLUDES_TK 299 - Tcl_StaticPackage(0, "Tk", Tk_Init, Tk_SafeInit); 300 -#endif 301 - 302 - TclSetPreInitScript(preInitCmd); 303 - 304 - return; 305 -}
Modified kitsh/build.sh from [2d7f94aadf] to [670c8d17c7].
26 26 rm -rf 'build' 'out' 'inst' 27 27 mkdir 'out' 'inst' || exit 1 28 28 29 29 30 30 ( 31 31 cp -r 'buildsrc' 'build' 32 32 cd "${BUILDDIR}" || exit 1 33 + 34 + # Fix up archives that Tcl gets wrong 35 + for archive in ../../../tcl/inst/lib/dde*/tcldde*.a ../../../tcl/inst/lib/reg*/tclreg*.a; do 36 + if [ ! -f "${archive}" ]; then 37 + continue 38 + fi 39 + 40 + rm -rf __TEMP__ 41 + ( 42 + mkdir __TEMP__ || exit 1 43 + cd __TEMP__ 44 + 45 + ## Patch archive name 46 + archive="../${archive}" 47 + 48 + "${AR:-ar}" x "${archive}" || exit 1 49 + 50 + rm -f "${archive}" 51 + 52 + "${AR:-ar}" cr "${archive}" *.o || exit 1 53 + "${RANLIB:-ranlib}" "${archive}" || true 54 + ) 55 + done 56 + 57 + # Determine how we invoke a Tcl interpreter 58 + for testsh in "${TCLSH_NATIVE:-false}" tclsh tclsh8.4 tclsh8.5 tclsh8.6 "${TCLKIT:-tclkit}"; do 59 + if echo 'exit 0' | "${testsh}" >/dev/null 2>/dev/null; then 60 + TCLSH_NATIVE="${testsh}" 61 + 62 + break 63 + fi 64 + done 33 65 34 66 # Cleanup, just incase the incoming directory was not pre-cleaned 35 67 ${MAKE:-make} distclean >/dev/null 2>/dev/null 68 + rm -rf 'starpack.vfs' 36 69 37 70 # Create VFS directory 38 71 mkdir "starpack.vfs" 39 72 mkdir "starpack.vfs/lib" 40 73 41 74 ## Copy in all built directories 42 75 cp -r "${OTHERPKGSDIR}"/*/out/* 'starpack.vfs/' ................................................................................ 58 91 # Copy user specified kit.rc and kit.ico in to build directory, if found 59 92 cp "${KITCREATOR_ICON}" "${BUILDDIR}/kit.ico" 60 93 cp "${KITCREATOR_RC}" "${BUILDDIR}/kit.rc" 61 94 62 95 # Include extra objects as required 63 96 ## Initialize list of extra objects 64 97 EXTRA_OBJS="" 98 + export EXTRA_OBJS 65 99 66 100 ## Tk Resources (needed for Win32 support) -- remove kit-found resources to prevent the symbols from being in conflict 67 101 TKDIR="$(cd "${OTHERPKGSDIR}/tk/inst" && pwd)" 68 102 TKRSRC="${TKDIR}/lib/tkbase.res.o" 69 103 if [ -n "${TKDIR}" -a -f "${TKRSRC}" ]; then 70 104 EXTRA_OBJS="${EXTRA_OBJS} ${TKRSRC}" 71 105 72 106 echo ' *** Removing "kit.rc" since we have Tk with its own resource file' 73 107 74 108 rm -f "${BUILDDIR}/kit.rc" 75 109 fi 76 110 77 - ## Export to the environment, to be picked up by the "configure" script 78 - export EXTRA_OBJS 111 + # Determine if target is KitDLL or KitSH 112 + if [ "${KITTARGET}" = "kitdll" ]; then 113 + CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll" 114 + fi 79 115 80 - # Compile Kitsh 116 + # Compile Kit 81 117 if [ -z "${ZLIBDIR}" ]; then 82 118 echo "Running: ./configure --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}" 83 119 84 120 ./configure --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA} 85 121 else 86 122 echo "Running: ./configure --with-tcl=\"${TCLCONFIGDIR}\" --with-zlib=\"${ZLIBDIR}\" ${CONFIGUREEXTRA}" 87 123 88 124 ./configure --with-tcl="${TCLCONFIGDIR}" --with-zlib="${ZLIBDIR}" ${CONFIGUREEXTRA} 89 125 fi 90 126 91 - echo "Running: ${MAKE:-make}" 92 - ${MAKE:-make} || exit 1 127 + echo "Running: ${MAKE:-make} TCLSH_NATIVE=\"${TCLSH_NATIVE}\"" 128 + ${MAKE:-make} TCLSH_NATIVE="${TCLSH_NATIVE}" || exit 1 93 129 94 130 # Strip the kit of all symbols, if possible 95 131 "${STRIP:-strip}" kit >/dev/null 2>/dev/null 132 + "${STRIP:-strip}" -g libtclkit* >/dev/null 2>/dev/null 133 + 134 + # Fix up Win32 DLL names 135 + ## .DLL.A -> .LIB 136 + for file in libtclkit*.dll.a; do 137 + if [ ! -f "${file}" ]; then 138 + continue 139 + fi 140 + 141 + newfile="$(basename "${file}" .dll.a).lib" 142 + mv "${file}" "${newfile}" 143 + done 144 + 145 + ## .DLL.DEF -> .DEF 146 + for file in libtclkit*.dll.def; do 147 + if [ ! -f "${file}" ]; then 148 + continue 149 + fi 150 + 151 + newfile="$(basename "${file}" .dll.def).def" 152 + mv "${file}" "${newfile}" 153 + done 154 + 155 + # Determine name of created kit 156 + KITTARGET_NAME='__error__' 157 + if [ "${KITTARGET}" = "kitdll" ]; then 158 + ## Find the library created 159 + for chkkittarget in libtclkit*.*; do 160 + if [ ! -f "${chkkittarget}" ]; then 161 + continue 162 + fi 163 + 164 + if echo "${chkkittarget}" | egrep '\.(lib|def|a)$'; then 165 + continue 166 + fi 167 + 168 + KITTARGET_NAME="${chkkittarget}" 169 + 170 + break 171 + done 172 + 173 + ## Also create an executable named "kit" so that we can run it later 174 + ${MAKE:-make} tclsh 175 + mv tclsh kit 176 + else 177 + ## The executable is always named "kit" 178 + KITTARGET_NAME='kit' 179 + fi 180 + export KITTARGET_NAME 181 + 182 + if [ "x${KITTARGET_NAME}" = 'x__error__' ]; then 183 + echo "Failed to locate kit target!" >&2 184 + 185 + exit 1 186 + fi 96 187 97 188 # Intall VFS onto kit 98 189 ## Determine if we have a Tclkit to do this work 99 190 TCLKIT="${TCLKIT:-tclkit}" 100 191 if echo 'exit 0' | "${TCLKIT}" >/dev/null 2>/dev/null; then 101 192 ## Install using existing Tclkit 102 193 ### Call installer 103 - echo "Running: \"${TCLKIT}\" installvfs.tcl kit starpack.vfs \"${ENABLECOMPRESSION}\"" 104 - "${TCLKIT}" installvfs.tcl kit starpack.vfs "${ENABLECOMPRESSION}" 194 + echo "Running: \"${TCLKIT}\" installvfs.tcl \"${KITTARGET_NAME}\" starpack.vfs \"${ENABLECOMPRESSION}\"" 195 + "${TCLKIT}" installvfs.tcl "${KITTARGET_NAME}" starpack.vfs "${ENABLECOMPRESSION}" 105 196 else 106 197 ## Bootstrap (cannot cross-compile) 107 198 ### Call installer 108 199 cp kit runkit 109 - echo "set argv [list kit starpack.vfs {${ENABLECOMPRESSION}}]" > setup.tcl 200 + echo "set argv [list {${KITTARGET_NAME}} starpack.vfs {${ENABLECOMPRESSION}}]" > setup.tcl 110 201 echo 'if {[catch { clock seconds }]} { proc clock args { return 0 } }' >> setup.tcl 111 202 echo 'source installvfs.tcl' >> setup.tcl 112 203 113 204 echo 'Running: echo | ./runkit' 114 - echo | ./runkit 205 + echo | ./runkit setup.tcl 115 206 fi 116 207 117 208 exit 0 118 209 ) || exit 1 119 210 120 211 exit 0
Modified kitsh/buildsrc/kitsh-0.0/Makefile.common.in from [3d3c56cfe6] to [6640ec3deb].
6 6 WISH_CFLAGS = @WISH_CFLAGS@ 7 7 LDFLAGS = @LDFLAGS@ 8 8 SHOBJLDFLAGS = @SHOBJLDFLAGS@ 9 9 LIBS = @LIBS@ 10 10 ARCHS = @ARCHS@ 11 11 STRIPLIBS = @STRIPLIBS@ @EXTRA_OBJS@ 12 12 EXTRA_OBJS = @EXTRA_OBJS@ 13 +LDRUNPATH = @LDRUNPATH@ 13 14 EXTRA_KIT_DEPS = @EXTRA_KIT_DEPS@ 15 +EXTRA_VFS_OBJS = @EXTRA_VFS_OBJS@ 14 16 TCLSH_NATIVE = tclsh 15 17 16 18 # Build targets 17 19 ## VFS Build 18 20 vfs_kitdll_data_tcl.o: vfs_kitdll_data_tcl.c 19 21 vfs_kitdll_data_tcl.c: dir2c.tcl starpack.vfs vfs_kitdll_data.c 20 22 "$(TCLSH_NATIVE)" dir2c.tcl tcl starpack.vfs > vfs_kitdll_data_tcl.c ................................................................................ 39 41 kit.res.o: kit.rc kit.ico 40 42 $(RC) -o kit.res.o $(CPPFLAGS) kit.rc 41 43 42 44 # Cleanup routines 43 45 clean: 44 46 rm -f kit kit.res.o 45 47 rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ 46 - rm -f $(OBJS) 48 + rm -f $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) 47 49 rm -f vfs_kitdll_data_tcl.c 48 50 rm -f vfs_kitdll.tcl.h 49 51 rm -f tclsh.o tclsh tclsh.exe 50 52 rm -f wish.o wish wish.exe 51 53 52 54 distclean: clean 53 55 rm -f Makefile Makefile.in Makefile.common
Modified kitsh/buildsrc/kitsh-0.0/Makefile.kitdll.in from [d50a3331ee] to [291ff89745].
1 -OBJS = vfs_kitdll_data_tcl.o kitInit.o rechan.o pwb.o zlib.o 1 +OBJS = kitInit.o rechan.o pwb.o zlib.o 2 2 3 3 # Default target 4 4 all: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ 5 5 6 6 -include Makefile.common 7 7 8 8 ## DLL Build 9 -libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@: $(OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_OBJS) 9 +libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@: $(OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) 10 10 -for striplib in $(STRIPLIBS); do $(OBJCOPY) --weaken "$${striplib}"; done 11 - $(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(ARCHS) @NOWHOLEARCHIVE@ $(LIBS) 11 + $(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(ARCHS) @NOWHOLEARCHIVE@ $(LIBS) 12 12 13 13 # Test driver 14 14 tclsh.o: tclsh.c 15 15 tclsh: tclsh.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ 16 - $(CC) $(CPPFLAGS) $(CFLAGS) -o tclsh tclsh.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ -Wl,-rpath,. 16 + $(CC) $(CPPFLAGS) $(CFLAGS) -o tclsh tclsh.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ $(LDRUNPATH) 17 17 18 18 wish.o: wish.c 19 19 wish: wish.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ 20 - $(CC) $(CPPFLAGS) $(CFLAGS) $(WISH_CFLAGS) -o wish wish.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ -Wl,-rpath,. 20 + $(CC) $(CPPFLAGS) $(CFLAGS) $(WISH_CFLAGS) -o wish wish.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ $(LDRUNPATH)
Modified kitsh/buildsrc/kitsh-0.0/Makefile.tclkit.in from [fe7827b4fe] to [b723314153].
1 1 OBJS = kitInit.o main.o pwb.o rechan.o zlib.o winMain.o 2 2 3 3 all: kit 4 4 5 5 -include Makefile.common 6 6 7 -kit: $(OBJS) $(EXTRA_OBJS) $(EXTRA_KIT_DEPS) $(ARCHS) 8 - $(CC) $(CPPFLAGS) $(CFLAGS) -o kit $(OBJS) $(EXTRA_OBJS) $(ARCHS) $(LDFLAGS) $(LIBS) 7 +kit: $(OBJS) $(EXTRA_OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_VFS_OBJS) $(ARCHS) 8 + $(CC) $(CPPFLAGS) $(CFLAGS) -o kit $(OBJS) $(EXTRA_OBJS $(EXTRA_VFS_OBJS)) $(ARCHS) $(LDFLAGS) $(LIBS)
Modified kitsh/buildsrc/kitsh-0.0/aclocal.m4 from [4ab5fc6711] to [f5f5688875].
33 33 34 34 if test -f "${tclconfigsh}"; then 35 35 . "${tclconfigsh}" 36 36 37 37 CFLAGS="${CFLAGS} ${TCL_INCLUDE_SPEC} -I${TCL_SRC_DIR}/generic -I${tclconfigshdir}" 38 38 CPPFLAGS="${CPPFLAGS} ${TCL_INCLUDE_SPEC} -I${TCL_SRC_DIR}/generic -I${tclconfigshdir}" 39 39 LIBS="${LIBS} ${TCL_LIBS}" 40 + 41 + KITDLL_LIB_VERSION=`echo "${TCL_VERSION}${TCL_PATCH_LEVEL}" | sed 's@\.@@g'` 40 42 fi 41 43 42 44 AC_SUBST(CFLAGS) 43 45 AC_SUBST(CPPFLAGS) 44 46 AC_SUBST(LIBS) 47 + AC_SUBST(KITDLL_LIB_VERSION) 45 48 46 49 AC_MSG_RESULT([$tclconfigsh]) 47 50 ]) 48 51 49 52 AC_DEFUN(DC_DO_TK, [ 50 53 AC_MSG_CHECKING([path to tk]) 51 54 AC_ARG_WITH(tk, AC_HELP_STRING([--with-tk], [directory containing tk configuration (tkConfig.sh)]), [], [ ................................................................................ 149 152 DC_DO_STATIC_LINK_LIB([C++ Library (Sun Studio)], [-lCstd -lCrun],, [ 150 153 DC_DO_STATIC_LINK_LIB([C++ Library (UNIX)], [-lstdc++]) 151 154 ]) 152 155 ]) 153 156 154 157 AC_DEFUN(DC_FIND_TCLKIT_LIBS, [ 155 158 DC_SETUP_TCL_PLAT_DEFS 159 + 160 + dnl We will need this for the Tcl project, which we will always have 161 + DC_CHECK_FOR_WHOLE_ARCHIVE 156 162 157 163 for proj in mk4tcl tcl tclvfs tk; do 158 164 AC_MSG_CHECKING([for libraries required for ${proj}]) 159 165 160 - libdir="../../../${proj}/inst" 161 - libfiles="`find "${libdir}" -name '*.a' 2>/dev/null | tr "\n" ' '`" 162 - libfilesnostub="`find "${libdir}" -name '*.a' 2>/dev/null | grep -v 'stub' | tr "\n" ' '`" 166 + projlibdir="../../../${proj}/inst" 167 + projlibfiles="`find "${projlibdir}" -name '*.a' 2>/dev/null | tr "\n" ' '`" 168 + projlibfilesnostub="`find "${projlibdir}" -name '*.a' 2>/dev/null | grep -v 'stub' | tr "\n" ' '`" 163 169 164 - ARCHS="${ARCHS} ${libfiles}" 170 + AC_MSG_RESULT([${projlibfilesnostub}]) 165 171 166 - AC_MSG_RESULT([${libfiles}]) 172 + hide_symbols="1" 167 173 168 - if test "${libfilesnostub}" != ""; then 169 - if test "${proj}" = "mk4tcl"; then 174 + if test "${proj}" = "tcl"; then 175 + DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfilesnostub], [ 176 + projlibfiles="${projlibfilesnostub}" 177 + ], [ 178 + DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfiles], [ 179 + projlibfiles="${projlibfiles}" 180 + ]) 181 + ]) 182 + 183 + hide_symbols="0" 184 + fi 185 + 186 + if test "${proj}" = "mk4tcl"; then 187 + if test -n "${projlibfiles}"; then 170 188 AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl]) 171 189 172 190 kc_cv_feature_kit_includes_mk4tcl='1' 173 191 174 192 DC_DO_STATIC_LINK_LIBCXX 175 193 fi 176 - if test "${proj}" = "tk"; then 194 + fi 195 + 196 + if test "${proj}" = "tk"; then 197 + if test "${projlibfilesnostub}" != ""; then 177 198 DC_DO_TK 178 199 AC_DEFINE(KIT_INCLUDES_TK, [1], [Specify this if we link statically to Tk]) 179 200 if test -n "${TK_VERSION}"; then 180 201 AC_DEFINE_UNQUOTED(KIT_TK_VERSION, "${TK_VERSION}${TK_PATCH_LEVEL}", [Specify the version of Tk]) 181 202 fi 182 203 183 204 if test "$host_os" = "mingw32msvc" -o "$host_os" = "mingw32"; then 184 205 AC_DEFINE(KITSH_NEED_WINMAIN, [1], [Define if you need WinMain (Windows)]) 185 206 CFLAGS="${CFLAGS} -mwindows" 186 207 fi 208 + 209 + hide_symbols="0" 187 210 fi 188 211 fi 212 + 213 + ARCHS="${ARCHS} ${projlibfiles}" 214 + 215 + if test "${hide_symbols}" = "1"; then 216 + STRIPLIBS="${STRIPLIBS} ${projlibfiles}" 217 + fi 189 218 done 190 219 191 220 AC_SUBST(ARCHS) 221 + AC_SUBST(STRIPLIBS) 192 222 ]) 193 223 194 224 AC_DEFUN(DC_SETUP_TCL_PLAT_DEFS, [ 195 225 AC_CANONICAL_BUILD 196 226 AC_CANONICAL_HOST 197 227 198 228 AC_MSG_CHECKING(host operating system) 199 229 AC_MSG_RESULT($host_os) 200 230 201 231 case $host_os in 202 232 mingw32*) 203 233 CFLAGS="${CFLAGS} -mno-cygwin -mms-bitfields" 234 + WISH_CFLAGS="-mwindows" 204 235 205 236 dnl If we are building for Win32, we need to define "BUILD_tcl" so that 206 237 dnl TCL_STORAGE_CLASS gets defined as DLLEXPORT, to make static linking 207 238 dnl work 208 239 AC_DEFINE(BUILD_tcl, [1], [Define if you need to pretend to be building Tcl (Windows)]) 209 240 AC_DEFINE(BUILD_tk, [1], [Define if you need to pretend to be building Tk (Windows)]) 210 241 ;; 211 242 cygwin*) 212 243 CFLAGS="${CFLAGS} -mms-bitfields" 244 + WISH_CFLAGS="-mwindows" 213 245 ;; 214 246 esac 247 + 248 + AC_SUBST(WISH_CFLAGS) 215 249 ]) 216 250 217 251 AC_DEFUN(DC_STATIC_LIBGCC, [ 218 252 AC_MSG_CHECKING([how to link statically against libgcc]) 219 253 220 254 SAVELDFLAGS="${LDFLAGS}" 221 255 staticlibgcc="" ................................................................................ 404 438 WHOLEARCHIVE=`echo "${wholearchive}" | cut -f 1 -d ' '` 405 439 NOWHOLEARCHIVE=`echo "${wholearchive}" | cut -f 2 -d ' '` 406 440 fi 407 441 408 442 AC_SUBST(WHOLEARCHIVE) 409 443 AC_SUBST(NOWHOLEARCHIVE) 410 444 ]) 445 + 446 +AC_DEFUN(DC_SETLDRUNPATH, [ 447 + OLD_LDFLAGS="${LDFLAGS}" 448 + 449 + for testldflags in "-Wl,-rpath -Wl,$1" "-Wl,-R -Wl,$1"; do 450 + LDFLAGS="${OLD_LDFLAGS} ${testldflags}" 451 + AC_TRY_LINK([#include <stdio.h>], [ return(0); ], [ 452 + LDRUNPATH="$LDRUNPATH $testldflags" 453 + 454 + break 455 + ]) 456 + done 457 + 458 + LDFLAGS="${OLD_LDFLAGS}" 459 + 460 + AC_SUBST(LDRUNPATH) 461 +])
Modified kitsh/buildsrc/kitsh-0.0/boot.tcl from [f82ab7409d] to [4987d39e91].
1 1 proc tclInit {} { 2 2 rename tclInit {} 3 3 4 4 global auto_path tcl_library tcl_libPath 5 5 global tcl_version tcl_rcFileName 6 6 7 - set noe [info nameofexecutable] 7 + set mountpoint [subst "$::TCLKIT_MOUNTPOINT_VAR"] 8 8 9 9 # Resolve symlinks 10 - set noe [file dirname [file normalize [file join $noe __dummy__]]] 10 + set mountpoint [file dirname [file normalize [file join $mountpoint __dummy__]]] 11 11 12 - set tcl_library [file join $noe lib tcl$tcl_version] 13 - set tcl_libPath [list $tcl_library [file join $noe lib]] 14 - 15 - # get rid of a build residue 16 - unset -nocomplain ::tclDefaultLibrary 12 + set tcl_library [file join $mountpoint lib tcl$tcl_version] 13 + set tcl_libPath [list $tcl_library [file join $mountpoint lib]] 17 14 18 15 # the following code only gets executed once on startup 19 - if {[info exists tcl_rcFileName]} { 16 + if {[info exists ::TCLKIT_INITVFS]} { 17 + catch { 18 + load {} vfs 19 + } 20 + 20 21 # lookup and emulate "source" of lib/vfs/{vfs*.tcl,mk4vfs.tcl} 21 22 switch -- $::tclKitStorage { 22 23 "mk4" { 23 - load {} vfs 24 - 25 24 # must use raw MetaKit calls because VFS is not yet in place 26 25 set d [mk::select exe.dirs parent 0 name lib] 27 26 set d [mk::select exe.dirs parent $d name vfs] 28 27 29 28 foreach x {vfsUtils vfslib mk4vfs} { 30 29 set n [mk::select exe.dirs!$d.files name $x.tcl] 31 30 set s [mk::get exe.dirs!$d.files!$n contents] ................................................................................ 76 75 } 77 76 "cvfs" { 78 77 set vfsHandler [list ::vfs::kitdll::vfshandler tcl] 79 78 } 80 79 } 81 80 82 81 # mount the executable, i.e. make all runtime files available 83 - vfs::filesystem mount $noe $vfsHandler 82 + vfs::filesystem mount $mountpoint $vfsHandler 84 83 85 84 # alter path to find encodings 86 85 if {[info tclversion] eq "8.4"} { 87 86 load {} pwb 88 87 librarypath [info library] 89 88 } else { 90 89 encoding dirs [list [file join [info library] encoding]] ;# TIP 258 ................................................................................ 93 92 # fix system encoding, if it wasn't properly set up (200207.004 bug) 94 93 if {[encoding system] eq "identity"} { 95 94 if {[info exists ::tclkit_system_encoding] && $::tclkit_system_encoding != ""} { 96 95 catch { 97 96 encoding system $::tclkit_system_encoding 98 97 } 99 98 } 100 - unset -nocomplain ::tclkit_system_encoding 101 99 } 102 100 103 101 # If we've still not been able to set the encoding, revert to Tclkit defaults 104 102 if {[encoding system] eq "identity"} { 105 103 catch { 106 104 switch $::tcl_platform(platform) { 107 105 windows { encoding system cp1252 } 108 106 macintosh { encoding system macRoman } 109 107 default { encoding system iso8859-1 } 110 108 } 111 109 } 112 110 } 111 + 112 + # Re-evaluate mountpoint with correct encoding set 113 + set mountpoint [subst "$::TCLKIT_MOUNTPOINT_VAR"] 113 114 114 115 # now remount the executable with the correct encoding 115 116 vfs::filesystem unmount [lindex [::vfs::filesystem info] 0] 116 117 117 - set noe [info nameofexecutable] 118 + # Resolve symlinks 119 + set mountpoint [file dirname [file normalize [file join $mountpoint __dummy__]]] 118 120 119 - # Resolve symlinks 120 - set noe [file dirname [file normalize [file join $noe __dummy__]]] 121 + set tcl_library [file join $mountpoint lib tcl$tcl_version] 122 + set tcl_libPath [list $tcl_library [file join $mountpoint lib]] 121 123 122 - set tcl_library [file join $noe lib tcl$tcl_version] 123 - set tcl_libPath [list $tcl_library [file join $noe lib]] 124 - 125 - vfs::filesystem mount $noe $vfsHandler 124 + vfs::filesystem mount $mountpoint $vfsHandler 126 125 } 127 126 128 127 # load config settings file if present 129 128 namespace eval ::vfs { variable tclkit_version 1 } 130 - catch { uplevel #0 [list source [file join $noe config.tcl]] } 129 + catch { uplevel #0 [list source [file join $mountpoint config.tcl]] } 131 130 131 + # Perform expected initialization 132 132 uplevel #0 [list source [file join $tcl_library init.tcl]] 133 133 134 134 # reset auto_path, so that init.tcl's search outside of tclkit is cancelled 135 135 set auto_path $tcl_libPath 136 136 137 137 # This loads everything needed for "clock scan" to work 138 138 # "clock scan" is used within "vfs::zip", which may be 139 139 # loaded before this is run causing the root VFS to break 140 140 catch { clock scan } 141 141 142 - # Cleanup 143 - unset ::tclKitStorage 144 - unset -nocomplain ::tclKitStorage_fd 142 + if {$::TCLKIT_TYPE == "kitdll"} { 143 + # Set a maximum seek to avoid reading the entire file looking for a 144 + # zip header 145 + catch { 146 + package require vfs::zip 147 + set ::zip::max_header_seek 8192 148 + } 149 + 150 + # Now that the initialization is complete, mount the user VFS if needed 151 + ## Mount the VFS from the Shared Object 152 + if {[info exists ::TCLKIT_INITVFS] && [info exists ::tclKitFilename]} { 153 + catch { 154 + vfs::zip::Mount $::tclKitFilename "/.KITDLL_USER" 155 + 156 + lappend auto_path [file normalize "/.KITDLL_USER/lib"] 157 + } 158 + } 159 + 160 + ## Mount the VFS from executable 161 + if {[info exists ::TCLKIT_INITVFS]} { 162 + catch { 163 + vfs::zip::Mount [info nameofexecutable] "/.KITDLL_APP" 164 + 165 + lappend auto_path [file normalize "/.KITDLL_APP/lib"] 166 + } 167 + } 168 + 169 + } 170 + 171 + # Clean up 172 + unset -nocomplain ::zip::max_header_seek 173 + unset -nocomplain ::TCLKIT_TYPE ::TCLKIT_INITVFS 174 + unset -nocomplain ::TCLKIT_MOUNTPOINT ::TCLKIT_VFSSOURCE ::TCLKIT_MOUNTPOINT_VAR ::TCLKIT_VFSSOURCE_VAR 175 + unset -nocomplain ::tclKitStorage ::tclKitStorage_fd ::tclKitFilename 176 + unset -nocomplain ::tclkit_system_encoding 145 177 }
Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [a84d1ae23f] to [b28720a899].
29 29 AC_MSG_RESULT([$TARGET]) 30 30 31 31 dnl Find the appropriate libraries to link to 32 32 AC_SEARCH_LIBS(acos, m,, [ AC_MSG_WARN([Couldn't find acos (normally in libm)!]) ]) 33 33 AC_SEARCH_LIBS(dlsym, dl,, [ AC_MSG_WARN([Couldn't find dlsym (normally in libdl)!]) ]) 34 34 35 35 AS_IF([test "$TARGET" = "tclkit"], [ 36 + dnl We have Tclkit 37 + 36 38 dnl Figure out how to statically link to libgcc, if needed 37 39 DC_STATIC_LIBGCC 38 40 39 41 dnl Specify local Appinit function 40 42 AC_DEFINE(DTK_LOCAL_APPINIT, [TclKit_AppInit], [Tclkit appinit function]) 41 43 ], [ 42 44 dnl We have KitDLL ................................................................................ 43 45 44 46 dnl Determine system information 45 47 DC_CHK_OS_INFO 46 48 47 49 dnl Determine how to create a shared object 48 50 DC_GET_SHOBJFLAGS 49 51 50 - dnl KitDLL always uses C-VFS 51 - AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage]) 52 + dnl Determine if we have "objcopy" available to weaken non-Tcl/Tk symbols 53 + AC_CHECK_TOOL(OBJCOPY, objcopy, [:]) 52 54 53 55 dnl Define KitDLL usage 54 56 AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit]) 55 57 ]) 58 + 59 +dnl Set linker rpath for tclsh/wish 60 +DC_SETLDRUNPATH([.]) 56 61 57 62 dnl Find the appropriate Tcl headers and libraries 58 63 DC_DO_TCL 59 64 60 65 dnl Find archives we need to link to 61 66 DC_FIND_TCLKIT_LIBS 62 67 63 68 dnl Find extra objects we need to link as a part of "kit" 64 69 AC_SUBST(EXTRA_OBJS) 70 +AC_SUBST(EXTRA_VFS_OBJS) 65 71 66 72 dnl Check for Windows Resource Compiler 67 73 AC_CHECK_TOOL([RC], [windres], [false]) 68 74 69 75 dnl If we found the resource compiler, add "kit.res.o" to our list of objects to build 70 76 dnl (as long as the source for such an object exists) 71 77 AS_IF([test "$RC" != "false"], [ ................................................................................ 99 105 AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [ 100 106 CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}" 101 107 CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}" 102 108 LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}" 103 109 ]) 104 110 105 111 dnl Only needed for Tclkit 106 -AS_IF([test "$TARGET" = "tclkit"], [ 107 - DC_DO_STATIC_LINK_LIB(zlib, -lz,, [ 108 - DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [ 109 - AC_SEARCH_LIBS(inflate, z zlib,, [ 110 - AC_MSG_WARN([Couldn't find inflate (normally in zlib)!]) 111 - ]) 112 +DC_DO_STATIC_LINK_LIB(zlib, -lz,, [ 113 + DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [ 114 + AC_SEARCH_LIBS(inflate, z zlib,, [ 115 + AC_MSG_WARN([Couldn't find inflate (normally in zlib)!]) 112 116 ]) 113 117 ]) 114 118 ]) 115 119 116 120 dnl Determine which storage mechanism to use 117 121 AC_MSG_CHECKING([which Tclkit Storage mechanism to use]) 118 122 ................................................................................ 179 183 AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage]) 180 184 181 185 dnl Define that C-VFS should be make [load]-able 182 186 AC_DEFINE([KITDLL_MAKE_LOADABLE], [1], [Specify that the C-VFS should be able to be loaded]) 183 187 184 188 dnl Add appropriate dependencies 185 189 EXTRA_KIT_DEPS="vfs_kitdll.tcl.h" 190 + EXTRA_VFS_OBJS="${EXTRA_VFS_OBJS} vfs_kitdll_data_tcl.o" 186 191 ] 187 192 ) 188 193 189 194 AC_SUBST(EXTRA_KIT_DEPS) 190 195 191 196 dnl Put correct Makefile template in place 192 197 rm -f Makefile.in 193 198 cp Makefile.${TARGET}.in Makefile.in 194 199 195 200 dnl Produce output 196 201 AC_OUTPUT(Makefile Makefile.common)
Modified kitsh/buildsrc/kitsh-0.0/installvfs.tcl from [2fb8a7d1f7] to [b17724e7c3].
11 11 set kitfile [lindex $argv 0] 12 12 set vfsdir [lindex $argv 1] 13 13 if {[lindex $argv 2] != ""} { 14 14 set opt_compression [lindex $argv 2] 15 15 } 16 16 17 17 # Determine what storage mechanism is being used 18 -set fd [open Makefile r] 18 +set fd [open Makefile.common r] 19 19 set data [read $fd] 20 20 close $fd 21 21 22 22 if {[string match "*KIT_STORAGE_ZIP*" $data]} { 23 23 set tclKitStorage zip 24 24 } 25 25 if {[string match "*KIT_STORAGE_MK4*" $data]} {
Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [ae720616f1] to [108a80f35a].
82 82 #endif 83 83 #ifdef _WIN32 84 84 Tcl_AppInitProc Dde_Init, Registry_Init; 85 85 #endif 86 86 87 87 #ifdef TCLKIT_DLL 88 88 # define TCLKIT_MOUNTPOINT "/.KITDLL_TCL" 89 +# define TCLKIT_VFSSOURCE "$::tclKitFilename" 89 90 #else 90 91 # define TCLKIT_MOUNTPOINT "[info nameofexecutable]" 92 +# define TCLKIT_VFSSOURCE "[info nameofexecutable]" 91 93 #endif /* TCLKIT_DLL */ 92 94 93 95 #ifdef HAVE_ACCEPTABLE_DLADDR 94 96 # ifdef KITSH_NEED_WINMAIN 95 97 # ifdef _WIN32_WCE 96 98 int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow); 97 99 # else ................................................................................ 139 141 "catch { load {} zlib }\n" 140 142 #endif 141 143 #ifdef KIT_INCLUDES_MK4TCL 142 144 "catch { load {} Mk4tcl }\n" 143 145 #endif 144 146 #ifdef TCLKIT_DLL 145 147 "load {} tclkit::init\n" 146 -#endif 148 + "::tclkit::init::initInterp\n" 149 + "rename ::tclkit::init::initInterp {}\n" 150 +#endif /* TCLKIT_DLL */ 147 151 "set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n" 148 152 "if {[file exists $bootfile]} {\n" 149 153 "catch {\n" 150 154 "set f [open $bootfile]\n" 151 155 "set s [read $f]\n" 152 156 "close $f\n" 153 157 "}\n" 154 158 "}\n" 155 159 #ifdef KIT_STORAGE_MK4 156 160 "set ::tclKitStorage \"mk4\"\n" 157 161 "if {![info exists s]} {\n" 158 - "mk::file open exe [info nameofexecutable] -readonly\n" 162 + "mk::file open exe " TCLKIT_VFSSOURCE " -readonly\n" 159 163 "set n [mk::select exe.dirs!0.files name boot.tcl]\n" 160 164 "if {$n != \"\"} {\n" 161 165 "set s [mk::get exe.dirs!0.files!$n contents]\n" 162 166 "if {![string length $s]} { error \"empty boot.tcl\" }\n" 163 167 "catch {load {} zlib}\n" 164 168 "if {[mk::get exe.dirs!0.files!$n size] != [string length $s]} {\n" 165 169 "set s [zlib decompress $s]\n" ................................................................................ 169 173 #endif /* KIT_STORAGE_MK4 */ 170 174 #ifdef KIT_STORAGE_ZIP 171 175 "set ::tclKitStorage \"zip\"\n" 172 176 "catch { load {} vfs }\n" 173 177 "if {![info exists s]} {\n" 174 178 # include "zipvfs.tcl.h" 175 179 "catch {\n" 176 - "set ::tclKitStorage_fd [::zip::open [info nameofexecutable]]\n" 180 + "set ::tclKitStorage_fd [::zip::open " TCLKIT_VFSSOURCE "]\n" 177 181 "::zip::stat $::tclKitStorage_fd boot.tcl sb\n" 178 182 "seek $::tclKitStorage_fd $sb(ino)\n" 179 183 "::zip::Data $::tclKitStorage_fd sb s\n" 180 184 "}\n" 181 185 "}\n" 182 186 #endif /* KIT_STORAGE_ZIP */ 183 187 #ifdef KIT_STORAGE_CVFS ................................................................................ 188 192 #include "vfs_kitdll.tcl.h" 189 193 "if {![info exists s]} {\n" 190 194 "catch {\n" 191 195 "set s [::vfs::kitdll::data::getData tcl boot.tcl]\n" 192 196 "}\n" 193 197 "}\n" 194 198 #endif /* KIT_STORAGE_CVFS */ 195 -#ifdef TCLKIT_DLL 196 - "::tclkit::init::initInterp\n" 197 - "rename ::tclkit::init::initInterp {}\n" 198 -#else 199 +#ifndef TCLKIT_DLL 199 200 "if {![info exists s]} {\n" 200 201 "set f [open setup.tcl]\n" 201 202 "set s [read $f]\n" 202 203 "close $f\n" 203 204 "}\n" 205 +#endif /* !TCLKIT_DLL */ 206 +#ifdef TCLKIT_DLL 207 + "set ::TCLKIT_TYPE \"kitdll\"\n" 208 +#else 209 + "set ::TCLKIT_TYPE \"tclkit\"\n" 204 210 #endif /* TCLKIT_DLL */ 211 + "set ::TCLKIT_MOUNTPOINT " TCLKIT_MOUNTPOINT "\n" 212 + "set ::TCLKIT_VFSSOURCE " TCLKIT_VFSSOURCE "\n" 213 + "set ::TCLKIT_MOUNTPOINT_VAR {" TCLKIT_MOUNTPOINT "}\n" 214 + "set ::TCLKIT_VFSSOURCE_VAR {" TCLKIT_VFSSOURCE "}\n" 205 215 "uplevel #0 $s\n" 206 216 #if defined(KIT_INCLUDES_TK) && defined(KIT_TK_VERSION) 207 217 "package ifneeded Tk " KIT_TK_VERSION " {\n" 208 218 "load {} Tk\n" 209 219 "}\n" 210 220 #endif 211 221 #ifdef _WIN32 ................................................................................ 364 374 } 365 375 366 376 static void _Tclkit_Interp_Init(Tcl_Interp *interp) { 367 377 #ifdef TCLKIT_CAN_SET_ENCODING 368 378 Tcl_DString encodingName; 369 379 #endif /* TCLKIT_CAN_SET_ENCODING */ 370 380 381 +#ifndef TCLKIT_DLL 371 382 /* the tcl_rcFileName variable only exists in the initial interpreter */ 372 -#ifdef _WIN32 383 +# ifdef _WIN32 373 384 Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY); 374 -#else 385 +# else 375 386 Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY); 376 -#endif 387 +# endif /* _WIN32 */ 388 +#endif /* !TCLKIT_DLL */ 389 + Tcl_SetVar(interp, "TCLKIT_INITVFS", "1", TCL_GLOBAL_ONLY); 377 390 378 391 #ifdef TCLKIT_CAN_SET_ENCODING 379 392 /* Set the encoding from the Environment */ 380 393 Tcl_GetEncodingNameFromEnvironment(&encodingName); 381 394 Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName)); 382 395 Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0); 383 396 Tcl_DStringFree(&encodingName); 384 -#endif 397 +#endif /* TCLKIT_CAN_SET_ENCODING */ 385 398 386 399 /* Hack to get around Tcl bug 1224888. This must be run here and 387 400 * in LibraryPathObjCmd because this information is needed both 388 401 * before and after that command is run. */ 389 402 FindAndSetExecName(interp); 390 403 391 404 return; 392 405 } 393 406 407 +#ifndef TCLKIT_DLL 394 408 int TclKit_AppInit(Tcl_Interp *interp) { 395 409 #ifdef KIT_INCLUDES_TK 396 410 # ifdef _WIN32 397 411 # ifndef _WIN32_WCE 398 412 char msgBuf[2049]; 399 413 # endif /* !_WIN32_WCE */ 400 414 # endif /* _WIN32 */ ................................................................................ 457 471 # endif /* !_WIN32_WCE */ 458 472 /* we won't reach this, but we need the return */ 459 473 # endif /* _WIN32 */ 460 474 #endif /* KIT_INCLUDES_TK */ 461 475 462 476 return TCL_ERROR; 463 477 } 478 +#endif /* !TCLKIT_DLL */ 464 479 465 480 466 481 #ifdef TCLKIT_DLL 467 482 # ifdef HAVE_ACCEPTABLE_DLADDR 468 483 /* Symbol to resolve against dladdr() */ 469 484 static void _tclkit_dummy_func(void) { 470 485 return;