https://gitlab.com/nomadic-labs/mi-cho-coq
Revision 7a7a1aa403201894461c5ff40ae9fee67be399f3 authored by Raphaël Cauderlier on 31 May 2021, 22:11:03 UTC, committed by Raphaël Cauderlier on 31 May 2021, 22:11:03 UTC
Before this commit, set.remove uses List.remove which only computes
when its decide_equality argument does. We passed it an opaque lemma
so it did not compute. Moreover, it always scanned the whole list but
since we only apply it on sorted lists it could stop as soon as it
encounters a value larger than the one to remove.

This commit redefines set.remove so that it does not depend on
decidability of equality anymore and returns as soon as it can.
1 parent 6406bf3
Raw File
Tip revision: 7a7a1aa403201894461c5ff40ae9fee67be399f3 authored by Raphaël Cauderlier on 31 May 2021, 22:11:03 UTC
[michocoq] Redefine set.remove so that it computes
Tip revision: 7a7a1aa
configure
#! /bin/sh

# Open Source License
# Copyright (c) 2019 Nomadic Labs. <contact@nomadic-labs.com>

# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

set -e

fail () {
    echo "$1"; exit 1
}

COMPONENTS="michocoq contracts_coq michocott"

if [ "$1" = "--help" ]; then
    echo "Usage: $0 [$(echo "$COMPONENTS" | tr ' ' '|')]*"
    echo
    echo "Configure building Mi-Cho-Coq with the specified list of components."
    echo "Several components can be given. By default all components are built."
    exit 1
fi

if [ $# -eq 0 ]; then
    # we actually want to split on space here
    # shellcheck disable=SC2086
    set -- $COMPONENTS
fi

DIRS="src"
echo "Generating the main Makefile"

echo "" > src/_CoqProject

while [ $# -gt 0 ]; do
    case "$1" in
        "michocoq")
            REQUIRES_MICHOCOQ=1
            ;;
        "contracts_coq")
            echo 'Build contracts'
            REQUIRES_MICHOCOQ=1
            DIRS="$DIRS src/contracts_coq"
            echo "contracts_coq" >> src/_CoqProject
            ;;
        "michocott")
            echo 'Build mi-cho-cott'
            DIRS="$DIRS src/michocott"
            echo "-R michocott/ Michocott" >> src/_CoqProject
            echo "michocott" >> src/_CoqProject
            ;;
        *)
            echo "Unrecognized component: '$1', expected one of: $COMPONENTS"
            exit 1
    esac
    shift
done

if [ -n "$REQUIRES_MICHOCOQ"  ]; then
    echo 'Build mi-cho-coq'

    tmp=$(mktemp);
    ( echo '-R michocoq/ Michocoq'; echo 'michocoq' ) | cat - src/_CoqProject > "$tmp" && mv "$tmp" src/_CoqProject
    DIRS="$DIRS src/michocoq src/michocoq/extraction"
fi

coq_makefile -f _CoqProject -o Makefile || fail "fail while building main makefile"

for i in $DIRS ; do
    echo "Generating Makefile in $i"
    (
        set -e
        cd "$i"
        if [ -x ./configure ] ; then sh configure ; fi
        coq_makefile -f _CoqProject -o Makefile
    )
done
back to top