Alien-Xmake

 view release on metacpan or  search on metacpan

Changes.md  view on Meta::CPAN

- Retry `config`/`build`/`clean` actions on Windows when there's no `--toolchain` setting because xmake has a hard time with the non-standard location of `gcc` from a Strawberry Perl install.

## [v1.0.2] - 2026-09-18

### Changed

- Compiler discovery in `_test_tools` now uses `Capture::Tiny` with a temp source file instead of `open3`/`gensym`, dropping the `Symbol` and `IPC::Open3` dependencies.

### Fixed

- Windows on Arm uses `PROCESSOR_ARCHITEW6432` env var when selecting the installer bundle, so emulated x64 perl (read: Strawberry Perl) downloads the native ARM64 build instead of the wrong win64 one.
- `_get_xmake_version` now warns when the downloaded binary cannot be spawned (e.g. wrong-architecture on Windows Arm) instead of silently returning `v0.0.0`.
- `./configure` on Unix is now run through `bash` when available, fixing builds on platforms whose default `/bin/sh` lacks POSIX features (Solaris and maybe others).

## [v1.0.1] - 2026-09-08

### Fixed

- xmake's core C engine prioritizes the `XMAKE_PROGRAM_DIR` env var over its own bundled Lua scripts creating situations where our local sharedir install attempts to run old, incompatible .lua from the system install.

## [v1.0.0] - 2026-09-07

README.md  view on Meta::CPAN

Uninstalls installed binaries from the install directory. Supports `installdir`, `bindir`, `libdir`, `includedir`,
`group` and `admin`.

## `package( [$target], %options )`

```perl
$xmake->package;                                      # package release artifacts
$xmake->package('hello', outputdir => './dist');
```

Packages the built targets into distribution archives/installers. `outputdir` selects the destination, `format` the
package format (`-f`, e.g. `deb`, `rpm`, `nsis`), `all` includes dependent targets, and `homepage`,
`description`, `url`, `version` and `shasum` fill the package metadata.

## `pack( [$pkg], %options )`

```perl
$xmake->pack('libpng', formats => ['zip', 'targz'], jobs => 4);
```

Bundles an installed package from the local package cache into distribution archives. `outputdir` selects the
destination, `formats` the archive format(s) (`zip`, `targz`, ...), `basename`, `autobuild` and `jobs` tune the
archive name, rebuild behavior and parallelism.

## `require( [$pkg], %options )`

```perl
$xmake->require('libpng');
my $list = $xmake->require( list => 1 );
my $json = $xmake->require( 'libpng', depgraph => 1, format => 'json' );
```

README.md  view on Meta::CPAN

    Standard package-install controls. **clean\_modes** resets the configs of the matched packages, **clean** only clears
    unused packages, **build** always build from source, and **addon** manages addon packages.

## `run( [$target], %options )`

```perl
$xmake->run;
$xmake->run('hello', args => [qw[--flag value]]);
```

Runs the build target (or the `run` script). `debug` attaches a debugger, `all`/`group` select targets, `workdir`
sets the working directory (`-w`), `jobs` sets the parallelism and `detach` runs the target in the background. Extra
program arguments go in `args`.

## `test( [$target], %options )`

```perl
$xmake->test;
$xmake->test( 'hello', rebuild => 1 );
```

README.md  view on Meta::CPAN

flags the previous version for removal.

## `service( %options )`

```perl
$xmake->service( start => 1, distcc => 1 );     # run the distcc service
$xmake->service( status => 1 );
```

Controls the built-in xmake services. One of `start`, `stop`, `restart`, `status`, `connect`, `disconnect`,
`reconnect`, `sync`, `clean`; `remote`, `distcc`, `ccache`, `add-user`, `rm-user`, `gen-token` select or
modify the service, `host` and `session` target a specific server/session, and `logs`/`pull` fetch server logs.

## `addon( [$name], %options )`

```perl
$xmake->addon('gcc_flags', install => 1);
my $found = $xmake->addon('flags', search => 1);   # captured output
```

Installs, removes, lists or searches xmake addon packages (`install`, `remove`, `list`, `search`, `upgrade`).

README.md  view on Meta::CPAN

```

Lists available checkers (captured) or runs a named check script. `info` explains a checker (captured).

## `doxygen( [$srcdir], %options )`

```perl
$xmake->doxygen('./src', outputdir => './docs');
```

Generates Doxygen documentation for `$srcdir`. `outputdir` selects the documentation directory.

## `format( [$target], %options )`

```perl
$xmake->format('hello', style => 'google');
$xmake->format( dry_run => 1, files => ['a.c', 'b.c'] );
```

Formats the project sources with clang-format. `style` chooses the style (`google`, `llvm`, ...), `create` writes a
default `.clang-format`, `dry_run` only reports files that would change (`-n`), `error` treats style mismatches as

README.md  view on Meta::CPAN

move them between machines.

## `project( %options )`

```perl
$xmake->project( kind => 'vsxmake' );
$xmake->project( kind => 'make', targets => ['hello'] );
```

Generates IDE/third-party project files (`vs`, `vsxmake`, `make`, `cmake`, `compile_commands`, ...). `kind`
selects the generator, `modes`/`archs` restrict the configs to generate, `target` generates only for that target and
`lsp` writes LSP-friendly output (`compile_flags.txt` or `compile_commands.json`).

## `repo( [$name], %options )`

```perl
my $repos = $xmake->repo( list => 1 );
$xmake->repo('local_extra', add => 1, url => 'git@github.com:me/xmake-repo.git');
```

Manages custom package repositories. `add`, `remove`, `update`, `clear` and `list` select the operation (`list`
returns captured output); `global` restricts the change to the global config; `url` and `branch` are used when
adding.

## `show( [$list], %options )`

```perl
my @platforms = $xmake->show('platforms');
my @targets   = $xmake->show('targets', format => 'json');
my $plain     = $xmake->show('targets', target => 'hello');
```

README.md  view on Meta::CPAN

chdir 'demo';
$x->configure(mode => 'release');            # configure the build
$x->build;                                   # compile it
$x->test;                                    # run target tests (none for a console template)
$x->run;                                     # execute the binary
```

## Generate files for another build system or IDE

`project` reads your `xmake.lua` and emits other build systems' project files, so you never maintain a second build
config by hand. `kind` selects the generator and `lsp` asks for IDE-friendly compile data:

```perl
use v5.40;
use Alien::Xmake;

my $x = Alien::Xmake->new;
$x->project(kind => 'make');                 # a Makefile
$x->project(kind => 'compile_commands', lsp => 1);   # compile_commands.json for clangd/IDEs
```

eg/nuklear/nuklear_xlib.h  view on Meta::CPAN

    } else if (evt->type == KeymapNotify) {
        XRefreshKeyboardMapping(&evt->xmapping);
        return 1;
    } else if (evt->type == SelectionClear) {
        free(xlib.clipboard_data);
        xlib.clipboard_data = NULL;
        xlib.clipboard_len = 0;
        return 1;
    } else if (evt->type == SelectionRequest) {
        XEvent reply;
        reply.xselection.type = SelectionNotify;
        reply.xselection.requestor = evt->xselectionrequest.requestor;
        reply.xselection.selection = evt->xselectionrequest.selection;
        reply.xselection.target = evt->xselectionrequest.target;
        reply.xselection.property = None; /* Default refuse */
        reply.xselection.time = evt->xselectionrequest.time;

        if (reply.xselection.target == xlib.xa_targets) {
            Atom target_list[4];
            target_list[0] = xlib.xa_targets;
            target_list[1] = xlib.xa_text;
            target_list[2] = xlib.xa_utf8_string;
            target_list[3] = XA_STRING;

            reply.xselection.property = evt->xselectionrequest.property;
            XChangeProperty(evt->xselection.display,evt->xselectionrequest.requestor,
                reply.xselection.property, XA_ATOM, 32, PropModeReplace,
                (unsigned char*)&target_list, 4);
        } else if (xlib.clipboard_data && (reply.xselection.target == xlib.xa_text ||
            reply.xselection.target == xlib.xa_utf8_string || reply.xselection.target == XA_STRING)) {
            reply.xselection.property = evt->xselectionrequest.property;
            XChangeProperty(evt->xselection.display,evt->xselectionrequest.requestor,
                reply.xselection.property, reply.xselection.target, 8, PropModeReplace,
                (unsigned char*)xlib.clipboard_data, xlib.clipboard_len);
        }
        XSendEvent(evt->xselection.display, evt->xselectionrequest.requestor, True, 0, &reply);
        XFlush(evt->xselection.display);
        return 1;
    } else if (evt->type == SelectionNotify && xlib.clipboard_target) {
        if ((evt->xselection.target != XA_STRING) &&
            (evt->xselection.target != xlib.xa_utf8_string) &&
            (evt->xselection.target != xlib.xa_text))
            return 1;

        {Atom actual_type;
        int actual_format;
        unsigned long pos = 0, len, remain;
        unsigned char* data = 0;
        do {
            XGetWindowProperty(dpy, win, XA_PRIMARY, (int)pos, 1024, False,
                AnyPropertyType, &actual_type, &actual_format, &len, &remain, &data);
            if (len && data)

lib/Alien/Xmake.pod  view on Meta::CPAN

    $xmake->uninstall('hello');

Uninstalls installed binaries from the install directory. Supports C<installdir>, C<bindir>, C<libdir>, C<includedir>,
C<group> and C<admin>.

=head2 C<package( [$target], %options )>

    $xmake->package;                                      # package release artifacts
    $xmake->package('hello', outputdir => './dist');

Packages the built targets into distribution archives/installers. C<outputdir> selects the destination, C<format> the
package format (C<-f>, e.g. C<deb>, C<rpm>, C<nsis>), C<all> includes dependent targets, and C<homepage>,
C<description>, C<url>, C<version> and C<shasum> fill the package metadata.

=head2 C<pack( [$pkg], %options )>

    $xmake->pack('libpng', formats => ['zip', 'targz'], jobs => 4);

Bundles an installed package from the local package cache into distribution archives. C<outputdir> selects the
destination, C<formats> the archive format(s) (C<zip>, C<targz>, ...), C<basename>, C<autobuild> and C<jobs> tune the
archive name, rebuild behavior and parallelism.

=head2 C<require( [$pkg], %options )>

    $xmake->require('libpng');
    my $list = $xmake->require( list => 1 );
    my $json = $xmake->require( 'libpng', depgraph => 1, format => 'json' );

Installs and manages the packages declared (or requested) for the current project.

lib/Alien/Xmake.pod  view on Meta::CPAN

Standard package-install controls. B<clean_modes> resets the configs of the matched packages, B<clean> only clears
unused packages, B<build> always build from source, and B<addon> manages addon packages.

=back

=head2 C<run( [$target], %options )>

    $xmake->run;
    $xmake->run('hello', args => [qw[--flag value]]);

Runs the build target (or the C<run> script). C<debug> attaches a debugger, C<all>/C<group> select targets, C<workdir>
sets the working directory (C<-w>), C<jobs> sets the parallelism and C<detach> runs the target in the background. Extra
program arguments go in C<args>.

=head2 C<test( [$target], %options )>

    $xmake->test;
    $xmake->test( 'hello', rebuild => 1 );

Runs the project's tests. C<group>, C<workdir>, C<jobs> and C<rebuild> behave as elsewhere.

lib/Alien/Xmake.pod  view on Meta::CPAN

Updates the C<xmake> installation. C<version> optionally pins a version. C<scriptonly> only updates the scripts
(C<-s>), C<integrate> re-integrates the shell environment, C<force> downloads even when up to date and C<uninstall>
flags the previous version for removal.

=head2 C<service( %options )>

    $xmake->service( start => 1, distcc => 1 );     # run the distcc service
    $xmake->service( status => 1 );

Controls the built-in xmake services. One of C<start>, C<stop>, C<restart>, C<status>, C<connect>, C<disconnect>,
C<reconnect>, C<sync>, C<clean>; C<remote>, C<distcc>, C<ccache>, C<add-user>, C<rm-user>, C<gen-token> select or
modify the service, C<host> and C<session> target a specific server/session, and C<logs>/C<pull> fetch server logs.

=head2 C<addon( [$name], %options )>

    $xmake->addon('gcc_flags', install => 1);
    my $found = $xmake->addon('flags', search => 1);   # captured output

Installs, removes, lists or searches xmake addon packages (C<install>, C<remove>, C<list>, C<search>, C<upgrade>).
C<all> applies an operation to every addon and C<force> bypasses checks.

lib/Alien/Xmake.pod  view on Meta::CPAN


    my $list = $xmake->check( list => 1 );
    $xmake->check('gcc_flags.logic');

Lists available checkers (captured) or runs a named check script. C<info> explains a checker (captured).

=head2 C<doxygen( [$srcdir], %options )>

    $xmake->doxygen('./src', outputdir => './docs');

Generates Doxygen documentation for C<$srcdir>. C<outputdir> selects the documentation directory.

=head2 C<format( [$target], %options )>

    $xmake->format('hello', style => 'google');
    $xmake->format( dry_run => 1, files => ['a.c', 'b.c'] );

Formats the project sources with clang-format. C<style> chooses the style (C<google>, C<llvm>, ...), C<create> writes a
default C<.clang-format>, C<dry_run> only reports files that would change (C<-n>), C<error> treats style mismatches as
errors (C<-e>), C<files> limits formatting to the given files, and C<all>/C<group>/C<jobs> behave as elsewhere.

lib/Alien/Xmake.pod  view on Meta::CPAN

Records and replays the shell commands that follow (clone of C<xmake macro>). C<begin>/C<end> control recording,
C<show> prints a recorded macro, C<list> lists them (captured), C<delete>/C<clear> remove them and C<export>/C<import>
move them between machines.

=head2 C<project( %options )>

    $xmake->project( kind => 'vsxmake' );
    $xmake->project( kind => 'make', targets => ['hello'] );

Generates IDE/third-party project files (C<vs>, C<vsxmake>, C<make>, C<cmake>, C<compile_commands>, ...). C<kind>
selects the generator, C<modes>/C<archs> restrict the configs to generate, C<target> generates only for that target and
C<lsp> writes LSP-friendly output (C<compile_flags.txt> or C<compile_commands.json>).

=head2 C<repo( [$name], %options )>

    my $repos = $xmake->repo( list => 1 );
    $xmake->repo('local_extra', add => 1, url => 'git@github.com:me/xmake-repo.git');

Manages custom package repositories. C<add>, C<remove>, C<update>, C<clear> and C<list> select the operation (C<list>
returns captured output); C<global> restricts the change to the global config; C<url> and C<branch> are used when
adding.

=head2 C<show( [$list], %options )>

    my @platforms = $xmake->show('platforms');
    my @targets   = $xmake->show('targets', format => 'json');
    my $plain     = $xmake->show('targets', target => 'hello');

Shows information about the current project or the C<xmake> installation.

lib/Alien/Xmake.pod  view on Meta::CPAN


    chdir 'demo';
    $x->configure(mode => 'release');            # configure the build
    $x->build;                                   # compile it
    $x->test;                                    # run target tests (none for a console template)
    $x->run;                                     # execute the binary

=head2 Generate files for another build system or IDE

C<project> reads your C<xmake.lua> and emits other build systems' project files, so you never maintain a second build
config by hand. C<kind> selects the generator and C<lsp> asks for IDE-friendly compile data:

    use v5.40;
    use Alien::Xmake;

    my $x = Alien::Xmake->new;
    $x->project(kind => 'make');                 # a Makefile
    $x->project(kind => 'compile_commands', lsp => 1);   # compile_commands.json for clangd/IDEs

=head2 Ask xmake what it can target



( run in 2.763 seconds using v1.01-cache-2.11-cpan-e623d60df62 )