na4zagin3 / satyrographos

Package manager for SATySFi
GNU Lesser General Public License v3.0
44 stars 13 forks source link

Build script #13

Closed na4zagin3 closed 5 years ago

na4zagin3 commented 5 years ago

Rather than manually copying files, Satyrographos must do that using a build file containing description of a package. Like dune.

na4zagin3 commented 5 years ago

What kind of build script is the best?

Extended OPAM File

We can use x-* fields in OPAM, which may allow the following descriptions.

(* project.opam *)
opam-version: "2.0"
name: "project"
version: "0.1"
build: [ ["satyrographos" "build"] ]
install: ["satyrographos" "install"]
x-satyrographos: {
  sources [ [ "fonts/foo.ttc" "./foo.ttc" ] ]
  doc [ "something.saty" ]
  doc-dependencies [
    "satysfi-lib-something" {> "0.0.1"}
  ]
}

Satyrographos File & OPAM

We may also provide a new build file like this:

; Satyrographos file
; I’m now too lazy to invent a new syntax for the file.
(package project
  (sources
    ("fonts/foo.ttc" "./foo.ttc"))
  (doc
    ("something.saty"))

and

(* project.opam *)
opam-version: "2.0"
name: "project"
version: "0.1"
build: [ ["satyrographos" "build"] ]
install: ["satyrographos" "install"]
x-satyrographos-doc-dependencies: [
  "satysfi-lib-something" {> "0.0.1"}
]

Satyrographos File replacing OPAM file

We can also introduce a new build file which replaces the OPAM file.

; Satyrographos file
; I’m now too lazy to invent a new syntax for the file.
(version 0.0.2)
(library
  (name "fonts-theano")
  (sources
    ((hash "fonts.satysfi-hash" "./fonts.satysfi-hash")
     (font "TheanoDidot-Regular.otf" "./theano/TheanoDidot-Regular.otf")
     (font "TheanoModern-Regular.otf" "./theano/TheanoModern-Regular.otf")
     (font "TheanoOldStyle-Regular.otf" "./theano/TheanoOldStyle-Regular.otf")))
  (compatibility ((renameFont fonts-theano:TheanoDidot TheanoDidot)
                  (renameFont fonts-theano:TheanoModern TheanoModern)))
  (opam "satysfi-fonts-theano.opam"))
(libraryDoc
  (name "fonts-theano-doc")
  (build
    ((satysfi "doc-fonts-theano-ja.saty" "-o" "doc-fonts-theano-ja.pdf")))
  (sources
    ((doc "doc-fonts-theano-ja.pdf" "./doc-fonts-theano-ja.pdf")))
  (opam "satysfi-fonts-theano-doc.opam")
  (dependencies ((fonts-theano ()))))
na4zagin3 commented 5 years ago
na4zagin3 commented 5 years ago

Considering there is demand to eliminate opam dependency, it may be better to invent a new build file format. Cf. https://github.com/amutake/satysfi-docker/issues/1

na4zagin3 commented 5 years ago

As currently Satyrographos relies on OPAM to resolve dependency, it may make sense to include opam file name to read/generate.

; Satyrographos file
; I’m now too lazy to invent a new syntax for the file.
(version 1)
(package
  (name project)
  (version "0.1")
  (opam "./project.opam")
  (sources
    ("fonts/foo.ttc" "./foo.ttc"))
  (dependencies (...))
  (doc
    (files "something.saty")
    (dependencies
      (satysfi-lib-something (> 0.0.1)))))
na4zagin3 commented 5 years ago

30 implemented the basic part of this.

na4zagin3 commented 5 years ago

Need to update the readme with the new build file info.

na4zagin3 commented 5 years ago

Readme is updated in #53