This splits MODRUBY_WANTLIB from MODRUBY_LIB_DEPENDS.  This has some
fallout for ports that use MODRUBY_LIB_DEPENDS, which will be updated
if/when it goes in.

This adds handling for CONFIGURE_STYLE="ruby gem ext" to ruby.port.mk.
This configure style will be used for gems with C extensions, with the
following changes:

SHARED_ONLY is added automatically.  gems with C extensions create .so
files, so they can only be used on archs that support shared libraries.

c, m, and MODRUBY_WANTLIB are added to WANTLIB.  MODRUBY_LIB_DEPENDS is
also added to LIB_DEPENDS, but I'm not sure if that is necessary.  I
believe that all ruby C extension gems need c, m, and MODRUBY_WANTLIB,
and since many C extension gem ports only have WANTLIB=c m, this can
simplify port makefiles by making it so you don't have to add a WANTLIB
line manually.

Here's the changes to ruby.port.mk and an example for ruby-id3lib.
sthen@ thinks this is OK, but we agree that more people should see this
first.  Thoughts?

Jeremy

Index: ruby.port.mk
===================================================================
RCS file: /cvs/ports/lang/ruby/ruby.port.mk,v
retrieving revision 1.31
diff -u -p -r1.31 ruby.port.mk
--- ruby.port.mk        24 Oct 2010 09:16:13 -0000      1.31
+++ ruby.port.mk        24 Oct 2010 11:32:07 -0000
@@ -14,7 +14,8 @@ RSPEC=                        ${LOCALBASE}/bin/spec
 
 MODRUBY_REGRESS?=
 
-MODRUBY_LIB_DEPENDS=   
ruby${MODRUBY_BINREV}:ruby->=1.8,<=1.9:lang/ruby/${MODRUBY_REV}
+MODRUBY_WANTLIB=       ruby${MODRUBY_BINREV}
+MODRUBY_LIB_DEPENDS=   ${MODRUBY_RUN_DEPENDS}
 MODRUBY_RUN_DEPENDS=   :ruby->=1.8,<=1.9:lang/ruby/${MODRUBY_REV}
 MODRUBY_BUILD_DEPENDS= ${MODRUBY_RUN_DEPENDS}
 
@@ -71,6 +72,11 @@ EXTRACT_SUFX=        .gem
 
 BUILD_DEPENDS+=        :ruby-gems->=1.3.7p0:devel/ruby-gems
 RUN_DEPENDS+=  ::devel/ruby-gems
+.  if ${CONFIGURE_STYLE:L:Mext}
+SHARED_ONLY=   Yes
+WANTLIB+=      c m ${MODRUBY_WANTLIB}
+LIB_DEPENDS+=  ${MODRUBY_LIB_DEPENDS}
+.  endif
 
 SUBST_VARS+=   DISTNAME
 
Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/ruby-id3lib/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile    28 Sep 2010 20:12:16 -0000      1.9
+++ Makefile    24 Oct 2010 11:31:42 -0000
@@ -1,7 +1,5 @@
 # $OpenBSD: Makefile,v 1.9 2010/09/28 20:12:16 jeremy Exp $
 
-SHARED_ONLY=   Yes
-
 COMMENT=       Ruby interface to the id3lib C++ library
 
 VERSION=       0.5.0
@@ -19,11 +17,10 @@ PERMIT_DISTFILES_CDROM=     Yes
 PERMIT_DISTFILES_FTP=  Yes
 
 MODULES=       lang/ruby
-WANTLIB=       c id3.>=4 m stdc++ z
-LIB_DEPENDS=   ${MODRUBY_LIB_DEPENDS} \
-               ::audio/id3lib
+WANTLIB=       id3.>=4 stdc++ z
+LIB_DEPENDS=   ::audio/id3lib
 
-CONFIGURE_STYLE=       ruby gem
+CONFIGURE_STYLE=       ruby gem ext
 
 REGRESS_DEPENDS=       :${PKGNAME}:${BASE_PKGPATH}
 MODRUBY_REGRESS=       rake 

Reply via email to