Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build F* with dune instead of ocamlbuild #2815

Merged
merged 151 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
8a5e410
step 1: instructions for a dune snapshot for the compiler and minimal…
tahina-pro Jan 24, 2023
e0df548
snap
tahina-pro Jan 25, 2023
31182a0
step 2: compile F* with dune
tahina-pro Jan 25, 2023
840e677
escape hatch to not verify `experimental`
tahina-pro Jan 25, 2023
76b5fc2
generate a fstar-stdlib snapshot
tahina-pro Jan 25, 2023
1036be2
special treatment for FStar.Pervasives
tahina-pro Jan 25, 2023
8ac0fb8
extract fstar-stdlib (formerly fstarlib)
tahina-pro Jan 25, 2023
1291dfb
snap
tahina-pro Jan 25, 2023
b4f42ac
extract some taclib
tahina-pro Jan 25, 2023
6e61ddf
snap
tahina-pro Jan 25, 2023
cad908a
load new fstar.taclib
tahina-pro Jan 25, 2023
f46c04c
snap
tahina-pro Jan 25, 2023
988620f
always print dynlink error
tahina-pro Jan 26, 2023
3f5f331
use -linkall for fstar.exe
tahina-pro Jan 26, 2023
e92863c
stage dune snapshot build
tahina-pro Jan 26, 2023
69cb66c
snap
tahina-pro Jan 26, 2023
9a1c44e
build fstar and libs from the dune snapshot, and verify ulib
tahina-pro Jan 26, 2023
7821bcd
dune-full-bootstrap
tahina-pro Jan 26, 2023
e9e39b0
overwrite FStar_Version.ml, do not extend it
tahina-pro Jan 26, 2023
3c726c0
snap
tahina-pro Jan 26, 2023
301393b
make sure we are not using a stale F* snapshot
tahina-pro Jan 26, 2023
408c53d
restore automatic tactic plugin compilation
tahina-pro Jan 26, 2023
cbcefb8
snap
tahina-pro Jan 26, 2023
6a5859a
no need to dynlink taclib anymore!
tahina-pro Jan 26, 2023
f23810d
snap
tahina-pro Jan 26, 2023
da9ce82
dune-bootstrap
tahina-pro Jan 27, 2023
2c7f81f
merge all libs
tahina-pro Jan 27, 2023
9e748db
snap
tahina-pro Jan 27, 2023
21bfa07
move CI entrypoint to root makefile, prepare for dune CI
tahina-pro Jan 27, 2023
6dea28a
add an explicit ocamlbuild rule
tahina-pro Jan 27, 2023
7b4a0c9
use Dune
tahina-pro Jan 27, 2023
0b02e48
ToDocument: preserve state of unfold_tuples
tahina-pro Jan 28, 2023
113f430
snap
tahina-pro Jan 28, 2023
a1855b9
fstarlib -> fstar.lib
tahina-pro Jan 28, 2023
eb38a57
add handwritten Steel ml files
tahina-pro Jan 28, 2023
29b8519
snap
tahina-pro Jan 28, 2023
e75cf5b
Merge branch 'taramana_dune_step_1' into taramana_dune_step_2
tahina-pro Jan 28, 2023
1b70d53
ocamlc -> ocamlopt
tahina-pro Jan 28, 2023
44301e8
examples/semiring: fstar-tactics-lib -> fstar.lib
tahina-pro Jan 30, 2023
2219770
Merge branch 'master' of github.com:FStarLang/FStar into taramana_dun…
tahina-pro Jan 30, 2023
98b4c9f
snap
tahina-pro Jan 30, 2023
deed0c6
remove ocamlbuild snapshot
tahina-pro Jan 30, 2023
c3914d5
remove handwritten ulib files
tahina-pro Jan 30, 2023
6224933
remove handwritten ml files in src/
tahina-pro Jan 30, 2023
acca4e3
generate everything directly into the snapshot, remove everything abo…
tahina-pro Jan 31, 2023
0b39cd8
extract everything in parallel
tahina-pro Jan 31, 2023
52cf538
tidy use of DUNE_SNAPSHOT
tahina-pro Jan 31, 2023
014314d
define FSTAR_HOME in src/ocaml-output/Makefile
tahina-pro Jan 31, 2023
23028be
remove handwritten files from ulib/experimental/ml
tahina-pro Jan 31, 2023
4825a2c
verify ulib before extracting it
tahina-pro Jan 31, 2023
603f2b6
extraction: drop paths in ranges
mtzguido Jan 31, 2023
8607890
.gitignore: ignore lib/
mtzguido Jan 31, 2023
ba0ec5f
snap, for compiler sources
mtzguido Jan 31, 2023
6ddfc73
snap, second for ulib files containing ranges
mtzguido Jan 31, 2023
3b910e4
move FStar_Version from generated to dynamic
tahina-pro Feb 1, 2023
bf18af2
snap
tahina-pro Feb 1, 2023
61de305
CI: update snapshot diff check
tahina-pro Feb 1, 2023
23b74b5
fix FSTAR_HOME in src/ocaml-output/Makefile
tahina-pro Feb 1, 2023
4b1f0ec
Merge branch 'master' of github.com:FStarLang/FStar into taramana_dun…
tahina-pro Feb 1, 2023
02ba786
snap
tahina-pro Feb 1, 2023
39179b8
extraction: drop paths in ranges
mtzguido Jan 31, 2023
164b354
snap
tahina-pro Feb 1, 2023
193716f
remove old snapshot
tahina-pro Feb 1, 2023
f9f2d4e
Merge branch '_taramana_dune_merge' into _taramana_dune
tahina-pro Feb 1, 2023
35e5a7c
remove all mentions of "fstarlib, fstartaclib, fstar-tactics-lib"
tahina-pro Feb 1, 2023
9d323d7
snap
tahina-pro Feb 1, 2023
86819c6
FStar.Tactics.Load.load_lib, try_load_lib no longer needed
tahina-pro Feb 1, 2023
2dd9ab9
restore the boot rule
tahina-pro Feb 1, 2023
085483c
update the compilation instructions
tahina-pro Feb 1, 2023
87d073d
a top-level verify-ulib rule
tahina-pro Feb 1, 2023
b02a50d
document `make verify-ulib`
tahina-pro Feb 1, 2023
186f455
Merge branch 'master' of github.com:FStarLang/FStar into _taramana_du…
tahina-pro Feb 1, 2023
59f9513
snap
tahina-pro Feb 1, 2023
dbb3bab
remove ocamlbuild snapshot
tahina-pro Feb 1, 2023
fc769a4
Merge branch '_taramana_dune_merge' into _taramana_dune
tahina-pro Feb 1, 2023
7514956
Makefile: PWD -> CURDIR
tahina-pro Feb 2, 2023
05314a3
reinstate `make install`
tahina-pro Feb 2, 2023
230e9d6
eci19 does not need FSTAR_HOME
tahina-pro Feb 2, 2023
7f42b18
a Dockerfile to test `make package` without OCaml
tahina-pro Feb 2, 2023
2663ccb
.gitattributes: do not show diff in ocaml/fstar-lib/generated
mtzguido Feb 2, 2023
400f371
Makefiles: autogenerate FStar_Version.ml on each run, do not check it in
mtzguido Feb 2, 2023
c3a71a5
Makefile.boot: take tests out of the library
mtzguido Feb 3, 2023
90b24c5
dune: fstar-tests: add public name to obtain an executable
mtzguido Feb 2, 2023
12fd6f4
Makefile: restore unit tests on ci rule
mtzguido Feb 2, 2023
d64b62c
snap, test ml files move to fstar-tests/generated
mtzguido Feb 3, 2023
1937ace
clarify fstar.opam
tahina-pro Feb 2, 2023
c0864c8
fix multifile example
tahina-pro Feb 2, 2023
fc54eb0
fix installation of doc/tutorial
tahina-pro Feb 2, 2023
e134f6a
for parts that do not work outside of F* sources, remove them from in…
tahina-pro Feb 2, 2023
8f7e674
`opam remove` needs no explicit `make uninstall`
tahina-pro Feb 3, 2023
55fa49f
fix `make uninstall`
tahina-pro Feb 3, 2023
7231315
book: fstarlib -> fstar.lib
tahina-pro Feb 3, 2023
7d2500d
ulib vs. lib/fstar is independent of FSTAR_HOME
tahina-pro Feb 3, 2023
6c8c760
move FStar_Tests_ files to ocaml/fstar-tests/generated
tahina-pro Feb 3, 2023
1748089
Merge branch 'master' of github.com:FStarLang/FStar into _taramana_du…
tahina-pro Feb 3, 2023
2a4b448
snap
tahina-pro Feb 3, 2023
d4733bb
remove the OCaml snapshot
tahina-pro Feb 3, 2023
5aec95d
Merge branch '_taramana_dune_merge' into taramana_dune
tahina-pro Feb 3, 2023
2031bcb
move FStar_Version.ml from generated to dynamic
tahina-pro Feb 4, 2023
b160b43
Merge branch '_taramana_dune_step_2' into _taramana_dune
tahina-pro Feb 4, 2023
e2f334a
include extracted ulib/fs into binary package
tahina-pro Feb 6, 2023
e90266a
do not include the nuget package, but do include ulibfs.dll
tahina-pro Feb 6, 2023
7769171
ulib/Makefile.extract.fsharp: avoid long cmdline for dependency analysis
tahina-pro Feb 6, 2023
4eade93
extract ulibfs using existing checked, no need for lax
tahina-pro Feb 7, 2023
9654a0d
Merge branch 'master' of github.com:FStarLang/FStar into _taramana_du…
tahina-pro Feb 7, 2023
c7685de
Makefile: comment
mtzguido Feb 6, 2023
079babf
dune: silence warnings
mtzguido Feb 7, 2023
c75c3b1
Makefiles: tidy up info messages
mtzguido Feb 6, 2023
0b15d92
re-extract F* snapshot
tahina-pro Feb 7, 2023
d24c786
bump checked files version number
tahina-pro Feb 7, 2023
e9813c0
snap
tahina-pro Feb 7, 2023
5a5692d
remove old ocamlbuild snapshot
tahina-pro Feb 7, 2023
468f832
Merge branch '_taramana_dune_merge' into _taramana_dune
tahina-pro Feb 7, 2023
f37e300
Merge branch '_taramana_dune' of github.com:FStarLang/FStar into _tar…
tahina-pro Feb 7, 2023
f5b7eb5
update testing Dockerfiles
tahina-pro Feb 7, 2023
248ecda
fix the package build script
tahina-pro Feb 7, 2023
5d10f12
minimal restore of nix flake
tahina-pro Feb 8, 2023
6b8a190
nix flake: install everything
tahina-pro Feb 8, 2023
bc9bfa0
fulfill all actions of `dune install`
tahina-pro Feb 8, 2023
1f0c342
Merge branch 'master' of github.com:FStarLang/FStar into _taramana_du…
tahina-pro Feb 10, 2023
0ab6859
snap
tahina-pro Feb 10, 2023
225c59d
remove the ocamlbuild snapshot
tahina-pro Feb 10, 2023
6d5cf43
Merge branch '_taramana_dune_merge' into _taramana_dune
tahina-pro Feb 10, 2023
82d2e26
mlexpr_of_range: what if filename has no `/` ?
tahina-pro Feb 10, 2023
e957f44
snap
tahina-pro Feb 10, 2023
7a54d99
update the build process
pnmadelaine Feb 9, 2023
2cc1a6f
leverage the install-sides rule
tahina-pro Feb 10, 2023
8d1edab
`make -C src clean` shouldn't erase `generated/`
tahina-pro Feb 14, 2023
056150a
fix `make -C ulib clean`
tahina-pro Feb 14, 2023
7ea6196
more intermediate files to cleanup
tahina-pro Feb 14, 2023
0730555
clarify what to clean when in the root Makefile
tahina-pro Feb 14, 2023
0fb05c9
Merge branch 'master' of github.com:FStarLang/FStar into _taramana_du…
tahina-pro Feb 14, 2023
c222f0f
snap
tahina-pro Feb 14, 2023
c596682
remove ocamlbuild snapshot
tahina-pro Feb 14, 2023
08d68a5
Merge branch '_taramana_dune' into _taramana_dune_merge
tahina-pro Feb 14, 2023
8e35a31
Nix update
pnmadelaine Feb 12, 2023
5865554
tweaks to Makefiles
mtzguido Feb 14, 2023
cd076c6
/Makefile: tidy PHONY rules and reintroduce shortcuts
mtzguido Feb 14, 2023
571a668
snap
mtzguido Feb 14, 2023
d883f05
ocaml: .gitignore version.txt and silence copy rule
mtzguido Feb 14, 2023
7f99f6d
ocaml/dune: ignore all warnings
mtzguido Feb 14, 2023
7a914d7
`dune --prefix` does not support Cygwin paths
tahina-pro Feb 14, 2023
f1ca638
Merge remote-tracking branch 'pnm/dev' into _taramana_dune
tahina-pro Feb 14, 2023
c0a7927
Merge branch 'master' of github.com:FStarLang/FStar into _taramana_du…
tahina-pro Feb 14, 2023
a108445
explicitly call bash from dune when regenerating FStar_Version.ml
tahina-pro Feb 14, 2023
de65146
snap
tahina-pro Feb 14, 2023
a297ac5
remove ocamlbuild snapshot
tahina-pro Feb 14, 2023
e9a951e
Merge branch '_taramana_dune_merge' into _taramana_dune
tahina-pro Feb 14, 2023
d3e0aef
checkedfiles: suppress not found warning for --lax
mtzguido Feb 14, 2023
a7feb41
require dune >= 3.2.0
tahina-pro Feb 15, 2023
6a26ef0
Merge branch 'master' into _taramana_dune
tahina-pro Feb 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# follows (taken from src/Makefile.boot):
#
# ocaml-output/%.ml:
# @echo "[EXTRACT $(notdir $@)]"
# $(call msg, "EXTRACT", $(notdir $@))
# $(Q)$(BENCHMARK_PRE) $(FSTAR_C) $(SIL) $(notdir $(subst .checked.lax,,$<)) \
# --codegen OCaml \
# --extract_module $(basename $(notdir $(subst .checked.lax,,$<)))
Expand All @@ -17,10 +17,6 @@
#
# Besides that, when not using V=1, F* receives the --silent flag to
# reduce non-critical output.
#
# It would be nice to define a function to print messages instead of
# copying the same echo invocation everywhere, but AFAIK that would mean
# we require GNU make.

Q?=@
SIL?=--silent
Expand All @@ -37,6 +33,10 @@ runlim not found:
You can get it from: [https://github.com/arminbiere/runlim]
endef

define msg =
@printf " %-8s %s\n" $(1) $(2)
endef

# Passing RESOURCEMONITOR=1 will create .runlim files through the source tree with
# information about the time and space taken by each F* invocation.
ifneq ($(RESOURCEMONITOR),)
Expand Down
1 change: 0 additions & 1 deletion .completion/fish/fstar.exe.fish
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ complete -c fstar.exe -l max_ifuel --description "non-negative integer Number o
complete -c fstar.exe -l MLish --description "Trigger various specializations for compiling the F* compiler itself (not meant for user code)"
complete -c fstar.exe -l no_default_includes --description "Ignore the default module search paths"
complete -c fstar.exe -l no_extract --description "module name Deprecated: use --extract instead; Do not extract code from this module"
complete -c fstar.exe -l no_load_fstartaclib --description "Do not attempt to load fstartaclib by default"
complete -c fstar.exe -l no_location_info --description "Suppress location information in the generated OCaml output (only relevant with --codegen OCaml)"
complete -c fstar.exe -l no_smt --description "Do not send any queries to the SMT solver, and fail on them instead"
complete -c fstar.exe -l normalize_pure_terms_for_extraction --description "Extract top-level pure terms after normalizing them. This can lead to very large code, but can result in more partial evaluation and compile-time specialization."
Expand Down
19 changes: 12 additions & 7 deletions .docker/build/build_funs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ function update_version_number () {
git commit -m "[CI] bump version number to $version_number"
}

function git_add_fstar_snapshot () {
if ! git diff-index --quiet --cached HEAD -- ocaml/*/generated ; then
git ls-files ocaml/*/generated | xargs git add
fi
}

function refresh_fstar_hints() {
[[ -n "$DZOMO_GITHUB_TOKEN" ]] &&
refresh_hints "https://$DZOMO_GITHUB_TOKEN@github.com/FStarLang/FStar.git" "git ls-files src/ocaml-output/ | xargs git add" "regenerate hints + ocaml snapshot" "."
refresh_hints "https://$DZOMO_GITHUB_TOKEN@github.com/FStarLang/FStar.git" "git_add_fstar_snapshot" "regenerate hints + ocaml snapshot" "."
}

# Note: this performs an _approximate_ refresh of the hints, in the sense that
Expand Down Expand Up @@ -194,8 +200,7 @@ function fstar_binary_build () {
function fstar_docs_build () {
# First - get fstar built
# Second - run fstar with the --doc flag
make -C src/ocaml-output clean && \
make -C src/ocaml-output -j $threads && \
OTHERFLAGS='--admit_smt_queries true' make -j $threads && \
.ci/fsdoc.sh && \
echo true >$status_file
}
Expand All @@ -213,7 +218,7 @@ function fstar_default_build () {
fi &

# Build F*, along with fstarlib
if ! make -C src -j $threads utest-prelude; then
if ! make -j $threads ci-utest-prelude; then
echo Warm-up failed
echo Failure >$result_file
return 1
Expand All @@ -232,13 +237,13 @@ function fstar_default_build () {
fi

# Once F* is built, run its main regression suite.
$gnutime make -C src -j $threads -k $localTarget && echo true >$status_file
$gnutime make -j $threads -k ci-$localTarget && echo true >$status_file
echo Done building FStar

# Make it a hard failure if there's a git diff. Note: FStar_Version.ml is in the
# .gitignore.
echo "Searching for a diff in src/ocaml-output"
if ! git diff --exit-code src/ocaml-output; then
echo "Searching for a diff in ocaml/*/generated"
if ! git diff --exit-code ocaml/*/generated ; then
echo "GIT DIFF: the files in the list above have a git diff"
echo false >$status_file
fi
Expand Down
15 changes: 11 additions & 4 deletions .docker/opam.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ FROM ocaml/opam:ubuntu-ocaml-$ocaml_version
# FIXME: the `opam depext` command should be unnecessary with opam 2.1
RUN opam depext conf-gmp z3.4.8.5 conf-m4

ADD --chown=opam:opam ./fstar.opam fstar.opam
RUN opam install --deps-only ./fstar.opam
RUN rm fstar.opam

ADD --chown=opam:opam ./ FStar/
RUN rm -rf FStar/.git

RUN opam install --deps-only FStar/fstar.opam
ARG opamthreads=24
RUN opam install -j $opamthreads -v -v -v FStar/fstar.opam
RUN eval $(opam env) && make -C $(opam config var fstar:share)/examples -j $opamthreads
RUN eval $(opam env) && make -C $(opam config var fstar:share)/tutorial -j $opamthreads regressions
RUN rm -rf FStar
# NOTE: I need to copy examples and tutorial from share/ because
# opam uninstall will balk at removing files created there during the test
RUN cp -p -r $(opam config var fstar:share)/examples $HOME/examples
RUN cp -p -r $(opam config var fstar:share)/doc $HOME/doc
RUN eval $(opam env) && make -C $HOME/examples -j $opamthreads
RUN eval $(opam env) && make -C $HOME/doc/tutorial -j $opamthreads regressions
RUN opam uninstall -v -v -v fstar
74 changes: 35 additions & 39 deletions .docker/package.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,45 @@

# Build the package
ARG ocaml_version=4.12
FROM ocaml/opam:ubuntu-20.04-ocaml-$ocaml_version AS fstardep
ARG opamthreads=24

FROM ocaml/opam:ubuntu-20.04-ocaml-$ocaml_version AS fstarbuild

# FIXME: the `opam depext` command should be unnecessary with opam 2.1
RUN opam depext conf-gmp z3.4.8.5 conf-m4

ADD --chown=opam:opam ./ FStar/
ADD --chown=opam:opam ./fstar.opam fstar.opam

# Install opam dependencies only
RUN opam install --deps-only FStar/fstar.opam
RUN opam install --deps-only ./fstar.opam

ARG opamthreads=24
# Install .NET
RUN sudo apt-get update && sudo apt-get install --yes --no-install-recommends \
libicu66

FROM fstardep AS fstarbuild
# (for .NET, cf. https://aka.ms/dotnet-missing-libicu )
# CI dependencies: .NET Core
# Repository install may incur some (transient?) failures (see for instance https://github.com/dotnet/sdk/issues/27082 )
# So, we use manual install instead, from https://docs.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#manual-install
ENV DOTNET_ROOT /home/opam/dotnet
RUN sudo apt-get install --yes --no-install-recommends \
wget

# Build the package,
RUN eval $(opam env) && env Z3_LICENSE="$(opam config expand '%{prefix}%')/.opam-switch/sources/z3.4.8.5/LICENSE.txt" OTHERFLAGS='--admit_smt_queries true' make -C FStar -j $opamthreads package_unknown_platform
RUN wget https://download.visualstudio.microsoft.com/download/pr/cd0d0a4d-2a6a-4d0d-b42e-dfd3b880e222/008a93f83aba6d1acf75ded3d2cfba24/dotnet-sdk-6.0.400-linux-x64.tar.gz && \
mkdir -p $DOTNET_ROOT && \
tar xf dotnet-sdk-6.0.400-linux-x64.tar.gz -C $DOTNET_ROOT

# Create a separate image to test the package
FROM fstardep AS fstarbin
ENV PATH=${PATH}:$DOTNET_ROOT:$DOTNET_ROOT/tools

# Remove F* sources (keep deps)
RUN mv FStar FStar.todelete && rm -rf FStar.todelete
ADD --chown=opam:opam ./ FStar/

# Copy the F* binary package
COPY --from=fstarbuild /home/opam/FStar/src/ocaml-output/fstar.tar.gz /home/opam/fstar.tar.gz
RUN tar xzf fstar.tar.gz
ENV FSTAR_HOME /home/opam/fstar
ENV PATH="${FSTAR_HOME}/bin:${PATH}"
# Build the package,
RUN eval $(opam env) && env Z3_LICENSE="$(opam config expand '%{prefix}%')/.opam-switch/sources/z3.4.8.5/LICENSE.txt" OTHERFLAGS='--admit_smt_queries true' make -C FStar -j $opamthreads package_unknown_platform

# Copy examples and docs
ADD --chown=opam:opam examples/ fstar_examples/
ADD --chown=opam:opam doc/ fstar_doc/
# Create a separate image to test the package

# Test the F* binary package

# Case 1: test the fresh package
FROM fstarbin
RUN eval $(opam env) && make -C fstar_examples -j $opamthreads
RUN eval $(opam env) && make -C fstar_doc/tutorial -j $opamthreads regressions

# Case 2: rebuild ulib and test again
FROM fstarbin
RUN eval $(opam env) && make -C $FSTAR_HOME/ulib rebuild -j $opamthreads
RUN eval $(opam env) && make -C fstar_examples/hello -j $opamthreads
RUN eval $(opam env) && make -C $FSTAR_HOME/ulib clean_checked && make -C $FSTAR_HOME/ulib -j $opamthreads
RUN eval $(opam env) && make -C fstar_examples -j $opamthreads
RUN eval $(opam env) && make -C fstar_doc/tutorial -j $opamthreads regressions

# Test the fresh package without OCaml
FROM ubuntu:20.04 AS fstarnoocaml
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -71,24 +62,29 @@ SHELL ["/bin/bash", "--login", "-c"]
# Copy the package
COPY --from=fstarbuild /home/opam/FStar/src/ocaml-output/fstar.tar.gz /home/test/fstar.tar.gz
RUN tar xzf fstar.tar.gz
ENV FSTAR_HOME /home/test/fstar
ENV PATH="${FSTAR_HOME}/bin:${PATH}"

# Copy tests, examples and docs
ADD --chown=test:test examples/ fstar_examples/
ADD --chown=test:test doc/ fstar_doc/

# Case 3: test F* package without OCaml
FROM fstarnoocaml
RUN make -C fstar_examples -j $opamthreads
RUN make -C fstar_doc/tutorial -j $opamthreads regressions

# Case 4: test F* package without OCaml, but recheck ulib
# Test the package with FSTAR_HOME defined
# Move z3 elsewhere
# FROM fstarnoocaml
# ENV FSTAR_HOME=$HOME/fstar
# RUN mkdir -p $HOME/bin && ln -s $FSTAR_HOME/bin/z3 $HOME/bin/
# ENV PATH="${HOME}/bin:${PATH}"
# RUN make -C fstar_examples -j $opamthreads
# RUN make -C fstar_doc/tutorial -j $opamthreads regressions

# Test the package with F* in the PATH instead
FROM fstarnoocaml
RUN make -C $FSTAR_HOME/ulib clean_checked && make -C $FSTAR_HOME/ulib -j $opamthreads
ENV PATH="/home/test/fstar/bin:${PATH}"
RUN make -C fstar_examples -j $opamthreads
RUN make -C fstar_doc/tutorial -j $opamthreads regressions

FROM fstarnoocaml
# This is the last image. So we can also copy the file that contains
# the desired filename for the package, to be extracted via
# `docker cp`
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.fsti linguist-language=FStar
*.fsti linguist-documentation=false
/src/ocaml-output/FStar_*.ml linguist-vendored
/ocaml/fstar-lib/generated/FStar_*.ml linguist-vendored

# Line endings
*.fs* eol=lf
Expand All @@ -24,6 +25,8 @@ karamel_ref eol=lf
# does not show diffs in the CLI nor GitHub.
/src/ocaml-output/FStar_*.ml -diff -merge
/src/ocaml-output/FStar_*.ml linguist-generated=true
/ocaml/fstar-lib/generated/FStar_*.ml -diff -merge
/ocaml/fstar-lib/generated/FStar_*.ml linguist-generated=true
*.hints -diff -merge
*.hints linguist-generated=true

Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ cache/
/bin/z3-x64.exe
/src/*/obj

/lib

examples/*/*.ml
examples/crypto/CntProtocol.exe
examples/wysteria/ocaml-output/*
Expand All @@ -43,6 +45,8 @@ _build/
/ulib/fs/obj
/ulib/fs/bin

/release

*.native
*.byte

Expand All @@ -60,6 +64,7 @@ dump
*.cmxs
*.cmxa
*.o
fstar.install

.depend
.depend.rsp
Expand Down
5 changes: 0 additions & 5 deletions .nix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ To build/run/install/... `fstar-bootsrap`, just use
`github:FStarLang/FStar#fstar-bootsrap` instead of
`github:FStarLang/FStar`.

## Building custom version of F\*

The file `.nix/lib.nix` provides a fined grained Nix API to build
custom F\*.

## Hacking on F\*

Just run `nix develop` in your local clone of F\*, you will be dropped
Expand Down
25 changes: 25 additions & 0 deletions .nix/bootstrap.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ fstar, fstar-dune, fstar-ocaml-snapshot, fstar-ulib, stdenv }:

let
ocaml-src = stdenv.mkDerivation {
name = "src";
src = fstar-ocaml-snapshot;
dontBuild = true;
installPhase = ''
mkdir -p $out/ocaml
mv ./* $out/ocaml
cp ${../version.txt} $out/version.txt
'';
};
fstar-dune-bootstrap = fstar-dune.overrideAttrs (_: {
pname = "fstar-bootstrap-dune";
src = ocaml-src;
});
fstar-ulib-bootstrap = (fstar-ulib.override
(_: { fstar-dune = fstar-dune-bootstrap; })).overrideAttrs
(_: { pname = "fstar-bootstrap-ulib"; });

in (fstar.override (_: {
fstar-dune = fstar-dune-bootstrap;
fstar-ulib = fstar-ulib-bootstrap;
})).overrideAttrs (_: { pname = "fstar-bootstrap"; })
42 changes: 42 additions & 0 deletions .nix/fstar.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ callPackage, fstar-dune, fstar-ulib, installShellFiles, lib, makeWrapper
, stdenv, version, z3 }:

stdenv.mkDerivation {
pname = "fstar";
inherit version;

buildInputs = [ installShellFiles makeWrapper ];

src = lib.sourceByRegex ./.. [
".common.mk"
"doc.*"
"examples.*"
"src(/ocaml-output(/Makefile)?)?"
"ucontrib.*"
];

dontBuild = true;

installPhase = ''
mkdir $out

CP="cp -r --no-preserve=mode"
$CP ${fstar-dune}/* $out
$CP ${fstar-ulib}/* $out

PREFIX=$out make -C src/ocaml-output install-sides

for binary in $out/bin/*
do
chmod +x $binary
wrapProgram $binary --prefix PATH ":" ${z3}/bin
done

cd $out
installShellCompletion --bash ${../.completion/bash/fstar.exe.bash}
installShellCompletion --fish ${../.completion/fish/fstar.exe.fish}
installShellCompletion --zsh --name _fstar.exe ${
../.completion/zsh/__fstar.exe
}
'';
}
Loading