Help language development. Donate to The Perl Foundation

Math::Libgsl::Combination cpan:FRITH last updated on 2020-02-17
#! /usr/bin/env raku
#Note `zef build .` will run this script
use v6;

class Build {
  need LibraryMake;
  # adapted from deprecated Native::Resources

  #| Sets up a C<Makefile> and runs C<make>.  C<$folder> should be
  #| C<"$folder/resources/lib"> and C<$libname> should be the name of the library
  #| without any prefixes or extensions.
  sub make(Str $folder, Str $destfolder, IO() :$libname!) {
    my %vars = LibraryMake::get-vars($destfolder);
    %vars<LIB-NAME> = ~ $*VM.platform-library-name($libname);
    %vars<LIB-LDFLAGS> = '-lgsl';
    %vars<LIB-CFLAGS>  = '-I/usr/include/gsl';
    s/:s '-DNDEBUG'// for %vars<CCFLAGS>, %vars<LDFLAGS>;

    LibraryMake::process-makefile($folder, %vars);

  method build($workdir) {
    my $destdir = 'resources/libraries';
    mkdir $destdir;
    make($workdir, "$destdir", :libname<gslhelper>);

# can also be run standalone
sub MAIN(Str $working-directory = '.' ) {$working-directory);