From 30b43f08955158d4f2066f4b50fe8d1241b3177b Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 16 May 2025 15:43:09 +0200 Subject: Remove configure + make build system. This commit also updates the README, cleans up some stuff and fixes some oopsies. --- configure.sh | 135 +---------------------------------------------------------- 1 file changed, 1 insertion(+), 134 deletions(-) (limited to 'configure.sh') diff --git a/configure.sh b/configure.sh index 4a60ed4..b5604ee 100755 --- a/configure.sh +++ b/configure.sh @@ -1,136 +1,3 @@ #!/bin/sh -# The following environment variables can be used to configure the build: -# -# CC="compiler" -# Specify the compiler to use. -# By default, cc will be used. -# The string "compiler" must be the name of an executable in $PATH. -# -# ARCH="architecture" -# You can use this variable to build for a different architecture, for example -# if you want to cross-compile or to use the portable version. -# By default, the build script will detect which architecture it is running on. -# The string "architecture" must be one of "AVX2", "NEON" or "PORTABLE". -# -# THREADS=n -# The maximum number of threads to use for multi-threaded operations. -# This is also used as default value in case an operation allows -# specifying how many threads to use. -# By default, 8 threads will be used (TODO: in the future this will be -# determined base on the system). -# The number n must be between 1 and 128. -# -# SANITIZE="option1,option2,..." -# Add the options "-fsanitize=option1", "-fsanitize=option2", ... to the -# compilation command when compiling in debug mode. -# By default, no sanitizer is used. -# -# Examples -# -# 1. Build using clang and 4 threads -# CC=clang THREADS=4 ./configure.sh && make -# -# 2. Build using thread and undefined behavior sanitizers when in debug mode -# SANITIZE="thread,undefined" ./configure.sh && make - -greparch() { - $CC -march=native -dM -E - /dev/null | grep "$1" -} - -detectthreads() { - echo 8 # TODO: choose based on system -} - -detectarch() { - [ -n "$(greparch __AVX2__)" ] && detected="AVX2" - [ -n "$(greparch __ARM_NEON)" ] && detected="NEON" - [ -z "$detected" ] && detected="PORTABLE" - - echo "$detected" -} - -validatecc() { - if ! (command -v "$CC" >/dev/null 2>&1) ; then - echo "Error: compiler '$CC' not found" - exit 1 - fi -} - -validatethreads() { - if [ "$THREADS" -le 0 ] || [ "$THREADS" -gt 128 ]; then - echo "Error: number of threads must be between 1 and 128" - exit 1 - fi -} - -validatearch() { - case "$ARCH" in - AVX2|NEON|PORTABLE) - ;; - *) - echo "Error: architecture '$ARCH' not supported" - echo "Supported architectures: AVX2, NEON, PORTABLE" - exit 1 - ;; - esac -} - -CC=${CC:-cc} -THREADS=${THREADS-"$(detectthreads)"} -ARCH=${ARCH-"$(detectarch)"} - -validatecc -validatethreads -validatearch - -STD="-std=c11" -POSIX="-D_POSIX_C_SOURCE=199309L" -WFLAGS="-pedantic -Wall -Wextra" -WNOFLAGS="-Wno-unused-parameter -Wno-unused-function -Wno-unknown-pragmas" -WNOFLAGS="$WNOFLAGS -Wno-unused-command-line-argument" - -[ "$ARCH" = "AVX2" ] && AVX="-mavx2" - -if [ -n "$SANITIZE" ]; then - # Use the user-specified comma-separated sanitizers - for san in $(echo "$SANITIZE" | tr ',' '\n'); do - SAN="$SAN -fsanitize=$san" - done -fi -LIBS="-lpthread" - -CFLAGS="$STD $POSIX $LIBS $WFLAGS $WNOFLAGS $AVX -O3 -fPIC -D$ARCH" -DBGFLAGS="$STD $POSIX $LIBS $WFLAGS $WNOFLAGS $SAN $AVX -g3 -DDEBUG -fPIC -D$ARCH" -WASMFLAGS="$STD $LIBS $WFLAGS $WNOFLAGS -O3 -fPIC" -MACROS="-DTHREADS=$THREADS" - -if (command -v "python3-config" >/dev/null 2>&1) ; then - PYTHON3_INCLUDES="$(python3-config --includes)" - PYTHON3="version $(echo "$PYTHON3_INCLUDES" | sed 's/.*3\./3./')" -else - PYTHON3_INCLUDES="" - PYTHON3="Not found, Python shell won't be available" -fi - -echo "Compiler: $CC" -echo "Selected architecture: $ARCH" -echo "Number of threads: $THREADS" -echo "Sanitizer options (debug build only): $SAN" -echo "Python3 development libraries: $PYTHON3" - -{ -echo "ARCH = $ARCH"; -echo ""; -echo "CFLAGS = $CFLAGS"; -echo ""; -echo "DBGFLAGS = $DBGFLAGS"; -echo ""; -echo "WASMFLAGS = $WASMFLAGS"; -echo ""; -echo "MACROS = $MACROS" -echo ""; -echo "PYTHON3_INCLUDES = $PYTHON3_INCLUDES" -echo "CC = $CC" -echo "EMCC = emcc" -} > config.mk +echo "The build system for nissy has changed, use ./build" -- cgit v1.3