Maintaining source code for selected ports.

Ryan Schmidt ryandesign at macports.org
Wed Feb 2 09:07:44 PST 2011


On Feb 2, 2011, at 09:40, Ben Tompkins wrote:

> I apologize if this question has already been answered, but I am new to this board and could not find a way to search
> the archives.

Welcome to MacPorts. To search the archives, I usually just use Google, restricting the results by including "site:lists.macosforge.org" in my query.

> So far I have been running an "easy" binary installation of macports without changing any of the defaults,
> which results in the source code getting deleted following each successful install. Now I would like to download the source code for selected ports, which may or may not have been installed through macports as binaries on my system, for offline browsing.

To clarify: MacPorts is a build-from-source system. There are no binaries provided, except of MacPorts base itself. Any port you install (with only a handful of exceptions amongst our thousands of ports) will have its source downloaded and compiled, then the result installed, then the work directory deleted. The distfiles (the original source tarballs) are kept elsewhere, so they are not automatically deleted.

> I see that there is a system wide option (portautoclean [default=yes]), apparently to prevent macports from cleaning any source/intermediate files for all future installs, but this strikes me as somewhat heavy-handed, and I don't like the idea of habitually modifying a system-wide configuration file according as I do or do not want to keep the source code for a given port. Of course, if that is indeed the best and/or only way to preserve the source code for selected ports, then I will do it, but I suspect strongly that there is a better way and seek guidance regarding this issue.

If you want to keep the work directory (containing the source and build products, and the destroot) only for particular port runs, supply the -k ("keep") flag, as in:

sudo port -k install portname

See "man port" for more options that you might like to use in other circumstances.

Since MacPorts keeps the distfiles elsewhere, you can extract the source code from them yourself, to any location you like, if you just want to take a look at the original source. The distfiles are in /opt/local/var/macports/distfiles/portname.




More information about the macports-users mailing list