symlinks

Mark Brethen mark.brethen at gmail.com
Fri Dec 30 14:34:27 PST 2011


On Dec 30, 2011, at 3:08 PM, Ryan Schmidt wrote:

> 
> On Dec 30, 2011, at 13:55, Mark Brethen wrote:
> 
>> When should sym-links be created? post-destroot? post-activate? If post-destroot, will the links break after activation?
> 
> It depends on what you're trying to do. Without more context, the answer is probably post-destroot, assuming you want to create symlinks that get installed by the port. Creating symlinks or anything else in post-activate would not register them to the port (they would not be removed at port uninstall time) so that's not usually what you want.
> 
> The links won't break if you create them correctly. For example, either create a relative symlink, or create an absolute symlink pointing to its final location (i.e. not pointing to its location in the destroot). For example:
> 
> 
> post-destroot {
> 	ln -s bar ${destroot}${prefix}/bin/foo
> }
> 
> (creates the symlink ${destroot}${prefix}/bin/foo (which will, after activation, be located at ${prefix}/bin/foo) which points to bar in the same directory, using a relative path; this is usually preferred)
> 
> 
> post-destroot {
> 	ln -s ${prefix}/bin/bar ${destroot}${prefix}/bin/foo
> }
> 
> (same as above, except the symlink refers to ${prefix}/bin/bar by the absolute path it will have after activation; use this if you cannot reliably construct a relative path, for example if you're linking from something in ${prefix} to something in ${applications_dir} or vice versa, since you don't know if the user has customized those locations)
> 
> 
> post-destroot {
> 	ln -s ../libexec/${name}/foo ${destroot}${prefix}/bin/foo
> }
> 
> (creates the symlink ${destroot}${prefix}/bin/foo which points to the relative path ../libexec/${name}/foo)
> 
> 
> 


The CSL Reduce includes a font directory, which it requires to be in the same directory as the executable. I'm going to put the font directory in ${destroot}${prefix}/share/${name}/fonts with a symlink of this directory in the same directory as reduce. The relative symlink should work.

Thanks,

Mark






More information about the macports-dev mailing list