[BUG](s) Ruby 185 incompatibility/issues with openssl

hi,

i'd originally posted this @:

    http://trac.macosforge.org/projects/macports/ticket/4103

on review, it's not clear 2 me if/how that project's fixes get back into
main trunk dev.

soooo, reposting here.

as of 23 Sep 06,

building, ruby 1.8.5 "out-of-the-box" on osx 10.4.7 w/ external instance of
openssl
0.9.8c,

though 'make' is successful, 'make install' dies (still?) @:

...
install -c -p -m 0644 ruby.1 /usr/local/man/man1/ruby.1
./miniruby ./ext/extmk.rb --dest-dir="" --make="make" --mflags=""
--make-flags="" --extout=".ext" --extension --extstatic -- install
cp -r ./.ext/. /usr/local/ruby/lib/ruby/1.8
Generating RDoc documentation
./miniruby ./runruby.rb --extout=.ext -- "./bin/rdoc" --all --ri --op
"/usr/local/ruby/share/ri/1.8/system" "."
dyld: NSLinkModule() error
dyld: Symbol not found: _ENGINE_load_aep
  Referenced from: /usr/ports/ruby-1.8.5/.ext/powerpc-darwin8.7.0
/openssl.bundle
  Expected in: flat namespace

per earlier post, noting in:

    /usr/ports/ruby-1.8.5/ext/openssl/ossl_engine.c

the current check (@ ~ line#64) for:

    #ifndef OPENSSL_NO_STATIC_ENGINE

and, hence, adding to CPPFLAGS:

    -DOPENSSL_NO_STATIC_ENGINE

and, after 'make', despite:

    setenv LDFLAGS "-L/usr/local/lib -lreadline -L/usr/local/ssl/lib -lssl
-lcrypto"
    setenv CPPGLAGS "-I/usr/local/include -I/usr/local/ssl/include
-DOPENSSL_NO_STATIC_ENGINE"

this is still required to pick up external openssl:

    /usr/ports/ruby-1.8.5/ext/openssl/Makefile

···

==========================================
    @82
    --- LIBS = $(LIBRUBYARG_SHARED) -lssl -lcrypto -lpthread -ldl
-lcrypt -lobjc
    +++ LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lcrypt -lobjc
-L/usr/local/ssl/lib -lssl -lcrypto
    ==========================================

then, a subsequent:

    % cd /usr/ports/ruby-1.8.5/ext/openssl
    % make clean
    % make
    % cd /usr/ports/ruby-1.8.5
    % rm -rf /usr/local/ruby
    % make install

finishes successfully:

    ...
    Generating RI...

    Files: 494
    Classes: 1369
    Modules: 721
    Methods: 7750
    Elapsed: 758.811s
    %

and checking:

    % rehash
    % which ruby
        /usr/local/ruby/bin/ruby
    % ruby --version
        ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0]

    % otool -L /usr/local/ruby/lib/ruby/1.8/powerpc-darwin8.7.0/openssl.bundle

        /usr/local/ruby/lib/libruby.dylib (compatibility version 1.8.0,
current version 1.8.5)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.1.6)
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current
version 227.0.0)
        /usr/local/ssl/lib/libssl.0.9.8.dylib (compatibility version 0.9.8,
current version 0.9.8)
        /usr/local/ssl/lib/libcrypto.0.9.8.dylib (compatibility version
0.9.8, current version 0.9.8)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)

    % otool -L /usr/local/ruby/bin/ruby
        /usr/local/lib/libreadline.5.1.dylib (compatibility version 5.0.0,
current version 5.1.0)
        /usr/local/ssl/lib/libssl.0.9.8.dylib (compatibility version 0.9.8,
current version 0.9.8)
        /usr/local/ssl/lib/libcrypto.0.9.8.dylib (compatibility version
0.9.8, current version 0.9.8)
        /usr/local/ruby/lib/libruby.dylib (compatibility version 1.8.0,
current version 1.8.5)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.1.6)
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current
version 227.0.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)

all, now, looks OK.

richard