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

Fix win32 ocaml5 tmp2 #7

Closed
wants to merge 14 commits into from
Closed
42 changes: 0 additions & 42 deletions .github/scripts/main/create-ocaml-cache.sh

This file was deleted.

6 changes: 1 addition & 5 deletions .github/scripts/main/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ case "$1" in
CONFIGURE_PREFIX="$PREFIX";;
esac

if [ -e "$OCAML_LOCAL/_build" ]; then
cp -a "$OCAML_LOCAL/_build" .
fi

./configure --prefix $CONFIGURE_PREFIX --with-vendored-deps --with-mccs
if [ "$OPAM_TEST" != "1" ]; then
echo 'DUNE_PROFILE=dev' >> Makefile.config
Expand All @@ -42,7 +38,7 @@ if [ $OPAM_UPGRADE -eq 1 ]; then
fi
# Disable implicit transitive deps
sed -i -e '/(implicit_transitive_deps /s/true/false/' dune-project
make all admin
make all admin opam-stripped
sed -i -e '/(implicit_transitive_deps /s/false/true/' dune-project

rm -f "$PREFIX/bin/opam"
Expand Down
12 changes: 7 additions & 5 deletions .github/scripts/main/ocaml-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ EOF
chmod +x "$OCAML_LOCAL/bin/ocamldoc"
fi

# Hand-over control to a separate script in case the branch being tested
# updates this script, which will fail on Windows (since the script is "open"
# and can't be overwritten)
cp -pf .github/scripts/main/create-ocaml-cache.sh ../create-ocaml-cache.sh
exec ../create-ocaml-cache.sh "$OCAML_BRANCH" "$PREFIX" "$EXE" "$OCAML_LOCAL" "$PLATFORM"
make -C src_ext dune-local.stamp
cd src_ext/dune-local
ocaml boot/bootstrap.ml
cp _boot/dune.exe "$PREFIX/bin/dune$EXE"
cd ../..

git clean -dfX
36 changes: 23 additions & 13 deletions .github/workflows/ci.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@

open Lib

let latest_ocaml4 = "4.14.2"
let latest_ocaml5 = "5.2.0"
let ocamls = [
(* Fully supported versions *)
"4.08.1"; "4.09.1"; "4.10.2"; "4.11.2"; "4.12.1"; "4.13.1"; "5.0.0"; "5.1.1"; "4.14.1";
"4.08.1"; "4.09.1"; "4.10.2"; "4.11.2"; "4.12.1"; "4.13.1";
"5.0.0"; "5.1.1";

(* The last elements of the list after 4.14 will be used as default versions *)
latest_ocaml4; latest_ocaml5;
]
let start_latests_ocaml = (4, 14)

(* Entry point for the workflow. Workflows are specified as continuations where
each job is passed as a continuation to the [workflow], terminated with
Expand Down Expand Up @@ -65,8 +72,6 @@ let end_workflow ~oc:_ ~workflow:_ = ()
let ocamls =
List.map (fun v -> Scanf.sscanf v "%u.%u.%u" (fun major minor _ -> ((major, minor), v))) ocamls

let latest_ocaml = List.fold_left (fun _ (v, _) -> v) (0, 0) ocamls

let platform_ocaml_matrix ?(dir=List.drop_while) ~fail_fast start_version =
(fail_fast,
[("ocamlv", List.map snd (dir (fun ocaml -> fst ocaml <> start_version) ocamls))],
Expand Down Expand Up @@ -296,13 +301,18 @@ let main_build_job ~analyse_job ~cygwin_job ?section runner start_version ~oc ~w
(* Intentionally fail fast, no need to run all build if there is a
* problem in a given version; usually it is functions not defined in lower
* versions of OCaml. *)
let (_fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:true start_version in
let (matrix, includes) =
if platform = Windows then
(("host", ["x86_64-pc-cygwin"; "i686-w64-mingw32"; "x86_64-w64-mingw32"; "i686-pc-windows"; "x86_64-pc-windows"]) ::
("build", ["x86_64-pc-cygwin"]) ::
matrix, [])
([], [
[("host", "x86_64-pc-cygwin"); ("build", "x86_64-pc-cygwin"); ("ocamlv", latest_ocaml4)];
[("host", "i686-w64-mingw32"); ("build", "x86_64-pc-cygwin"); ("ocamlv", latest_ocaml4)];
[("host", "x86_64-w64-mingw32"); ("build", "x86_64-pc-cygwin"); ("ocamlv", latest_ocaml4)];
[("host", "x86_64-w64-mingw32"); ("build", "x86_64-pc-cygwin"); ("ocamlv", latest_ocaml5)];
[("host", "i686-pc-windows"); ("build", "x86_64-pc-cygwin"); ("ocamlv", latest_ocaml4)];
[("host", "x86_64-pc-windows"); ("build", "x86_64-pc-cygwin"); ("ocamlv", latest_ocaml4)];
])
else
let (_fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:true start_version in
(matrix, []) in
let matrix = ((platform <> Windows), matrix, includes) in
let needs = if platform = Windows then [analyse_job; cygwin_job] else [analyse_job] in
Expand Down Expand Up @@ -351,7 +361,7 @@ let main_test_job ~analyse_job ~build_linux_job ~build_windows_job:_ ~build_macO
| MacOS -> [analyse_job] (* This isn't gated on build_macOS_job for speed *)
| Linux -> [analyse_job; build_linux_job]
in
let matrix = platform_ocaml_matrix ~fail_fast:false latest_ocaml in
let matrix = platform_ocaml_matrix ~fail_fast:false start_latests_ocaml in
let host = host_of_platform platform in
let ocamlv = "${{ matrix.ocamlv }}" in
job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~env:[("OPAM_TEST", "1")] ~matrix ~needs ("Test-" ^ name_of_platform platform)
Expand Down Expand Up @@ -391,7 +401,7 @@ let solvers_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_jo
let only_on target = only_on platform target in
let needs = [analyse_job; (match platform with Linux -> build_linux_job | Windows -> build_windows_job | MacOS -> build_macOS_job)] in
let env = [("SOLVER", "${{ matrix.solver }}"); ("OPAMBSROOT", "~/.cache/opam.${{ matrix.solver }}.cached")] in
let (fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:false latest_ocaml in
let (fail_fast, matrix, _) = platform_ocaml_matrix ~fail_fast:false start_latests_ocaml in
let matrix =
(fail_fast, ("solver", ["z3"; "0install"])::matrix, [])
in
Expand All @@ -413,7 +423,7 @@ let upgrade_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_jo
let host = host_of_platform platform in
let only_on target = only_on platform target in
let needs = [analyse_job; (match platform with Linux -> build_linux_job | Windows -> build_windows_job | MacOS -> build_macOS_job)] in
let matrix = platform_ocaml_matrix ~fail_fast:false latest_ocaml in
let matrix = platform_ocaml_matrix ~fail_fast:false start_latests_ocaml in
let ocamlv = "${{ matrix.ocamlv }}" in
job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~needs ~matrix ("Upgrade-" ^ name_of_platform platform)
++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"])
Expand Down Expand Up @@ -482,16 +492,16 @@ let main oc : unit =
] in
let keys = [
("archives", "archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }}");
("ocaml-cache", "${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.sh') }}");
("ocaml-cache", "${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }}");
("cygwin", "${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }}");
("opam-bs-cache", "${{ hashFiles('.github/scripts/main/opam-bs-cache.sh', '*.opam', '.github/scripts/main/preamble.sh') }}");
] in
workflow ~oc ~env "Builds, tests & co"
++ analyse_job ~keys ~platforms:[Linux]
@@ fun analyse_job -> cygwin_job ~analyse_job
@@ fun cygwin_job -> main_build_job ~analyse_job ~cygwin_job ~section:"Build" Linux (4, 08)
@@ fun build_linux_job -> main_build_job ~analyse_job ~cygwin_job Windows latest_ocaml
@@ fun build_windows_job -> main_build_job ~analyse_job ~cygwin_job MacOS latest_ocaml
@@ fun build_linux_job -> main_build_job ~analyse_job ~cygwin_job Windows start_latests_ocaml
@@ fun build_windows_job -> main_build_job ~analyse_job ~cygwin_job MacOS start_latests_ocaml
@@ fun build_macOS_job -> main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam tests" Linux
@@ fun _ -> main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS
@@ fun _ -> cold_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam cold" Linux
Expand Down
42 changes: 29 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
run: |
echo archives=archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }}
echo archives=archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }} >> $GITHUB_OUTPUT
echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.sh') }}
echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.sh') }} >> $GITHUB_OUTPUT
echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }}
echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} >> $GITHUB_OUTPUT
echo cygwin=${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }}
echo cygwin=${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }} >> $GITHUB_OUTPUT
echo opam-bs-cache=${{ hashFiles('.github/scripts/main/opam-bs-cache.sh', '*.opam', '.github/scripts/main/preamble.sh') }}
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
needs: Analyse
strategy:
matrix:
ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 4.14.1 ]
ocamlv: [ 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.1, 4.13.1, 5.0.0, 5.1.1, 4.14.2, 5.2.0 ]
fail-fast: true
steps:
- name: Install bubblewrap
Expand Down Expand Up @@ -141,9 +141,25 @@ jobs:
needs: [ Analyse, Cygwin ]
strategy:
matrix:
host: [ x86_64-pc-cygwin, i686-w64-mingw32, x86_64-w64-mingw32, i686-pc-windows, x86_64-pc-windows ]
build: [ x86_64-pc-cygwin ]
ocamlv: [ 4.14.1 ]
include:
- host: x86_64-pc-cygwin
build: x86_64-pc-cygwin
ocamlv: 4.14.2
- host: i686-w64-mingw32
build: x86_64-pc-cygwin
ocamlv: 4.14.2
- host: x86_64-w64-mingw32
build: x86_64-pc-cygwin
ocamlv: 4.14.2
- host: x86_64-w64-mingw32
build: x86_64-pc-cygwin
ocamlv: 5.2.0
- host: i686-pc-windows
build: x86_64-pc-cygwin
ocamlv: 4.14.2
- host: x86_64-pc-windows
build: x86_64-pc-cygwin
ocamlv: 4.14.2
fail-fast: false
defaults:
run:
Expand Down Expand Up @@ -226,7 +242,7 @@ jobs:
needs: Analyse
strategy:
matrix:
ocamlv: [ 4.14.1 ]
ocamlv: [ 4.14.2, 5.2.0 ]
fail-fast: true
steps:
- name: Checkout tree
Expand Down Expand Up @@ -262,7 +278,7 @@ jobs:
needs: [ Analyse, Build-Linux ]
strategy:
matrix:
ocamlv: [ 4.14.1 ]
ocamlv: [ 4.14.2, 5.2.0 ]
fail-fast: false
env:
OPAM_TEST: 1
Expand Down Expand Up @@ -316,7 +332,7 @@ jobs:
needs: Analyse
strategy:
matrix:
ocamlv: [ 4.14.1 ]
ocamlv: [ 4.14.2, 5.2.0 ]
fail-fast: false
env:
OPAM_TEST: 1
Expand Down Expand Up @@ -403,7 +419,7 @@ jobs:
strategy:
matrix:
solver: [ z3, 0install ]
ocamlv: [ 4.14.1 ]
ocamlv: [ 4.14.2, 5.2.0 ]
fail-fast: false
env:
SOLVER: ${{ matrix.solver }}
Expand Down Expand Up @@ -451,7 +467,7 @@ jobs:
strategy:
matrix:
solver: [ z3, 0install ]
ocamlv: [ 4.14.1 ]
ocamlv: [ 4.14.2, 5.2.0 ]
fail-fast: false
env:
SOLVER: ${{ matrix.solver }}
Expand Down Expand Up @@ -499,7 +515,7 @@ jobs:
needs: [ Analyse, Build-Linux ]
strategy:
matrix:
ocamlv: [ 4.14.1 ]
ocamlv: [ 4.14.2, 5.2.0 ]
fail-fast: false
steps:
- name: Install bubblewrap
Expand Down Expand Up @@ -532,7 +548,7 @@ jobs:
needs: [ Analyse, Build-macOS ]
strategy:
matrix:
ocamlv: [ 4.14.1 ]
ocamlv: [ 4.14.2, 5.2.0 ]
fail-fast: false
steps:
- name: Checkout tree
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ ifneq ($(MANIFEST_ARCH),)
@cd Opam.Runtime.$(MANIFEST_ARCH) && $(LN_S) -f ../_build/install/default/bin/Opam.Runtime.$(MANIFEST_ARCH)/$(RUNTIME_GCC_S).dll .
endif

opam-stripped: $(DUNE_DEP) build-opam processed-opam.install
@cp -f _build/default/src/client/opamMain.exe "$@$(EXE)"
@chmod 755 "$@$(EXE)"
strip "$@$(EXE)"

opam-installer: $(DUNE_DEP) build-opam-installer processed-opam-installer.install
@$(LN_S) -f _build/default/src/tools/opam_installer.exe $@$(EXE)

Expand Down
5 changes: 5 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ users)

## Build
* Bump the requirement for dune to 2.8 [#6204 @kit-ty-kate]
* Fix the compilation of opam on Windows with OCaml >= 5.0 again [#6216 @kit-ty-kate]

## Infrastructure

## Release scripts
* Fix the release script after the bump of dune lang to 2.6 [#6204 @kit-ty-kate]
* Fix the release script after the introduction of opam\_core\_stubs [#6204 @kit-ty-kate]
* Improve the release script by ignoring interactive questions asked by the FreeBSD package manager [#6204 @kit-ty-kate]
* Simplify the making of stripped binaries by introducing the `make opam-stripped` target [#6208 @kit-ty-kate]

## Install script
* Add 2.3.0\~alpha1 to the install scripts [#6203 @kit-ty-kate]
Expand Down Expand Up @@ -110,6 +112,9 @@ users)
### Engine

## Github Actions
* Add OCaml 5.2.0 to the build matrix [#6216 @kit-ty-kate]
* Allow to have more than one OCaml default version and add 5.2 to the list of default versions together with 4.14 [#6216 @kit-ty-kate]
* Bump 4.14 to the latest patch version (4.14.2) [#6216 @kit-ty-kate]

## Doc

Expand Down
6 changes: 2 additions & 4 deletions release/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ CMD { tar xz && \
cd opam-full-${VERSION} && \
./configure --with-vendored-deps --with-mccs && \
echo "(${LINKING})" > src/client/linking.sexp && \
make opam && \
chmod u+w _build/default/src/client/opamMain.exe && \
strip opam ; \
make opam-stripped ; \
} >&2 && \
cat opam
cat opam-stripped
6 changes: 2 additions & 4 deletions release/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ host: $(OUTDIR)/opam-full-$(VERSION).tar.gz build/$(HOST).env
cd build/opam-full-$(VERSION) && \
./configure --with-vendored-deps --with-mccs && \
echo "$(call LINKING,$(HOST_OS))" >src/client/linking.sexp && \
$(MAKE) opam; \
$(MAKE) opam-stripped; \
)
chmod u+w build/opam-full-$(VERSION)/_build/default/src/client/opamMain.exe
cp build/opam-full-$(VERSION)/opam $(OUTDIR)/opam-$(VERSION)-$(HOST)
strip $(OUTDIR)/opam-$(VERSION)-$(HOST)
cp build/opam-full-$(VERSION)/opam-stripped $(OUTDIR)/opam-$(VERSION)-$(HOST)
$(OUTDIR)/opam-$(VERSION)-$(HOST) --version
rm -rf build/opam-full-$(VERSION)

Expand Down
1 change: 1 addition & 0 deletions src/client/opamMain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
(* *)
(**************************************************************************)

(* test *)
let () = OpamCliMain.main ()
7 changes: 7 additions & 0 deletions src/core/dune
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@
(action (copy# opamStubs.unix.ml opamStubs.ml)))

(rule
(targets opamWin32Stubs.ml)
(enabled_if (= %{os_type} "Win32"))
(action (copy# opamWin32Stubs.win32.ml opamWin32Stubs.ml)))

(rule
(deps opamWin32Stubs.ml)
(enabled_if (and (= %{os_type} "Win32") (< %{ocaml_version} "5.0")))
(action (copy# opamStubs.ocaml4.ml opamStubs.ml)))

(rule
(deps opamWin32Stubs.ml)
(enabled_if (and (= %{os_type} "Win32") (>= %{ocaml_version} "5.0")))
(action (copy# opamStubs.ocaml5.ml opamStubs.ml)))

Expand Down
Loading
Loading