diff options
test: Add shellcheck
3 files changed, 21 insertions, 2 deletions
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rwxr-xr-x | configure | 21 |
@@ -55,6 +55,7 @@ uri_test: uri.o uri_test.o .PHONY: test test: $(EXE_test) $(MANDOC) -Tlint -Wunsupp,error,warning ./badwolf.1 + $(SHELLCHECK) ./configure .PHONY: install install: all @@ -61,6 +61,7 @@ Dependencies are: - A pkg-config implementation (pkgconf is recommended) - (optional) gettext implementation (such as GNU Gettext) - (optional, test) [mandoc](https://mdocml.bsd.lv/) (the command) for linting the manpage +- (optional, test) [shellcheck](https://www.shellcheck.net/) for linting the `./configure` script Compilation is done with `./configure && make`, install with `make install` (`DESTDIR` and `PREFIX` environment variables are supported, amongs other common ones). An example AppArmor profile is provided at `usr.bin.badwolf`, please do some long runtime checks before shipping it or a modified version, help can be provided but with no support. @@ -26,6 +26,7 @@ Variables: CFLAGS=OPTIONS EXTRA_CFLAGS=OPTIONS MANDOC=BIN + SHELLCHECK=BIN WITH_WEBKITGTK=(4.0|4.1) WITH_URI_PARSER=(guri|libsoup2) @@ -37,7 +38,8 @@ Dependencies: - libxml-2.0 - webkit2gtk-4.1 version >=${min_webkitgtk} or webkit2gtk-4.0 version >=${min_webkitgtk} - libsoup-2.4 or glib-2.0 version >=${min_glib_guri} -- mandoc: for linting the manual page (optionnal, test dep) +- mandoc: for linting the manual page (optional, test dep) +- shellcheck: for linting ./configure (optional, test dep) END } @@ -73,6 +75,7 @@ INKSCAPE="${INKSCAPE:-inkscape}" CC="${CC:-cc}" CFLAGS="${CFLAGS:--g -O2 -pie -fPIE}" MANDOC="${MANDOC:-mandoc}" +SHELLCHECK="${SHELLCHECK:-shellcheck}" # Also allow variables through arguments @@ -111,6 +114,7 @@ APPSDIR="${APPSDIR:-${PREFIX}/share/applications}" CFLAGS="${CFLAGS} -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wconversion -Wsign-conversion -Werror=implicit-function-declaration -Werror=implicit-int -Werror=vla ${EXTRA_CFLAGS}" ## System checks +# commands printf 'Checking %s command existance ...' "${PKGCONFIG}" command -v "${PKGCONFIG}" >/dev/null ; required @@ -122,10 +126,22 @@ if command -v "${MANDOC}" >/dev/null ; is_ok then : else + printf 'Warning: Tests depending on mandoc disabled' MANDOC="true" fi +printf 'Checking %s command existance ...' "${SHELLCHECK}" +if command -v "${SHELLCHECK}" >/dev/null ; is_ok +then + : +else + printf 'Warning: Tests depending on shellcheck disabled' + SHELLCHECK="true" +fi + +echo +# pkg-config for dep in ${DEPS} do pkg_config_check --exists "$dep" || exit 1 @@ -209,7 +225,7 @@ required ## Configuration write -printf 'Writing to config.mk ...' +printf '\nWriting to config.mk ...' cat >config.mk <<EOF # Autogenerated by ./configure PACKAGE = Badwolf @@ -229,6 +245,7 @@ INKSCAPE = ${INKSCAPE} MSGFMT = ${MSGFMT} DBG = ${DBG} MANDOC = ${MANDOC} +SHELLCHECK = ${SHELLCHECK} CFLAGS = ${CFLAGS} -DDATADIR=\"\${DATADIR}\" -DPACKAGE=\"\${PACKAGE}\" -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"\${VERSION_FULL}\" ${DEPS_cflags} LIBS = ${DEPS_libs} |