[MacOS X][ANN] RAliasFile Initial Release

RAliasFile is aimed to resolve alias file on Mac OS X using a C
extension to ruby.

see <http://rubyforge.org/frs/?group_id=2129&release_id=6684>

I'd be glad hearing comments upon it.

next plan :

do a RAliasRecord extension to Ruby

···

--
une bévue

Ok, here we go:

1. The RUBY_PLATFORM test in your extconf.rb file is broken. It will only allow to build the extension for a ruby *built* under 10.4.7. For example, it will fail for a ruby built on 10.4.6 but running under 10.4.7. And the regexp you are using is incorrect to begin with ('.' does not match '.', but any character).

2. You are adding include paths to CFLAGS which you don't need. Only Carbon and CoreFoundation are required, you can remove everything else.

3. Same for LDFLAGS, you only need to link against the Carbon and CoreFoundation frameworks, forget about CoreServices and Foundation.

4. I have no idea how your extension can work, because it really should not. You are defining methods for RAliasFile which is a global variable set to Qnil, instead of defining them for cRAliasFile which you correctly define first. This makes no sense. Remove RAliasFile, you don't need it.

5. Same story for the alias_path global variable, it's totally useless as far as I can tell.

6. Having "version" as an instance method is bogus, you should probably make it a singleton method.

That's after a quick 5mn look, there's probably more to say... :slight_smile:

···

On 30 août 06, at 13:05, Une bévue wrote:

I'd be glad hearing comments upon it.

--
Luc Heinrich - luc@honk-honk.com - http://www.honk-honk.com

Ok, here we go:

1. The RUBY_PLATFORM test in your extconf.rb file is broken. It will
only allow to build the extension for a ruby *built* under 10.4.7.
For example, it will fail for a ruby built on 10.4.6 but running
under 10.4.7. And the regexp you are using is incorrect to begin with
('.' does not match '.', but any character).

ok, i've corrected that to /powerpc-darwin8\.\d\.\d/

2. You are adding include paths to CFLAGS which you don't need. Only
Carbon and CoreFoundation are required, you can remove everything else.

3. Same for LDFLAGS, you only need to link against the Carbon and
CoreFoundation frameworks, forget about CoreServices and Foundation.

ok corrected

4. I have no idea how your extension can work, because it really
should not. You are defining methods for RAliasFile which is a global
variable set to Qnil, instead of defining them for cRAliasFile which
you correctly define first. This makes no sense. Remove RAliasFile,
you don't need it.

5. Same story for the alias_path global variable, it's totally
useless as far as I can tell.

ok too...

6. Having "version" as an instance method is bogus, you should
probably make it a singleton method.

fixed ))

thanks a lot for your help, i now have a 0.0.2 version ...

···

Luc Heinrich <luc@honk-honk.com> wrote:
--
une bévue

That won't work on my Mac, will it? (Checking.) Nope. My platform is
i686-darwin8.7.1. So unless you're *only* wanting this to work on
older Macs, you'll need to have /.*-darwin8.*/ (if darwin8 is the
right version; darwin may be the right choice).

I haven't *tried* it, yet -- too much work to do today -- but just a note.

-austin

···

On 8/30/06, Une bévue <pere.noel@laponie.com.invalid> wrote:

ok, i've corrected that to /powerpc-darwin8\.\d\.\d/

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
               * austin@halostatue.ca * You are in a maze of twisty little passages, all alike. // halo • statue
               * austin@zieglers.ca

fine thanks for this point, i can change it quickly.

···

Austin Ziegler <halostatue@gmail.com> wrote:

That won't work on my Mac, will it? (Checking.) Nope. My platform is
i686-darwin8.7.1. So unless you're *only* wanting this to work on
older Macs, you'll need to have /.*-darwin8.*/ (if darwin8 is the
right version; darwin may be the right choice).

I haven't *tried* it, yet -- too much work to do today -- but just a note.

--
une bévue

following a try-out of Lon Baker on <1DE858BB-9002-48E0-AACC-DC37AD646FA2@speedymac.com> ([Rubycocoa-talk] mailing list ) changing what u've suggested above is ok.

best,

Yvon

only one line to change in ext/extconf.rb :

change line 6 (just after "case RUBY_PLATFORM") to :

   when /.*-darwin8.*/

that's all to do ))

ext/extconf.rb becomes :

---- ext/extconf.rb ----------------------------------------------------
#!/usr/bin/env ruby
# Loads mkmf which is used to make makefiles for Ruby extensions
require 'mkmf'

case RUBY_PLATFORM
   when /.*-darwin8.*/
     $CFLAGS << " -I /System/Library/Frameworks/Carbon.framework/Headers "
     $CFLAGS << " -I /System/Library/Frameworks/CoreFoundation.framework/Headers "
     $CFLAGS << " -fnested-functions "

     $LDFLAGS << " -framework CoreFoundation "
     $LDFLAGS << " -framework Carbon "

     # Give it a name
     extension_name = 'raliasfile'

     # The destination
     dir_config(extension_name)

     # Do the work
     create_makefile(extension_name)
   else
     puts "This Ruby extension needs MacOS X 10.4+"
   end

···

Le 30 août 06 à 22:18, Austin Ziegler a écrit :

That won't work on my Mac, will it? (Checking.) Nope. My platform is
i686-darwin8.7.1. So unless you're *only* wanting this to work on
older Macs, you'll need to have /.*-darwin8.*/ (if darwin8 is the
right version; darwin may be the right choice).

------------------------------------------------------------------------

Ok now let's push this a bit further: why are you limiting the compilation to Tiger ? You don't seem to use any Tiger specific call, not to mention the fact that you are limiting compilation to Tiger *only* so Leopard users won't be able to compile it either. Just remove the test, it's useless :slight_smile:

···

On 1 sept. 06, at 07:43, Yvon Thoraval wrote:

change line 6 (just after "case RUBY_PLATFORM") to :

  when /.*-darwin8.*/

--
Luc Heinrich - luc@honk-honk.com - http://www.honk-honk.com

i just want a user of not Mac OS X to be advice this prog works only on
Mac OS X.

that's the "8" preventing compilation over Leopard ?

···

Luc Heinrich <luc@honk-honk.com> wrote:

Ok now let's push this a bit further: why are you limiting the
compilation to Tiger ?

--
une bévue

i just want a user of not Mac OS X to be advice this prog works only on
Mac OS X.

Ah, good point.

that's the "8" preventing compilation over Leopard ?

I would expect so, yes.

···

On 1 sept. 06, at 18:25, Une bévue wrote:

--
Luc Heinrich - luc@honk-honk.com - http://www.honk-honk.com

ok change done ))

i'll upload asap.

Yvon

···

Le 1 sept. 06 à 20:59, Luc Heinrich a écrit :

I would expect so, yes.