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
76 changes: 60 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
sudo apt-get update
sudo apt-get install -y \
build-essential \
autotools-dev \
autoconf \
automake \
pkg-config \
libwlroots-dev \
libwayland-dev \
Expand All @@ -28,35 +31,76 @@ jobs:
clang-format \
clang-tools \
cppcheck \
emacs-nox \
bear
emacs-pgtk \
bear \
libxml2-utils

- name: Generate configure script
run: |
echo "Generating autotools files..."
autoreconf -fvi

- name: Configure build
run: |
echo "Configuring build with autotools..."
# Try with PGTK check first, fallback if emacs-pgtk not available
./configure || ./configure --disable-pgtk-check

- name: Check format
run: |
echo "Checking C code formatting..."
for file in $(sed -ne '/^SRCS/s/.*=//p' Makefile); do
if ! clang-format -style=Google --dry-run --Werror "$file" >/dev/null 2>&1; then
echo "FAILED: $file is not formatted according to Google style"
echo "Expected formatting:"
clang-format -style=Google "$file" | diff -u "$file" - || true
exit 1
else
echo "PASSED: $file"
fi
done

- name: Build EWS part
make pre-commit
echo "PASSED: Code formatting check completed"

- name: Build project
run: |
echo "Building project with autotools..."
make
echo "PASSED: Build completed successfully"

- name: Test with different compilers
run: |
echo "Testing compilation with different compilers..."

make clean
make CC=gcc ews
(./configure CC=gcc || ./configure CC=gcc --disable-pgtk-check)
make
echo "PASSED: GCC compilation successful"

make clean
make CC=clang ews
(./configure CC=clang || ./configure CC=clang --disable-pgtk-check)
make
echo "PASSED: Clang compilation successful"

- name: Test sanitizer builds
run: |
echo "Testing sanitizer builds..."

make clean
(./configure --enable-asan || ./configure --enable-asan --disable-pgtk-check)
make
echo "PASSED: AddressSanitizer build successful"

make clean
(./configure --enable-ubsan || ./configure --enable-ubsan --disable-pgtk-check)
make
echo "PASSED: UndefinedBehaviorSanitizer build successful"

- name: Run tests
run: |
echo "Running test suite..."
# Reconfigure for tests
make clean
(./configure || ./configure --disable-pgtk-check)
make check
echo "PASSED: Tests completed"

- name: Run elisp checks
run: |
echo "Running Elisp lint checks..."
make lint-elisp
echo "PASSED: Elisp checks completed"

- name: Run cppcheck
run: |
echo "Running cppcheck static analysis..."
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.elc
*-protocol.h
*-protocol.c
ews
112 changes: 0 additions & 112 deletions Makefile

This file was deleted.

34 changes: 34 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = ews elisp tests

EXTRA_DIST = \
README.org \
NOTES.org \
COPYING \
protocols/ewp.xml

.PHONY: check-elisp lint-elisp elsa-check cppcheck scan-build tidy pre-commit

check-elisp: all
$(MAKE) -C elisp check

lint-elisp:
$(MAKE) -C elisp lint

elsa-check:
$(MAKE) -C elisp elsa-check

cppcheck:
$(MAKE) -C ews cppcheck

scan-build:
$(MAKE) -C ews scan-build

tidy:
$(MAKE) -C ews tidy

pre-commit:
$(MAKE) -C ews pre-commit

check-local: check-elisp
105 changes: 105 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
AC_PREREQ([2.71])
AC_INIT([ewx],[0.1.0],[rayslava+ewx@rayslava.com])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_CONFIG_FILES([
Makefile
ews/Makefile
elisp/Makefile
tests/Makefile
])

# Configure Autotest
AC_CONFIG_TESTDIR([tests])

AC_PROG_CC
AC_PROG_CC_C_O
AM_PROG_AR
AC_PROG_RANLIB

PKG_PROG_PKG_CONFIG

PKG_CHECK_MODULES([WLROOTS], [wlroots >= 0.15.0])
PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server])
PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon])

PKG_CHECK_VAR([WAYLAND_PROTOCOLS_DATADIR], [wayland-protocols], [pkgdatadir])
if test "x$WAYLAND_PROTOCOLS_DATADIR" = "x"; then
AC_MSG_ERROR([wayland-protocols not found])
fi

PKG_CHECK_VAR([WAYLAND_SCANNER], [wayland-scanner], [wayland_scanner])
if test "x$WAYLAND_SCANNER" = "x"; then
AC_MSG_ERROR([wayland-scanner not found])
fi

AC_CHECK_PROG([EMACS], [emacs], [emacs])
if test "x$EMACS" = "x"; then
AC_MSG_ERROR([emacs not found])
fi

AC_ARG_ENABLE([pgtk-check],
AS_HELP_STRING([--disable-pgtk-check], [Skip checking for Emacs PGTK support (dangerous)]),
[pgtk_check=$enableval],
[pgtk_check=yes])

if test "x$pgtk_check" = "xyes"; then
AC_MSG_CHECKING([if Emacs has PGTK support])
if $EMACS --batch --eval "(unless (eq window-system 'pgtk) (kill-emacs 1))" 2>/dev/null; then
AC_MSG_RESULT([yes])
else
# Backup check via system-configuration-features
if $EMACS --batch --eval "(unless (member \"PGTK\" (split-string system-configuration-features)) (kill-emacs 1))" 2>/dev/null; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Emacs must be built with PGTK support for Wayland compatibility.
Please install emacs-pgtk or rebuild Emacs with --with-pgtk configure option.
Use --disable-pgtk-check to bypass this check.])
fi
fi
else
AC_MSG_NOTICE([Skipping PGTK check as requested])
fi

CFLAGS="$CFLAGS -Wall -Wextra -Wno-error -pedantic -std=c2x"
CFLAGS="$CFLAGS -Wformat=2 -Wformat-security"
CFLAGS="$CFLAGS -Wnull-dereference -Wstack-protector"
CFLAGS="$CFLAGS -Wstrict-overflow=3 -Warray-bounds"
CFLAGS="$CFLAGS -fstack-protector-strong"
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"

AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [Enable debug build]),
[debug=$enableval],
[debug=yes])

if test "x$debug" = "xyes"; then
CFLAGS="$CFLAGS -ggdb -O1"
else
CFLAGS="$CFLAGS -Ofast -DNDEBUG -g"
fi

AC_ARG_ENABLE([asan],
AS_HELP_STRING([--enable-asan], [Enable AddressSanitizer]),
[asan=$enableval],
[asan=no])

if test "x$asan" = "xyes"; then
CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer -O1"
LDFLAGS="$LDFLAGS -fsanitize=address"
fi

AC_ARG_ENABLE([ubsan],
AS_HELP_STRING([--enable-ubsan], [Enable UndefinedBehaviorSanitizer]),
[ubsan=$enableval],
[ubsan=no])

if test "x$ubsan" = "xyes"; then
CFLAGS="$CFLAGS -fsanitize=undefined -fno-omit-frame-pointer -O1"
LDFLAGS="$LDFLAGS -fsanitize=undefined"
fi

AC_DEFINE([WLR_USE_UNSTABLE], [1], [Use unstable wlroots API])

AC_OUTPUT
File renamed without changes.
34 changes: 34 additions & 0 deletions elisp/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ELISP_FILES = \
ewc.el \
ewl.el

EXTRA_DIST = \
$(ELISP_FILES) \
ewc-test.el \
ewl-test.el

ELCFILES = $(ELISP_FILES:.el=.elc)

SUFFIXES = .el .elc

.el.elc:
$(EMACS) -Q --batch -L $(srcdir) -L $(top_builddir)/ews -f batch-byte-compile $<

ewl.elc: ewc.elc

all-local: $(ELCFILES)

.PHONY: check-local lint

check-local: ewl-test.el $(ELCFILES)
# TODO(test): Implement a reasonable test for ewl appropriate for CI
# $(EMACS) -Q -L $(srcdir) -L $(top_builddir)/ews -l $(srcdir)/ewl-test.el

lint: $(ELISP_FILES)
@echo "Running elisp lint (byte compilation with warnings as errors)..."
$(EMACS) -Q --batch -L $(srcdir) -L $(top_builddir)/ews \
--eval "(setq byte-compile-error-on-warn t)" \
-f batch-byte-compile $(srcdir)/ewc.el $(srcdir)/ewl.el

clean-local:
rm -f $(ELCFILES)
File renamed without changes.
Loading