Adiciona tinyblocks-jpg (libjpeg, build condicional) e melhora o empacotamento AppImage

This commit is contained in:
mguinhos committed 2026-10-20 21:15:29 -03:00
1 parent 714186a1a1
commit e36fbc43e1
6 files changed
+337 -7

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
# Makefile da library jpg (categoria "JPG"); depende de libjpeg.
# Como os headers de desenvolvimento podem nao estar instalados, o build e'
# condicional: sem <jpeglib.h> a library e' apenas ignorada.
CC := gcc
BUILD := build
JPEG_CFLAGS := $(shell pkg-config --cflags libjpeg 2>/dev/null)
JPEG_LIBS := $(shell pkg-config --libs libjpeg 2>/dev/null)
JPEG_HAVE := $(shell printf '\#include <jpeglib.h>\nint main(void){return 0;}\n' | \
$(CC) -xc - -o /dev/null $(JPEG_CFLAGS) $(JPEG_LIBS) -ljpeg >/dev/null 2>&1 && echo yes)
CFLAGS := -std=c11 -Wall -Wextra -pedantic -fvisibility=hidden \
-D_POSIX_C_SOURCE=200809L -I../../include -Iinclude $(JPEG_CFLAGS)
OBJ := $(BUILD)/tb_jpg.o
LIB_A := $(BUILD)/libtinyblocks-jpg.a
LIB_SO := $(BUILD)/libtinyblocks-jpg.so
ifeq ($(JPEG_HAVE),yes)
.PHONY: all static shared clean
all: static shared
static: $(LIB_A)
shared: $(LIB_SO)
$(OBJ): src/tb_jpg.c include/tb_jpg.h
@mkdir -p $(BUILD)
$(CC) $(CFLAGS) -fPIC -c $< -o $@
$(LIB_A): $(OBJ)
ar rcs $@ $^
$(LIB_SO): $(OBJ)
$(CC) -shared -o $@ $^ $(JPEG_LIBS) -ljpeg
clean:
$(RM) -r $(BUILD)
else
.PHONY: all static shared clean
all static shared:
@echo "tinyblocks-jpg: <jpeglib.h> ausente (instale libjpeg-dev/libjpeg-turbo8-dev) - pulando"
clean:
$(RM) -r $(BUILD)
endif