[MacPorts] snc modified

MacPorts noreply at macports.org
Fri Feb 6 05:59:43 PST 2009

Changed page "snc" by snc at macports.org from*
Page URL: <http://trac.macports.org/wiki/snc>
Diff URL: <http://trac.macports.org/wiki/snc?action=diff&version=20>
Revision 20
Comment: destroot tips

Index: snc
--- snc (version: 19)
+++ snc (version: 20)
@@ -5,14 +5,18 @@
 Unfortunately, there are useful things that end up buried in the Guide. For example, if you're developing against mysql5 (where multiple packages might create the mysql5 binary), you'd want to [http://guide.macports.org/#reference.dependencies.types depend on the binary] instead of a specific port.  This is accomplished in [source:trunk/dports/www/php5/Portfile#L264 php5] through {{{depends_lib-append path:bin/mysql_config5:mysql5}}}.  '''Note:''' The trailing mysql5 indicates which port to be installed if the binary cannot be found.
 Also hidden (to the point where I cannot find it) is how to write wrapper scripts; [source:trunk/dports/x11/wine/ wine] is considered the poster-portfile. Another example is [source:trunk/dports/math/pspp/ pspp]. The scripts should be included in the port's {{{files}}} directory and dynamically modified through the portfile by the [http://guide.macports.org/#reference.tcl-extensions tcl extensions], {{{xinstall}}} and {{{reinplace}}}.
-=== When to Use Patch Files ===
-There are 4 basic rules to follow when considering patch files.
- 1. Do nothing, because MacPorts already puts{{{ --prefix=${prefix} }}}in {{{configure.pre_args}}} and most software uses configure scripts and most configure scripts understand that flag.
+=== Steps to Decide When to Use Patch Files ===
+ 1. Do nothing: MacPorts already puts{{{ --prefix=${prefix} }}}in {{{configure.pre_args}}} and most software uses configure scripts and most configure scripts understand that flag.
  1. If there is another flag you need to use instead, overwrite {{{configure.pre_args}}}.
  1. If there is no flag to do this, try an environment variable (e.g.,{{{ configure.env-append PREFIX=${prefix} }}}).
  1. If no environment variable exists for this, then patch.
 === Do Not Hardcode /opt/local ===
 Speaking of {{{reinplace}}}, '''do not''' hardcode {{{/opt/local}}} anywhere! Instead, use {{{reinplace}}} to replace things like {{{${prefix} }}}and {{{${x11prefix} }}}and other variables that can be different on users' systems.
+=== Steps to Installing to Destroot ===
+ 1. Do nothing: MacPorts already puts{{{ DESTROOT=${destroot}${prefix} }}}into {{{destroot.destdir}}} and most Makefiles support this.
+ 1. If there is another variable you need to use, overwrite {{{destroot.destdir}}} (perhaps{{{ destroot.destdir INSTALL_ROOT=${destroot}${prefix} }}}or{{{ destroot.destdir PREFIX=${destroot}${prefix} }}}).
+ 1. If the Makefile doesn't support {{{DESTROOT}}}, request from the author that they do. If they won't or you can't wait for their fix, patch the Makefile to support {{{DESTROOT}}}, or override the destroot phase entirely and {{{xinstall}}} the files into place in the portfile.
+ 1. Sometimes in {{{post-destroot}}} you have to{{{ reinplace s|${destroot}|| somefiles }}}because the destroot path has gotten inserted into them.
 == Portindex ==
 Once you've created your portfile, it's best to test it with your copy of MacPorts.  The first step is to create a [http://guide.macports.org/#development.local-repositories local portfile repository] for testing. For this, I suggest creating the directory {{{~/ports}}}.   Inside this new directory, you should run {{{portindex}}} which will create the repository index of everything following the {{{./group/port/Portfile}}} heirarchy.  '''Note:''' This command should be run everytime you make changes as it will include the new index data for MacPorts. Also watch out for any errors it reports, which stop the portfile from showing up in MacPorts.
 == Port Info ==


* The IP shown here might not mean anything if the user or the server is
behind a proxy.

MacPorts <http://www.macports.org/>
Ports system for Mac OS

This is an automated message. Someone at http://www.macports.org/ added your email
address to be notified of changes on snc. If it was not you, please
report to .

More information about the macports-changes mailing list