Prev: protobuf
Next: Graph Algorithms
From: Y.T. on 20 Jan 2010 12:26 So like a lot of people, I don't bother with a TCL "distro". I download the recent tclkit (these days from code.google.com) and fire it up and have pretty much everything I need right at hand. When I'm finished writing/debugging something and it runs fine from within tclkit, I use sdx to wrap it up into a standalone distributable and leave it at that. For the "wrapping up" part (I use a little self-written app, in TCL, that keeps track of the resources that have to be added to the vfs/lib before wrapping) there's invariably a step that looks kinda like this: sdx::sdx wrap $appname.exe -runtime $tclkitcopy where $tclkitcopy is a copy of my tclkit (since I cannot use the one I'm currently sitting in). Now while I find tclkit perfectly adequate in performance/capabilities for my dev work, once I commit to wrapping a runtime it tends to be way too large. There's hundreds kB of stuff in there that I do not ever (will not ever) need in my distributables. I understand *just enough* of the internals of metakit to know that I can do something like sdx::sdx lsk ./tclkit-8.5.8-win32.upx.exe to get a listing of all the "batteries included" in the kit. 100kB just for tcltest, which will never be used in my distributables. Another 100k for various i18n concepts, like the Ukraine-encoding for the Mac or the polish message catalog. I write little gui apps that are being used internally in a non-civilian US aerospace outfit to control equipment; I definitely will never need any of these. I also definitely don't want anything in there that can make (or even accept, shudder) network connections, I definitely don't need the aqua theme (or any "theme", for that matter), I don't rely on obsolete functions that are included "for compatibility" (optparse etc), and for my general use I could even do away with fairly-standard-TCL-bits that I simply never use (tearoff or mkpsenc or such. Even console, I suppose). So what I'm trying to figure out (and have been rather unsuccessful at) is how to use all these fabulous vfs tools at my disposal to open a (copy of) a tclkit and *remove* various parts from it; leaving the STAR alone (which isn't listed by 'sdx lsk', apparently because the metakit content is merely appended to the binary itself). This strikes me as such a useful thing to do, that I'm sure this must have been asked before - however I'm having the hardest time finding any adequate documentation. Dozens of webpages telling me how to "make my first starkit (or even starpack)" and very little about the mechanics behind the scenes and how to customize things and such. Any help would be appreciated ... cordially Y.T. -- Remove yourclothes to email me.
From: Thomas Braun on 20 Jan 2010 13:33 Y.T. wrote: [Slimming the tclkit runtime] > Any help would be appreciated ... > Have a look at... http://wiki.tcl.tk/18146 ....and read, how to build your own slim tclkit runtime executable. Cheers...
From: Pat Thoyts on 20 Jan 2010 17:01 "Y.T." <ytyourclothes(a)gmail.com> writes: [snip] First bear in mind that the sizes you see reported for the kit contents are not the true size in the db. Everything is compressed in the vfs and text files compress very nicely. So you may not achieve much saving except for eliminating some of the i18n catalogs. You can of course build your own tclkit - but its probably simplest here to split off the vfs, mount it in a tcl interpreter and remove the stuff you think you can loose. sdx mksplit mytclkit.exe ;# splits off mytclkit.head and .tail tclkitsh % vfs::mk4::Mount mytclkit.tail vfs % cd vfs % foreach file {lib/tcl8.6/encoding/cp869 lib/tcl8.6/....} { file delete $file } Once you deleted and modified everything you just concatenate the exe and database parts. [windows] copy /b mytclkit.head + mytclkit.tail mytclkit.exe [unix] cat mytclkit.head mytclkit.tail > mytclkit On windows with the metakit sources there is a program called kviewer.exe which shows the metakit database structure and the compressed size and uncompressed size - that might help you to target the right things. Also - you can upx compress more aggressively. The windows tclkits are usually compressed already using upx --best but you can do more if you are patient. Split the binary as above (rename the head to head.exe) and do: upx -q --ultra-brute --compress-resources=0 mytclkit.head.exe then join the parts together again. Finally - tclkit-gui is smaller that tclkit. It can also be code-signed if you need that. -- Pat Thoyts http://www.patthoyts.tk/ To reply, rot13 the return address or read the X-Address header. PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
From: Larry W. Virden on 21 Jan 2010 07:06 On Jan 20, 5:01 pm, Pat Thoyts <cnggub...(a)hfref.fbheprsbetr.arg> wrote: > > Once you deleted and modified everything you just concatenate the exe > and database parts. After doing that, then carefully test the resulting program (which should no longer be called tclkit, so that you and others don't confuse the skinny kit with the real thing). There might be dependencies of which you are not aware on the pieces you are removing because you don't explicitly use them.
From: Y.T. on 21 Jan 2010 23:20 Thanks -- that was exactly the kind of pointer I was looking for. Now the usual question: where should I have looked this up? Which documentation did I fail to read? And for future googlers looking for the same info, here's a few more remarks: > sdx mksplit mytclkit.exe ;# splits off mytclkit.head and .tail > tclkitsh > % vfs::mk4::Mount mytclkit.tail vfs > % cd vfs > % foreach file {lib/tcl8.6/encoding/cp869 lib/tcl8.6/....} { > file delete $file > > } At this point one should probably do an Unmount and up to this point, the result is not actually any smaller until the db is (re)packed. I.e. something like set db [vfs::mk4::Mount tclkitcopy.tail vfs] file delete vfs/lib/tcl8/8.5/tcltest-2.3.2.tm vfs::mk4::Unmount $db vfs file rename tclkitcopy.tail tclkitcopy.oldtail sdx::sdx mkpack tclkitcopy.oldtail tclkitcopy.tail > Also - you can upx compress more aggressively. The windows tclkits are > usually compressed already using upx --best but you can do more if you > are patient. Split the binary as above (rename the head to head.exe) > and do: > upx -q --ultra-brute --compress-resources=0 mytclkit.head.exe > then join the parts together again. I tried that - -d'ed the head, then recompressed it with the above cmd line and got the exact same length. cordially Y.T. -- Remove YourClothes to email me.
|
Pages: 1 Prev: protobuf Next: Graph Algorithms |