diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a5d16b09..18fa88552 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,5 +86,4 @@ jobs: satysfi-external: git+https://github.com/gfngfn/satysfi-external-repo.git default: git+https://github.com/ocaml/opam-repository.git - - name: Lint opam - uses: ocaml/setup-ocaml/lint-opam@v3 + - uses: ocaml/setup-ocaml/lint-opam@v3 diff --git a/.gitignore b/.gitignore index 889b3be8c..8fdd2b02e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,72 +1,6 @@ -.DS_Store -\#* -.\#* -*~ -*.exe -*.tex -*.log -*.aux -*.dvi -*.pdf -*.out -*.html -obsolete/*.txt -old/ -*.png -satysfi -*.ttf -*.otf -*.ttc -*.dfont -*.afm -*.t1a -*.svg -!/logo/macrodown.svg -*.dat -*.ttx -*.jpg -!/demo/satysfi-logo.jpg -!/tests/images/satysfi-logo-cmyk.jpg -!/tests/images/satysfi-logo-gray.jpg -!/tests/images/satysfi-logo-rgb.jpg -!/tests/images/peppers-cmyk.jpg -!/tests/images/peppers-gray.jpg -!/tests/images/peppers-rgb.jpg -*.satysfi-aux -external/ - -# Created by https://www.toptal.com/developers/gitignore/api/ocaml -# Edit at https://www.toptal.com/developers/gitignore?templates=ocaml - -### OCaml ### -*.annot -*.cmo -*.cma -*.cmi -*.a -*.o -*.cmx -*.cmxs -*.cmxa - -# ocamlbuild working directory -_build/ - -# ocamlbuild targets -*.byte -*.native - -# oasis generated files -setup.data -setup.log - -# Merlin configuring file for Vim and Emacs -.merlin - -# Dune generated files -*.install - -# Local OPAM switch -_opam - -# End of https://www.toptal.com/developers/gitignore/api/ocaml +/_build/ +/_opam/ +/lib-satysfi/dist/fonts/ +/temp/IPAexfont00401/ +/temp/latinmodern-math-1959/ +/temp/*.zip diff --git a/Makefile b/Makefile index 1f030db1c..7e486bfe9 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,17 @@ PREFIX=/usr/local LIBDIR=$(PREFIX)/share/satysfi -TARGET=satysfi BINDIR=$(PREFIX)/bin -RM=rm -f -DUNE=dune -.PHONY: all install lib uninstall clean +.PHONY: all clean install uninstall all: - $(DUNE) build --root . - cp _build/install/default/bin/$(TARGET) . + dune build -install: $(TARGET) - mkdir -p $(BINDIR) - install $(TARGET) $(BINDIR) +clean: + dune clean -#preliminary: -# [ -d .git ] && git submodule update -i || echo "Skip git submodule update -i" +install: + dune install --bindir=$(BINDIR) uninstall: - rm -rf $(BINDIR)/$(TARGET) - rm -rf $(LIBDIR) - -clean: - $(DUNE) clean - $(RM) satysfi + dune uninstall --bindir=$(BINDIR) diff --git a/download-fonts.sh b/download-fonts.sh index 25a266a20..2b7eef22c 100755 --- a/download-fonts.sh +++ b/download-fonts.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash set -ue diff --git a/dune-project b/dune-project index 0847cffc1..3401876f3 100644 --- a/dune-project +++ b/dune-project @@ -4,8 +4,6 @@ (name satysfi) -(version 0.0.11) - (license LGPL-3.0-only) (authors "Takashi Suwa") @@ -40,19 +38,16 @@ (core_kernel (and (>= v0.15) - (< v0.17))) + (< v0.18))) (cppo (and - :build (>= 1.6.4) - (< 1.7.0))) + (< 1.7))) + dune-build-info (menhir - (and - :build - (>= 20231231))) + (>= 20231231)) (menhirLib (>= 20231231)) - (ocamlfind :build) (omd (and (>= 1.3.2) @@ -67,7 +62,6 @@ (< 6.0))) (re (and - :build (>= 1.10.4) (< 2.0))) (uutf diff --git a/install-libs.sh b/install-libs.sh index 1c4ed4cb0..c1a1bfd2e 100755 --- a/install-libs.sh +++ b/install-libs.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash LIBDIR=${1:-/usr/local/share/satysfi} diff --git a/satysfi.opam b/satysfi.opam index 47338f1a4..606501e54 100644 --- a/satysfi.opam +++ b/satysfi.opam @@ -1,6 +1,5 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "0.0.11" synopsis: "A statically-typed, functional typesetting system" description: "SATySFi is a typesetting system equipped with a statically-typed, functional programming language. It consists mainly of two “layers” ― the text layer and the program layer. The former is for writing documents in LaTeX-like syntax. The latter, which has OCaml-like syntax, is for defining functions and commands. SATySFi enables you to write documents markuped with flexible commands of your own making. In addition, its informative type error reporting will be a good help to your writing." @@ -15,27 +14,31 @@ depends: [ "batteries" {>= "3.6.0" & < "4.0"} "camlimages" {>= "5.0.1" & < "5.0.5"} "camlpdf" {= "2.3.1+satysfi"} - "core_kernel" {>= "v0.15" & < "v0.17"} - "cppo" {build & >= "1.6.4" & < "1.7.0"} - "menhir" {build & >= "20231231"} + "core_kernel" {>= "v0.15" & < "v0.18"} + "cppo" {>= "1.6.4" & < "1.7"} + "dune-build-info" + "menhir" {>= "20231231"} "menhirLib" {>= "20231231"} - "ocamlfind" {build} "omd" {>= "1.3.2" & < "2.0"} "otfed" {>= "0.3.1" & < "0.4"} "ppx_deriving" {>= "5.2.1" & < "6.0"} - "re" {build & >= "1.10.4" & < "2.0"} + "re" {>= "1.10.4" & < "2.0"} "uutf" {>= "1.0.3" & < "2.0"} "yojson-with-position" {= "1.4.2+satysfi"} "odoc" {with-doc} ] -dev-repo: "git+https://github.com/gfngfn/SATySFi.git" build: [ - ["mkdir" "-p" "temp"] - [make "-f" "Makefile" "PREFIX=%{prefix}%"] -] -install: [ - [make "-f" "Makefile" "install" "PREFIX=%{prefix}%"] -] -remove: [ - [make "-f" "Makefile" "uninstall" "PREFIX=%{prefix}%"] + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] ] +dev-repo: "git+https://github.com/gfngfn/SATySFi.git" diff --git a/satysfi.opam.template b/satysfi.opam.template deleted file mode 100644 index d2dee95bc..000000000 --- a/satysfi.opam.template +++ /dev/null @@ -1,10 +0,0 @@ -build: [ - ["mkdir" "-p" "temp"] - [make "-f" "Makefile" "PREFIX=%{prefix}%"] -] -install: [ - [make "-f" "Makefile" "install" "PREFIX=%{prefix}%"] -] -remove: [ - [make "-f" "Makefile" "uninstall" "PREFIX=%{prefix}%"] -] diff --git a/src/backend/Makefile b/src/backend/Makefile deleted file mode 100644 index 2f30fd34c..000000000 --- a/src/backend/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -OCBFLAGS = ocamlbuild -use-ocamlfind -pkgs "core,ctypes" -tag thread -CFLAGS = ocamlc.opt -c - -pageBreak.native: pageBreak.ml lineBreak.ml flowGraph.ml horzBox.ml handlePdf.ml fontInfo.ml base85.ml mutableSet.ml - $(OCBFLAGS) pageBreak.native - -all: - cp external/camlpdf/*.c ./ - cp external/camlpdf/*.h ./ -# $(CFLAGS) flatestubs.c -# $(CFLAGS) rijndael-alg-fst.c -# $(CFLAGS) stubs-aes.c -# $(CFLAGS) miniz.c -# $(CFLAGS) sha2.c -# $(CFLAGS) stubs-sha2.c -# ocamlc -c external/camlpdf/flatestubs.c -# ocamlc -c external/camlpdf/rijndael-alg-fst.c -# ocamlc -c external/camlpdf/stubs-aes.c -# ocamlc -c external/camlpdf/miniz.c -# ocamlc -c external/camlpdf/sha2.c -# ocamlc -c external/camlpdf/stubs-sha2.c - mv *.c _build/ - mv *.h _build/ -# ocamlbuild -use-ocamlfind -use-menhir -tag thread -pkgs "core,ctypes,otfm" -lflags "external/camlpdf/flatestubs.o external/camlpdf/rijndael-alg-fst.o external/camlpdf/stubs-aes.o external/camlpdf/miniz.o external/camlpdf/sha2.o external/camlpdf/stubs-sha2.o" -I external/camlpdf/ pageBreak.native -# ocamlbuild -use-ocamlfind -use-menhir -tag thread -pkgs "core,ctypes,otfm" -lflags "flatestubs.o rijndael-alg-fst.o stubs-aes.o miniz.o sha2.o stubs-sha2.o" -no-hygiene -I external/camlpdf/ pageBreak.native - ocamlbuild -use-ocamlfind -use-menhir -tag thread -pkgs "core,ctypes,result,uutf" -lflags "flatestubs.c rijndael-alg-fst.c stubs-aes.c sha2.c stubs-sha2.c" -I external/camlpdf/ -I external/otfm/ pageBreak.native -# ocamlbuild -use-ocamlfind -use-menhir -tag thread -pkgs "core,ctypes,otfm" -no-hygiene -I external/camlpdf/ pageBreak.native diff --git a/src/backend/how-to-compile.md b/src/backend/how-to-compile.md deleted file mode 100644 index c728bb523..000000000 --- a/src/backend/how-to-compile.md +++ /dev/null @@ -1,3 +0,0 @@ -# How to Compile - -Type `ocamlbuild -use-ocamlfind pageBreak.native`. diff --git a/src/dune b/src/dune index dfbe24617..ea5da96fb 100644 --- a/src/dune +++ b/src/dune @@ -12,6 +12,7 @@ camlpdf core_kernel core_kernel.pairing_heap + dune-build-info menhirLib otfed uutf @@ -47,16 +48,6 @@ (flags (--table --explain))) -(rule - (targets version.ml) - (deps - ../tools/genversion/genversion.exe - (:src ../satysfi.opam)) - (action - (with-stdout-to - %{targets} - (run %{deps})))) - (rule (targets types.ml) (deps diff --git a/src/version.ml b/src/version.ml new file mode 100644 index 000000000..a037540df --- /dev/null +++ b/src/version.ml @@ -0,0 +1,4 @@ +let version = + match Build_info.V1.version () with + | None -> "dev" + | Some v -> Build_info.V1.Version.to_string v diff --git a/temp/.gitignore b/temp/.gitignore deleted file mode 100644 index a872f3e09..000000000 --- a/temp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.zip -latinmodern-math-1959/ -IPAexfont00301/ diff --git a/tools/gencode/dune-project b/tools/gencode/dune-project deleted file mode 100644 index de4fc2092..000000000 --- a/tools/gencode/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.0) diff --git a/tools/genversion/dune b/tools/genversion/dune deleted file mode 100644 index abde6685f..000000000 --- a/tools/genversion/dune +++ /dev/null @@ -1,3 +0,0 @@ -(executable - (name genversion) - (libraries str)) diff --git a/tools/genversion/dune-project b/tools/genversion/dune-project deleted file mode 100644 index de4fc2092..000000000 --- a/tools/genversion/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 1.0) diff --git a/tools/genversion/genversion.ml b/tools/genversion/genversion.ml deleted file mode 100644 index d4791f201..000000000 --- a/tools/genversion/genversion.ml +++ /dev/null @@ -1,21 +0,0 @@ -let version_regex = Str.regexp {|^version: ?"\([0-9]+\.[0-9]+\.[0-9]+\)"$|} - -let () = - let version = ref "" in - let opam_file_path = Sys.argv.(1) in - let channel_in = open_in opam_file_path in - let search_version () = - let cond = ref true in - while !cond do - let line = input_line channel_in in - try - let _ = Str.search_forward version_regex line 0 in - version := Str.matched_group 1 line; - cond := false - with Not_found -> - () - done - in - search_version (); - close_in channel_in; - print_endline ("let version = \"" ^ !version ^ "\"")