Help language development. Donate to The Perl Foundation

MsgPack cpan:AZAWAWI last updated on 2017-11-08
use v6;

unit class Build;

method build($workdir) {

    if $* {
        # On windows, let us install the bundled DLL version, module installer
        # will copy the DLL for us.
        die "Windows is not supported at the moment";

        # Success
        return 1;

    # on Unix, let us try to make it
    my $makefiledir = "$workdir/src";
    my $destdir = "$workdir/resources";

    # Create empty resources files for all platforms so that package managers
    # do not complain
    for <dll dylib so> -> $ext {

    my @libs = <msgpackc>;
    my $libs = { "-l$_" } ).join(' ');
    my $libname = sprintf($*VM.config<dll>, "msgpack-perl6");
    if $* eq "macosx" {
        shell("gcc -Wall -shared -fPIC -I/usr/local/include -L/usr/local/lib -o $destdir/$libname src/libmsgpack-perl6.c $libs");
    } else {
        shell("gcc -Wall -shared -fPIC -o $destdir/$libname src/libmsgpack-perl6.c $libs");