comparison graphics/cairo/cairo.sh @ 273:4f9b6a3484c2

graphics/cairo: initial import, closes #14:17
author David Demelier <markand@malikania.fr>
date Fri, 22 Mar 2019 20:09:00 +0100
parents
children 18a3a8db4361
comparison
equal deleted inserted replaced
272:c6a33cbb38f0 273:4f9b6a3484c2
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #
17
18 PKGNAME=cairo
19 PKGVERSION=1.16.0
20 PKGREVISION=1
21 PKGLICENSE="LGPLv21 MPLv11"
22 PKGSUMMARY="vector graphics library"
23 PKGDOWNLOAD="https://cairographics.org/releases/$PKGNAME-$PKGVERSION.tar.xz"
24 PKGDEPENDS="x11/pixman"
25 PKGOPTIONS="DRM EGL FONTCONFIG FREETYPE GALLIUM GLES2 GLES3 GLIB PDF PNG SVG X"
26
27 : ${CHOST:=$(uname -m)-linux-musl}
28 : ${CBUILD:=$(uname -m)-linux-musl}
29 : ${CC:=gcc}
30 : ${CFLAGS:=-O2}
31 : ${LDFLAGS:=}
32 : ${LIBS:=}
33 : ${DRM:=no}
34 : ${EGL:=yes}
35 : ${FONTCONFIG:=yes}
36 : ${FREETYPE:=yes}
37 : ${GALLIUM:=no}
38 : ${GLES2:=no}
39 : ${GLES3:=no}
40 : ${GLIB:=yes}
41 : ${PDF:=yes}
42 : ${PNG:=yes}
43 : ${SVG:=yes}
44 : ${X:=yes}
45
46 if [ "$DRM" = "yes" ]; then
47 PKGDEPENDS="core/eudev $PKGDEPENDS"
48 with_drm="--enable-drm"
49 else
50 with_drm="--disable-drm"
51 fi
52
53 if [ "$FONTCONFIG" = "yes" ]; then
54 PKGDEPENDS="fonts/fontconfig $PKGDEPENDS"
55 with_fontconfig="--enable-fc"
56 else
57 with_fontconfig="--disable-fc"
58 fi
59
60 if [ "$FREETYPE" = "yes" ]; then
61 PKGDEPENDS="lib/freetype $PKGDEPENDS"
62 with_freetype="--enable-ft"
63 else
64 with_freetype="--disable-ft"
65 fi
66
67 # All these options require mesa.
68 if [ "$EGL" = "yes" ] || [ "$GALLIUM" = "yes" ] || [ "$GLES2" = "yes" ] || [ "$GLES3" = "yes" ]; then
69 PKGDEPENDS="graphics/mesa $PKGDEPENDS"
70
71 if [ "$EGL" = "yes" ]; then
72 with_egl="--enable-egl"
73 else
74 with_egl="--disable-egl"
75 fi
76
77 if [ "$GLES2" = "yes" ]; then
78 with_gles2="--enable-gles2"
79 else
80 with_gles2="--disable-gles2"
81 fi
82
83 if [ "$GLES3" = "yes" ]; then
84 with_gles3="--enable-gles3"
85 else
86 with_gles3="--disable-gles3"
87 fi
88 fi
89
90 if [ "$GLIB" = "yes" ]; then
91 PKGDEPENDS="lib/glib $PKGDEPENDS"
92 with_glib="--enable-gobject"
93 else
94 with_glib="--disable-gobject"
95 fi
96
97 if [ "$PDF" = "yes" ]; then
98 PKGDEPENDS="graphics/poppler $PKGDEPENDS"
99 with_pdf="--enable-pdf"
100 else
101 with_pdf="--disable-pdf"
102 fi
103
104 if [ "$PNG" = "yes" ]; then
105 PKGDEPENDS="lib/libpng $PKGDEPENDS"
106 with_png="--enable-png"
107 else
108 with_png="--disable-png"
109 fi
110
111 if [ "$SVG" = "yes" ]; then
112 PKGDEPENDS="graphics/librsvg $PKGDEPENDS"
113 with_svg="--enable-svg"
114 else
115 with_svg="--disable-svg"
116 fi
117
118 if [ "$X" = "yes" ]; then
119 PKGDEPENDS="x11/libxrender x11/libxext x11/libx11 x11/libxcb"
120 with_x="--enable-xlib $with_x"
121 with_x="--enable-xlib-xrender $with_x"
122 with_x="--enable-xcb=yes $with_x"
123 with_x="--enable-xlib-xcb $with_x"
124 with_x="--with-x $with_x"
125 else
126 with_x="--enable-xlib $with_x"
127 with_x="--enable-xlib-xrender $with_x"
128 with_x="--enable-xcb $with_x"
129 with_x="--enable-xlib-xcb $with_x"
130 with_x="--with-x $with_x"
131 fi
132
133 build()
134 {
135 rm -rf $PKGNAME-$PKGVERSION
136 tar xvaf $PKGNAME-$PKGVERSION.tar.xz
137 pushd $PKGNAME-$PKGVERSION
138
139 CC="$CC" \
140 CFLAGS="$CFLAGS" \
141 LDFLAGS="$LDFLAGS" \
142 LIBS="$LIBS" \
143 ./configure \
144 --build=$CBUILD \
145 --host=$CHOST \
146 --prefix=/usr \
147 --disable-static \
148 --disable-valgrind \
149 --enable-shared \
150 $with_drm \
151 $with_fontconfig \
152 $with_freetype \
153 $with_egl \
154 $with_gles2 \
155 $with_gles3 \
156 $with_glib \
157 $with_pdf \
158 $with_png \
159 $with_svg \
160 $with_x
161 make
162 make install DESTDIR=$DESTDIR
163 rm -f $DESTDIR/usr/lib/cairo/libcairo-trace.la
164 rm -f $DESTDIR/usr/lib/libcairo-script-interpreter.la
165 rm -f $DESTDIR/usr/lib/libcairo.la
166
167 popd
168 rm -rf $PKGNAME-$PKGVERSION
169 }