#!/bin/zsh # Build script for OCaml on illumos # # OCaml 5.x requires libatomic for atomic operations set -e cd "$SRCDIR" # Force 64-bit compilation on illumos export CC="gcc -m64" export CXX="g++ -m64" export CFLAGS="-m64" export CXXFLAGS="-m64" export LDFLAGS="-m64 $LDFLAGS" export AS="as --64" # libatomic is at /usr/lib (hammerhead BSD layout) export LD_LIBRARY_PATH="/usr/lib:${LD_LIBRARY_PATH:-}" export LIBRARY_PATH="/usr/lib:${LIBRARY_PATH:-}" ./configure --prefix=$PREFIX --build=$BUILD_TRIPLE gmake -j${JOBS:-1} world.opt # Fix INSTALL path for gmake install — OCaml Makefiles use relative # ./build-aux/install-sh which breaks when gmake -C enters subdirectories. # Override with the absolute path. INSTALL_SH="$(pwd)/build-aux/install-sh" gmake install DESTDIR="$PKGDIR" INSTALL="$INSTALL_SH -c" # Create environment script mkdir -p "$PKGDIR/etc/profile.d" cat > "$PKGDIR/etc/profile.d/ocaml.sh" << EOF # OCaml environment export PATH=$PREFIX/bin:\$PATH EOF --- ocaml-5.4.0/configure 2026-03-11 20:48:20.896212520 -0500 +++ ocaml-5.4.0/configure 2026-03-11 20:49:02.433464677 -0500 @@ -6972,7 +6972,7 @@ lt_cv_deplibs_check_method=pass_all ;; -solaris*) +solaris*|hammerhead*) lt_cv_deplibs_check_method=pass_all ;; @@ -7777,7 +7777,7 @@ osf*) symcode='[BCDEGQRST]' ;; -solaris*) +solaris*|hammerhead*) symcode='[BCDRT]' ;; sco3.2v5*) @@ -8409,7 +8409,7 @@ CFLAGS=$SAVE_CFLAGS fi ;; -*-*solaris*) +*-*solaris*|*-*hammerhead*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext @@ -8423,7 +8423,7 @@ case $lt_cv_prog_gnu_ld in yes*) case $target in - i?86-*-solaris*|x86_64-*-solaris*) + i?86-*-solaris*|x86_64-*-solaris*|x86_64-*-hammerhead*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) @@ -10296,7 +10296,7 @@ serenity*) ;; - solaris*) + solaris*|hammerhead*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -10948,7 +10948,7 @@ fi ;; - solaris*) + solaris*|hammerhead*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 @@ -11744,7 +11744,7 @@ serenity*) ;; - solaris*) + solaris*|hammerhead*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' @@ -12931,7 +12931,7 @@ dynamic_linker='SerenityOS LibELF' ;; -solaris*) +solaris*|hammerhead*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -13331,7 +13331,7 @@ serenity*) ;; - solaris*) + solaris*|hammerhead*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -18239,7 +18239,7 @@ *) : ;; esac ;; #( - *-*-solaris*) : + *-*-solaris*|*-*-hammerhead*) : sharedlib_cflags="-fPIC" mkdll_flags='-shared' rpath="-Wl,-rpath," @@ -18334,7 +18334,7 @@ natdynlink=true ;; #( powerpc*-*-linux*) : natdynlink=true ;; #( - x86_64-*-solaris*) : + x86_64-*-solaris*|x86_64-*-hammerhead*) : natdynlink=true ;; #( i686-*-kfreebsd*) : natdynlink=true ;; #( @@ -18576,7 +18576,7 @@ has_native_backend=yes; arch=amd64; system=linux ;; #( x86_64-*-dragonfly*) : arch=amd64; system=dragonfly ;; #( - x86_64-*-solaris*) : + x86_64-*-solaris*|x86_64-*-hammerhead*) : has_native_backend=yes; arch=amd64; system=solaris ;; #( x86_64-*-freebsd*) : has_native_backend=yes; arch=amd64; system=freebsd ;; #( @@ -20022,7 +20022,7 @@ fi ;; #( - *-*-solaris*) : + *-*-solaris*|*-*-hammerhead*) : cclibs="$cclibs -lsocket -lnsl" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 printf %s "checking for library containing socket... " >&6; } @@ -22132,7 +22132,7 @@ ;; - solaris*) + solaris*|hammerhead*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based @@ -22208,7 +22208,7 @@ # correctly enabled case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) + darwin* | hpux* | linux* | osf* | solaris*|hammerhead*) ax_pthread_check_macro="_REENTRANT" ;; @@ -22533,7 +22533,7 @@ else $as_nop ax_cv_PTHREAD_SPECIAL_FLAGS=no case $host_os in - solaris*) + solaris*|hammerhead*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac @@ -23608,7 +23608,7 @@ printf "%s\n" "#define HAS_NICE 1" >>confdefs.h ;; #( - *-*-solaris*) : + *-*-solaris*|*-*-hammerhead*) : # This is required as otherwise floats are printed # as "Infinity" and "Inf" instead of the expected "inf" printf "%s\n" "#define HAS_BROKEN_PRINTF 1" >>confdefs.h # OCaml - Functional programming language # https://ocaml.org/ [package] name = "ocaml" version = "5.4.0" release = 1 description = "OCaml programming language compiler and runtime" url = "https://ocaml.org/" license = "LGPL-2.1" maintainer = "Chris Tusa " arch = "x86_64" [dependencies] runtime = [] build = ["make"] [[source]] file = "ocaml-5.4.0.tar.gz" urls = ["https://github.com/ocaml/ocaml/archive/refs/tags/5.4.0.tar.gz"] checksum = "4ab55ac30d247e20f35df20a9f7596e5eb5f92fbbd0f8e3e54838bbc3edf931e" [patches] files = ["hammerhead-solaris-compat.patch"] strip = 1 [build] parallel = true