Howdy do all you out there in interland. This one is mostly for A. L. to get her to stop pouting.
Today, boys and girls, I'll be speaking about macports. Macports is a ports-like package management thing
for OS X. For all my arch linux peeps, it's like the AUR for PKGBUILDs, but you need privileges to check in. It's both easy to use and easy to break. Er, easy to contribute to I meant. These contributions are known as Portfiles
; text files defining various things necessary to compile your software of interest.
It's so easy to use I can show you how to make your own Portfile in five easy steps.
Step 1: Create a Portfile!
This is easier with a template and as it happens I have one lying around. Here, have this and rename it to Portfile
.
# $Id$ PortSystem 1.0 name version categories maintainers nomaintainer description long_description ${description} platforms darwin homepage master_sites use_bzip2 yes checksums md5
Step 2: Fill in the values!
# $Id$ PortSystem 1.0 name choqok version 0.4 categories kde kde4 maintainers nomaintainer description A Free/Open Source micro-blogging client for KDE. long_description ${description} platforms darwin homepage http://choqok.ospdev.net/ master_sites http://mirror.lfeo.org/${name}/${name}/${version}/ use_bzip2 yes checksums md5
Step 3: Add dependencies and configure arguments!
# $Id$ PortSystem 1.0 name choqok version 0.4 categories kde kde4 maintainers nomaintainer description A Free/Open Source micro-blogging client for KDE. long_description ${description} platforms darwin homepage http://choqok.ospdev.net/ master_sites http://mirror.lfeo.org/${name}/${name}/${version}/ use_bzip2 yes checksums md5 configure.args-append ../${distname}We didn't have any dependencies for choqok, or did we?
Step 4: Add the magic!
# $Id$ PortSystem 1.0 PortGroup kde4 1.0 name choqok version 0.4 revision 0 categories kde kde4 maintainers nomaintainer description A Free/Open Source micro-blogging client for KDE. long_description ${description} platforms darwin homepage http://choqok.ospdev.net/ master_sites http://mirror.lfeo.org/${name}/${name}/${version}/ use_bzip2 yes checksums md5 configure.args-append ../${distname}
Step 5: Add the checksums!
# $Id$ PortSystem 1.0 PortGroup kde4 1.0 name choqok version 0.4 revision 0 categories kde kde4 maintainers nomaintainer description A Free/Open Source micro-blogging client for KDE. long_description ${description} platforms darwin homepage http://choqok.ospdev.net/ master_sites http://mirror.lfeo.org/${name}/${name}/${version}/ use_bzip2 yes checksums md5 d460f54b7bbaa47e3a669b72e1a2a760 \ sha1 b1c61ae23dd911620b0357df47275e96e5d61e54 \ rmd160 7e7940ff161488a497f9c54aa73e91b0c2096f72 configure.args-append ../${distname}
Too fast for you? No worries! We can go over it again.
To get the md5 sum you can download the tarball and use an md5 utility like md5
or md5sum
. You can also run sudo port -d configure
in the directory containing your Portfile. This assumes you have macports installed already. This will tell you that you have a checksum missing and conveniently spit out a variety of them for you: sha1, rmd160 and md5.
The magical PortGroup kde4 1.0
line does a variety of things for us. All of which can be seen in the kde4-1.0.tcl file. It sets up values common to most, if not all, KDE4 software. Without it a koffice2 portfile would go from looking like this to something like this. Even worse, individual portfile authors would need to change multiple portfiles each time some common option needed to be added or changed. The portgroups are a life and time saver. My gift to you, since the kde portfiles we have now are the only ones I'm concerned with. (hint, hint people who keep on asking for digikam) :-)
For something with dependencies here's an example from ktorrent:
# $Id$ PortSystem 1.0 PortGroup kde4 1.0 name ktorrent version 3.2 categories kde kde4 maintainers nomaintainer description KDE4 bittorrent client. long_description Bittorrent client for KDE4 supporting a variety of \ features such as uPNP. platforms darwin homepage http://www.kde.org master_sites http://ktorrent.org/downloads/${version}/ use_bzip2 yes checksums md5 e215de7a711b3f9c33044bf97a6d8bfb \ sha1 7cc7c50f8860ef31aca3c93f65eee131cc84c968 \ rmd160 e04cf261b22f191f6bda4bccb8b56fdcd734b944 depends_lib-append port:kdebase4-runtime \ port:qca port:gmp configure.args-append ../${distname} \ -DQCA2_LIBRARIES=${prefix}/lib/libqca.2.dylib \ -DQCA2_INCLUDE_DIR=${prefix}/include/QtCrypto
Independent kde apps only need to depend on kdebase4-runtime. That pulls in kdelibs which pull in qt4 and blah, blah, blah. Having said that, choqok should definitely depend on kdebase4-runtime too. Lookit that! iBlogged a bugfix. ahem
So there it is: Creating a Portfile in 20 easy steps.
Caveats: This won't work on OS X.4 because Apple hasn't release their version of gcc-4.2 isn't on Tiger, and no one except me has gotten it to work via manual installation. The solution: Fink (RangerRick to the rescue!)