-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
126 lines (91 loc) · 3.77 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
VERSION=$(shell echo `git describe --tags`)
#PREFIX=/opt/imgflo
PREFIX=$(shell echo `pwd`/install)
FLAGS=-Wall -Werror -std=c99 -g
TARGET=$(shell uname -n)
ifneq ("$(wildcard /app)","")
# Heroku build. TODO: find better way to detect
RELOCATE_DEPS:=true
endif
ifdef RELOCATE_DEPS
PKGCONFIG_ARGS:=--define-variable=prefix=$(PREFIX)
else
PKGCONFIG_ARGS:=
endif
LIBS=gegl-0.3 gio-unix-2.0 json-glib-1.0 libsoup-2.4 libpng
DEPS=$(shell $(PREFIX)/env.sh pkg-config $(PKGCONFIG_ARGS) --libs --cflags $(LIBS))
GNOME_SOURCES=http://ftp.gnome.org/pub/gnome/sources
GLIB_MAJOR=2.42
GLIB_VERSION=2.42.1
GLIB_TARNAME=glib-$(GLIB_VERSION)
LIBSOUP_MAJOR=2.50
LIBSOUP_VERSION=2.50.0
LIBSOUP_TARNAME=libsoup-$(LIBSOUP_VERSION)
OPENH264_VERSION=1.6.0
FFMPEG_VERSION=3.2
FFMPEG_OPTIONS=--disable-hwaccels --disable-protocols --disable-devices --disable-bsfs --disable-filters \
--enable-shared \
--enable-ffmpeg \
--disable-vda \
--enable-protocol=file \
--enable-avcodec --enable-avformat --enable-swscale --enable-swresample --enable-avfilter \
--enable-libopenh264
GEGL_OPTIONS=--enable-workshop --with-libavformat --without-libv4l --without-umfpack
all: env
install: env link-check
cp ./examples/link-check $(PREFIX)/bin/link-check
link-check:
$(PREFIX)/env.sh gcc -o ./examples/link-check examples/link-check.c -I. $(FLAGS) $(DEPS)
env:
mkdir -p build || true
mkdir -p $(PREFIX)/bin || true
sed -e 's|@PREFIX@|$(PREFIX)|' env.sh.in > $(PREFIX)/env.sh
chmod +x $(PREFIX)/env.sh
glib: env
cd build && curl -L -O $(GNOME_SOURCES)/glib/$(GLIB_MAJOR)/$(GLIB_TARNAME).tar.xz
cd build && tar -xf $(GLIB_TARNAME).tar.xz
cd build/$(GLIB_TARNAME) && $(PREFIX)/env.sh ./autogen.sh --prefix=$(PREFIX)
cd build/$(GLIB_TARNAME) && $(PREFIX)/env.sh make -j4 install
babl: env
cd babl && $(PREFIX)/env.sh ./autogen.sh --prefix=$(PREFIX)
cd babl && $(PREFIX)/env.sh make -j4 install
gegl: env
cp ./hacks/nls.m4 ./gegl/m4/ && echo "HACKED nls.m4"
cd gegl && $(PREFIX)/env.sh ./autogen.sh --prefix=$(PREFIX) $(GEGL_OPTIONS)
cd gegl && $(PREFIX)/env.sh make -j4 install CFLAGS="-I/app/.apt/usr/include/json-glib-1.0/"
libsoup: env
# cp $(PREFIX)/share/aclocal/nls.m4 ./libsoup/m4/ || echo "HACK to get intltool working on Heroku not used"
cd build && curl -L -O $(GNOME_SOURCES)/libsoup/$(LIBSOUP_MAJOR)/$(LIBSOUP_TARNAME).tar.xz
cd build && tar -xf $(LIBSOUP_TARNAME).tar.xz
cd build/$(LIBSOUP_TARNAME) && $(PREFIX)/env.sh ./configure --prefix=$(PREFIX) --disable-gtk-doc --disable-tls-check || cat config.log
cd build/$(LIBSOUP_TARNAME) && $(PREFIX)/env.sh make -j4 install
openh264-download: env
cd build && curl -L -O https://github.com/cisco/openh264/archive/v${OPENH264_VERSION}.tar.gz
cd build && tar -xf v${OPENH264_VERSION}.tar.gz
openh264-build:
cd build/openh264-${OPENH264_VERSION} && $(PREFIX)/env.sh make -j4 install PREFIX=${PREFIX}
openh264: openh264-download openh264-build
ffmpeg-download: env
cd build && curl -L -O https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz
cd build && tar -xf ffmpeg-${FFMPEG_VERSION}.tar.xz
ffmpeg-build: env
cd build/ffmpeg-${FFMPEG_VERSION} && $(PREFIX)/env.sh ./configure --prefix=${PREFIX} ${FFMPEG_OPTIONS}
cd build/ffmpeg-${FFMPEG_VERSION} && $(PREFIX)/env.sh make -j4 install
ffmpeg: ffmpeg-download ffmpeg-build
copy-apt:
# move into our prefix so it will be installed and
rsync -a /app/.apt/usr/* $(PREFIX)/
heroku-deps: openh264 ffmpeg copy-apt
null:
echo "null target"
travis-deps: openh264 ffmpeg null
dependencies: libsoup babl gegl
check: install
$(PREFIX)/env.sh $(PREFIX)/bin/link-check
clean:
git clean -dfx --exclude node_modules --exclude install
package:
tar -czf ./imgflo-dependencies-$(TARGET).tgz ./install
release: dependencies check upload
heroku-release: heroku-deps dependencies upload
.PHONY=all link-check libsoup