how to generate the checksums with CMake?

Joshua Root jmr at macports.org
Fri Feb 17 23:44:54 PST 2012


On 2012-2-18 18:31 , Erik Sjölund wrote:
> Hi,
> I am trying to create a Portfile for some software that is using the
> build system CMake.
> I was wondering if anyone managed to automatically create the Portfile
> from within CMake.
> 
> In CMake I can do "make package_source" to create a source tar.gz
> file. I then need to compute some checksums of that file. These
> checksums then need to be inserted into the Portfile at the line
> starting with "checksums".
> 
> It would be nice if could create a make target
> 
> make package_source_and_portfile
> 
> Do you have any idea of how to do that?

I have no idea if cmake has an internal capability to compute checksums;
and that would be a question for their lists/forums/whatever.

You can of course run external tools, so something along these lines
would do it:

echo "checksums rmd160 `openssl dgst -rmd160 $(distfile_path) | cut -d '
' -f 2` \\" >> Portfile
echo "          sha256 `openssl dgst -sha256 $(distfile_path) | cut -d '
' -f 2`" >> Portfile

- Josh


More information about the macports-dev mailing list