Since the PPC Macs are no longer being produced and my PPC build machine is getting a little old I thought I would try making a universal version of the Mac OS X gem. After a little investigation it turned out to be surprisingly easy to do, just pass --enable-universal_binary when building wxWidgets and add -arch ppc -arch i386 to $extra_cppflags and $extra_ldflags in rakemacosx.rb. Now the problem, the resulting GEM is 9.6MB. How does everyone feel about downloading a file that size and not using half of what is inclosed in it? I had a feeling that people would not like that big of a build so I built a gem task that uses lipo and generates a i386 and ppc GEM from the universal one. These single arch GEMS are around 5.1MB. With the special split task I wrote this is the process of making a universal, i386 and ppc gem on any mac. rake WXRUBY_RELEASE=true strip -x lib/wxruby2.bundle rake gem WXRUBY_RELEASE=true WXRUBY_VERSION=1.9.3 rake osx_split_gem WXRUBY_RELEASE=true WXRUBY_VERSION=1.9.3 which will result in: wxruby-1.9.3-universal-macosx.gem 9.6MB wxruby-1.9.3-i386-macosx.gem 5.1MB wxruby-1.9.3-ppc-macosx.gem 5.2MB As you can see I also cleaned up the gem name so it is easier to associate with the correct platform. I will wait for comment before committing the changes but would really like to go this route which will help me out when it comes time to do a release. Sean
Sean Long wrote:> Since the PPC Macs are no longer being produced and my PPC build > machine is getting a little old I thought I would try making a > universal version of the Mac OS X gem. >I''m glad you''ve looked into this. There''s small and declining downloads of PPC (fewer than AMD64 build for 1.9.1), but enough to suggest that some people still find it useful.> After a little investigation it turned out to be surprisingly easy to > do, just pass --enable-universal_binary when building wxWidgets and > add -arch ppc -arch i386 to $extra_cppflags and $extra_ldflags in > rakemacosx.rb. >Nice work> Now the problem, the resulting GEM is 9.6MB. How does everyone feel > about downloading a file that size and not using half of what is > inclosed in it?Two things: 1) yes it''s bigger than I would want but, 2) could be very useful for people who want to bundle and redistribute universal apps eg using rubyscript2exe. I don''t know whether rs2exe supports universal binaries - haven''t tried it much on OS X.> I had a feeling that people would not like that big of > a build so I built a gem task that uses lipo and generates a i386 and > ppc GEM from the universal one. These single arch GEMS are around > 5.1MB. >Does that include the recent OpenGL check-in? If so that sounds about the same size as the existing separate-built gems (which are ~4.7MB with OpenGL and numerous DataObject etc classes).> With the special split task I wrote this is the process of making a > universal, i386 and ppc gem on any mac. >I would be happy to see this checked in. I''m assuming that if someone wants to build their own OS X gem, and hasn''t built a universal wxWidgets, it will still just build their own platform-native library?> which will result in: > wxruby-1.9.3-universal-macosx.gem 9.6MB > wxruby-1.9.3-i386-macosx.gem 5.1MB > wxruby-1.9.3-ppc-macosx.gem 5.2MB > > As you can see I also cleaned up the gem name so it is easier to > associate with the correct platform. >Be careful. I had something like this checked in when we first started doing public releases of wxRuby2, that stripped the -7.9.0 off the PPC gem. It caused problems with rubygems recognising the match between the user''s arch and the offered gem''s arch. I would stick with [i686|powerpc]-darwin[x.x.x].gem unless you''re very sure.> I will wait for comment before committing the changes but would really > like to go this route which will help me out when it comes time to do > a release.Please do check this in. You''ve been v generous in building the binaries (4 for the last release!). I''m hopefully getting a replacement Mac before too long so maybe we can split it more evenly. alex
> > Now the problem, the resulting GEM is 9.6MB. How does everyone feel > > about downloading a file that size and not using half of what is > > inclosed in it? > Two things: > 1) yes it''s bigger than I would want but, > 2) could be very useful for people who want to bundle and redistribute > universal apps eg using rubyscript2exe. I don''t know whether rs2exe > supports universal binaries - haven''t tried it much on OS X.For #2 how about we just upload all 3 so the user can choose.> Does that include the recent OpenGL check-in? If so that sounds about > the same size as the existing separate-built gems (which are ~4.7MB with > OpenGL and numerous DataObject etc classes).Yes this includes OpenGL, it is a bit misconceiving because I had OpenGL built into the previous gems. I had wxWidgets built with opengl because I was planning on adding the GLCanvas code, I just never got around to it before this week.> I would be happy to see this checked in. I''m assuming that if someone > wants to build their own OS X gem, and hasn''t built a universal > wxWidgets, it will still just build their own platform-native library?Not sure on this one, most likely will need to some kind of check in rakemacosx.rb. I will look into it.> Be careful. I had something like this checked in when we first started > doing public releases of wxRuby2, that stripped the -7.9.0 off the PPC > gem. It caused problems with rubygems recognising the match between the > user''s arch and the offered gem''s arch. > > I would stick with [i686|powerpc]-darwin[x.x.x].gem unless you''re very sure.I changed it back so we will get the following gems: wxruby-1.9.3-universal-darwin.gem wxruby-1.9.3-powerpc-darwin.gem wxruby-1.9.3-i686-darwin.gem I would like to try this before adding back the 8.8.2 or whatever, which changes from one Mac model to the next.> Please do check this in. You''ve been v generous in building the binaries > (4 for the last release!). I''m hopefully getting a replacement Mac > before too long so maybe we can split it more evenly.No problem, with this I can now build OS X intel, ppc, Windows, Linux, Linux 64 all on my MacBook Pro. Apple switching to x86 sure was a good idea. :) I will commit the changes in a minute. Sean
I changed the rake command to: osx_all_gems so to build all 3 gems on OS X just type this: rake WXRUBY_RELEASE=true strip -x lib/wxruby2.bundle rake osx_all_gems WXRUBY_RELEASE=true WXRUBY_VERSION=1.9.3 Sean On 11/1/07, Sean Long <sean.m.long at gmail.com> wrote:> > > Now the problem, the resulting GEM is 9.6MB. How does everyone feel > > > about downloading a file that size and not using half of what is > > > inclosed in it? > > Two things: > > 1) yes it''s bigger than I would want but, > > 2) could be very useful for people who want to bundle and redistribute > > universal apps eg using rubyscript2exe. I don''t know whether rs2exe > > supports universal binaries - haven''t tried it much on OS X. > > For #2 how about we just upload all 3 so the user can choose. > > > > Does that include the recent OpenGL check-in? If so that sounds about > > the same size as the existing separate-built gems (which are ~4.7MB with > > OpenGL and numerous DataObject etc classes). > > Yes this includes OpenGL, it is a bit misconceiving because I had > OpenGL built into the previous gems. I had wxWidgets built with opengl > because I was planning on adding the GLCanvas code, I just never got > around to it before this week. > > > I would be happy to see this checked in. I''m assuming that if someone > > wants to build their own OS X gem, and hasn''t built a universal > > wxWidgets, it will still just build their own platform-native library? > > Not sure on this one, most likely will need to some kind of check in > rakemacosx.rb. I will look into it. > > > Be careful. I had something like this checked in when we first started > > doing public releases of wxRuby2, that stripped the -7.9.0 off the PPC > > gem. It caused problems with rubygems recognising the match between the > > user''s arch and the offered gem''s arch. > > > > I would stick with [i686|powerpc]-darwin[x.x.x].gem unless you''re very sure. > > I changed it back so we will get the following gems: > wxruby-1.9.3-universal-darwin.gem > wxruby-1.9.3-powerpc-darwin.gem > wxruby-1.9.3-i686-darwin.gem > > I would like to try this before adding back the 8.8.2 or whatever, > which changes from one Mac model to the next. > > > Please do check this in. You''ve been v generous in building the binaries > > (4 for the last release!). I''m hopefully getting a replacement Mac > > before too long so maybe we can split it more evenly. > > No problem, with this I can now build OS X intel, ppc, Windows, Linux, > Linux 64 all on my MacBook Pro. Apple switching to x86 sure was a good > idea. :) > > I will commit the changes in a minute. > > Sean >
Sean Long wrote:> I changed the rake command to: osx_all_gems > >Looking at the commit, will having ''-arch ppc -arch i386'' cause problems for people who''ve built a single-arch version of wxWidgets? If so, would it be possible to have it so building os_all_gems sets a flag which sets the arch flags in $extra_cppflags and $extra_ldflags, but otherwise it assumes it''s a single-arch build? re OpenGl and gem size, I think the static linking of wxruby only pulls in those parts of wxWidgets which are referenced in wxRuby. So even if your wx build was with --open-gl, it wouldn''t affect the file size until we had Wx::GLCanvas included. So, basically, nothing to worry about I think :) cheers alex
> Looking at the commit, will having ''-arch ppc -arch i386'' cause problems > for people who''ve built a single-arch version of wxWidgets?Most likely. I added an environment variable WXRUBY_OSX_NO_UNIVERSAL so universal building can be turned off. Go ahead and tweak this if you like, I am running out of time to spend on this and need to move on to other things.> re OpenGl and gem size, I think the static linking of wxruby only pulls > in those parts of wxWidgets which are referenced in wxRuby. So even if > your wx build was with --open-gl, it wouldn''t affect the file size until > we had Wx::GLCanvas included. So, basically, nothing to worry about I > think :)Good to know. Sean
Sean Long wrote:>> Looking at the commit, will having ''-arch ppc -arch i386'' cause problems >> for people who''ve built a single-arch version of wxWidgets? >> > > Most likely. I added an environment variable WXRUBY_OSX_NO_UNIVERSAL > so universal building can be turned off. >I would really rather the default is single-arch, or at least test wx-config to see if it''s a universal build before attempting that. Better for it to be easy for first-time users; we developers know how to use the flags to get exactly the build we want.> Go ahead and tweak this if you like, I am running out of time to spend > on this and need to move on to other things. >Fair enough, will have a look at this later. thanks alex