switch to meson

This commit is contained in:
Jovan Lanik 2024-10-21 22:43:47 +02:00
parent 6333fb856f
commit 31a2b0f049
5 changed files with 42 additions and 43 deletions

2
.clangd Normal file
View file

@ -0,0 +1,2 @@
CompileFlags:
CompilationDatabase: builddir/ # Search builddir/ directory for compile_commands.json

7
.gitignore vendored
View file

@ -1,6 +1 @@
/build/
/.cache/
/powerbar-module.so
compile_flags.txt
compile_commands.json
*.o
/builddir/

View file

@ -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

View file

@ -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 $@

38
meson.build Normal file
View file

@ -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,
)