Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 17 additions & 23 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
set-env HOST_CXX "$CXX"
if [ -n "${{ matrix.host }}" ]; then
set-env HOST "--host=${{ matrix.host }}"
set-env PKG_CONFIG_LIBDIR "/usr/lib/${{ matrix.host }}/pkgconfig"
fi
if [ "${{ matrix.sanitizer }}" = "true" ]; then
SAN="-fsanitize=undefined -fsanitize=address,pointer-compare,pointer-subtract"
Expand All @@ -113,15 +114,14 @@ jobs:
sudo apt-get install clang-${{ matrix.version }}
set-env HOST_CC "clang-${{ matrix.version }}"
set-env HOST_CXX "clang++-${{ matrix.version }}"
set-env CXXFLAGS "-Wno-vla-cxx-extension"

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
env:
LIBS: >
ev asound2 x264 x265 speexdsp png freetype6 zvbi gcrypt tasn1 dvbv5
udev avcodec avformat swresample swscale gl1-mesa glu1-mesa
srt-gnutls gnutls28 ssl ebur128 dvbcsa
udev avcodec avformat avfilter swresample swscale gl1-mesa glu1-mesa
srt-gnutls gnutls28 ssl bearssl ebur128 dvbcsa
run: |
if [ "${{ matrix.arch }}" != "amd64" ]; then
sudo apt-get install qemu-user-binfmt
Expand All @@ -147,13 +147,11 @@ jobs:
set-env HOST_CC "clang"
set-env HOST_CXX "clang++"
set-env CFLAGS "-Wno-error=deprecated-declarations -fsanitize=undefined -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-recover=all -fno-omit-frame-pointer -fno-optimize-sibling-calls -I$BREW_PREFIX/include"
if clang++ -Werror -Wno-vla-cxx-extension -xc++ -c /dev/null -o /dev/null 2>/dev/null; then
set-env CXXFLAGS "-Wno-vla-cxx-extension"
fi
set-env LDFLAGS "-fsanitize=undefined -fsanitize=address -L$BREW_PREFIX/lib"
set-env DISABLE_VALGRIND "1"
set-env INSERT_LIBRARIES "$(clang -print-search-dirs | sed -n 's/^libraries: =//p')/lib/darwin/libclang_rt.asan_osx_dynamic.dylib"
set-env LD_INSERT_LIBRARIES "$(clang -print-search-dirs | sed -n 's/^libraries: =//p')/lib/darwin/libclang_rt.asan_osx_dynamic.dylib"
set-env UBSAN_OPTIONS "print_stacktrace=1"
set-env LLVM_DWARFDUMP "dwarfdump"

- name: Install bitstream
run: |
Expand Down Expand Up @@ -183,31 +181,27 @@ jobs:
sudo make install

- name: Configure
env:
BUILD_COLORS: always
run: |
autoreconf -i
if [ "${{ matrix.static }}" = "true" ]; then
STATIC="--disable-shared"
fi
if [ "${{ matrix.luajit }}" != "false" ]; then
LUAJIT="--enable-luajit"
fi
CONFIGURE_FLAGS="$LUAJIT $STATIC --disable-silent-rules $HOST CC=\"$HOST_CC\" CXX=\"$HOST_CXX\" CFLAGS=\"-Werror -Wno-error=deprecated-declarations -O2 -g -gdwarf-4 -fdiagnostics-color=always $CFLAGS\" CXXFLAGS=\"-Werror -O2 -g -fdiagnostics-color=always $CXXFLAGS\" LDFLAGS=\"$LDFLAGS\""
CONFIGURE_FLAGS="$LUAJIT $STATIC --disable-silent-rules $HOST CC=\"$HOST_CC\" CXX=\"$HOST_CXX\" CFLAGS=\"-Werror -Wno-deprecated-declarations -O2 -g -fdiagnostics-color=always $CFLAGS\" CXXFLAGS=\"-Werror -O2 -g -fdiagnostics-color=always $CXXFLAGS\" LDFLAGS=\"$LDFLAGS\""
set-env CONFIGURE_FLAGS "$CONFIGURE_FLAGS"
eval ./configure $CONFIGURE_FLAGS

- name: Archive config log
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}_config.log
path: config.log
echo
cat config.log

- name: Build and test
run: >
make distcheck
DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"
AM_COLOR_TESTS="always"
VERBOSE=1
BUILD_COLORS="always"
VERBOSE_TESTS=1

coding-style:
runs-on: ubuntu-24.04
Expand All @@ -223,19 +217,19 @@ jobs:
sudo apt-get install $(printf 'lib%s-dev ' $LIBS)

- name: Configure
run: |
autoreconf -i
./configure
env:
BUILD_COLORS: always
run: ./configure

- name: Check whitespaces
run: make check-whitespace

- name: Check headers
env:
AM_COLOR_TESTS: always
BUILD_COLORS: always
run: make check-headers

- name: Check tests
env:
AM_COLOR_TESTS: always
BUILD_COLORS: always
run: make check-tests
32 changes: 8 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
# http://www.gnu.org/software/libtool

/libtool
*.lo
*.la

# http://www.gnu.org/software/automake

Makefile.in
.dirstamp

# http://www.gnu.org/software/autoconf

/autom4te.cache
/aclocal.m4
/autotools
/config.mk
/config.log
/config.status
/configure
/config.h
/config.h.in
/stamp-h1
Makefile
/include/upipe/config.h

# mkdoc

/doc/html
/doc/dependencies.png

Expand All @@ -36,12 +15,17 @@ Makefile

# built files
*.o
*.a
*.d
*.so
*.so.*
*.log
*.trs
*.swp
*~
.libs
.deps

# ctags
/tags

# cscope files
cscope.*
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ D: design and implementation of the core

N: Clément Vasseur
E: clement.vasseur AT gmail DOT com
D: luajit bindings
D: build system and luajit bindings

N: Arnaud de Turckheim
E: quarium AT gmail DOT com
Expand Down
185 changes: 185 additions & 0 deletions Build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# --- general settings ---------------------------------------------------------

name = upipe
description = Upipe multimedia framework
version = 0.5

cflags = -O2 -g $(warn) $(warn_c)
cxxflags = -O2 -g $(warn) $(warn_cxx)
cppflags = -Iinclude -I$(top_srcdir)/include
ldflags = $(if $(or $(have_apple),$(have_san)),,-Wl,--no-undefined)

warn = -Wall \
-Wextra \
-Wno-unused-parameter \
-Wno-sign-compare \
-Wmissing-declarations \
-Wwrite-strings \
-Wredundant-decls \
-Wundef \
-Wmissing-include-dirs

warn_opt = -Wstrict-prototypes \
-Wmissing-prototypes \
-Wold-style-definition \
-Wduplicated-cond \
-Wduplicated-branches \
-Wlogical-op \
-Wrestrict \
-Wformat=2 \
-Wno-vla-larger-than \
-Wno-vla-cxx-extension

warn_c = $(foreach w,$(warn_opt),$(call try_cc,$w))
warn_cxx = $(foreach w,$(warn_opt),$(call try_cxx,$w))

distfiles = AUTHORS \
COPYING \
COPYING.LGPLv2 \
COPYING.MIT \
INSTALL \
README

subdirs = lib examples tests x86 luajit doc

# --- config checks ------------------------------------------------------------

SED ?= sed

configs += atomic
atomic-assert = __ATOMIC_SEQ_CST

configs += bigendian
bigendian-assert = __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__

configs += eventfd
eventfd-includes = sys/eventfd.h
eventfd-functions = eventfd

configs += features.h
features.h-includes = features.h

configs += net/if.h
net/if.h-includes = net/if.h

configs += pic
pic-assert = __pic__

configs += pipe
pipe-includes = unistd.h
pipe-functions = pipe

configs += pthread
pthread-cppflags = -pthread
pthread-ldflags = -pthread

configs += semaphore
semaphore-includes = semaphore.h
semaphore-functions = sem_init

configs += unistd.h
unistd.h-includes = unistd.h

configs += writev
writev-includes = sys/uio.h
writev-functions = writev

# --- headers locations --------------------------------------------------------

includes-transform = :lib/%=include/%
includesubdir = $(notdir $(patsubst %/,%,$(dir $1)))

# --- config.h generation ------------------------------------------------------

genfiles = config.h include/upipe/config.h

config.h:
$(call cmd,gen){ \
$(if $(have_alsa),echo "#define HAVE_ALSA_ASOUNDLIB_H 1";) \
$(if $(have_atomic),echo "#define HAVE_ATOMIC_OPS 1";) \
$(if $(have_audiotoolbox),echo "#define HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H 1";) \
$(if $(have_bearssl),echo "#define HAVE_BEARSSL_H 1";) \
$(if $(have_bigendian),echo "#define WORDS_BIGENDIAN 1";) \
$(if $(have_bitstream),echo "#define HAVE_BITSTREAM_COMMON_H 1";) \
$(if $(have_eventfd),echo "#define HAVE_EVENTFD 1";) \
$(if $(have_features.h),echo "#define HAVE_FEATURES_H 1";) \
$(if $(have_libgcrypt),echo "#define HAVE_GCRYPT_H 1";) \
$(if $(have_libtasn1),echo "#define HAVE_LIBTASN1_H 1";) \
$(if $(have_net/if.h),echo "#define HAVE_NET_IF_H 1";) \
$(if $(have_pipe),echo "#define HAVE_PIPE 1";) \
$(if $(have_semaphore),echo "#define HAVE_SEMAPHORE_H 1";) \
$(if $(have_unistd.h),echo "#define HAVE_UNISTD_H 1";) \
$(if $(have_x86asm),echo "#define HAVE_X86ASM 1";) \
$(if $(have_zvbi-0.2),echo "#define HAVE_LIBZVBI_H 1";) \
} > $@

# --- coding-style checks ------------------------------------------------------

check-whitespace:
@check_attr() { \
git check-attr $$2 "$$1" | grep -q ": $$3$$"; \
}; \
pfx="^ *\([0-9]*\) "; \
git ls-files -- :$(top_srcdir)/*.[ch] | while read file; do \
check_attr "$$file" binary set && continue; \
check_attr "$$file" check-coding-style unset && continue; \
out=$$({ \
cat -n "$$file" | $(SED) -n \
-e "s/$$pfx.* $$/\1: trailing whitespace/p" \
-e "s/$$pfx.* .*/\1: invalid tab/p" \
-e "1s/$$pfx$$/\1: leading newline/p" \
-e "\$$s/$$pfx$$/\1: trailing newline/p"; \
{ cat "$$file"; echo '#'; } | cat -n | $(SED) -n \
-e "\$$s/$$pfx..*#$$/\1: missing newline/p"; \
} | while read -r line; do echo "$$file:$$line"; done); \
test -n "$$out" && echo "$$out" && ret=1; \
test -z "$$ret"; \
done

check-untracked:
@if git ls-files $(top_srcdir) --others --exclude-standard | grep .; then exit 1; fi

check-headers: include/upipe/config.h
@for header in $(top_srcdir)/include/*/*.h; do \
h=$${header#$(top_srcdir)/include/}; \
if [ $$h != "upipe/config.h" ]; then \
guard=$$(echo _$${h}_ | tr [a-z] [A-Z] | tr '/.-' _); \
if ! grep -q $$guard $$header; then \
echo "$(c_red)FAIL$(c_end): $$h: invalid guard"; ret=1; \
fi; \
if ! grep -q Copyright $$header; then \
echo "$(c_red)FAIL$(c_end): $$h: missing copyright"; ret=1; \
fi; \
fi; \
if $(CC) -I$(top_srcdir)/include -Iinclude \
$(CPPFLAGS) $(CFLAGS) -Werror \
-include $$header -c -xc /dev/null -o /dev/null; \
then echo "$(c_green)PASS$(c_end): $$h"; \
else echo "$(c_red)FAIL$(c_end): $$h"; ret=1; \
fi; \
done; \
test -z "$$ret"

check-spelling:
@codespell \
--skip=$(top_srcdir)/lib/upipe-blackmagic/include \
--skip=$(top_srcdir)/lib/upipe-modules/http-parser \
--ignore-words-list multicat,happend,inout,parms,hist \
--ignore-regex '"te\.' \
$(top_srcdir)/doc \
$(top_srcdir)/examples \
$(top_srcdir)/include \
$(top_srcdir)/lib \
$(top_srcdir)/luajit \
$(top_srcdir)/tests \
$(top_srcdir)/x86

check-tests:
@cd $(top_srcdir)/tests; \
for src in *.c; do \
if grep -q '^#undef NDEBUG' $$src; \
then echo "$(c_green)PASS$(c_end): $$src"; \
else echo "$(c_red)FAIL$(c_end): $$src"; ret=1; \
fi; \
done; \
test -z "$$ret"
Loading
Loading