Creating a port where a dependency requires the port's source

Ryan Schmidt ryandesign at macports.org
Sat Nov 25 11:53:56 PST 2006


On Nov 25, 2006, at 11:47, Ashley Moran wrote:

> This is my first time writing a Portfile.  I'm trying to write a  
> port so I can install Ruby with the oniguruma regular expression  
> library.  I've created a folder for the test ports, and added  
> file:///Users/ashleymoran/Documents/Development/dports-dev to /opt/ 
> local/etc/ports/sources.conf .
>
> The change to the ruby port is just a variant, but I've created a  
> new port for the time being:
> ~/Documents/Development/dports-dev/lang/ruby-oniguruma/Portfile:
>   ... existing ruby portfile...
>   variant oniguruma {
>     depends_lib-append port:oniguruma2
>   }
>
> And I've made a new port for the oniguruma 2.x:
>
> ~/Documents/Development/dports-dev/devel/onigurama2/Portfile:
>   # $Id: $
>   PortSystem        1.0
>   name              oniguruma2
>   version           2.5.8
>   categories        devel
>   maintainers       work at ashleymoran.me.uk
>   description       A regular expressions library.
>   long_description \
>       Oniguruma is a regular expressions library in which \
>       different character encoding can be specified for every  
> expression. \
>       Version 2.x is for Ruby 1.8
>   homepage          http://www.geocities.jp/kosako3/oniguruma/
>   master_sites      http://www.geocities.jp/kosako3/oniguruma/archive/
>
>   distname          onigd2_5_8
>   checksums   md5   82cd47ded85f854149ae620a9fa728e5
>   #configure.args    --with-rubydir=../../lang/ruby-oniguruma/work/ 
> ruby
>   configure.args    --with-rubydir=/opt/local/var/db/dports/build/ 
> _Users_ashleymoran_Documents_Development_dports-dev_lang_ruby- 
> oniguruma/work/ruby
>
>   worksrcdir        oniguruma
>   build.cmd         make 185
>
> Note the hideous configure.args is just my attempt to locate the  
> source of the ruby port.
>
> But this is where I come unstuck.  This is the install process for  
> oniguruma is this:
>   (in oniguruma directory)
>      1. ./configure --with-rubydir=<ruby-source-dir>
>      2. make 185    # for Ruby 1.8.5
>
> But when I do "port build ruby-oniguruma +oniguruma", it seems to  
> go off and build oniguruma *before* it's extracted the ruby source,  
> so there's nothing in the work directory for it to patch.
>
> Has this build pattern occured before?  Is there any way round the  
> order MacPorts uses for building dependencies?  I'm completely new  
> to this so I thought I'd ask for help.

I'm also new to this, so I'll happily defer to anyone else's advice,  
but I believe the answers are:

> Also, regardless of whether it's possible to do it cleanly, I've  
> got two questions about the Portfile above:
>
> 1. how do I calculate the ruby work directory for the line  
> "configure.args --with-rubydir="?

I believe the correct approach is to download the ruby source again  
for the ruby-onigurama port. Precedent for this has been set, by the  
ghostscript port for example, which downloaded its own copy of the  
zlib, libpng and libjpeg sources. However, it looks like this was  
removed when the ghostscript portfile was upgraded from 8.53 to 8.54,  
and I don't know why this was possible, since according to the  
documentation, the sources of these other libraries are still  
required. See:

http://www.ghostscript.com/doc/8.54/Make.htm#Third-party_libraries

Here is the 8.53 version of the ghostscript portfile which shows how  
you can download other sources if you need to:

http://trac.macosforge.org/projects/macports/browser/trunk/dports/ 
print/ghostscript/Portfile?rev=17881


> 2. although I set build.cmd to "make 185", MacPorts uses the build  
> command "make 185 all".  How do you stop this?

I believe you can leave "build.cmd" as it is (the default is "make"  
which is fine) but you change "build.target" to "185" (the default is  
"all"):

build.target	185





More information about the macports-users mailing list