Web Stack source packages
By jyri on Jul 24, 2008
In a previous article I mentioned how easy it was to build one component in Debian by just grabbing the source package and its dependencies.
Earlier this week I was cleaning up the script which builds and produces the Web Stack repository packages and it occurred to me it'd be really easy to enhance it to also publish source packages, so why not. If you've looked at the repository in the last couple days you may have already noticed several \*-source packages.
So let's say you'd like to build nginx on OpenSolaris yourself instead of using the nginx package from the Web Stack repository (maybe you want to change a build flag or something). So now you have one more option on how to do it:
% pfexec pkg install pkg://webstack/nginx-source % pfexec zsh # cd /opt/webstack-source/nginx # make install
If you have your own local IPS repo running you can also easily publish the freshly rebuilt package into it by simply:
# export PKG_REPO=http://myips.example.com:10000 # make publish
(where, of course, the value you set for PKG_REPO is actually the URL to your own local IPS repository)
Then you (or others in your group) could simply try out your rebuild package by installing it from your $PKG_REPO.
Notice that the \*-source package sets all its dependencies such that you can simply type 'make' right away and all the packages (such as compilers and needed libraries) are already in place. You don't have to go through any READMEs to figure out what other packages you need before compiling. Pretty cool! ;-)
Now, admittedly, in some ways this is just a gimmick due to IPS limitations today. For one thing, I had to pick an install location (so I chose /opt/webstack-source/$PKGNAME) because unlike apt, pkg doesn't know abot source packages so there's no convenient way to drop the source into "." which is probably where you really want it. So it also means you then had to become root to build under /opt/webstack-source/ (I might change this to use a dedicated user but still it's not optimal). (Installing the source package into a user image might seem like a workaround but it won't do what you want since then all the dependencies get installed in the wrong place.)
You could of course simply check out the source directly with mercurial and get the same content with the benefit of placing the source tree wherever you want and owned by your uid. The drawback is that in that case you will need to figure out and manuall install all dependencies needed to actually build the source.
So, there's benefits and drawbacks either way. Nonetheless, an interesting experiment!