libdiscord

libdiscord.git
git clone git://git.lenczewski.org/libdiscord.git
Log | Files | Refs | README | LICENSE

build.sh (1043B)


      1 #!/bin/sh
      2 
      3 CC="${CC:-clang}"
      4 AR="${AR:-llvm-ar}"
      5 RANLIB="${RANLIB:-llvm-ranlib}"
      6 
      7 WARNINGS="-Wall -Wextra -Wpedantic ${WERROR:+-Werror} -Wno-unused-parameter -Wno-format-pedantic"
      8 FLAGS="-std=c11 -Og -g"
      9 
     10 VERSION_MAJOR="$(grep -oe '#define LIBDISCORD_VERSION_MAJOR "\([0-9]\+\)"' include/libdiscord.h | grep -oe '[0-9]\+')"
     11 VERSION_MINOR="$(grep -oe '#define LIBDISCORD_VERSION_MINOR "\([0-9]\+\)"' include/libdiscord.h | grep -oe '[0-9]\+')"
     12 VERSION_PATCH="$(grep -oe '#define LIBDISCORD_VERSION_PATCH "\([0-9]\+\)"' include/libdiscord.h | grep -oe '[0-9]\+')"
     13 VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
     14 
     15 DEPS="liburing openssl"
     16 INCS="$(pkg-config --cflags $DEPS)"
     17 LIBS="$(pkg-config --libs $DEPS)"
     18 
     19 set -ex
     20 
     21 mkdir -p bin lib obj
     22 
     23 $CC -o obj/libdiscord.o -c src/libdiscord.c $WARNINGS $FLAGS -Iinclude $INCS
     24 $AR rcs lib/libdiscord.$VERSION.a obj/libdiscord.o
     25 $RANLIB lib/libdiscord.$VERSION.a
     26 
     27 $CC -o bin/testbot extras/testbot.c $WARNINGS $FLAGS \
     28 	-Iinclude $INCS -Llib -ldiscord.$VERSION $LIBS
     29 
     30 [ -z "$BUILD_EXTRAS" ] && exit
     31