-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile_Rsvg
445 lines (351 loc) · 10.4 KB
/
Makefile_Rsvg
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
LIBPNG_VERSION ?= 1.6.37
UTIL_LINUX_VERSION ?= 2.33
LIBJPEG_VERSION ?= 9c
OPENJP2_VERSION ?= 2.3.1
LIBTIFF_VERSION ?= 4.0.9
LIBXML2_VERSION ?= 2.9.9
GLIB_VERSION ?= 2.58.3
CAIRO_VERSION ?= 1.14.8
LIBCROCO_VERSION ?= 0.6.8
PANGO_VERSION ?= 1.28.4
GDK_PIXBUF_VERSION ?= 2.28.2
LIBFFI_VERSION ?= 3.2.1
LIBRSVG_VERSION ?= 2.26.3
PIXMAN_VERSION ?= 0.38.4
FONTCONFIG_VERSION ?= 2.13.0
FREETYPE_VERSION ?= 2.10.0
BZIP2_VERSION ?= 1.0.6
HARFBUZZ_VERSION ?= 2.4.0
#fontconfig-2.10.95-11.amzn2.0.2.x86_64.rpm
#harfbuzz-1.3.2-1.amzn2.0.2.x86_64.rpm
#freetype-2.4.11-15.amzn2.0.2.x86_64.rpm
# what to tell RSVG where it will expect to run from
TARGET_DIR ?= /opt/
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
## this is a temporary area for libraries; we don't use the main destination
## because a bunch of these libraries install additional tools and things
## that the final package does not need. in order to minimise the final
## Lambda layer size, this build script first makes/installs static
## dependencies with their docs and command line tools to the cache area,
## and then just finally installs rsvg into the actual target
CACHE_DIR=$(PROJECT_ROOT)build/cache
.ONESHELL:
CMAKE=cmake3
PKG_CONFIG=PKG_CONFIG_PATH=$(CACHE_DIR)/lib/pkgconfig
CONFIGURE = ./configure \
CPPFLAGS=-I$(CACHE_DIR)/include \
LDFLAGS="-L$(CACHE_DIR)/lib -L$(CACHE_DIR)/lib64" \
$(PKG_CONFIG) \
--disable-dependency-tracking \
--disable-shared \
--enable-static \
--disable-rpath \
--prefix=$(CACHE_DIR)
## dev tool istallation
init:
yum install -y gcc gcc-c++ cmake3 intltool flex bison shared-mime-info gperf
## util-linux has libmount and libuuid etc
LIBUUID=$(CACHE_DIR)/lib/libuuid.a
UTIL_LINUX_SOURCE=util-linux-$(UTIL_LINUX_VERSION).tar.xz
$(UTIL_LINUX_SOURCE):
curl -LO https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v$(UTIL_LINUX_VERSION)/$(UTIL_LINUX_SOURCE)
$(LIBUUID): $(UTIL_LINUX_SOURCE)
tar xf $<
cd util-linux*
$(CONFIGURE) \
--disable-all-programs \
--enable-libuuid
make
make install
## libffi
LIBFFI_SOURCE=libffi-$(LIBFFI_VERSION).tar.gz
LIBFFI=$(CACHE_DIR)/lib64/libffi.a
$(LIBFFI_SOURCE):
curl -LO ftp://sourceware.org/pub/libffi/$(LIBFFI_SOURCE)
$(LIBFFI): $(LIBFFI_SOURCE)
tar xf $<
cd libffi*
$(CONFIGURE)
make
make install
## GLIB,
# see https://developer.gnome.org/glib/stable/glib-building.html
#
GLIB_SOURCE=glib-$(GLIB_VERSION).tar.xz
GLIB_MINOR_VERSION=$(basename $(GLIB_VERSION))
GLIB_MAJOR_VERSION=$(basename $(GLIB_MINOR_VERSION))
GLIB=$(CACHE_DIR)/lib/libglib-$(GLIB_MAJOR_VERSION).0.a
$(GLIB_SOURCE):
curl -LO http://ftp.gnome.org/pub/gnome/sources/glib/$(GLIB_MINOR_VERSION)/$(GLIB_SOURCE)
$(GLIB): $(GLIB_SOURCE) $(LIBFFI)
tar xf $<
cd glib*
$(PKG_CONFIG) ./autogen.sh
$(CONFIGURE) \
--disable-gtk-doc \
--disable-man \
--disable-libmount \
--disable-fam \
--disable-libelf \
--disable-xattr \
--disable-installed-tests \
--with-pcre=internal
make
make install
## libxml2
LIBXML2_SOURCE=libxml2-$(LIBXML2_VERSION).tar.gz
LIBXML2=$(CACHE_DIR)/lib/libxml2.a
$(LIBXML2_SOURCE):
curl -LO ftp://xmlsoft.org/libxml2/$(LIBXML2_SOURCE)
$(LIBXML2): $(LIBXML2_SOURCE)
tar xf $<
cd libxml2*
$(CONFIGURE) \
--without-history \
--without-python
make
make install
## licroco
LIBCROCO_SOURCE=libcroco-$(LIBCROCO_VERSION).tar.xz
LIBCROCO_MINOR_VERSION=$(basename $(LIBCROCO_VERSION))
LIBCROCO=$(CACHE_DIR)/lib/libcroco-$(LIBCROCO_MINOR_VERSION).a
$(LIBCROCO_SOURCE):
curl -OL http://ftp.gnome.org/pub/GNOME/sources/libcroco/$(LIBCROCO_MINOR_VERSION)/$(LIBCROCO_SOURCE)
$(LIBCROCO): $(LIBCROCO_SOURCE) $(LIBXML2) $(GLIB)
tar xf $<
cd libcroco*
$(CONFIGURE) \
--disable-gtk-doc \
--disable-gtk-doc-html
make
make install
## libjpg
LIBJPEG_SOURCE=jpegsrc.v$(LIBJPEG_VERSION).tar.gz
LIBJPEG=$(CACHE_DIR)/lib/libjpeg.a
$(LIBJPEG_SOURCE):
curl -LO http://ijg.org/files/$(LIBJPEG_SOURCE)
$(LIBJPEG): $(LIBJPEG_SOURCE)
tar xf $<
cd jpeg*
$(CONFIGURE)
make
make install
## libpng
LIBPNG_SOURCE=libpng-$(LIBPNG_VERSION).tar.xz
LIBPNG=$(CACHE_DIR)/lib/libpng.a
$(LIBPNG_SOURCE):
curl -LO http://prdownloads.sourceforge.net/libpng/$(LIBPNG_SOURCE)
$(LIBPNG): $(LIBPNG_SOURCE)
tar xf $<
cd libpng*
$(CONFIGURE)
make
make install
# libbz2
BZIP2_SOURCE=bzip2-$(BZIP2_VERSION).tar.gz
LIBBZ2=$(CACHE_DIR)/lib/libbz2.a
$(BZIP2_SOURCE):
curl -LO http://prdownloads.sourceforge.net/bzip2/bzip2-$(BZIP2_VERSION).tar.gz
$(LIBBZ2): $(BZIP2_SOURCE)
tar xf $<
cd bzip2-*
make libbz2.a
make install PREFIX=$(CACHE_DIR)
# libtiff
LIBTIFF_SOURCE=tiff-$(LIBTIFF_VERSION).tar.gz
LIBTIFF=$(CACHE_DIR)/lib/libtiff.a
$(LIBTIFF_SOURCE):
curl -LO http://download.osgeo.org/libtiff/$(LIBTIFF_SOURCE)
$(LIBTIFF): $(LIBTIFF_SOURCE)
tar xf $<
cd tiff-*
$(CONFIGURE) \
--disable-jpeg \
--disable-old-jpeg \
--disable-lzma \
--disable-jpeg12 \
--without-x
make
make install
## libopenjp2
OPENJP2_SOURCE=openjp2-$(OPENJP2_VERSION).tar.gz
$(OPENJP2_SOURCE):
curl -L https://github.com/uclouvain/openjpeg/archive/v$(OPENJP2_VERSION).tar.gz -o $(OPENJP2_SOURCE)
LIBOPENJP2=$(CACHE_DIR)/lib/libopenjp2.a
$(LIBOPENJP2): $(OPENJP2_SOURCE) $(LIBPNG) $(LIBTIFF)
tar xf $<
cd openjpeg-*
mkdir -p build
cd build
$(PKG_CONFIG) $(CMAKE) .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$(CACHE_DIR) \
-DBUILD_SHARED_LIBS:bool=off \
-DBUILD_CODEC:bool=off
make
make install
## pixman
PIXMAN_SOURCE=pixman-$(PIXMAN_VERSION).tar.gz
LIBPIXMAN=$(CACHE_DIR)/lib/libpixman-1.a
$(PIXMAN_SOURCE):
curl -LO https://www.cairographics.org/releases/$(PIXMAN_SOURCE)
$(LIBPIXMAN): $(PIXMAN_SOURCE) $(LIBPNG)
tar xf $<
cd pixman*
$(CONFIGURE) \
--disable-gtk
make
make install
## freetype and harfbuzz co-depend on each other, so freetype needs to be
## built without harfbuzz first, then harfbuzz with freetype, then freetype again
## see http://www.linuxfromscratch.org/blfs/view/svn/general/harfbuzz.html
FREETYPE_SOURCE=freetype-$(FREETYPE_VERSION).tar.gz
LIBFREETYPE=$(CACHE_DIR)/lib/libfreetype.a
HARFBUZZ_SOURCE=harfbuzz-$(HARFBUZZ_VERSION).tar.bz2
LIBHARFBUZZ=$(CACHE_DIR)/lib/libharfbuzz.a
$(FREETYPE_SOURCE):
curl -LO https://download.savannah.gnu.org/releases/freetype/$(FREETYPE_SOURCE)
$(HARFBUZZ_SOURCE):
curl -LO https://www.freedesktop.org/software/harfbuzz/release/$(HARFBUZZ_SOURCE)
FT_WITHOUT_HB_DIR=$(PROJECT_ROOT)build/freetype-$(FREETYPE_VERSION)-without-harfbuzz
FT_WITHOUT_HB=$(FT_WITHOUT_HB_DIR)/objs/.libs/libfreetype.a
$(FT_WITHOUT_HB): $(FREETYPE_SOURCE)
tar xf $< -C /tmp
rm -rf $(FT_WITHOUT_HB_DIR)
mv /tmp/freetype-$(FREETYPE_VERSION) $(FT_WITHOUT_HB_DIR)
cd $(FT_WITHOUT_HB_DIR)
$(CONFIGURE) --without-harfbuzz
make
make install
$(LIBHARFBUZZ): $(HARFBUZZ_SOURCE) $(FT_WITHOUT_HB)
tar xf $<
cd harfbuzz-$(HARFBUZZ_VERSION)
$(CONFIGURE) \
--with-freetype
make
make install
$(LIBFREETYPE): $(FREETYPE_SOURCE) $(GLIB) $(LIBPNG) $(LIBBZ2) $(LIBHARFBUZZ)
tar xf $<
cd freetype-$(FREETYPE_VERSION)
$(CONFIGURE) \
--with-harfbuzz \
--with-png \
--with-bzip2
make distclean clean
make
make install
## fontconfig
FONTCONFIG_SOURCE=fontconfig-$(FONTCONFIG_VERSION).tar.bz2
LIBFONTCONFIG=$(CACHE_DIR)/lib/libfontconfig.a
$(FONTCONFIG_SOURCE):
curl -LO https://www.freedesktop.org/software/fontconfig/release/$(FONTCONFIG_SOURCE)
fontconfig $(LIBFONTCONFIG): $(FONTCONFIG_SOURCE) $(LIBXML2) $(LIBFREETYPE) $(LIBUUID)
tar xf $<
cd fontconfig-$(FONTCONFIG_VERSION)
$(CONFIGURE) --enable-libxml2
make
make install
## cairo
CAIRO_SOURCE=cairo-$(CAIRO_VERSION).tar.xz
LIBCAIRO:=$(CACHE_DIR)/lib/libcairo.a
$(CAIRO_SOURCE):
curl -OL https://www.cairographics.org/releases/$(CAIRO_SOURCE)
cairo $(LIBCAIRO): $(CAIRO_SOURCE) $(LIBPNG) $(LIBXML2) $(LIBFONTCONFIG) $(LIBPIXMAN)
tar xf $<
cd cairo*
$(CONFIGURE) \
--disable-gtk-doc \
--disable-gtk-doc-html \
--disable-valgrind \
--disable-xlib \
--disable-xlib-xrender \
--disable-xcb \
--disable-xlib-xcb \
--disable-xcb-shm \
--disable-qt \
--disable-quartz \
--disable-quartz-font \
--disable-quartz-image \
--enable-png \
--enable-pdf \
--enable-svg \
--disable-test-surfaces \
--disable-gobject \
--without-x \
--disable-interpreter \
--disable-full-testing \
--disable-gl \
--disable-glx \
--disable-egl \
--disable-wgl \
--disable-test-suite \
--enable-xml \
--disable-trace
make
make install
## pango
PANGO_SOURCE=pango-$(PANGO_VERSION).tar.bz2
PANGO_MINOR_VERSION=$(basename $(PANGO_VERSION))
PANGO_MAJOR_VERSION=$(basename $(PANGO_MINOR_VERSION))
LIBPANGO:=$(CACHE_DIR)/lib/libpango-$(PANGO_MAJOR_VERSION).0.a
$(PANGO_SOURCE):
curl -OL http://ftp.gnome.org/pub/GNOME/sources/pango/$(PANGO_MINOR_VERSION)/$(PANGO_SOURCE)
$(LIBPANGO): $(PANGO_SOURCE) $(LIBCROCO) $(LIBCAIRO)
tar xf $<
cd pango*
$(CONFIGURE) \
--with-included-modules \
--disable-introspection \
--disable-gtk-doc \
--disable-gtk-doc-html \
--disable-doc-cross-references \
--without-x
make
make install
### GDK_PIXBUF
GDK_PIXBUF_SOURCE=gdk-pixbuf-$(GDK_PIXBUF_VERSION).tar.xz
GDK_PIXBUF_MINOR_VERSION=$(basename $(GDK_PIXBUF_VERSION))
GDK_PIXBUF_MAJOR_VERSION=$(basename $(GDK_PIXBUF_MINOR_VERSION))
LIBGDK_PIXBUF=$(CACHE_DIR)/lib/libgdk_pixbuf-$(GDK_PIXBUF_MAJOR_VERSION).0.a
$(GDK_PIXBUF_SOURCE):
curl -OL http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/$(GDK_PIXBUF_MINOR_VERSION)/$(GDK_PIXBUF_SOURCE)
$(LIBGDK_PIXBUF): $(GDK_PIXBUF_SOURCE) $(LIBPNG) $(LIBOPENJP2) $(LIBJPEG) $(LIBTIFF) $(GLIB)
tar xf $<
cd gdk-pixbuf*
$(CONFIGURE) \
--without-gdiplus \
--disable-modules \
--disable-glibtest \
--disable-introspection \
--disable-gtk-doc-html \
--with-included-loaders=yes \
--disable-gio-sniffing \
--disable-rpath \
--disable-gtk-doc \
--without-x11
make
make install
## RSVG
LIBS:=$(LIBCROCO) $(LIBPANGO) $(LIBCAIRO) $(LIBGDK_PIXBUF)
LIBRSVG_SOURCE=librsvg-$(LIBRSVG_VERSION).tar.gz
LIBRSVG_MINOR_VERSION=$(basename $(LIBRSVG_VERSION))
LIBRSVG_MAJOR_VERSION=$(basename $(LIBRSVG_MINOR_VERSION))
$(LIBRSVG_SOURCE):
curl -OL http://ftp.gnome.org/pub/GNOME/sources/librsvg/$(LIBRSVG_MINOR_VERSION)/$(LIBRSVG_SOURCE)
$(CACHE_DIR)/bin/rsvg-convert: $(LIBRSVG_SOURCE) $(LIBS)
tar xf $<
cd librsvg-*
make clean distclean
$(CONFIGURE) \
--disable-pixbuf-loader \
--disable-gtk-theme \
--without-x \
--disable-gtk-doc
make all
make install
$(TARGET_DIR)bin/rsvg-convert: $(CACHE_DIR)/bin/rsvg-convert
mkdir -p $(TARGET_DIR)bin
cp $< $@
strip -s $@
libs: $(LIBS)
all: $(TARGET_DIR)bin/rsvg-convert