freebsd-ports/graphics/libbpg/files/patch-Makefile
Juergen Lock 58000b12ef Add new port graphics/libbpg:
BPG (Better Portable Graphics) is a new image format. Its purpose is to
replace the JPEG image format when quality or file size is an issue. Its
main advantages are:
 - High compression ratio. Files are much smaller than JPEG for similar
   quality.
 - Supported by most Web browsers with a small Javascript decoder (gzipped
   size: 56 KB).
 - Based on a subset of the HEVC open video compression standard.
 - Supports the same chroma formats as JPEG (grayscale, YCbCr 4:2:0, 4:2:2,
   4:4:4) to reduce the losses during the conversion. An alpha channel is
   supported. The RGB, YCgCo and CMYK color spaces are also supported.
 - Native support of 8 to 14 bits per channel for a higher dynamic range.
 - Lossless compression is supported.
 - Various metadata (such as EXIF, ICC profile, XMP) can be included.
 - Animation support.

WWW: http://bellard.org/bpg/

PR:		196837
Submitted by:	Matthieu Volat <mazhe@alkumuna.eu>
2015-01-30 17:47:01 +00:00

82 lines
2.2 KiB
Text

--- Makefile.orig 2015-01-11 16:17:07 UTC
+++ Makefile
@@ -17,7 +17,7 @@ USE_BPGVIEW=y
# Enable for compilation on MacOS X
#CONFIG_APPLE=y
# Installation prefix
-prefix=/usr/local
+prefix=${DESTDIR}${PREFIX}
#################################
@@ -31,19 +31,20 @@ CROSS_PREFIX:=
EXE:=
endif
-CC=$(CROSS_PREFIX)gcc
-CXX=$(CROSS_PREFIX)g++
-AR=$(CROSS_PREFIX)ar
+CC?=$(CROSS_PREFIX)gcc
+CXX?=$(CROSS_PREFIX)g++
+AR?=$(CROSS_PREFIX)ar
+LD?=$(CROSS_PREFIX)ld
EMCC=emcc
PWD:=$(shell pwd)
-CFLAGS:=-Os -Wall -MMD -fno-asynchronous-unwind-tables -fdata-sections -ffunction-sections -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer
-CFLAGS+=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT
-CFLAGS+=-I.
-CFLAGS+=-DCONFIG_BPG_VERSION=\"$(shell cat VERSION)\"
+CFLAGS_DIST:=-Os -Wall -MMD -fno-asynchronous-unwind-tables -fdata-sections -ffunction-sections -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer
+CFLAGS_DIST+=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT
+CFLAGS_DIST+=-I.
+CFLAGS_DIST+=-DCONFIG_BPG_VERSION=\"$(shell cat VERSION)\"
ifdef USE_JCTVC_HIGH_BIT_DEPTH
-CFLAGS+=-DRExt__HIGH_BIT_DEPTH_SUPPORT
+CFLAGS_DIST+=-DRExt__HIGH_BIT_DEPTH_SUPPORT
endif
# Emscriptem config
@@ -53,14 +54,17 @@ EMLDFLAGS+=-s NO_FILESYSTEM=1 -s NO_BROW
EMLDFLAGS+=-O3 --memory-init-file 0 --closure 1 --post-js post.js
EMCFLAGS:=$(CFLAGS)
-LDFLAGS=-g
+LDFLAGS_DIST=-g
ifdef CONFIG_APPLE
-LDFLAGS+=-Wl,-dead_strip
+LDFLAGS_DIST+=-Wl,-dead_strip
else
-LDFLAGS+=-Wl,--gc-sections
+LDFLAGS_DIST+=-Wl,--gc-sections
endif
-CFLAGS+=-g
-CXXFLAGS=$(CFLAGS)
+CFLAGS_DIST+=-g
+
+CFLAGS:=${CFLAGS_DIST} ${CFLAGS}
+LDFLAGS:=${LDFLAGS_DIST} ${LDFLAGS}
+CXXFLAGS=${CFLAGS}
PROGS=bpgdec$(EXE) bpgenc$(EXE)
ifdef USE_BPGVIEW
@@ -70,7 +74,7 @@ ifdef USE_EMCC
PROGS+=bpgdec.js bpgdec8.js bpgdec8a.js
endif
-all: $(PROGS)
+all: libbpg.a libbpg.so $(PROGS)
LIBBPG_OBJS:=$(addprefix libavcodec/, \
hevc_cabac.o hevc_filter.o hevc.o hevcpred.o hevc_refs.o\
@@ -158,6 +162,9 @@ bpgenc.o: CFLAGS+=-Wno-unused-but-set-va
libbpg.a: $(LIBBPG_OBJS)
$(AR) rcs $@ $^
+libbpg.so: $(LIBBPG_OBJS)
+ $(CC) $(LDFLAGS) -shared -o $@ $^
+
bpgdec$(EXE): bpgdec.o libbpg.a
$(CC) $(LDFLAGS) -o $@ $^ $(BPGDEC_LIBS)