Questions about smalltalk/x and its class library

Smalltalk/X Application Deployment in Windows

Postby fmadrid » 3. Dec 2008, 17:24

Smalltalk/X Application Deployment in Windows

ST/X includes support to generate self-installing NSIS (Nullsoft installable) packages. There is no requirement for bytecode or images to be packed with such a distribution (i.e. the package consists of an exe, a bunch of dll's and additional configuration files). Once installed, updates can be delivered as individual dll's or via patch files.

ST/X provide the opportunity to use existing libraries (like stx:libbasic, stx:libui, stx:libview, stx:goodies/sunit, etc) and to create new libraries for your applications. Each library will require a Library Package in order to generate the makefiles and to be compiled into a dll. To deploy the application with it's prerequisite libraries, an Application Package is required to generate the makefiles, the NSIS script and to obtain the self-installing package.

Prerequisites

In order to generate such packages, you will need (for Win32 apps):
- the free borland command-line tool package (bcc32, release 5.5) <Getting started with Borland C++ 5.5 http://www.codeproject.com/KB/recipes/usingbcc.aspx>
- the free NullSoft scriptable installer system. <NSIS http://nsis.sourceforge.net/>
- a CVS repository on one of your machines and CVS command line tools <CVS Sourcecode & Revision Management http://www.exept.de:8080/doc/online/english/programming/sourcemanager.html>


Steps

1. (optional) Generate Library Packages for self-developed projects
2. Generate Application Package
3. Check in the classes, extensions, libraries and the application package
4. Check out all related project's folders by calling cvs upd -d from the command line
5. Build all related libraries and the application by calling bmake from the command line

Generate Library Package

1. Assign classes to a new separate project by selecting them in the Browser and using the Class>Move>To Project menu entry

2. (optional) Assign extensions methods of classes in STX projects or other projects to your new project by selecting the selectors in the Browser and using the Selector>Move>To Project menu entry

3. Change the Browser to Project view selecting the View>Project option in the menu

4. Check in classes for the project by selecting the project and using the Project>Repository>Check In menu entry

5. (optional) Check in extensions for the project by selecting the project and using the Project>Repository>CheckIn Extensions only menu entry

6. Generate the Library Package by selecting the project and pressing Project>New... menu entry. In the dialog, confirm the project and select Library for the type. This will create a Library Definition class for the project (for example, stx_goodies\sunit for the project stx:goodies\sunit) where the most important methods are:

#classNamesAndAttributes containing the name of all library's classes

#preRequisites containing the name of all library's prerequisites projects

#extensionMethodNames containing the class name and selector of all library's extensions

7. After adding new classes or extension methods to the project, update the Library Package definition methods by using Project>Generate>Update Project Contents Definition Methods menu entry or regenerate them completely by using Project>Generate>Regenerate Project Contents Definition Methods.

8. Check in the Library Package class and generate the compilation support files by using Project>Repository>Check in Build Support files only... menu entry


Generate Application Package

1. Assign classes to a new project by selecting them in the Browser and using the Class>Move>To Project menu entry

2. (optional) Assign extensions methods of STX projects or other projects to your new project by selecting them in the Browser and using the Selector>Move>To Project menu entry

3. Change the Browser to Project view selecting the View>Project option in the menu

4. Check in classes for the project by selecting the project and using the Project>Repository>Check In menu entry or by selecting the classes and using Class>Repository>Check in menu entry

5. (optional) Check in extensions for the project by selecting the project and using the Project>Repository>CheckIn Extensions only menu entry

6. Generate the Application Package by selecting the project and pressing Project>New... menu entry. In the dialog, confirm the project and for the type filed select GUI-Application or NonGUI-Application (for a headless app). This will create an Application Definition class for the project (for example, stx_goodies\sunit for the project stx:goodies\sunit) where the most important methods are:

#classNamesAndAttributes containing the name of all application's classes

#preRequisites containing the name of all application's prerequisites projects

#extensionMethodNames containing the class name and selector of all application's extensions

#startupClassName specify the name of the startup class. This can be any application class or a new class with should inherit StandaloneStartup class and should redifine #main to program the application's starting proceedings.

#startupSelector specify the name of the startup selector. This can be any method of the startup class or should be start, if the startupClassName inherits from StandaloneStartup

#productName specify the name of the application and of the generated installer

#additionalSections_dot_nsi specify additional NSIS sections to include additional files needed by the application

#offerApplicationSourceCode specify if the source code of the application should be offered as install option

#offerSmalltalkSourceCode specify if the source code of the smalltalk base system should be offered as install option

7. After adding new classes or extension methods to the project, update the Application Package definition methods by using Project>Generate>Update Project Contents Definition Methods menu entry or regenerate them completely by using Project>Generate>Regenerate Project Contents Definition Methods.

8. Check in the Application Package class and generate the compilation support files by using Project>Repository>Check in Build Support files only... menu entry

User Patches

The standard ST/X includes a mechanism to automatically look for a patches directory and load any such patch-files. The patches can be changes files (*.chg), as well as, smalltalk classes (*.st) since they will be filed in. The mechanism is programmed in the './bin/patches' file and the standard directories are './bin/stxPatches' and './bin/userPatches'.

If you need dynamic updates into a running system, you have to write a some code yourself (i.e. to download ST-patches from some webserver, place them into the patches directory for the next restart, and installing them using to the build-in bytecode compiler).

Example (unzip helloWorldApp_before_make.zip in folder \stx\projects\)

Step by step:

1. no own additional library is required for the example, since all the prerequisite libraries come from stx and are already compiled

2.4 generate the HelloWorldApplication class and check in the application project stx:projects/helloWorldApp.

2.6 Generate stx_projects_helloWorldApp package, change the method #startupClassName to return 'HelloWorldApplication' and change the method #startupSelector to return #'open'

3. check in HelloWorldApplication class, HelloWorldStartup class and check in build support files for stx_projects_helloWorldApp package

4. from the command line, call cvs upd -d in the directory stx/projects/helloWorldApp to check out the project stx:projects/helloWorldApp

5. from the command line, call bmake in the directory stx/projects/helloWorldApp and the installer HelloWorldDemoSetup.exe will be generated
Attachments
helloWorldApp_before_make.zip
HelloWorldApplication
(25.12 KiB) Downloaded 626 times
fmadrid
 
Posts: 10
Joined: 19. Nov 2008, 18:49

Re: Smalltalk/X Application Deployment in Windows

Postby jan_vrany » 11. Dec 2008, 19:53

Thanks for the tutorial!

I'm trying to compile class my own library (sources: http://smalltalk.felk.cvut.cz/projects/stx-goodies/browser/xmlsuite/xmlreaderimpl/trunk. On Linux, everything compiles & work OK, but I cannot compile it on Windows box (using BCC5.5):

Code: Select all
        c:\Borland\bcc55\bin\bcc32.exe -I"..\..\..\include" -IC:\Borland\BCC55\b
in\..\include -I..\support\win32\include "-IC:\Program Files\Expat 2.0.1\Source\
lib"  -D_NO_VCL;WIN32;DEBUG;_RTLDLL -O2 -5  -WD -w- -w-pro -w-ccc -w-rch -w-aus
-w-par -x- -r- -k -y -v -vi- -c -tWDR -RT- -Tkh30000    -c -oXMLv2__VWXMLReader.
obj XMLv2__VWXMLReader.sc
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
xmlv2__vwxmlreader.sc:
        del *.sc
        copy libInit.cc ntLibInit.c
        1 file(s) copied.
        c:\Borland\bcc55\bin\bcc32.exe -I"..\..\..\include" -IC:\Borland\BCC55\b
in\..\include -I..\support\win32\include "-IC:\Program Files\Expat 2.0.1\Source\
lib"  -D_NO_VCL;WIN32;DEBUG;_RTLDLL -O2 -5  -WD -w- -w-pro -w-ccc -w-rch -w-aus
-w-par -x- -r- -k -y -v -vi- -c -tWDR -RT- -Tkh30000    -c -o.\objbc\ntLibInit.o
bj ntLibInit.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
ntlibinit.c:
generating libstx_goodies_xmlsuite_xmlreaderimpl.dll / .lib [link] ...
 @echo -L..\..\..\libbc -LC:\Borland\BCC55\bin\..\lib;C:\Borland\BCC55\bin\..\li
b\PSDK; -ap -Tpd -s -Gn -Gi -v -w-dup  +
 @echo c0d32.obj .\objbc\ntLibInit.obj  stx_goodies_xmlsuite_xmlreaderimpl.obj
 XMLv2__ExpatXMLReader.obj   XMLv2__VWSAXBuilder.obj   XMLv2__VWXMLReader.obj  "
C:\Program Files\Expat 2.0.1\Source\bcb5\release\libexpats_mtd.lib" , +
 @echo .\objbc\libstx_goodies_xmlsuite_xmlreaderimpl.dll,, +
 @echo ..\..\..\libbc\librun.lib  import32.lib C:\Borland\BCC55\bin\..\lib\PSDK\
iphlpapi.lib cs32i.lib , +
 @echo bc.def, +
 @echo
        c:\Borland\bcc55\bin\ilink32.exe @MAKE0001.@@@
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '___ADD_REFCELL' referenced from H:\JANFROG\WORK\STX\
5.4.2\WIN32\STX\GOODIES\XMLSUITE\XMLREADERIMPL\XMLV2__EXPATXMLREADER.OBJ
Error: Unresolved external '___REMOVE_REFCELL' referenced from H:\JANFROG\WORK\S
TX\5.4.2\WIN32\STX\GOODIES\XMLSUITE\XMLREADERIMPL\XMLV2__EXPATXMLREADER.OBJ
Warning: Attempt to export non-public symbol '_xmlreaderimpl_Init'

** error 2 ** deleting .\objbc\libstx_goodies_xmlsuite_xmlreaderimpl.dll


It seems that __ADD_REFCELL/__REMOVE_REFCELL is missing in librun.obj. I try to
find them using tdump, I cannot found anything in win32 distribution.
Linux version of librun.so/librun.a has defined symbol __ADD_REFCELL, so it seems
that __ADD_REFCELL is a function somewhere in the linux VM. However, it seems not
to be present in Windows version.

Do you have any idea whats wrong? I'm not windows guy, so maybe I miss some important point...
jan_vrany
 
Posts: 28
Joined: 10. Dec 2008, 12:37

Re: Smalltalk/X Application Deployment in Windows

Postby cgittinger » 11. Dec 2008, 23:56

Jan, I will look at the ADDREFCELL problem (I've never seen that, so I have to figure out where it is needed/missing myself). I'll post more info later...

In the meantime (as a teaser), I'd like to point you all to a little ready-to-install, and wrapped up self installing demo application which is foudn on the exept webSite
at http://www.exept.de/de/products/smalltalk-x/stx-sampleapplications

(I know, I know, its bad to add a teaser and then not helping in the ADDREFCELL problem - like a dealer who cannot deliver the drugs later... :twisted: )

Claus
cgittinger
 
Posts: 61
Joined: 12. Nov 2008, 17:05

Re: Smalltalk/X Application Deployment in Windows

Postby jan_vrany » 12. Dec 2008, 00:14

Claus,
Thanks. Don't worry, this is not a crucial issue for me.
Now, windows version is just nice-to-have :-)
jan_vrany
 
Posts: 28
Joined: 10. Dec 2008, 12:37


Return to Programming Help

Users browsing this forum: No registered users and 1 guest

Design by GB