Switch to jbuilder
This commit is contained in:
parent
d6f6a9465a
commit
ba3d278b32
|
@ -1,8 +1,3 @@
|
|||
_build/
|
||||
/utop-*.tar.gz
|
||||
/setup.data
|
||||
/setup.log
|
||||
/setup.exe
|
||||
/setup-dev.exe
|
||||
/man/*.gz
|
||||
/src/lib/uTop_version.ml
|
||||
.merlin
|
||||
*.install
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
JaneStreet
|
83
Makefile
83
Makefile
|
@ -1,64 +1,41 @@
|
|||
# Makefile
|
||||
# --------
|
||||
# Copyright : (c) 2012, Jeremie Dimino <jeremie@dimino.org>
|
||||
# Licence : BSD3
|
||||
#
|
||||
# Generic Makefile for oasis project
|
||||
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
|
||||
|
||||
# Set to setup.exe for the release
|
||||
SETUP := setup-dev.exe
|
||||
.PHONY: all
|
||||
all:
|
||||
jbuilder build @install
|
||||
|
||||
# Default rule
|
||||
default: build
|
||||
.PHONY: install
|
||||
install:
|
||||
jbuilder install $(INSTALL_ARGS)
|
||||
|
||||
# Setup for the development version
|
||||
setup-dev.exe: _oasis setup.ml
|
||||
sed '/^#/D' setup.ml > setup_dev.ml
|
||||
ocamlfind ocamlopt -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || \
|
||||
ocamlfind ocamlc -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || true
|
||||
rm -f setup_dev.*
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
jbuilder uninstall $(INSTALL_ARGS)
|
||||
|
||||
# Setup for the release
|
||||
setup.exe: setup.ml
|
||||
ocamlopt.opt -w -3 -o $@ $< || ocamlopt -w -3 -o $@ $< || ocamlc -w -3 -o $@ $<
|
||||
rm -f setup.cmx setup.cmi setup.o setup.obj setup.cmo
|
||||
.PHONY: reinstall
|
||||
reinstall:
|
||||
$(MAKE) uninstall
|
||||
$(MAKE) install
|
||||
|
||||
build: $(SETUP) setup.data
|
||||
./$(SETUP) -build $(BUILDFLAGS)
|
||||
.PHONY: test
|
||||
test:
|
||||
jbuilder runtest
|
||||
|
||||
doc: $(SETUP) setup.data build
|
||||
./$(SETUP) -doc $(DOCFLAGS)
|
||||
cp style.css _build/utop-api.docdir/
|
||||
.PHONY: all-supported-ocaml-versions
|
||||
all-supported-ocaml-versions:
|
||||
jbuilder runtest --workspace jbuild-workspace.dev
|
||||
|
||||
test: $(SETUP) setup.data build
|
||||
./$(SETUP) -test $(TESTFLAGS)
|
||||
.PHONY: cinaps
|
||||
cinaps:
|
||||
cinaps -styler ocp-indent -i src/migrate_parsetree_versions.ml*
|
||||
cinaps -styler ocp-indent -i src/migrate_parsetree_40?_40?.ml*
|
||||
|
||||
all: $(SETUP)
|
||||
./$(SETUP) -all $(ALLFLAGS)
|
||||
|
||||
install: $(SETUP) setup.data
|
||||
ocamlfind remove utop 2>/dev/null || true
|
||||
./$(SETUP) -install $(INSTALLFLAGS)
|
||||
|
||||
uninstall: $(SETUP) setup.data
|
||||
./$(SETUP) -uninstall $(UNINSTALLFLAGS)
|
||||
|
||||
reinstall: $(SETUP) setup.data
|
||||
ocamlfind remove utop 2>/dev/null || true
|
||||
./$(SETUP) -reinstall $(REINSTALLFLAGS)
|
||||
|
||||
clean: $(SETUP)
|
||||
./$(SETUP) -clean $(CLEANFLAGS)
|
||||
|
||||
distclean: $(SETUP)
|
||||
./$(SETUP) -distclean $(DISTCLEANFLAGS)
|
||||
|
||||
configure: $(SETUP)
|
||||
./$(SETUP) -configure $(CONFIGUREFLAGS)
|
||||
|
||||
setup.data: $(SETUP)
|
||||
./$(SETUP) -configure $(CONFIGUREFLAGS)
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf _build *.install
|
||||
find . -name .merlin -delete
|
||||
|
||||
.PHONY: gh-pages
|
||||
gh-pages: doc
|
||||
git clone `git config --get remote.origin.url` .gh-pages --reference .
|
||||
git -C .gh-pages checkout --orphan gh-pages
|
||||
|
@ -69,5 +46,3 @@ gh-pages: doc
|
|||
git -C .gh-pages commit -m "Update Pages"
|
||||
git -C .gh-pages push origin gh-pages -f
|
||||
rm -rf .gh-pages
|
||||
|
||||
.PHONY: default build doc test all install uninstall reinstall clean distclean configure gh-pages
|
||||
|
|
151
_oasis
151
_oasis
|
@ -1,151 +0,0 @@
|
|||
# +-------------------------------------------------------------------+
|
||||
# | Package parameters |
|
||||
# +-------------------------------------------------------------------+
|
||||
|
||||
OASISFormat: 0.4
|
||||
OCamlVersion: >= 4.01
|
||||
Name: utop
|
||||
Version: 1.19.3
|
||||
LicenseFile: LICENSE
|
||||
License: BSD-3-clause
|
||||
Authors: Jeremie Dimino
|
||||
Maintainers: Jeremie Dimino <jeremie@dimino.org>
|
||||
Homepage: https://github.com/diml/utop
|
||||
BuildTools: ocamlbuild
|
||||
Plugins: DevFiles (0.3), META (0.3)
|
||||
XDevFilesEnableMakefile: false
|
||||
FilesAB: src/lib/uTop_version.ml.ab
|
||||
AlphaFeatures: ocamlbuild_more_args
|
||||
XOCamlbuildPluginTags: package(cppo_ocamlbuild)
|
||||
Synopsis: Universal toplevel for OCaml
|
||||
Description:
|
||||
utop is an improved toplevel for OCaml. It can run in a terminal or
|
||||
in Emacs. It supports line edition, history, real-time and context
|
||||
sensitive completion, colors, and more.
|
||||
.
|
||||
It integrates with the tuareg mode in Emacs.
|
||||
|
||||
# +-------------------------------------------------------------------+
|
||||
# | The toplevel |
|
||||
# +-------------------------------------------------------------------+
|
||||
|
||||
Flag camlp4
|
||||
Description: camlp4 support
|
||||
Default: false
|
||||
|
||||
Flag interact
|
||||
Description: enable UTop_main.interact (requires ppx_tools)
|
||||
Default: false
|
||||
|
||||
Library utop
|
||||
Path: src/lib
|
||||
Modules:
|
||||
UTop,
|
||||
UTop_main
|
||||
InternalModules:
|
||||
UTop_private,
|
||||
UTop_version,
|
||||
UTop_lexer,
|
||||
UTop_token,
|
||||
UTop_complete,
|
||||
UTop_styles,
|
||||
UTop_cmt_lifter
|
||||
BuildDepends: threads, findlib, lambda-term (>= 1.2)
|
||||
XMETADescription: utop configuration
|
||||
XMETARequires: findlib, lambda-term
|
||||
|
||||
Library "utop-camlp4"
|
||||
Build$: flag(camlp4)
|
||||
Install$: flag(camlp4)
|
||||
FindlibName: camlp4
|
||||
FindlibParent: utop
|
||||
Path: src/camlp4
|
||||
Modules: UTop_camlp4
|
||||
BuildDepends: utop, camlp4
|
||||
XMETAType: syntax
|
||||
XMETADescription: Camlp4 integration
|
||||
|
||||
Executable utop
|
||||
Install: true
|
||||
Path: src/top
|
||||
CompiledObject: byte
|
||||
MainIs: uTop_top.ml
|
||||
BuildDepends: threads, findlib, lambda-term, utop
|
||||
DataFiles: utop.el ($datadir/emacs/site-lisp)
|
||||
|
||||
Executable "utop-full"
|
||||
Install: true
|
||||
Path: src/top
|
||||
CompiledObject: byte
|
||||
MainIs: uTop_top_full.ml
|
||||
BuildDepends: threads, findlib, lambda-term, utop
|
||||
DataFiles: utop.el ($datadir/emacs/site-lisp)
|
||||
|
||||
# +-------------------------------------------------------------------+
|
||||
# | Doc |
|
||||
# +-------------------------------------------------------------------+
|
||||
|
||||
Document "utop-api"
|
||||
Title: API reference for utop
|
||||
Type: ocamlbuild (0.3)
|
||||
Install: true
|
||||
InstallDir: $htmldir/api
|
||||
DataFiles: style.css
|
||||
BuildTools: ocamldoc
|
||||
XOCamlbuildPath: ./
|
||||
XOCamlbuildLibraries: utop
|
||||
XOCamlbuildExtraArgs: "-docflag -t -docflag 'API reference for utop' -docflags '-colorize-code -short-functors -charset utf-8 -css-style style.css'"
|
||||
|
||||
# +-------------------------------------------------------------------+
|
||||
# | Manual pages |
|
||||
# +-------------------------------------------------------------------+
|
||||
|
||||
Document "utop-man"
|
||||
Type: custom (0.3)
|
||||
Title: Man page for utop
|
||||
Install: true
|
||||
BuildTools: gzip
|
||||
XCustom: $gzip -c man/utop.1 > man/utop.1.gz
|
||||
XCustomClean: $rm man/utop.1.gz
|
||||
DataFiles: man/utop.1.gz
|
||||
InstallDir: $mandir/man1
|
||||
|
||||
Document "utop-full-man"
|
||||
Type: custom (0.3)
|
||||
Title: Man page for utop
|
||||
Install: true
|
||||
BuildTools: gzip
|
||||
XCustom: $gzip -c man/utop-full.1 > man/utop-full.1.gz
|
||||
XCustomClean: $rm man/utop-full.1.gz
|
||||
DataFiles: man/utop-full.1.gz
|
||||
InstallDir: $mandir/man1
|
||||
|
||||
Document "utoprc-man"
|
||||
Type: custom (0.3)
|
||||
Title: Man page for utoprc
|
||||
Install: true
|
||||
BuildTools: gzip
|
||||
XCustom: $gzip -c man/utoprc.5 > man/utoprc.5.gz
|
||||
XCustomClean: $rm man/utoprc.5.gz
|
||||
DataFiles: man/utoprc.5.gz
|
||||
InstallDir: $mandir/man5
|
||||
|
||||
# +-------------------------------------------------------------------+
|
||||
# | Configuration examples |
|
||||
# +-------------------------------------------------------------------+
|
||||
|
||||
Document "utoprcs"
|
||||
Type: custom (0.3)
|
||||
Title: utoprc examples
|
||||
XCustom: true
|
||||
Install: true
|
||||
DataFiles: utoprc-dark, utoprc-light
|
||||
|
||||
# +-------------------------------------------------------------------+
|
||||
# | Misc |
|
||||
# +-------------------------------------------------------------------+
|
||||
|
||||
SourceRepository head
|
||||
Type: git
|
||||
Location: https://github.com/diml/utop.git
|
||||
Browser: https://github.com/diml/utop
|
9
_tags
9
_tags
|
@ -1,9 +0,0 @@
|
|||
# -*- conf -*-
|
||||
|
||||
<src/**/*.ml{,i}>: cppo_V_OCAML, cppo_interact, package(compiler-libs)
|
||||
<src/camlp5/**/*.ml{,i}>: use_camlp5
|
||||
|
||||
<**/*.ml>: warn(-3-40@8)
|
||||
|
||||
# OASIS_START
|
||||
# OASIS_STOP
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# OASIS_START
|
||||
make configure CONFIGUREFLAGS="$*"
|
||||
# OASIS_STOP
|
36
dist
36
dist
|
@ -1,36 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# dist
|
||||
# ----
|
||||
# Copyright : (c) 2012, Jeremie Dimino <jeremie@dimino.org>
|
||||
# Licence : BSD3
|
||||
#
|
||||
# Script to build the release
|
||||
|
||||
set -e
|
||||
|
||||
# Extract project parameters from _oasis
|
||||
NAME=`oasis query Name 2> /dev/null`
|
||||
VERSION=`oasis query Version 2> /dev/null`
|
||||
PREFIX=$NAME-$VERSION
|
||||
ARCHIVE=$(pwd)/$PREFIX.tar.gz
|
||||
|
||||
# Create a branch for the release
|
||||
git checkout -b release-$VERSION
|
||||
|
||||
# Generate files
|
||||
oasis setup
|
||||
|
||||
# Set release mode in the Makefile
|
||||
sed 's/^SETUP := setup-dev.exe.*/SETUP := setup.exe/' Makefile > Makefile.new
|
||||
mv Makefile.new Makefile
|
||||
|
||||
# Remove this script
|
||||
rm -f dist
|
||||
|
||||
# Commit
|
||||
git add --all
|
||||
git commit -m "prepare release"
|
||||
git tag $VERSION
|
||||
|
||||
git checkout master
|
120
myocamlbuild.ml
120
myocamlbuild.ml
|
@ -1,120 +0,0 @@
|
|||
(*
|
||||
* myocamlbuild.ml
|
||||
* ---------------
|
||||
* Copyright : (c) 2011, Jeremie Dimino <jeremie@dimino.org>
|
||||
* Licence : BSD3
|
||||
*
|
||||
* This file is a part of utop.
|
||||
*)
|
||||
|
||||
(* OASIS_START *)
|
||||
(* OASIS_STOP *)
|
||||
# 13 "myocamlbuild.ml"
|
||||
|
||||
let () =
|
||||
dispatch
|
||||
(fun hook ->
|
||||
dispatch_default hook;
|
||||
Ocamlbuild_cppo.dispatcher hook;
|
||||
match hook with
|
||||
| Before_options ->
|
||||
Options.make_links := false
|
||||
|
||||
| After_rules ->
|
||||
(* Copy tags from *.byte to *.top *)
|
||||
tag_file
|
||||
"src/top/uTop_top.top"
|
||||
(List.filter
|
||||
(* Remove the "file:..." tag and syntax extensions. *)
|
||||
(fun tag -> not (String.is_prefix "file:" tag) && not (String.is_suffix tag ".syntax"))
|
||||
(Tags.elements (tags_of_pathname "src/top/uTop_top.byte")));
|
||||
|
||||
(* Use -linkpkg for creating toplevels *)
|
||||
flag ["ocaml"; "link"; "toplevel"] & A"-linkpkg";
|
||||
|
||||
let env = BaseEnvLight.load () in
|
||||
let stdlib = BaseEnvLight.var_get "standard_library" env in
|
||||
|
||||
let paths = [A "-I"; A "+camlp5"] in
|
||||
flag ["ocaml"; "compile"; "use_camlp5"] & S paths;
|
||||
flag ["ocaml"; "ocamldep"; "use_camlp5"] & S paths;
|
||||
flag ["ocaml"; "doc"; "use_camlp5"] & S paths;
|
||||
|
||||
(* Expunge compiler modules *)
|
||||
rule "toplevel expunge"
|
||||
~dep:"src/top/uTop_top.top"
|
||||
~prod:"src/top/uTop_top.byte"
|
||||
(fun _ _ ->
|
||||
(* Build the list of explicit dependencies. *)
|
||||
let packages =
|
||||
Tags.fold
|
||||
(fun tag packages ->
|
||||
if String.is_prefix "package(" tag then
|
||||
String.sub tag 8 (String.length tag - 9) :: packages
|
||||
else
|
||||
packages)
|
||||
(tags_of_pathname "src/top/uTop_top.byte")
|
||||
[]
|
||||
in
|
||||
(* Build the list of dependencies. *)
|
||||
let deps = Findlib.topological_closure (List.rev_map Findlib.query packages) in
|
||||
(* Build the set of locations of dependencies. *)
|
||||
let locs = List.fold_left (fun set pkg -> StringSet.add pkg.Findlib.location set) StringSet.empty deps in
|
||||
(* Directories to search for .cmi: *)
|
||||
let directories = StringSet.add stdlib (StringSet.add (stdlib / "threads") locs) in
|
||||
(* Construct the set of modules to keep by listing
|
||||
.cmi files: *)
|
||||
let modules =
|
||||
StringSet.fold
|
||||
(fun directory set ->
|
||||
List.fold_left
|
||||
(fun set fname ->
|
||||
if Pathname.check_extension fname "cmi" then
|
||||
StringSet.add (module_name_of_pathname fname) set
|
||||
else
|
||||
set)
|
||||
set
|
||||
(Array.to_list (Pathname.readdir directory)))
|
||||
directories StringSet.empty
|
||||
in
|
||||
(* These are not in the stdlib path since 4.00 *)
|
||||
let modules = StringSet.add "Toploop" modules in
|
||||
let modules = StringSet.add "Topmain" modules in
|
||||
Cmd (S [A (stdlib / "expunge");
|
||||
A "src/top/uTop_top.top";
|
||||
A "src/top/uTop_top.byte";
|
||||
A "UTop"; A "UTop_private"; S(List.map (fun x -> A x) (StringSet.elements modules))]));
|
||||
|
||||
rule "full toplevel (not expunged)"
|
||||
~dep:"src/top/uTop_top.top"
|
||||
~prod:"src/top/uTop_top_full.byte"
|
||||
(fun _ _ -> cp "src/top/uTop_top.top" "src/top/uTop_top_full.byte");
|
||||
|
||||
|
||||
let interact_enabled = BaseEnvLight.var_get "interact" env = "true" in
|
||||
flag ["cppo"; "cppo_interact"] (
|
||||
if interact_enabled then
|
||||
S [A "-D"; A "ENABLE_INTERACT"]
|
||||
else
|
||||
N);
|
||||
|
||||
rule "format lifter"
|
||||
~prod:"src/lib/uTop_cmt_lifter.ml"
|
||||
(fun _ _ ->
|
||||
let ocaml_version =
|
||||
Scanf.sscanf (BaseEnvLight.var_get "ocaml_version" env)
|
||||
"%u.%u" (fun a b -> (a, b))
|
||||
in
|
||||
if ocaml_version < (4, 02) || not interact_enabled then
|
||||
Echo ([], "src/lib/uTop_cmt_lifter.ml")
|
||||
else
|
||||
Cmd (S [ P "ocamlfind"
|
||||
; A "ppx_tools/genlifter"
|
||||
; A "-I"
|
||||
; A "+compiler-libs"
|
||||
; A "Cmt_format.cmt_infos"
|
||||
; Sh ">"
|
||||
; A "src/lib/uTop_cmt_lifter.ml"
|
||||
]))
|
||||
| _ ->
|
||||
())
|
38
setup.ml
38
setup.ml
|
@ -1,38 +0,0 @@
|
|||
(*
|
||||
* setup.ml
|
||||
* --------
|
||||
* Copyright : (c) 2012, Jeremie Dimino <jeremie@dimino.org>
|
||||
* Licence : BSD3
|
||||
*
|
||||
* This file is a part of utop.
|
||||
*)
|
||||
|
||||
(* OASIS_START *)
|
||||
#use "topfind";;
|
||||
#require "oasis.dynrun";;
|
||||
open OASISDynRun;;
|
||||
(* OASIS_STOP *)
|
||||
|
||||
let search_compiler_libs () =
|
||||
prerr_endline "I: Searching for OCaml compiler libraries";
|
||||
let stdlib = BaseEnv.var_get "standard_library" in
|
||||
let ( / ) = Filename.concat in
|
||||
try
|
||||
List.find (fun path -> Sys.file_exists (path / "types.cmi") || Sys.file_exists (path / "typing" / "types.cmi")) [
|
||||
stdlib;
|
||||
stdlib / "compiler-libs";
|
||||
stdlib / "compiler-lib";
|
||||
stdlib / ".." / "compiler-libs";
|
||||
stdlib / ".." / "compiler-lib";
|
||||
]
|
||||
with Not_found ->
|
||||
prerr_endline "E: Cannot find compiler libraries! See the README for details.";
|
||||
exit 1
|
||||
|
||||
let compiler_libs =
|
||||
BaseEnv.var_define
|
||||
~short_desc:(fun () -> "compiler libraries")
|
||||
"compiler_libs"
|
||||
search_compiler_libs
|
||||
|
||||
let () = setup ()
|
|
@ -0,0 +1,9 @@
|
|||
(jbuild_version 1)
|
||||
|
||||
(library
|
||||
((name uTop_camlp4)
|
||||
(public_name utop.camlp4)
|
||||
(optional)
|
||||
(modes (byte))
|
||||
(libraries (utop camlp4.lib))
|
||||
(preprocess (action (run ${bin:cppo} -V OCAML:${ocaml_version} ${<})))))
|
|
@ -0,0 +1,35 @@
|
|||
(* -*- tuareg -*- *)
|
||||
|
||||
module J = Jbuild_plugin.V1
|
||||
|
||||
let version =
|
||||
let ic = open_in_bin "../../utop.opam" in
|
||||
let rec loop ic =
|
||||
let line = input_line ic in
|
||||
try
|
||||
Scanf.sscanf line "version: %S" (fun x -> x)
|
||||
with _ ->
|
||||
loop ic
|
||||
in
|
||||
let v = loop ic in
|
||||
close_in ic;
|
||||
v
|
||||
|
||||
let () =
|
||||
Printf.ksprintf J.send {|
|
||||
(jbuild_version 1)
|
||||
|
||||
(library
|
||||
((name uTop)
|
||||
(public_name utop)
|
||||
(wrapped false)
|
||||
(modes (byte))
|
||||
(libraries (compiler-libs.toplevel findlib_top lambda-term threads))
|
||||
(preprocess (action (run ${bin:cppo} -V OCAML:${ocaml_version} ${<})))))
|
||||
|
||||
(ocamllex (uTop_lexer))
|
||||
|
||||
(rule
|
||||
((targets (uTop_version.ml))
|
||||
(action (with-stdout-to ${@} (echo "let version = \"%s\"")))))
|
||||
|} version
|
|
@ -1,10 +0,0 @@
|
|||
(*
|
||||
* uTop_version.ml.ab
|
||||
* ------------------
|
||||
* Copyright : (c) 2012, Jeremie Dimino <jeremie@dimino.org>
|
||||
* Licence : BSD3
|
||||
*
|
||||
* This file is a part of utop.
|
||||
*)
|
||||
|
||||
let version = "$(pkg_version)"
|
|
@ -0,0 +1,9 @@
|
|||
(jbuild_version 1)
|
||||
|
||||
(executables
|
||||
((names (utop))
|
||||
(libraries (utop))))
|
||||
|
||||
(install
|
||||
((section bin)
|
||||
(files ((utop.bc as utop-full)))))
|
|
@ -1 +0,0 @@
|
|||
UTop_start
|
|
@ -1,4 +1,5 @@
|
|||
opam-version: "1.2"
|
||||
version: "1.19.3+dev"
|
||||
maintainer: "jeremie@dimino.org"
|
||||
authors: ["Jérémie Dimino"]
|
||||
license: "BSD3"
|
Loading…
Reference in New Issue