From d902fcf88ea1077b2b3aa0861dc6adad365c2196 Mon Sep 17 00:00:00 2001 From: Romain Beauxis Date: Sun, 25 Feb 2024 12:34:16 -0600 Subject: [PATCH] Add ocaml-windows.5.1.1 --- .github/workflows/ci.yml | 4 +- .../ocaml-windows.5.1.1/files/install.sh | 12 ++++ .../ocaml-windows.5.1.1/files/remove.sh | 8 +++ .../ocaml-windows/ocaml-windows.5.1.1/opam | 18 ++++++ .../ocaml-windows64.5.1.1/files/build.sh | 35 ++++++++++++ .../ocaml-windows64.5.1.1/files/install.sh | 31 ++++++++++ .../files/patches/configure.patch | 45 +++++++++++++++ .../files/patches/ostype-fix.patch | 56 +++++++++++++++++++ .../ocaml-windows64.5.1.1/files/remove.sh | 10 ++++ .../files/windows.conf.in | 9 +++ .../ocaml-windows64.5.1.1/opam | 40 +++++++++++++ 11 files changed, 266 insertions(+), 2 deletions(-) create mode 100755 packages/ocaml-windows/ocaml-windows.5.1.1/files/install.sh create mode 100755 packages/ocaml-windows/ocaml-windows.5.1.1/files/remove.sh create mode 100644 packages/ocaml-windows/ocaml-windows.5.1.1/opam create mode 100755 packages/ocaml-windows64/ocaml-windows64.5.1.1/files/build.sh create mode 100755 packages/ocaml-windows64/ocaml-windows64.5.1.1/files/install.sh create mode 100644 packages/ocaml-windows64/ocaml-windows64.5.1.1/files/patches/configure.patch create mode 100644 packages/ocaml-windows64/ocaml-windows64.5.1.1/files/patches/ostype-fix.patch create mode 100755 packages/ocaml-windows64/ocaml-windows64.5.1.1/files/remove.sh create mode 100644 packages/ocaml-windows64/ocaml-windows64.5.1.1/files/windows.conf.in create mode 100644 packages/ocaml-windows64/ocaml-windows64.5.1.1/opam diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4dd81ef4..e5f0be74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: package: ${{ fromJson(needs.build_details.outputs.packages) }} # ocaml compiler 4.14.1 does not have an option to build in 32 bit mode anymore. arch: [x64] - ocaml_version: [4.14.1] + ocaml_version: [4.14.1, 5.1.1] container: image: ocamlcross/windows-${{ matrix.arch }}-base:${{ matrix.ocaml_version }} options: --user root @@ -109,7 +109,7 @@ jobs: matrix: package: ${{ fromJson(needs.collect_revdeps.outputs.revdeps) }} arch: [x64] - ocaml_version: [4.14.1] + ocaml_version: [4.14.1, 5.1.1] container: image: ocamlcross/windows-${{ matrix.arch }}-base:${{ matrix.ocaml_version }} options: --user root diff --git a/packages/ocaml-windows/ocaml-windows.5.1.1/files/install.sh b/packages/ocaml-windows/ocaml-windows.5.1.1/files/install.sh new file mode 100755 index 00000000..5e8a6bd6 --- /dev/null +++ b/packages/ocaml-windows/ocaml-windows.5.1.1/files/install.sh @@ -0,0 +1,12 @@ +#!/bin/sh -e + +PREFIX="$1" +HOST="$2" + +for bin in ocamlc ocamlopt ocamlmklib; do + ln -s "${PREFIX}/windows-sysroot/bin/${bin}" "${PREFIX}/bin/${HOST}-${bin}" +done + +for bin in ocamlmktop ocamldoc ocamldep; do + ln -s "${PREFIX}/bin/${bin}" "${PREFIX}/bin/${HOST}-${bin}" +done diff --git a/packages/ocaml-windows/ocaml-windows.5.1.1/files/remove.sh b/packages/ocaml-windows/ocaml-windows.5.1.1/files/remove.sh new file mode 100755 index 00000000..9dfcbe05 --- /dev/null +++ b/packages/ocaml-windows/ocaml-windows.5.1.1/files/remove.sh @@ -0,0 +1,8 @@ +#!/bin/sh -e + +PREFIX="$1" +HOST="$2" + +for bin in ocamlc ocamlopt ocamlcp ocamlmklib ocamlmktop ocamldoc ocamldep; do + rm -f "${PREFIX}/bin/${HOST}-${bin}" +done diff --git a/packages/ocaml-windows/ocaml-windows.5.1.1/opam b/packages/ocaml-windows/ocaml-windows.5.1.1/opam new file mode 100644 index 00000000..becb5abb --- /dev/null +++ b/packages/ocaml-windows/ocaml-windows.5.1.1/opam @@ -0,0 +1,18 @@ +opam-version: "2.0" +maintainer: "whitequark@whitequark.org" +install: [ + ["./install.sh" "%{prefix}%" "%{conf-gcc-windows:host}%"] +] +remove: [ + ["./remove.sh" "%{prefix}%" "%{conf-gcc-windows:host}%"] +] +depends: [ + "ocaml" + "conf-gcc-windows" + "ocaml-windows64" {= version} +] +synopsis: "A meta-package depending on any OCaml cross-compiler" +extra-files: [ + ["remove.sh" "md5=b97c542567963902a748467b7edf90d8"] + ["install.sh" "md5=767ed38d97e0f3293a2f9ecdfd676fae"] +] diff --git a/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/build.sh b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/build.sh new file mode 100755 index 00000000..f7332806 --- /dev/null +++ b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/build.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e + +HOST=$1 +OPAM_PREFIX="$2" +FLEXDLL_DIR="$3" + +OPTS="" + +if [ `opam var conf-flambda-windows:installed` = "true" ]; then + OPTS="--enable-flambda" +fi + +export PATH=${FLEXDLL_DIR}:$PATH + +./configure --host="${HOST}" --prefix="${OPAM_PREFIX}/windows-sysroot" --enable-systhreads ${OPTS} + +make runtime/sak.exe DEP_CC="${HOST}-gcc -MM" SAK_CC=cc SAK_CFLAGS= SAK_LINK='cc -o $(1) $(2)' + +make ocamlopt ocamlc OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun CAMLC="`which ocamlc`" +make ocamlmklib OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun CAMLC="`which ocamlc`" +make boot/ocamlruns.exe +make runtime-all +make -C stdlib OCAMLRUN=ocamlrun COMPILER="${PWD}/boot/ocamlc" +make ocamlyacc OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun +make ocamllex OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun OCAMLYACC=ocamlyacc CAMLC="`which ocamlc`" +make coldstart OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun +make runtime/libasmrun.a + +make library otherlibs opt ocamlnat ocaml ocamldoc ocamldebugger \ + OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun \ + OPTCOMPILER="${PWD}/ocamlopt.exe" \ + MKLIB="ocamlrun \"${PWD}/tools/ocamlmklib.exe\"" \ + OCAMLYACC=ocamlyacc diff --git a/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/install.sh b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/install.sh new file mode 100755 index 00000000..e1966fd7 --- /dev/null +++ b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/install.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e + +PREFIX="$1" +FLEXDLL_PATH="$2" + +cd tools && ln -s stripdebug.exe stripdebug && cd .. +make install installopt RUNTIMED=false INSTRUMENTED_RUNTIME=false OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun + +cp -rf compilerlibs/*.cmxa compilerlibs/*.a "${PREFIX}/windows-sysroot/lib/ocaml/compiler-libs" + +for bin in ocaml ocamlc ocamlopt ocamlcp ocamlmklib ocamlmktop ocamldoc ocamldep; do + cat >"${PREFIX}/windows-sysroot/bin/${bin}" </dev/null)" ++ flexlink_where="$($flexlink_where_cmd_prefix "$flexlink" -where 2>/dev/null)" + if test -z "$flexlink_where" + then : + as_fn_error $? "$flexlink is not executable from a native Win32 process" "$LINENO" 5 +@@ -18358,9 +18366,17 @@ + + ## Determine how to link with the POSIX threads library + ++extra_mingw_pthread_lib='' ++case $build in #( ++ *-*-mingw32*) : ++ extra_mingw_pthread_lib="-lgcc_eh" ;; #( ++ *) : ++ ;; ++esac ++ + case $host in #( + *-*-mingw32*) : +- PTHREAD_LIBS="-l:libpthread.a -lgcc_eh" ;; #( ++ PTHREAD_LIBS="-l:libpthread.a $extra_mingw_pthread_lib" ;; #( + *-pc-windows) : + PTHREAD_LIBS="-l:libpthread.lib" ;; #( + *) : diff --git a/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/patches/ostype-fix.patch b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/patches/ostype-fix.patch new file mode 100644 index 00000000..e08727b2 --- /dev/null +++ b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/patches/ostype-fix.patch @@ -0,0 +1,56 @@ +diff --git a/middle_end/closure/closure.ml b/middle_end/closure/closure.ml +index b4095b7237..62d67b17d7 100644 +--- a/middle_end/closure/closure.ml ++++ b/middle_end/closure/closure.ml +@@ -1080,9 +1080,9 @@ let rec close ({ backend; fenv; cenv ; mutable_vars } as env) lam = + | Word_size -> make_const_int (8*B.size_int) + | Int_size -> make_const_int (8*B.size_int - 1) + | Max_wosize -> make_const_int ((1 lsl ((8*B.size_int) - 10)) - 1 ) +- | Ostype_unix -> make_const_bool (Sys.os_type = "Unix") +- | Ostype_win32 -> make_const_bool (Sys.os_type = "Win32") +- | Ostype_cygwin -> make_const_bool (Sys.os_type = "Cygwin") ++ | Ostype_unix -> make_const_bool false ++ | Ostype_win32 -> make_const_bool true ++ | Ostype_cygwin -> make_const_bool false + | Backend_type -> + make_const_int 0 (* tag 0 is the same as Native here *) + in +diff --git a/utils/config.common.ml b/utils/config.common.ml +index d4850ffd50..182046f38b 100644 +--- a/utils/config.common.ml ++++ b/utils/config.common.ml +@@ -64,11 +64,7 @@ let lazy_tag = 246 + let max_young_wosize = 256 + let stack_threshold = 32 (* see runtime/caml/config.h *) + let stack_safety_margin = 6 +-let default_executable_name = +- match Sys.os_type with +- "Unix" -> "a.out" +- | "Win32" | "Cygwin" -> "camlprog.exe" +- | _ -> "camlprog" ++let default_executable_name = "camlprog.exe" + type configuration_value = + | String of string + | Int of int +@@ -107,7 +103,7 @@ let configuration_variables () = + p "ext_asm" ext_asm; + p "ext_lib" ext_lib; + p "ext_dll" ext_dll; +- p "os_type" Sys.os_type; ++ p "os_type" "Win32"; + p "default_executable_name" default_executable_name; + p_bool "systhread_supported" systhread_supported; + p "host" host; +diff --git a/utils/config.generated.ml.in b/utils/config.generated.ml.in +index 83d99afaa3..60708e888e 100644 +--- a/utils/config.generated.ml.in ++++ b/utils/config.generated.ml.in +@@ -96,7 +96,7 @@ let asm_cfi_supported = @asm_cfi_supported@ + let with_frame_pointers = @frame_pointers@ + let reserved_header_bits = @reserved_header_bits@ + +-let ext_exe = {@QS@|@exeext@|@QS@} ++let ext_exe = ".exe" + let ext_obj = "." ^ {@QS@|@OBJEXT@|@QS@} + let ext_asm = "." ^ {@QS@|@S@|@QS@} + let ext_lib = "." ^ {@QS@|@libext@|@QS@} diff --git a/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/remove.sh b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/remove.sh new file mode 100755 index 00000000..b77fffc3 --- /dev/null +++ b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/remove.sh @@ -0,0 +1,10 @@ +#!/bin/sh -e + +PREFIX="$1" + +for bin in ocaml ocamlc ocamlcp ocamldebug ocamldep ocamldoc ocamllex ocamlmklib ocamlmktop ocamlobjinfo ocamlopt ocamloptp ocamlprof ocamlrun ocamlyacc; do + rm -f "${PREFIX}/windows-sysroot/bin/${bin}" +done + +rm -rf "${PREFIX}/windows-sysroot/lib/ocaml" +rm -rf "${PREFIX}/lib/findlib.conf.d/windows.conf" diff --git a/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/windows.conf.in b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/windows.conf.in new file mode 100644 index 00000000..ac3244dc --- /dev/null +++ b/packages/ocaml-windows64/ocaml-windows64.5.1.1/files/windows.conf.in @@ -0,0 +1,9 @@ +path(windows) = "%{prefix}%/windows-sysroot/lib" +destdir(windows) = "%{prefix}%/windows-sysroot/lib" +stdlib(windows) = "%{prefix}%/windows-sysroot/lib/ocaml" +ocamlc(windows) = "%{prefix}%/windows-sysroot/bin/ocamlc" +ocamlopt(windows) = "%{prefix}%/windows-sysroot/bin/ocamlopt" +ocamlmklib(windows) = "%{prefix}%/windows-sysroot/bin/ocamlmklib" +ocamlmktop(windows) = "%{prefix}%/bin/ocamlmktop" +ocamldoc(windows) = "%{prefix}%/bin/ocamldoc" +ocamldep(windows) = "%{prefix}%/bin/ocamldep" diff --git a/packages/ocaml-windows64/ocaml-windows64.5.1.1/opam b/packages/ocaml-windows64/ocaml-windows64.5.1.1/opam new file mode 100644 index 00000000..256ef406 --- /dev/null +++ b/packages/ocaml-windows64/ocaml-windows64.5.1.1/opam @@ -0,0 +1,40 @@ +opam-version: "2.0" +maintainer: "whitequark@whitequark.org" +patches: [ + "patches/ostype-fix.patch" + "patches/configure.patch" +] +substs: [ + "windows.conf" +] +build: [ + ["/bin/sh" "./build.sh" "%{conf-gcc-windows64:host}%" "%{prefix}%" "%{flexdll-windows:lib}%"] +] +install: [ + ["/bin/sh" "./install.sh" "%{prefix}%" "%{flexdll-windows:lib}%"] +] +depends: [ + "ocaml" {= version} + "ocamlfind" {>= "1.5.4"} + "conf-gcc-windows64" + "flexdll-windows" {>= "0.42"} +] +depopts: [ + "conf-flambda-windows" +] +available: arch = "x86_64" | (arch = "arm64" & os = "macos") +conflicts: [ + "ocaml-windows32" +] +synopsis: "OCaml cross-compiler for 64-bit x86 Windows targets" +extra-files: [ + ["windows.conf.in" "md5=69f2a64db241a28e172eb316ddd9cef1"] + ["build.sh" "md5=93e8e83fed757be1e6c59b65873b5c93"] + ["install.sh" "md5=771227318703c168f819281d3c051b29"] + ["patches/ostype-fix.patch" "md5=57404edca01e9a353f28d3b3c0139f55"] + ["patches/configure.patch" "md5=668bfb4f3fccd959daa553f70b28e803"] +] +url { + src: "https://github.com/ocaml/ocaml/archive/5.1.1.tar.gz" + checksum: "md5=ac4a19e57d1ed6c2efc70d1a9b97c567" +}