satyrographos

A naive package manager for SATySFi
README

日本語版 README はこちら

A naive package manager for SATySFi.

WARNING: Command line interfaces, except for the satyrographos install, are EXPERIMENTAL and subject to change and removal.

It composes files under directories ~/.opam/<ocaml-version>/share/satysfi/<package> installed by OPAM and copies them into directory ~/.satysfi/dist.
It also sets up environments so that SATySFi can use system fonts. See Section Install System Fonts below.

Satyrographos simplifies installation of SATySFi. For example, @zr-tex8r’s make-satysfi.sh will be like this.

#!/bin/bash
set -eux

sudo apt -y update
sudo apt -y install build-essential git m4 unzip curl ruby

yes '' | sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)

opam init --auto-setup --comp 4.06.0 --disable-sandboxing
eval $(opam env)
opam repository add satysfi-external https://github.com/gfngfn/satysfi-external-repo.git
opam repository add satyrographos https://github.com/na4zagin3/satyrographos-repo.git
opam update

# opam pin add https://github.com/na4zagin3/satyrographos.git # run this line if you want to try the latest Satyrographos

opam install -y satysfi
opam install -y satyrographos

satyrographos install

To use the latest version of Satyrographos, pin the repository like this:

opam pin add https://github.com/na4zagin3/satyrographos.git

Install System Fonts

This feature is still experimental and its interface and/or behaviour may be changed later.

If your machine is using Fontconfig, i.e., using Mac or Linux Desktop Environment, Satyrographos can set up SATySFi to utilise your existing system fonts.

Satyrographos offers the -system-font-prefix <system-font-name-prefix> option of gathering system fonts to enable them for use with names prefixed with <system-font-name-prefix> with SATySFi.

For example, the following command installs system fonts with the prefix system:.

$ satyrographos install -system-font-prefix 'system:'

Then you can use the system fonts, for example, Arial as system:Arial. (Technically, a font will have a SATySFi name which consists of the given prefix and the font's PostScript name. This behavior may be changed in the near future.)

@require: stdjabook

let-inline ctx \set-non-cjk-font name it =
  let ctx =
    ctx |> set-font Latin (name, 1., 0.)
        |> set-font OtherScript (name, 1., 0.)
  in
  read-inline ctx it

let-inline ctx \set-cjk-font name it =
  let ctx =
    ctx |> set-font HanIdeographic (name, 1., 0.)
        |> set-font Kana (name, 1., 0.)
  in
  read-inline ctx it
in

document (|
  title = {System Fonts};
  author = {\@na4zagin3};
  show-title = true;
  show-toc = false;
|) '<
  +p {
    ABCDabcd
    \set-non-cjk-font(`system:Tahoma-Bold`){ABCDabcd}
  }
  +p {
    あいうえお漢字
    \set-cjk-font(`system:HiraKakuStd-W8`){あいうえお漢字}
  }
>

How Does It Work?

Satyrographos links all files under ~/.opam/<ocaml-version>/share/satysfi/<package> and ~/.satyrographos/packages/<package> into ~/.satysfi/dist.

Satyrographos also does duplication detection and hash file merging, satyrographos install behaves as

$ cp -r "$(opam var share)"/share/satysfi/*/* ~/.satysfi/dist
$ cp -r ~/.satyrographos/packages/*/* ~/.satysfi/dist

With -system-font-prefix <system-font-name-prefix>, Satyrograph query system fonts with fc-list and installs those fonts too.

Register Libraries

You can add a new library for SATySFi as an OPAM library or a directory under ~/.satyrographos.

In this section, we are going to register a new library great-package like this.

- ~/src/
  - great-package/
    - hash/
      - fonts.satysfi-hash
    - fonts/
      - interesting-font.ttf
    - packages/
      - your-great.package.satyh

OPAM Package

Create a new package which installs the file into %{share}%/satysfi/great-package/packages/your-great-package.satyh.

Examples:

  • SATySFi-fonts-theano: https://github.com/na4zagin3/SATySFi-fonts-theano

  • SATySFi-grcnum: https://github.com/na4zagin3/SATySFi-grcnum

Local Directory (EXPERIMENTAL)

Register your local library with satyrographos pin add <local-dir>.

$ satyrographos pin add ~/src/great-package
$ satyrographos install
Install
Published
11 Feb 2019
Sources
v0.0.1.4.tar.gz
md5=8a82e1ebae8c63014519c834fce1b27a
sha512=76615b62b14408cb2f00c08c82bd7e987d784355c2f6352a236d620161f7439e10ab3e48b33cf57aab2521a9a91f6fa27c0f2d74d25d2c48895c47d88499d353
Dependencies
uri
>= "2.0.0" & < "3.0.0"
ppx_jane
build & < "v0.12"
ppx_inline_test
build & < "v0.12"
core
< "v0.12"
ocaml
>= "4.06.0"
Reverse Dependencies