Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Build starpack / starkit / etc. from scratch?

174 views
Skip to first unread message

Dave

unread,
Jun 27, 2018, 7:56:37 PM6/27/18
to
I thought I'd again look into starkits, starpacks, etc. whatever they
are called now. Every time I do this I wind up on pages telling me to
download an existing sdx, kit, etc. Most of these are ancient versions
of Tcl/Tk. None of them have the IMG extension.

I want to wrap an app of mine that uses the IMG extension. I can build
Tcl/Tk successfully on windows. I want to start from scratch and build
the sdx.exe and whatever I need.

I don't want a pre-built thing, I want to build it myself. Is there a
reference >anywhere< that describes just how to build this stuff from
scratch? Thanks.

--
computerjock AT mail DOT com

Rich

unread,
Jun 27, 2018, 9:12:25 PM6/27/18
to
Maybe not quite what you are looking for, but you could look into Roy
Keene's Kit Creator code for info on 'how' to build kits. You might
gain inspiration there.

IMG, however, does not seem to be one of the libraries it includes at
this time.

Rich

unread,
Jun 27, 2018, 9:13:09 PM6/27/18
to
Dave <nor...@nohost.com> wrote:
> I don't want a pre-built thing, I want to build it myself. Is there a
> reference >anywhere< that describes just how to build this stuff from
> scratch? Thanks.
>

Sorry, forgot the URL: https://kitcreator.rkeene.org/fossil/index

Robert Heller

unread,
Jun 27, 2018, 9:27:22 PM6/27/18
to
What you want to build is a tclkit.exe. You don't actually need to build a
sdx.exe (actually you don't really want that). You can get a sdx.kit file (OS
& arch agnostic). You *can* convert the sdx.kit to sdx.exe as a conviencence
-- I guess that might be necessary, given MS-Windows "primitive" shell/CLI
system (compared to Linux).

*I* don't know about building tclkit *under MS-Windows*, since I don't use
MS-Windows (I cross-build under Linux using the MXE mingw32 distro under
Ubuntu 14.04), but I have built tclkits under Linux.

What you want is called "kitgen" -- do a web search for it.

Oh, you don't actually need a tclkit with any extensions beyond the core and
what is minimually needed for the tclkit. You can *add* extensions during the
wrapping process: wrap the main program with qwrap, then unwrap it. This
gives you a .vfs dir tree that you can add additional files to, include shared
libraries (binary extensions) and then wrap all of that together with a
runtime. Visit https://github.com/RobertPHeller/ModelRRSystem and look at the
build infrastucture (specificly the Makefile.am files under the Scripts
directory) for hints on how to do this.

>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Christian Gollwitzer

unread,
Jun 28, 2018, 3:53:29 AM6/28/18
to
Am 28.06.18 um 01:56 schrieb Dave:
Thing is, it is a quite complex process to build this stuff from
scratch. The support files of Tcl (the library/ stuff and for Tk there
is more like icons etc) need to be packaged in a virtual file system,
and the startup code must be modified to actually run. Therefore, there
are some projects which consist of a script to build these things.

The most recent one is BAWT:
http://www.bawt.tcl3d.org/

Another one is kbs:
https://sourceforge.net/projects/kbskit/files/kbs/0.4.9/
If you donwload just "kbs.tcl", it will do the process of donwloading
the sources and building this stuff. Unfortunately, not updated since
1,5 years. In the prebuilt kits, Img is included.

Roy Keene's Kitcreator was also mentioned. I think this will be the
hardest to get running, actually, so it is much easier to use the web
interface.

If all you want is a starpack with Img, there is an easier solution. YOu
just create your starpack and include the Img package under a folder
lib/. Most packages can be wrapped by simply adding them to your files.

Building sdx is another story, because it requires sdx to be built....
Actually I do not see a good reason that it is distributed as a .kit
instead of a single .tcl file, so maybe some kind soul will be able to
free it from the cage on day ;)

Christian





Mike Griffiths

unread,
Jun 28, 2018, 4:56:46 PM6/28/18
to
You shouldn't need to actually *compile* anything. You can download an existing Tclkit (or an ActiveTcl basekit), use sdx.kit to wrap up your application (including your extensions like Img, if they aren't part of the Tclkit you're using) into a starkit (Tcl bundle) or a starpack executable (tclkit + starkit). See http://wiki.tcl.tk/8900 for instructions, but what I generally do:

* Copy your Tclkit to c:\tclkit.exe *and* c:\tclkit2.exe (on Windows you need one to run and one to combine into the starpack at the end, because Windows is dumb sometimes)
* Download sdx.kit to c:\sdx.kit
* Place the main Tcl script for your app at c:\MyApp.tcl
*** For all sdx commands that follow, do Start -> Run and enter c:\tclkit.exe sdx.kit <command>
* c:\tclkit.exe sdx.kit qwrap MyApp.tcl
** This creates an initial MyApp.kit from your Tcl file
* c:\tclkit.exe sdx.kit unwrap MyApp.kit
** This extracts the MyApp.vfs directory structure from the MyApp.kit. You can now remove c:\MyApp.kit and c:\MyApp.tcl, as MyApp.tcl is now in the vfs directory (as MyApp.vfs/lib/app-MyApp/MyApp.tcl)
* Throw any other binary extensions you need (like Img) in MyApp.vfs/lib/
* Copy any other Tcl scripts, images, and any other files your app uses into the MyApp.vfs (where you want to put them is up to you - possibly in lib/app-MyApp, particularly if MyApp.tcl is referencing them by path)
* The main entry point to your application when it runs from a bundle is MyApp.vfs/main.tcl - you can also run this script to test things before you re-bundle it up.
* When you're ready, either run:
** c:\tclkit.exe wrap MyApp.kit
** This creates a new Starkit. (It may also create a MyApp.bat batch file, which you can ignore/delete).
* And/or, to create a single-file executable:
** c:\tclkit.exe wrap MyApp.exe -runtime tclkit2.exe

You can then edit the icons and file information for MyApp.exe in a number of ways - personally, I use Resource Hacker, but there are some Tcl tools for it (some of which are bundled in sdx.kit).

Robert Heller

unread,
Jun 28, 2018, 7:12:43 PM6/28/18
to
At Thu, 28 Jun 2018 13:56:43 -0700 (PDT) Mike Griffiths <mi...@keyboardzombie.com> wrote:

>
> On Thursday, 28 June 2018 02:27:22 UTC+1, Robert Heller wrote:
> > At Wed, 27 Jun 2018 18:56:31 -0500 Dave <nor...@nohost.com> wrote:
> >=20
> > >=20
> > > I thought I'd again look into starkits, starpacks, etc. whatever they=
> =20
> > > are called now. Every time I do this I wind up on pages telling me to=
> =20
> > > download an existing sdx, kit, etc. Most of these are ancient versions=
> =20
> > > of Tcl/Tk. None of them have the IMG extension.
> > >=20
> > > I want to wrap an app of mine that uses the IMG extension. I can build=
> =20
> > > Tcl/Tk successfully on windows. I want to start from scratch and build=
> =20
> > > the sdx.exe and whatever I need.
> > >=20
> > > I don't want a pre-built thing, I want to build it myself. Is there a=
> =20
> > > reference >anywhere< that describes just how to build this stuff from=
> =20
> > > scratch? Thanks.
> >=20
> > What you want to build is a tclkit.exe. You don't actually need to build =
> a
> > sdx.exe (actually you don't really want that). You can get a sdx.kit fil=
> e (OS=20
> > & arch agnostic). You *can* convert the sdx.kit to sdx.exe as a convienc=
> ence=20
> > -- I guess that might be necessary, given MS-Windows "primitive" shell/CL=
> I=20
> > system (compared to Linux).
> >=20
> > *I* don't know about building tclkit *under MS-Windows*, since I don't us=
> e=20
> > MS-Windows (I cross-build under Linux using the MXE mingw32 distro under=
> =20
> > Ubuntu 14.04), but I have built tclkits under Linux.
> >=20
> > What you want is called "kitgen" -- do a web search for it.
> >=20
> > Oh, you don't actually need a tclkit with any extensions beyond the core =
> and=20
> > what is minimually needed for the tclkit. You can *add* extensions durin=
> g the=20
> > wrapping process: wrap the main program with qwrap, then unwrap it. This=
> =20
> > gives you a .vfs dir tree that you can add additional files to, include s=
> hared=20
> > libraries (binary extensions) and then wrap all of that together with a=
> =20
> > runtime. Visit https://github.com/RobertPHeller/ModelRRSystem and look a=
> t the=20
> > build infrastucture (specificly the Makefile.am files under the Scripts=
> =20
> > directory) for hints on how to do this.
> >=20
> > >=20
> >=20
> > --=20
> > Robert Heller -- 978-544-6933
> > Deepwoods Software -- Custom Software Services
> > http://www.deepsoft.com/ -- Linux Administration Services
> > hel...@deepsoft.com -- Webhosting Services
>
> You shouldn't need to actually *compile* anything. You can download an exis=
> ting Tclkit (or an ActiveTcl basekit), use sdx.kit to wrap up your applicat=
> ion (including your extensions like Img, if they aren't part of the Tclkit =
> you're using) into a starkit (Tcl bundle) or a starpack executable (tclkit =
> + starkit). See http://wiki.tcl.tk/8900 for instructions, but what I genera=
> lly do:

Right. There are up-to-date Tclkits (and the Img library, and a few other key
libraries) on ActiveState in the ActiveTcl builds.

>
> * Copy your Tclkit to c:\tclkit.exe *and* c:\tclkit2.exe (on Windows you ne=
> ed one to run and one to combine into the starpack at the end, because Wind=
> ows is dumb sometimes)
> * Download sdx.kit to c:\sdx.kit
> * Place the main Tcl script for your app at c:\MyApp.tcl
> *** For all sdx commands that follow, do Start -> Run and enter c:\tclkit.e=
> xe sdx.kit <command>
> * c:\tclkit.exe sdx.kit qwrap MyApp.tcl
> ** This creates an initial MyApp.kit from your Tcl file
> * c:\tclkit.exe sdx.kit unwrap MyApp.kit
> ** This extracts the MyApp.vfs directory structure from the MyApp.kit. You =
> can now remove c:\MyApp.kit and c:\MyApp.tcl, as MyApp.tcl is now in the vf=
> s directory (as MyApp.vfs/lib/app-MyApp/MyApp.tcl)
> * Throw any other binary extensions you need (like Img) in MyApp.vfs/lib/
> * Copy any other Tcl scripts, images, and any other files your app uses int=
> o the MyApp.vfs (where you want to put them is up to you - possibly in lib/=
> app-MyApp, particularly if MyApp.tcl is referencing them by path)
> * The main entry point to your application when it runs from a bundle is My=
> App.vfs/main.tcl - you can also run this script to test things before you r=
> e-bundle it up.
> * When you're ready, either run:
> ** c:\tclkit.exe wrap MyApp.kit
> ** This creates a new Starkit. (It may also create a MyApp.bat batch file, =
> which you can ignore/delete).
> * And/or, to create a single-file executable:
> ** c:\tclkit.exe wrap MyApp.exe -runtime tclkit2.exe
>

The above process is codified in the Makefile.am files I use with my Model RR
system. Feel free to grab those Makefile.am files and adapt them or use them
as the basis of .bat or .sh files.

> You can then edit the icons and file information for MyApp.exe in a number =
> of ways - personally, I use Resource Hacker, but there are some Tcl tools f=
> or it (some of which are bundled in sdx.kit).
>

Christian Gollwitzer

unread,
Jun 29, 2018, 1:24:46 AM6/29/18
to
Am 28.06.18 um 22:56 schrieb Mike Griffiths:
> * When you're ready, either run:
> ** c:\tclkit.exe wrap MyApp.kit

Small mistake: It would be "c:\tclkit.exe sdx.kit wrap MyApp.kit".
Notice the "sdx.kit" which was missing.

> ** This creates a new Starkit. (It may also create a MyApp.bat batch file, which you can ignore/delete).
> * And/or, to create a single-file executable:
> ** c:\tclkit.exe wrap MyApp.exe -runtime tclkit2.exe

here the same applies.

Christian

Dave

unread,
Jul 5, 2018, 11:47:47 AM7/5/18
to

Thanks very much for all the info.

I now have a working prototype. What I noticed right away is the
TCLxxxxxxxx/ directory in tmp which was used to load the embedded dll's.
I would >really< like this to go away when the app exits -- most windows
users do not know how to cleanup their tmp directory periodically. A
year ago I was messing around with freewrap and came up with a solution
that worked for me. It requires either patching Tcl core or, in the case
of freewrap, patching its frontend.

Tcl must be linked statically so one can call
TclpTempFileNameForLibrary(). This gets the name of the directory
containing the dll's. An atexit() proc is setup which will scan that
directory and do an unlink() on each file. If any unlink() fails, set a
secret environment var with the name of the directory and re-invoke
argv[0] as a child process. The parent then exits. With the existence of
the secret environment var, the child waits for the parent to exit and
then attempts removing the contents (and the directory itself) again.

This seemed to work very well for my needs. More thought would be needed
to make this a tcl core function since one does not want tcl to become a
universal directory deletion utility by a malicious perp who sets up
everything correctly in order to spoof tcl into deleting an arbitrary
directory.

Anyway, that's why I wanted to learn how to compile a tclkit myself.
0 new messages