Changes between Version 19 and Version 20 of snc
- Timestamp:
- Feb 6, 2009, 1:59:42 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
snc
v19 v20 6 6 7 7 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}}}. 8 === When to Use Patch Files === 9 There are 4 basic rules to follow when considering patch files. 10 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. 8 === Steps to Decide When to Use Patch Files === 9 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. 11 10 1. If there is another flag you need to use instead, overwrite {{{configure.pre_args}}}. 12 11 1. If there is no flag to do this, try an environment variable (e.g.,{{{ configure.env-append PREFIX=${prefix} }}}). … … 14 13 === Do Not Hardcode /opt/local === 15 14 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. 15 === Steps to Installing to Destroot === 16 1. Do nothing: MacPorts already puts{{{ DESTROOT=${destroot}${prefix} }}}into {{{destroot.destdir}}} and most Makefiles support this. 17 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} }}}). 18 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. 19 1. Sometimes in {{{post-destroot}}} you have to{{{ reinplace s|${destroot}|| somefiles }}}because the destroot path has gotten inserted into them. 16 20 == Portindex == 17 21 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.