diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..8da9495 --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + CompilationDatabase: builddir/ # Search builddir/ directory for compile_commands.json diff --git a/.gitignore b/.gitignore index 3f64715..5c68d9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1 @@ -/build/ -/.cache/ -/powerbar-module.so -compile_flags.txt -compile_commands.json -*.o +/builddir/ diff --git a/README.md b/README.md index f6addb1..0aec73f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,6 @@ The `gtklock-module.h` header can be used when making your own modules. __⚠️ Module version matches the compatible gtklock version. Other versions might or might not work.__ ## Dependencies -- GNU Make (build-time) +- Meson (build-time) - pkg-config (build-time) - gtk+3.0 diff --git a/makefile b/makefile deleted file mode 100644 index 1ca0b68..0000000 --- a/makefile +++ /dev/null @@ -1,36 +0,0 @@ -# gtklock-powerbar-module -# Copyright (c) 2022 Jovan Lanik - -# Makefile - -NAME := powerbar-module.so - -PREFIX = /usr/local -LIBDIR = $(PREFIX)/lib -INSTALL = install - -LIBS := gtk+-3.0 gmodule-export-2.0 -CFLAGS += -std=c11 -fPIC $(shell pkg-config --cflags $(LIBS)) -LDLIBS += $(shell pkg-config --libs $(LIBS)) - -SRC = $(wildcard *.c) -OBJ = $(SRC:%.c=%.o) - -TRASH = $(OBJ) $(NAME) - -.PHONY: all clean install uninstall - -all: $(NAME) - -clean: - @rm $(TRASH) | true - -install: - $(INSTALL) -d $(DESTDIR)$(LIBDIR)/gtklock - $(INSTALL) $(NAME) $(DESTDIR)$(LIBDIR)/gtklock/$(NAME) - -uninstall: - rm -f $(DESTDIR)$(LIBDIR)/gtklock/$(NAME) - -$(NAME): $(OBJ) - $(LINK.c) -shared $^ $(LDLIBS) -o $@ diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..3f7de00 --- /dev/null +++ b/meson.build @@ -0,0 +1,38 @@ +# gtklock-powerbar-module +# Copyright (c) 2024 Jovan Lanik + +project( + 'gtklock-powerbar-module', 'c', + version : '4.0.0', + license : 'GPLv3', + default_options : ['c_std=c11'], +) + +gtk = dependency('gtk+-3.0') +gmodule_export = dependency('gmodule-export-2.0') + +dependencies = [ + gtk, + gmodule_export, +] + +gtklock_powerbar_module_sources = files('source.c') + +gtklock_powerbar_module_set = [ + gtklock_powerbar_module_sources, +] + +if import('fs').is_absolute(get_option('libdir')) + gtklock_module_dir = get_option('libdir') / 'gtklock' +else + gtklock_module_dir = get_option('prefix') / get_option('libdir') / 'gtklock' +endif + +shared_library( + 'powerbar-module', + gtklock_powerbar_module_set, + name_prefix : '', + dependencies : dependencies, + install : true, + install_dir : gtklock_module_dir, +)