NAME

Data::Hopen - A build generator with first-class edges and explicit dependencies

SYNOPSIS

hopen is a cross-platform software build generator. It makes files you can pass to Make, Ninja, Visual Studio, or other build tools, to compile and link your software. hopen gives you:

  • A full, Turing-complete, robust programming language to write your build scripts (specifically, Perl 5.14+)

  • No hidden magic! All your data is visible and accessible in a build graph.

  • Context-sensitivity. Your users can tweak their own builds for their own platforms without affecting your project.

See Data::Hopen::Conventions for details of the input format.

Why Perl? Because (1) you probably already have it installed, and (2) it is the original write-once, run-everywhere language!

INSTALLATION

Easiest: install cpanminus if you don't have it - see https://metacpan.org/pod/App::cpanminus#INSTALLATION. Then run cpanm Data::Hopen.

Manually: clone or untar into a working directory. Then, in that directory,

    perl Makefile.PL
    make
    make test

(you may need to install dependencies as well - see https://www.cpan.org/modules/INSTALL.html for resources). If all the tests pass,

    make install

If some of the tests fail, please check the issues and file a new one if no one else has reported the problem yet.

VARIABLES

Not exported by default, except as noted.

$VERBOSE

Set to a positive integer to get debug output on stderr from hopen's internals. The higher the value, the more output you are likely to get. See also "hlog".

$QUIET

Set to truthy to suppress output. Quiet overrides "$VERBOSE".

FUNCTIONS

All are exported by default unless indicated.

hnew

Creates a new Data::Hopen instance. For example:

    hnew DAG => 'foo';

is the same as

    Data::Hopen::G::DAG->new( name => 'foo' );

If the provided name does not include a double-colon, it is first tried after Data::Hopen::G::. It is then tried in Data::Hopen:: and as a complete package name. The first one that succeeds is used.

The first parameter must be a part of a class name, and the second parameter must be the name of the new instance. All other parameters are passed unchanged to the relevant constructor.

loadfrom

(Not exported by default) Load a package given a list of stems. Usage:

    my $fullname = loadfrom($name[, @stems]);

Returns the full name of the loaded package, or falsy on failure.

hlog

Log information if "$VERBOSE" is set. Usage:

    hlog { <list of things to log> } [optional min verbosity level (default 1)];

The items in the list are joined by ' ' on output, and a '\n' is added. Each line is prefixed with '# ' for the benefit of test runs.

The list is in {} so that it won't be evaluated if logging is turned off. It is a full block, so you can run arbitrary code to decide what to log. If the block returns an empty list, hlog will not produce any output.

The message will be output only if "$VERBOSE" is at least the given minimum verbosity level (1 by default).

isMYH

Returns truthy if the given argument is the name of a MY.hopen.pl file. See also "MYH".

getparameters

An alias of the parameters() function from Getargs::Mixed, but with -undef_ok set.

CONSTANTS

UNSPECIFIED

A Data::Hopen::Util::NameSet that matches any non-empty string. Always returns the same reference, so that it can be tested with ==.

NOTHING

A Data::Hopen::Util::NameSet that never matches. Always returns the same reference, so that it can be tested with ==.

MYH

The name MY.hopen.pl, centralized here. Not exported by default.

INTERNALS

 - C<Op>: A class representing an operation
   - C<Op:run()> takes a Data::Hopen::Scope and returns a hashref of outputs.

Implementation

After the hopen file is processed, cycles are detected and reported as errors. *(TODO change this to support LaTeX multi-run files?)* Then the DAG is traversed, and each operation writes the necessary information to the file being generated.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Data::Hopen
    perldoc hopen

You can also look for information at:

INSPIRED BY

  • Luke

  • a bit of Ant

  • a tiny bit of Buck

  • my own frustrations working with CMake.

LICENSE AND COPYRIGHT

Copyright (C) 2018--2019 Christopher White, <cxwembedded at gmail.com>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA