Clues for the Clueless?

Scott Haneda talklists at newgeo.com
Sat Oct 17 16:20:27 PDT 2009


On Oct 17, 2009, at 11:02 AM, Michael Crawford wrote:

> I'd like to take a stab at building Ogg Frog as a MacPort.  But I
> don't have the first clue as to how to create a port file from
> scratch.  Is there a "Getting Started" tutorial somewhere?

I was very much in the same boat as you.  I needed a software, the  
port for it was old and outdated, to the point it needed to be redone,  
so I decided to give it a shot.

> There are several dependencies, some of which might already be in
> MacPorts - the various audio codecs, libz, and image format libraries.
> I will need to make a new portfile for ZooLib, and then one for Ogg
> Frog itself that pulls all these pieces together.
>
> Given all those dependencies, my final port file may need to be rather
> advanced.  I would also like to support it being built as both a Mac
> OS X Carbon application as well as an X11 application.  ZooLib can be
> built both ways on the Mac, so I'm sure I could do so with Ogg Frog.

I few people have said to me, I probably did not chose the best port  
to learn from.  I suggest you not get into that same situation, as the  
alternative is 20 minutes to get up to speed, versus the method I  
chose, which was months to get up to speed in my spare time.  I also  
spend a lot of time on the list asking questions.  Questions were  
graciously answered, as usual, however, I could have done better to  
start simpler, and then the more complex port would have made more  
sense.

Here is my suggestion, if I had to do it all over again.

Set up your local port repo
http://guide.macports.org/#development.local-repositories
Learn that enough that you understand what it is, and how it works  
with regards to it's impact on the order in which ports take  
precedence against a local repo.

Hit up CPAN and see if you can find a perl module that interests you  
in some way, or that you think would be of value to the community.   
Also look through the bug tracker, and see if there are any perl  
module requests.

With a known perl module in mind, go copy an existing perl module  
portfile into your local repo, edit it, and see if you can get it to  
work.

At this point, you should have made your first portfile.  Look back to  
CPAN, or the docs of that module, to see if there are any unit tests  
you can run.  Run what tests you can to make sure your module is  
working.

Post it to trac so you can learn the procedure for submitting portfiles.

This is all pretty good, as it is probably the simplest way to get  
into a result of making a working portfile, helping out the community,  
and learning the process.

With that basic one out of the way, I would look to an interim port  
file.  Something that compiles, something that has some options and  
perhaps some config files.  Ideally, something you need or are curious  
about, that you know works on the Mac, but has never been added to  
MacPorts.

See what you can do to get that up and running.  This will teach you  
about the different phases of a portfile, something that most of the  
perl modules need not know.

 From there, you should have a basic enough grasp on how things work,  
that while you will probably struggle as I did with more complex  
ports, you will at least know the correct questions to ask.

Hope these suggestions help, and are not too far off the mark from  
what others would agree with.
-- 
Scott * If you contact me off list replace talklists@ with scott@ *



More information about the macports-dev mailing list