BMK NG - Universal Builds

BlitzMax Forums/BlitzMax NG/BMK NG - Universal Builds

Brucey(Posted 2009) [#1]
I'm currently tinkering with my bmk(NG) app - the one that already supports scripting.

At the moment, with a -i command-line option (-i implies universal), it will build both PPC and X86 modules on Intel.
This is step 1 on the road to supporting an automated Universal build for applications.

Example output :
$ ./bmk makemods -i -a brl.blitz

Compiling:blitz_app.c
Compiling:blitz_types.c
Compiling:blitz_cclib.c
Compiling:blitz_memory.c
Compiling:blitz_module.c
Compiling:blitz_object.c
Compiling:blitz_string.c
Compiling:blitz_array.c
Compiling:blitz_gc.c
Compiling:blitz_handle.c
Compiling:blitz_debug.c
Compiling:blitz_incbin.c
Compiling:blitz_ex.c
Compiling:blitz_ex.macos.x86.s
Compiling:blitz_gc.macos.x86.s
Compiling:blitz_ftoi.macos.x86.s
Compiling:blitz.bmx
Archiving:blitz.debug.macos.x86.a
Compiling:blitz_app.c
Compiling:blitz_types.c
Compiling:blitz_cclib.c
Compiling:blitz_memory.c
Compiling:blitz_module.c
Compiling:blitz_object.c
Compiling:blitz_string.c
Compiling:blitz_array.c
Compiling:blitz_gc.c
Compiling:blitz_handle.c
Compiling:blitz_debug.c
Compiling:blitz_incbin.c
Compiling:blitz_ex.c
Compiling:blitz_ex.macos.ppc.s
Compiling:blitz_gc.macos.ppc.s
Compiling:blitz.bmx
Archiving:blitz.debug.macos.ppc.a


Step 2.
Will be create both an x86 and ppc application binary.
I might get away with having the ppc binary have a _ppc suffix, throwing both in the same .app bundle.

Step 3.
Lipo the two binaries, and delete the _ppc

Job done :-)


Caveats.
Requires the PPC bcc binary from the PPC BlitzMax release. No big deal really, as you can download and unzip the contents somewhere. Renaming to something like bcc_ppc and dropping it into the BlitzMax/bin folder should be enough to get everything else working.

Shared Objects (.dylib) and external static lib integration :
Well, if they are Universal binaries, it will be no issue.
However, if they are PPC or X86 (like my wxWidgets static libs) then you'll have problems. - I guess this means I may want to do a universal build of those too at some point.

For any libraries that are compiled in as source into a module, it's not a problem, since you will have both the PPC and X86 versions available when you lipo them together.
Actually, come to think of it... it might be okay for my wxMax libs too... something to find out later, no doubt.

Otherwise, there don't appear to be any significant outstanding issues.

Steps 2 and 3 I've still to complete, but it's looking good so far.

I know I said I wasn't going to do any more "tweaking" of any official BlitzMax modules/apps any more, but this is directly useful for me, so I'm letting it slide for now :-p


Brucey(Posted 2009) [#2]
I should probably point out that this is a Mac-only feature :-p

Everyone else... move along... move along... nothing to see here...


DavidDC(Posted 2009) [#3]
I think this is great. But what's lipo?


markcw(Posted 2009) [#4]
FAB.

what's lipo?

lipo and 9 other os x command line utils


DavidDC(Posted 2009) [#5]
Ah thanks! I was thinking to myself no, it couldn't possibly be related to liposuction...


byo(Posted 2009) [#6]
I was thinking that too. ROTFLMAO!


Brucey(Posted 2009) [#7]
And once you've built all your modules for both X86 and PPC, you can impress your friends by showing them how much disk-space it all takes up :-p

I think I need a bigger harddrive...


Brucey(Posted 2009) [#8]
Another possible caveat...

it takes bloody ages to compile everything - twice!


Brucey(Posted 2009) [#9]
If anyone is interested, here is my first Universal app built directly in BlitzMax : universal_test.zip (750kb)

It runs fine on my Intel box. But if anyone with a PPC machine would like to try it - just to prove it works... :-)

Escape to quit the app.


xlsior(Posted 2009) [#10]
*very* nice!

I know that the Mac release requires xcode which pretty much rules out something like this ever happening on the PC, but what about the other way around?

Supposedly there is a MinGW build that will run on Mac OSX to create windows binaries: http://crossgcc.rts-software.org/doku.php


Brucey(Posted 2009) [#11]
Yeah, it had crossed my mind a bit (same for Win32 build on Linux), but I'm not sure if it's worth the time-investment required - which would be substantial - since I already have Parallels on Mac for Windows.


jkrankie(Posted 2009) [#12]
Works fine here on PPC 10.4.11, and it's a nice effect :)

Cheers
Charlie


xlsior(Posted 2009) [#13]
It might be something for BRL to pursue, though...


Brucey(Posted 2009) [#14]
It might be something for BRL to pursue, though...

I wouldn't think they're at all interested.

Look at the myriad of complaints when people want to use MinGW with BlitzMax - which isn't particularly difficult to set up, but yet for some the effort amounts to something like climbing K2.

Now, you want them to set up a cross-compiler tool-chain? heh ;-)

There's a big difference between someone wanting to use a feature like that, and that someone having to go through a 12 step list of configuration to get that feature working.

Not so much of an issue for you or me, perhaps... but I think we are in a minority.