Writing a port for a Mono executable (Pash)

Ryan Schmidt ryandesign at macports.org
Fri Nov 13 23:04:25 PST 2015


This is a question about Portfile development, so it belongs on the macports-dev mailing list. I'm Cc'ing that list now. If you're not subscribed to that list yet, please subscribe. If you reply, please remove macports-users from the recipient list.


On Nov 13, 2015, at 7:14 PM, Ludwig wrote:
> 
> I'm writing a port for Pash, a Power Shell clone for Mono, and am stuck as
> described here: https://trac.macports.org/ticket/49656#comment:4
> 
>> Pash builds successfully via Mono’s xbuild tool, but it doesn’t have a “make
>> install” equivalent, it leaves the executable in the project hierarchy at
>> Source/PashConsole/bin/Debug/Pash.exe.
> 
>> Furthermore, it’s not a “normal” executable, it’s a “PE32 executable
>> (console) Intel 80386 Mono/.Net assembly, for MS Windows,” meaning it has to
>> be launched via Mono, e.g. mono path/to/Pash.exe.
> 
>> AFAICT none of the other ports in the mono category use xbuild, so I don’t
>> have a model to follow here.

Since xbuild is a program installed by a MacPorts port, you should run it by its absolute path, ${prefix}/bin/xbuild, to ensure there are no problems if the user has a nonstandard binpath set in macports.conf.


>> I guess the right thing to do would be a
>> post-install script creating a one-line launcher shell script, which is what
>> would be installed in ${prefix}/bin.

Right, except it would be a post-destroot block, not post-install. You would install the script into ${destroot}${prefix}/bin, and at install time, MacPorts will place it in ${prefix}/bin.


>> But I don’t know where to put the
>> project directory, which is full of DLLs and stuff that the executable
>> presumably depends on, and as such should be kept in its entirety.
>> ${workpath} and ${portpath} are subject to being cleaned, right? What is the
>> proper location for persistent files?

Somewhere in ${prefix}. Perhaps ${prefix}/libexec/${subport} would be appropriate.


>> Attached what I’ve got of the Portfile so far.

There should be no comma between multiple values for an option, for example in the license line.


>> The checksums are for the
>> tarball I rolled from the source, do I attach that here or…?

You shouldn't manually roll a tarball. The port should download from the officially available stable tarballs. If there are none, ask the developers to create one. If they won't, you can download from their source repository or, since this project is hosted on github, you should use the github portgroup and download from github's automatically-generated tarballs. Documentation is in the github portgroup file.


>> Sorry if these are dopey questions, this is my first real attempt at
>> packaging a port.

These are good questions, please ask on macports-dev if you have other questions about Portfile writing.



More information about the macports-dev mailing list