Add dump
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Failing after 13s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 16s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 17s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 18s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 15s
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Failing after 13s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 16s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 17s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 18s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 15s
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
22
build.sh
22
build.sh
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
BUILD_DIR="BUILD"
|
||||
@@ -7,8 +8,10 @@ CFLAGS="-std=gnu99 -Wall -Wextra -pedantic -Werror -Wno-newline-eof -Wno-languag
|
||||
BUILD_SHARED=1
|
||||
PTHREAD_SUPPORT=1
|
||||
POSIX_SUPPORT=1
|
||||
BUILD_PROGRAMS=0
|
||||
SRC_DIR="src"
|
||||
INCLUDE_DIR="include"
|
||||
PROGRAMS_DIR="programs"
|
||||
OUTPUT_NAME="libdcfg"
|
||||
|
||||
for arg in "$@"; do
|
||||
@@ -17,12 +20,13 @@ for arg in "$@"; do
|
||||
--release) CFLAGS="$CFLAGS -O2" ;;
|
||||
--no-pthread) PTHREAD_SUPPORT=0 ;;
|
||||
--no-posix) POSIX_SUPPORT=0 ;;
|
||||
--with-programs) BUILD_PROGRAMS=1 ;;
|
||||
--clean) rm -rf "$BUILD_DIR" "$INSTALL_DIR"; echo "Cleaned."; exit 0 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Setup directories
|
||||
mkdir -p "$BUILD_DIR" "$INSTALL_DIR/lib" "$INSTALL_DIR/include"
|
||||
mkdir -p "$BUILD_DIR" "$INSTALL_DIR/lib" "$INSTALL_DIR/include" "$INSTALL_DIR/bin"
|
||||
|
||||
# Compiler and linker
|
||||
CC=${CC:-cc}
|
||||
@@ -39,16 +43,28 @@ echo "Building DCFG..."
|
||||
cd "$BUILD_DIR"
|
||||
|
||||
set -x
|
||||
# Shared library
|
||||
$CC $CFLAGS -fPIC -shared "../$SRC_DIR/dcfg.c" -I"../$INCLUDE_DIR" -o "$OUTPUT_NAME.so" $LIBS
|
||||
|
||||
# Static library
|
||||
$CC $CFLAGS -c "../$SRC_DIR/dcfg.c" -I"../$INCLUDE_DIR"
|
||||
ar rcs "$OUTPUT_NAME.a" dcfg.o
|
||||
|
||||
set +x
|
||||
|
||||
echo "Installing..."
|
||||
echo "Installing library..."
|
||||
cp -r "../$INCLUDE_DIR/"* "$INSTALL_DIR/include/"
|
||||
cp "$OUTPUT_NAME.so" "$INSTALL_DIR/lib/"
|
||||
cp "$OUTPUT_NAME.a" "$INSTALL_DIR/lib/"
|
||||
|
||||
# Build programs if requested
|
||||
if [ "$BUILD_PROGRAMS" -eq 1 ]; then
|
||||
echo "Building example programs..."
|
||||
for src in "../$PROGRAMS_DIR"/*.c; do
|
||||
prog=$(basename "$src" .c)
|
||||
echo "Building $prog..."
|
||||
$CC $CFLAGS "$src" -I"../$INCLUDE_DIR" "$OUTPUT_NAME.a" $LIBS -o "$prog"
|
||||
cp "$prog" "$INSTALL_DIR/bin/"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Done. Installed to $INSTALL_DIR"
|
||||
|
Reference in New Issue
Block a user