#!/bin/sh
#**************************************************************************
#*                                                                        *
#*                                 OCaml                                  *
#*                                                                        *
#*            Sebastien Hinderer, projet Gallium, INRIA Paris             *
#*                                                                        *
#*   Copyright 2017 Institut National de Recherche en Informatique et     *
#*     en Automatique.                                                    *
#*                                                                        *
#*   All rights reserved.  This file is distributed under the terms of    *
#*   the GNU Lesser General Public License version 2.1, with the          *
#*   special exception on linking described in the file LICENSE.          *
#*                                                                        *
#**************************************************************************

# Commands to run for the 'other-configs' job on Inria's CI

# Stop on error
set -e

mainjob=./tools/ci/inria/main
main="${mainjob} -j8"

echo "============== minimal build ================="
# The "MIN_BUILD" (formerly on Travis) builds with everything disabled (apart
# from ocamltest). Its goals:
#  - Ensure that the system builds correctly without native compilation
#  - Ensure ocamltest builds correctly without Unix
#  - Ensure the testsuite runs correctly with everything switched off
${main} -conf --disable-native-compiler \
        -conf --disable-native-toplevel \
        -conf --disable-shared \
        -conf --disable-debug-runtime \
        -conf --disable-instrumented-runtime \
        -conf --disable-systhreads \
        -conf --disable-str-lib \
        -conf --disable-unix-lib \
        -conf --disable-ocamldoc \
        -conf --disable-dependency-generation \
        -no-native

echo "============== no flat float arrays, clang, C23 ================="
${main} -conf --disable-flat-float-array \
        -conf CC=clang-18 \
        -conf CFLAGS=-std=gnu2x

echo "============== flambda ================="
${main} -conf --enable-flambda

echo "============== frame pointers, reserved header bits ================="
${main} -conf --enable-frame-pointers -conf --enable-reserved-header-bits=27

echo "============== bootstrap, pic ================="
${main} -with-bootstrap -conf --with-pic

echo "============== cleanup at exit, clang ================="
OCAMLRUNPARAM="c=1" ${main} -conf CC=clang-18
