head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.1
	netbsd-11-0-RC3:1.1.1.1
	netbsd-11-0-RC2:1.1.1.1
	netbsd-11-0-RC1:1.1.1.1
	netbsd-11:1.1.1.1.0.2
	netbsd-11-base:1.1.1.1
	brotli-1-0-9:1.1.1.1
	GOOGLE:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2023.01.29.06.38.34;	author mrg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	gOcuvoN6w4Ry1pbE;

1.1.1.1
date	2023.01.29.06.38.34;	author mrg;	state Exp;
branches;
next	;
commitid	gOcuvoN6w4Ry1pbE;


desc
@@



1.1
log
@Initial revision
@
text
@OS := $(shell uname)
LIBSOURCES = $(wildcard c/common/*.c) $(wildcard c/dec/*.c) \
             $(wildcard c/enc/*.c)
SOURCES = $(LIBSOURCES) c/tools/brotli.c
BINDIR = bin
OBJDIR = $(BINDIR)/obj
LIBOBJECTS = $(addprefix $(OBJDIR)/, $(LIBSOURCES:.c=.o))
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.c=.o))
LIB_A = libbrotli.a
EXECUTABLE = brotli
DIRS = $(OBJDIR)/c/common $(OBJDIR)/c/dec $(OBJDIR)/c/enc \
       $(OBJDIR)/c/tools $(BINDIR)/tmp
CFLAGS += -O2
ifeq ($(os), Darwin)
  CPPFLAGS += -DOS_MACOSX
endif

ifneq ($(strip $(CROSS_COMPILE)), )
	CC=$(CROSS_COMPILE)-gcc
	ARCH=$(firstword $(subst -, ,$(CROSS_COMPILE)))
	BROTLI_WRAPPER="qemu-$(ARCH) -L /usr/$(CROSS_COMPILE)"
endif

# The arm-linux-gnueabi compiler defaults to Armv5. Since we only support Armv7
# and beyond, we need to select Armv7 explicitly with march.
ifeq ($(ARCH), arm)
	CFLAGS += -march=armv7-a -mfloat-abi=hard -mfpu=neon
endif

all: test
	@@:

.PHONY: all clean test

$(DIRS):
	mkdir -p $@@

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) -lm -o $(BINDIR)/$(EXECUTABLE)

lib: $(LIBOBJECTS)
	rm -f $(LIB_A)
	ar -crs $(LIB_A) $(LIBOBJECTS)

test: $(EXECUTABLE)
	tests/compatibility_test.sh $(BROTLI_WRAPPER)
	tests/roundtrip_test.sh $(BROTLI_WRAPPER)

clean:
	rm -rf $(BINDIR) $(LIB_A)

.SECONDEXPANSION:
$(OBJECTS): $$(patsubst %.o,%.c,$$(patsubst $$(OBJDIR)/%,%,$$@@)) | $(DIRS)
	$(CC) $(CFLAGS) $(CPPFLAGS) -Ic/include \
        -c $(patsubst %.o,%.c,$(patsubst $(OBJDIR)/%,%,$@@)) -o $@@
@


1.1.1.1
log
@initial import of brotli 1.0.9.

modern blender wants freetype to have brotli support enabled or it
won't build.  fortunately, enabling the decoder support (all it
needs currently) is relatively easy and small (~160k on amd64)
without exposing brotli as a first class citizen is easy, so this
will be linked into xsrc freetype directly.

XXX: pullup-10?  or perhaps force -10 to use pkgsrc freetype?

from pkgsrc DESCR:
Brotli is a generic-purpose lossless compression algorithm that compresses data
using a combination of a modern variant of the LZ77 algorithm, Huffman coding
and 2nd order context modeling, with a compression ratio comparable to the best
currently available general-purpose compression methods. It is similar in speed
with deflate but offers more dense compression.
@
text
@@
