[JOB] It is possible to "cross compile" starkits for a specific platform! The following Makefile shows how it works. Some further explanations: For cross compilation, we need both: a binary (tclkit) for the current platform, we are running the Makefile on (which is used to create a working sdx utility) and another pre-compiled binary for the target platform. The sdx utility in turn is capable to maintain any tclkit binary regardless which binary it belongs to! I am using a similar Makefile to create binaries for win* although the development platform is a mac - which works pretty well! ====== # Makefile --- # ------------------------------------------------------------------------- # Purpose: # Create (*)starkit and application binaries # for unix and windows. This makefile might be used to # "cross compile" binaries for any target OS. # # Copyright(c) 2008, Johann Oberdorfer # mail-to: johann.oberdorfer@googlemail.com # ------------------------------------------------------------------------- # This source file is distributed under the BSD license. # main entry point: TCLROOT=$(HOME)/myCoolSoftware # unix / win / osx ... AIX_KIT=$(TCLROOT)/kbs/bin/kbskit85-gui_aix WIN_KIT=$(TCLROOT)/kbs/bin/tclkit85-win32.upx.exe OSX_KIT=$(TCLROOT)/kbs/bin/tclkit85-darwin-univ-aqua # the sdx utility: SDXUTIL=$(TCLROOT)/binary_repository/sdx.kit # *edit* to reflect your build platform # you are currently running on: # ------------------------------------- TCL_KIT=$(AIX_KIT) VER=V0.1 APP=myCoolApplication INSTALL_DIR=$(TCLROOT)/myCoolApps all: aix win ls devel: aix win kit ls aix: $(APP).aix win: $(APP).exe osx: $(APP).osx kit: $(APP).kit sdx: cp $(TCL_KIT) kitbin cp $(SDXUTIL) sdx.kit $(TCL_KIT) $(SDXUTIL) unwrap sdx.kit $(TCL_KIT) $(SDXUTIL) wrap sdx -runtime kitbin rm -rf sdx.vfs rm -r sdx.kit rm -f kitbin $(APP).kit: $(VER) $(TCL_KIT) $(SDXUTIL) wrap $@ -vfs $(VER) $(APP).aix: $(VER) cp $(AIX_KIT) aixkitbin $(TCL_KIT) $(SDXUTIL) wrap $@ -vfs $(VER) -runtime aixkitbin rm -f aixkitbin $(APP).exe: $(VER) cp $(WIN_KIT) winkitbin.exe $(TCL_KIT) $(SDXUTIL) wrap $@ -vfs $(VER) -runtime winkitbin.exe rm -f winkitbin.exe $(APP).osx: $(VER) cp $(OSX_KIT) osxkitbin $(OSX_KIT) $(SDXUTIL) wrap $@ -vfs $(VER) -runtime osxkitbin rm -f osxkitbin ls: ls -ltr install: @if [ -f $(APP).aix ]; then \ echo "Moving file: $(APP).aix to: $(INSTALL_DIR)" ; \ mv $(APP).aix $(INSTALL_DIR) ; \ fi @if [ -f $(APP).exe ]; then \ echo "Moving file: $(APP).exe to: $(INSTALL_DIR)" ; \ mv $(APP).exe $(INSTALL_DIR) ; \ fi @if [ -f $(APP).osx ]; then \ echo "Moving file: $(APP).osx to: $(INSTALL_DIR)" ; \ mv $(APP).osx $(INSTALL_DIR) ; \ fi clean: rm -f aixkitbin rm -f winkitbin.exe rm -f osxkitbin rm -f kitbin rm -f $(APP).kit rm -f $(APP).aix rm -f $(APP).exe ====== ---- [lyon] Just a word of caution about this makefile. It renames the windows kit and the new name does *not* finish with .exe and this has a side effect: sdx *will ignore* the tclkit.ico you may have inserted in your vfs. If you do mind about making a custom icon, rename the windows kit with a trailing .exe and consider reading Pat Thoyts web page detailing the process of adding an icon to a Windows Starkit: [http://web.archive.org/web/20081204233913/www.equi4.com/wikis/equi4/267] ---- [JOB] Thank you lyon for your remark (looks as I am heavily influenced by unix driven boxes, where the file extension for executables isn't relevant at all). Next time I am going to try to extend the Makefile to handle custom icons as well. The main purpose of the Makefile although is the fact that - with starkit technology - you can freely choose your development platform - a kind of freedom for developers! -> Changed the Makefile accordingly. ---- [dcd] See [Building Starkits and Starpacks using a Makefile 2] for a way to generalize the makefile for different platforms, including getting the extension right. The makefile there will handle cross-compiling as well. When I get around to it, kbskit looks like it could also be useful. ---- [RZ] If you are already using kbskit you can put the creation in a package definition. But it works like your Makefile only for tcl only extensions. May be an idea for the next version. Package my_program0.1 { Require { Use kbskit8.5 sdx.kit my_lib0.1 } Source { Link my_program0.1 } Configure { Kit {source $::starkit::topdir/my_program.tcl} Tk } Make { Kit my_program my_lib0.1} Install { Kit my_program kbskit85-gui_aix file rename -force [Get builddir]/bin/my_program [Get builddir]/bin/aix_my_program Kit my_program kbskit85-gui_win.exe file rename -force [Get builddir]/bin/my_program.exe [Get builddir]/bin/win_my_program.exe } } ---- [JOB] Yes, kbskit is great - an additional ''rule'' for kbskit would also be a neat idea! With the following additional rule, the above makefile can be used to create a MacOS executable bundle: ====== # minimum app structure: # myCoolApp.app # ./Contents/Info.plist # ./Contents/MacOS/myCoolApp.osx # ./Contents/Resources/mycoolicon.icns $(APP).app: $(VFS) @echo "Establishing required bundle directory structure ..." ; \ mkdir -p $(APP).app ; cd $(APP).app ; \ mkdir -p Contents ; cd Contents ; \ \ echo "Creating application specific Info.plist ..." ; \ cp ../../macbundle/Info.plist . ; \ /usr/bin/sed s/AppName/$(APP)/g Info.plist > tmp ; mv tmp Info.plist ; \ /usr/bin/sed s/AppVer/$(VER)/g Info.plist > tmp ; mv tmp Info.plist ; \ \ mkdir -p MacOS ; cp ../../$(APP).osx ./MacOS ; \ mkdir -p Resources ; cp ../../macbundle/$(APP).icns ./Resources ; \ cd ../.. ; \ echo "Done." ====== In addition the following Info.plist template is required, stored in a sibling directory named as "macbundle", plus the application's image file (*.icns). Info.plist - template with minimum required settings: ====== CFBundleDevelopmentRegion English CFBundleExecutable AppName.osx CFBundleGetInfoString AppName Starpack Application AppVer CFBundleIconFile AppName.icns CFBundleIdentifier tk.tcltk.AppName-app CFBundleInfoDictionaryVersion 6.0 CFBundleName AppName CFBundlePackageType APPL CFBundleShortVersionString 1.0.0 CFBundleSignature WISH CFBundleVersion 1 LSMinimumSystemVersion 10.4.0 LSRequiresCarbon NSAppleScriptEnabled ====== <>Tclkit|Deployment|Development