From: ptkwt@... (Phil Tomson) Date: 2004-05-07T03:38:58+09:00 Subject: Re: miniruby.exe & statically linked ruby.exe (Windows) In article , daz wrote: > >Phil Tomson wrote: > >> I've been trying to build a statically linked ruby.exe on windows using >> MSVC. I think I might have been successful, ... > >I think so, too. > >> I'm assuming (because of the name) that miniruby.exe is missing something. >> Is this true, and if so, what's missing? > >I'm going by the bcc build but, having glanced at the ms makefiles, there >doesn't seem to be any difference. With that caveat; it's only missing >the resource file (.res) which might be better added in. That'll make >version information available on the "Properties" sheet and to any other >utilities that look for it. > >So, looking at these two sections ... > >miniruby$(EXEEXT): > @echo. $(LIBS) > $(PURIFY) $(CC) $(MAINOBJ) $(LIBRUBY_A) $(LIBS) -Fe$@ $(LDFLAGS) > >$(PROGRAM): $(RUBY_INSTALL_NAME).res > $(PURIFY) $(CC) $(MAINOBJ) $(RUBY_INSTALL_NAME).res \ > $(OUTFLAG)$@ $(LIBRUBYARG) $(LDFLAGS) $(XLDFLAGS) > >... to give miniruby (or your version) a resource, change: > > $(PURIFY) $(CC) $(MAINOBJ) $(LIBRUBY_A) $(LIBS) -Fe$@ $(LDFLAGS) >to: > $(PURIFY) $(CC) $(MAINOBJ) $(LIBRUBY_A) $(LIBS) >$(RUBY_INSTALL_NAME).res -Fe$@ $(LDFLAGS) > >(It appears that MSVC will accept the .res file almost anywhere on the >compile line ??) > >> [Actually, I just tried to run my script with miniruby.exe and found that >> it couldn't require net/http. Same goes for the statically linked ruby.exe >> I created, so it's apparently equivilent to miniruby.exe] > >It is. > >Ruby.exe & miniruby.exe build their loadpaths relative to the directory >they are in (can be overridden with environment variables). I copied >miniruby to an empty dir and ran this from the Start/Run box: > > C:\tmp\miniruby.exe -e"puts $:; gets" > >resulting in: > >C:/TMP/lib/ruby/site_ruby/1.9 >C:/TMP/lib/ruby/site_ruby/1.9/i586-bccwin32 >C:/TMP/lib/ruby/site_ruby >C:/TMP/lib/ruby/1.9 >C:/TMP/lib/ruby/1.9/i586-bccwin32 >. Ah... that's what's going on. > >Any files your users want to require will need to be in that relative >directory structure. As you know, '.' represents the current directory. > >If you want to bundle statically linked extensions, I think you just >uncomment the corresponding line in ext\Setup before building. That's true on Linux, I suppose it probably also works that way for the Windows build as well. > >> Can anyone give me any clues about building a statically linked ruby.exe >> on Windows using the microsoft compiler? >> > >No, sorry; ask Phil T. :-) Good to know that I got it to work. Why is it that the makefile creates both miniruby.exe(statically linked) and ruby.exe (dynamically linked) that are essentially equivilent? Phil