Skip to content

Instantly share code, notes, and snippets.

@bsharper
Last active August 29, 2015 14:10
Show Gist options
  • Save bsharper/dd517547f6e1bcabf6be to your computer and use it in GitHub Desktop.
Save bsharper/dd517547f6e1bcabf6be to your computer and use it in GitHub Desktop.
Diff to allow BPG Image format library (http://bellard.org/bpg/) to compile on OS X 10.10.2
diff -ruN orig/Makefile libbpg-0.9/Makefile
--- orig/Makefile 2014-12-05 11:05:35.000000000 -0600
+++ libbpg-0.9/Makefile 2014-12-06 13:23:37.000000000 -0600
@@ -49,7 +49,7 @@
EMLDFLAGS+=-O3 --memory-init-file 0 --closure 1 --post-js post.js
EMCFLAGS:=$(CFLAGS)
-LDFLAGS= -g -Wl,--gc-sections
+LDFLAGS= -g -Wl,-dead_strip
CFLAGS+=-g
CXXFLAGS=$(CFLAGS)
@@ -113,7 +113,7 @@
LIBS:=-lz
LDFLAGS+=-static
else
-LIBS:=-lrt -lm -lpthread
+LIBS:=-lm -lpthread
endif
BPGENC_LIBS+=-lpng -ljpeg $(LIBS)
diff -ruN orig/libavutil/mem.c libbpg-0.9/libavutil/mem.c
--- orig/libavutil/mem.c 2014-12-05 11:05:35.000000000 -0600
+++ libbpg-0.9/libavutil/mem.c 2014-12-06 13:22:07.000000000 -0600
@@ -33,7 +33,7 @@
#include <stdlib.h>
#include <string.h>
#if HAVE_MALLOC_H
-#include <malloc.h>
+#include <malloc/malloc.h>
#endif
#include "avassert.h"
# If you run this as a script it should patch and compile BPG for you
wget http://bellard.org/bpg/libbpg-0.9.tar.gz
tar xvzf libbpg-0.9.tar.gz
cd libbpg-0.9
wget https://gist.githubusercontent.com/bsharper/dd517547f6e1bcabf6be/raw/d125ab609e07e4fd624137543d36eb48bcaab91b/bpg_osx.patch
patch -p1 < bpg_osx.patch
# Output should be:
# patching file Makefile
# patching file libavutil/mem.c
# If you see something like "patch unexpectedly ends in middle of line" it should still work
make all
# This may take a while depending on your system
# When this is done, bpgenc and bpgdec should be in the current directory
./bpgenc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment