mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
development/cbmc: Added (Bounded Model Checker for C and C++).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
924caec686
commit
9ce3865175
4 changed files with 204 additions and 0 deletions
37
development/cbmc/README
Normal file
37
development/cbmc/README
Normal file
|
@ -0,0 +1,37 @@
|
|||
CBMC is a Bounded Model Checker for C and C++ programs.
|
||||
It supports C89, C99, most of C11/C17 and most compiler extensions
|
||||
provided by gcc, clang, and Visual Studio. A variant of CBMC that
|
||||
analyses Java bytecode is available as JBMC.
|
||||
[Set JBMC=ON to enable JBMC.]
|
||||
|
||||
CBMC verifies memory safety (which includes array bounds checks
|
||||
and checks for the safe use of pointers), checks for exceptions,
|
||||
checks for various variants of undefined behavior, and
|
||||
user-specified assertions. Furthermore, it can check C and C++ for
|
||||
I/O equivalence with other languages, such as Verilog. The
|
||||
verification is performed by unwinding the loops in the program
|
||||
and passing the resulting equation to a decision procedure.
|
||||
|
||||
CBMC comes with a built-in solver for bit-vector formulas that is
|
||||
based on MiniSat. As an alternative, CBMC has featured support for
|
||||
external SMT solvers since version 3.3. The solvers we recommend
|
||||
are (in no particular order) Boolector, CVC5 and Z3. Note that
|
||||
these solvers need to be installed separately and have different
|
||||
licensing conditions.
|
||||
[This SlackBuild builds Cadical as the internal solver.]
|
||||
|
||||
If you need a Model Checker for Verilog or SMV files, consider
|
||||
EBMC. For Java, use JBMC.
|
||||
|
||||
This research was sponsored by the Semiconductor Research
|
||||
Corporation (SRC) under contract no. 99-TJ-684, the National
|
||||
Science Foundation (NSF) under grant no. CCR-9803774, the Office
|
||||
of Naval Research (ONR), the Naval Research Laboratory (NRL) under
|
||||
contract no. N00014-01-1-0796, and by the Defense Advanced
|
||||
Research Projects Agency, and the Army Research Office (ARO) under
|
||||
contract no. DAAD19-01-1-0485, and the General Motors
|
||||
Collaborative Research Lab at CMU. The views and conclusions
|
||||
contained in this document are those of the author and should not
|
||||
be interpreted as representing the official policies, either
|
||||
expressed or implied, of SRC, NSF, ONR, NRL, DOD, ARO, or the U.S.
|
||||
government.
|
136
development/cbmc/cbmc.SlackBuild
Normal file
136
development/cbmc/cbmc.SlackBuild
Normal file
|
@ -0,0 +1,136 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for cbmc
|
||||
|
||||
# Copyright 2024 Caterino Tommaso, T.O.P. U.S.A.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=cbmc
|
||||
VERSION=${VERSION:-5.95.1}
|
||||
CADVER=${CADVE:-2.0.0-rc.6} #Cadical version and hash
|
||||
CADMD5=${CADMD5:-5825f8ac81283f5049c402938fe6ee99}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Bail out if not x86_64
|
||||
if [ "$ARCH" == i?86 ]; then
|
||||
echo "Architecture $ARCH is not supported" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
else
|
||||
SLKCFLAGS="-O2"
|
||||
LIBDIRSUFFIX=""
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$PRGNAM-$VERSION
|
||||
tar xvf $CWD/$PRGNAM-$PRGNAM-$VERSION.tar.gz
|
||||
cd $PRGNAM-$PRGNAM-$VERSION
|
||||
chown -R root:root .
|
||||
find -L . \
|
||||
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
||||
-o -perm 511 \) -exec chmod 755 {} \+ -o \
|
||||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
|
||||
|
||||
sed -i 's/-Werror//' CMakeLists.txt
|
||||
mkdir -p build/cadical-download/cadical-download-prefix/src build/cadical-src
|
||||
echo $CADVER > build/cadical-src/VERSION
|
||||
cp -a $CWD/cadical-rel-$CADVER.tar.gz build/cadical-download/cadical-download-prefix/src/rel-$CADVER.tar.gz
|
||||
sed -i 's/rel-1\.7\.2\.tar\.gz/rel-'$CADVER'.tar.gz/' src/solvers/CMakeLists.txt
|
||||
sed -i 's/URL_MD5 be646831a017f81b300664e58deba1b5/URL_MD5 '$CADMD5'/' src/solvers/CMakeLists.txt
|
||||
|
||||
cd build
|
||||
cmake \
|
||||
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
||||
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
|
||||
-DMAN_INSTALL_DIR=/usr/man \
|
||||
-DWITH_JBMC=${JBMC:-OFF} \
|
||||
-Dsat_impl=cadical \
|
||||
-DCMAKE_BUILD_TYPE=Release ..
|
||||
make
|
||||
make install DESTDIR=$PKG
|
||||
cd ..
|
||||
|
||||
chmod +x $PKG/usr/bin/ls_parse.py
|
||||
|
||||
mkdir -p $PKG/etc/bash_completion.d
|
||||
mv $PKG/usr/etc/bash_completion.d/cbmc $PKG/etc/bash_completion.d/
|
||||
rm -fr $PKG/usr/etc
|
||||
|
||||
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
|
||||
|
||||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
mv $PKG/usr/share/man $PKG/usr/
|
||||
rm -fr $PKG/usr/share
|
||||
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
||||
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a \
|
||||
[A-Z_.]* \
|
||||
$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
12
development/cbmc/cbmc.info
Normal file
12
development/cbmc/cbmc.info
Normal file
|
@ -0,0 +1,12 @@
|
|||
PRGNAM="cbmc"
|
||||
VERSION="5.95.1"
|
||||
HOMEPAGE="https://www.cprover.org/cbmc/"
|
||||
DOWNLOAD="UNSUPPORTED"
|
||||
MD5SUM=""
|
||||
DOWNLOAD_x86_64="https://github.com/diffblue/cbmc/archive/refs/tags/cbmc-5.95.1.tar.gz \
|
||||
https://github.com/arminbiere/cadical/archive/rel-2.0.0-rc.6.tar.gz"
|
||||
MD5SUM_x86_64="05f0e4a4a3e7e2830c3be3b9398018de \
|
||||
5825f8ac81283f5049c402938fe6ee99"
|
||||
REQUIRES=""
|
||||
MAINTAINER="Caterino Tommaso, T.O.P."
|
||||
EMAIL="alan_avNOersa@lavSPAMabit.com (remove NO and SPAM)"
|
19
development/cbmc/slack-desc
Normal file
19
development/cbmc/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description.
|
||||
# Line up the first '|' above the ':' following the base package name, and
|
||||
# the '|' on the right side marks the last column you can put a character in.
|
||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
cbmc: cbmc (C Bounded Model Checker)
|
||||
cbmc:
|
||||
cbmc: CBMC is a Bounded Model Checker for C and C++ programs. It supports
|
||||
cbmc: C89, C99, most of C11/C17 and most compiler extensions provided by
|
||||
cbmc: gcc and clang.
|
||||
cbmc: CBMC verifies memory safety (which includes array bounds checks and
|
||||
cbmc: checks for the safe use of pointers), checks for exceptions, checks
|
||||
cbmc: for various variants of undefined behavior, and user-specified
|
||||
cbmc: assertions.
|
||||
cbmc: Compiled with native SAT solver Cadical:
|
||||
cbmc: https://www.cprover.org/cbmc https://github.com/arminbiere/cadical
|
Loading…
Reference in a new issue