diff options
-rw-r--r-- | .github/workflows/ci.yml | 8 | ||||
-rw-r--r-- | Makefile | 121 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | meson.build | 39 | ||||
-rw-r--r-- | meson_options.txt | 6 | ||||
-rw-r--r-- | src/common.c | 2 | ||||
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/dxvk.c | 2 | ||||
-rw-r--r-- | src/lutris.c | 2 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/meson.build | 28 | ||||
-rw-r--r-- | src/net.c | 2 | ||||
-rw-r--r-- | src/tar.c | 2 | ||||
-rw-r--r-- | src/wine.c | 2 |
14 files changed, 97 insertions, 127 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d71f9a..5e9680e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install dependencies - run: sudo apt-get install libcurl4-openssl-dev libjson-c-dev libarchive-dev + run: sudo apt-get install libcurl4-openssl-dev libjson-c-dev libarchive-dev meson - name: Build - run: make - + run: | + meson _build + ninja -vC _build + ninja -vC _build dist diff --git a/Makefile b/Makefile deleted file mode 100644 index e2e1ca0..0000000 --- a/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -# GENERAL VARIABLES -NAME := polecat -VERSION := 0.1.5 -TARGET ?= debug -DEBUG := 0 -ifeq ($(TARGET),debug) - DEBUG := 1 -endif - -PRETTY_OUTPUT ?= 1 - -# CROSS COMPILATION SETUP -CROSS ?= - -# COMMAND VARIABLES -RM := rm -rf -MKDIR := mkdir -p -DOXYGEN := doxygen -PKGCONFIG := ${CROSS}pkg-config -CURLCONFIG := ${CROSS}curl-config - -# DIRECTORIES -BIN_DIR := bin -OBJ_DIR := obj - -SRC_DIR := src - -FILES := $(filter-out $(BIN_DIR) $(OBJ_DIR), $(wildcard *)) - -# FLAGS -CFLAGS ?= -LDFLAGS ?= - -ifeq ($(DEBUG),1) - CFLAGS += -g -endif -CFLAGS += -Wall `$(PKGCONFIG) json-c --cflags` `$(PKGCONFIG) libarchive --cflags` `$(CURLCONFIG) --cflags` -LDFLAGS += `$(PKGCONFIG) json-c --libs` `$(PKGCONFIG) libarchive --libs` `$(CURLCONFIG) --libs` -DEFINES := -DNAME=\"$(NAME)\" -DVERSION=\"$(VERSION)\" -ifeq ($(DEBUG),1) - DEFINES += -DDEBUG -else - # define NDEBUG to prevent assert and similar to cause problems - DEFINES += -DNDEBUG -endif - -# SOURCE CODE AND OBJECT FILES -CC_SRC_FILES := $(wildcard $(SRC_DIR)/*.c) - -OBJ_FILES := $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/$(TARGET)/%.o, $(CC_SRC_FILES)) - - -# TARGETS -default: $(BIN_DIR)/$(TARGET)/$(NAME)$(OUT_EXT) - -all: $(BIN_DIR)/$(TARGET)/$(NAME)$(OUT_EXT) - -$(BIN_DIR)/$(TARGET): - ${MKDIR} $@ - -$(OBJ_DIR)/$(TARGET): - ${MKDIR} $@ - -$(BIN_DIR)/$(TARGET)/$(NAME)$(OUT_EXT): $(OBJ_FILES) | $(BIN_DIR)/$(TARGET) - ${LINK_STATUS} - ${RECIPE_IF} ${CROSS}${CC} -o$@ $^ ${CFLAGS} ${DEFINES} ${LDFLAGS} ${RECIPE_RESULT_LINK} - -$(OBJ_DIR)/$(TARGET)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)/$(TARGET) - ${COMPILE_STATUS} - ${RECIPE_IF} ${CROSS}${CC} -c -o$@ $< ${CFLAGS} ${DEFINES} ${RECIPE_RESULT_COMPILE} - -clean: - ${RM} ${BIN_DIR} ${OBJ_DIR} 2> /dev/null - -loc: - -find ${SRC_DIR} ${INC_DIR} -name '*.cpp' -o -name '*.c' -o -name '*.h' -o -name '*.hpp' -type f | xargs wc -l - -tar: ${NAME}.tar - -dist: tar -distclean: - ${RM} ${NAME}.tar 2> /dev/null - -${NAME}.tar: - ${ARCHIVE_STATUS} - $(RECIPE_IF) tar -cf $@ ${FILES} $(RECIPE_RESULT_ARCHIVE) - -.PHONY: default all clean docs loc tar dist - - -ifeq ($(PRETTY_OUTPUT),1) -.SILENT: -RECIPE_IF = if -COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r" -COMPILE_OK = printf "\033[K\033[0;32mBuilt object \033[1;32m$@\033[0;32m \033[0m\n" -COMPILE_FAILED = printf "\033[K\033[0;31mFailed building \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1 -RECIPE_RESULT_COMPILE = ; then $(COMPILE_OK); else $(COMPILE_FAILED); fi -ARCHIVE_STATUS = printf "\033[K\033[0mCreating library archive \033[1m$@\033[0m...\033[0m\r" -ARCHIVE_OK = printf "\033[K\033[0;32mCreated library archive \033[1;32m$@\033[0;32m \033[0m\n" -ARCHIVE_FAILED = printf "\033[K\033[0;31mFailed creating library archive \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1 -RECIPE_RESULT_ARCHIVE = ; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi -LINK_STATUS = printf "\033[K\033[0;0mLinking \033[1m$@\033[0;0m...\033[0m\r" -LINK_OK = printf "\033[K\033[0;32mLinked \033[1;32m$@\033[0;32m \033[0m\n" -LINK_FAILED = printf "\033[K\033[0;31mFailed linking \033[1;31m$@\033[0;31m!\nIf the build options, environment, or system packages have changed, run \'\033[1;31mmake clean\033[0;31m\' and try again.\033[0m\n"; exit 1 -RECIPE_RESULT_LINK = ; then $(LINK_OK); else $(LINK_FAILED); fi -else -RECIPE_IF = -BUILD_STARTED = -COMPILE_STATUS = -COMPILE_OK = true -COMPILE_FAILED = false; exit 1 -RECIPE_RESULT_COMPILE = -ARCHIVE_STATUS = -ARCHIVE_OK = true -ARCHIVE_FAILED = false; exit 1 -RECIPE_RESULT_ARCHIVE = -LINK_STATUS = -LINK_OK = true -LINK_FAILED = false; exit 1 -RECIPE_RESULT_LINK = -endif @@ -26,15 +26,15 @@ polecat depends on: - pkg-config - libcurl -- curl-config (should be included with the libcurl development package) - json-c - libarchive +- meson ## Build instructions - ensure you have all [dependencies](#Dependencies) installed -- run `make` for a debug build -- run `make TARGET=release` for a release build +- run `meson _build && ninja -C _build` for a debug build +- run `meson _build -Drelease=true && ninja -C _build` for a release build ### [License](LICENSE) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..c4d1bff --- /dev/null +++ b/meson.build @@ -0,0 +1,39 @@ +project( + 'polecat', + 'c', + default_options : [ + 'buildtype=debugoptimized', + ], + license : 'MIT', + version : '0.1.5', +) + +libarchive_dep = dependency('libarchive') +libcurl_dep = dependency('libcurl') +libjson_c_dep = dependency('json-c') + +conf_data = configuration_data() +conf_data.set_quoted('NAME', meson.project_name()) +conf_data.set_quoted('VERSION', meson.project_version()) +if get_option('release') + conf_data.set('NDEBUG', true) +else + conf_data.set('DEBUG', true) +endif +configure_file(output : 'polecat-config.h', configuration : conf_data) + +conf_inc = include_directories('.') + +run_target( + 'loc', + command : [ + 'sh', + '-c', + 'find src' + + ' -type f' + + ' -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp"' + + ' | xargs wc -l', + ], +) + +subdir('src') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..386d85f --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,6 @@ +option( + 'release', + type : 'boolean', + value : false, + description : 'Release build' +) diff --git a/src/common.c b/src/common.c index 6d687ee..c2691fe 100644 --- a/src/common.c +++ b/src/common.c @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <stdio.h> #include <string.h> #include <stdbool.h> diff --git a/src/config.c b/src/config.c index 4309d87..26c775a 100644 --- a/src/config.c +++ b/src/config.c @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <string.h> #include <stdio.h> @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <stdio.h> #include <string.h> #include <json.h> diff --git a/src/lutris.c b/src/lutris.c index ec1f14d..b06ce40 100644 --- a/src/lutris.c +++ b/src/lutris.c @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <stdio.h> #include <string.h> #include <linux/limits.h> @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <stdio.h> #include <string.h> #include <linux/limits.h> diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..06aae89 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,28 @@ +polecat_deps = [libarchive_dep, libcurl_dep, libjson_c_dep] + +polecat_sources = files( + 'common.c', + 'common.h', + 'config.c', + 'config.h', + 'dxvk.c', + 'dxvk.h', + 'lutris.c', + 'lutris.h', + 'main.c', + 'main.h', + 'net.c', + 'net.h', + 'tar.c', + 'tar.h', + 'wine.c', + 'wine.h', +) + +executable( + 'polecat', + polecat_sources, + dependencies : polecat_deps, + include_directories : conf_inc, + install : true, +) @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <stdio.h> #include <stdlib.h> #include <archive.h> @@ -1,3 +1,5 @@ +#include <polecat-config.h> + #include <stdlib.h> #include <stdio.h> #include <string.h> |