samurai-737f70

#### Supplemental Linux® From Scratch - Version 13.0

### Chapter 5. Programming

- Prev

  Python Modules

- Next

  strace-6.19

- Up
- Home

# samurai-737f70

## Introduction to samurai

The samurai package provides a drop-in replacement for the Ninja package. It aims for full compatibility.

### Note

This package works for most packages as a Ninja replacement. It's known to work just fine for 32-bit on 64-bit and with projects with Rust, as well. However, it can be bitten by some build systems with potentially ambiguous dependency information, causing important targets to be skipped that Ninja papers over. If you find that a project tries to include a header like so: `#include "xdg-shell.h"`, but can't, it is probably generated by a target which got skipped. You can try using Ninja to see if that resolves the issue.

Known packages with that issue:

- gnome-keyring (cannot include `"gkm-marshal.h"`)

- SceneFX-0.4.1 (examples are disabled so this issue cannot be observed, but if enabled, then it cannot include `"xdg-shell-protocol.h"`)

- Download: https://github.com/michaelforney/samurai/archive/737f702fed670acb25e5e70b4b802690df7a4a8b/samurai-737f702fed670acb25e5e70b4b802690df7a4a8b.tar.gz

## Installation of samurai

Install samurai by running the following commands:

    make CC=cc CFLAGS+=" -std=c99"

Now, as the `root` user:

    make PREFIX=/usr install

## Configuring samurai

### Configuration Information

If you want samu to be used whenever ninja is run, make a symlink as the `root` user:

    if [ "$(file /usr/bin/ninja | grep ELF)" ]; then
      mv -v /usr/bin/ninja{,.old}
    fi &&
    ln -svf samu /usr/bin/ninja

samu won't run on all logical CPUs or threads by default, similar to make. The process to make it do so is the same: pass `-j`<x>``, where ``<x>`` is the number of logical CPUs you want to use whenever samu (or ninja if you made the symlink) is run. You can get around having to specify it every time by including `-j`<x>`` in `SAMUFLAGS` like so:

    export SAMUFLAGS=-j$(nproc)

If `MAKEFLAGS` only contains the `-j` option, you can set `SAMUFLAGS` to `MAKEFLAGS` like so:

    export SAMUFLAGS=$MAKEFLAGS

If you'd like to avoid manually setting `SAMUFLAGS` each time you log in, add it to a Bash profile script like `~/.bash_profile`.

## Contents

Installed Programs: samu
Installed Libraries: None
Installed Directories: None

### Short Descriptions

samu | is a drop-in replacement for ninja

- Prev

  Python Modules

- Next

  strace-6.19

- Up
- Home