changeset 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 c6a33cbb38f0
children 59ff99d85c97
files graphics/cairo/cairo.sh
diffstat 1 files changed, 169 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/cairo/cairo.sh	Fri Mar 22 20:09:00 2019 +0100
@@ -0,0 +1,169 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+PKGNAME=cairo
+PKGVERSION=1.16.0
+PKGREVISION=1
+PKGLICENSE="LGPLv21 MPLv11"
+PKGSUMMARY="vector graphics library"
+PKGDOWNLOAD="https://cairographics.org/releases/$PKGNAME-$PKGVERSION.tar.xz"
+PKGDEPENDS="x11/pixman"
+PKGOPTIONS="DRM EGL FONTCONFIG FREETYPE GALLIUM GLES2 GLES3 GLIB PDF PNG SVG X"
+
+: ${CHOST:=$(uname -m)-linux-musl}
+: ${CBUILD:=$(uname -m)-linux-musl}
+: ${CC:=gcc}
+: ${CFLAGS:=-O2}
+: ${LDFLAGS:=}
+: ${LIBS:=}
+: ${DRM:=no}
+: ${EGL:=yes}
+: ${FONTCONFIG:=yes}
+: ${FREETYPE:=yes}
+: ${GALLIUM:=no}
+: ${GLES2:=no}
+: ${GLES3:=no}
+: ${GLIB:=yes}
+: ${PDF:=yes}
+: ${PNG:=yes}
+: ${SVG:=yes}
+: ${X:=yes}
+
+if [ "$DRM" = "yes" ]; then
+	PKGDEPENDS="core/eudev $PKGDEPENDS"
+	with_drm="--enable-drm"
+else
+	with_drm="--disable-drm"
+fi
+
+if [ "$FONTCONFIG" = "yes" ]; then
+	PKGDEPENDS="fonts/fontconfig $PKGDEPENDS"
+	with_fontconfig="--enable-fc"
+else
+	with_fontconfig="--disable-fc"
+fi
+
+if [ "$FREETYPE" = "yes" ]; then
+	PKGDEPENDS="lib/freetype $PKGDEPENDS"
+	with_freetype="--enable-ft"
+else
+	with_freetype="--disable-ft"
+fi
+
+# All these options require mesa.
+if [ "$EGL" = "yes" ] || [ "$GALLIUM" = "yes" ] || [ "$GLES2" = "yes" ] || [ "$GLES3" = "yes" ]; then
+	PKGDEPENDS="graphics/mesa $PKGDEPENDS"
+
+	if [ "$EGL" = "yes" ]; then
+		with_egl="--enable-egl"
+	else
+		with_egl="--disable-egl"
+	fi
+
+	if [ "$GLES2" = "yes" ]; then
+		with_gles2="--enable-gles2"
+	else
+		with_gles2="--disable-gles2"
+	fi
+
+	if [ "$GLES3" = "yes" ]; then
+		with_gles3="--enable-gles3"
+	else
+		with_gles3="--disable-gles3"
+	fi
+fi
+
+if [ "$GLIB" = "yes" ]; then
+	PKGDEPENDS="lib/glib $PKGDEPENDS"
+	with_glib="--enable-gobject"
+else
+	with_glib="--disable-gobject"
+fi
+
+if [ "$PDF" = "yes" ]; then
+	PKGDEPENDS="graphics/poppler $PKGDEPENDS"
+	with_pdf="--enable-pdf"
+else
+	with_pdf="--disable-pdf"
+fi
+
+if [ "$PNG" = "yes" ]; then
+	PKGDEPENDS="lib/libpng $PKGDEPENDS"
+	with_png="--enable-png"
+else
+	with_png="--disable-png"
+fi
+
+if [ "$SVG" = "yes" ]; then
+	PKGDEPENDS="graphics/librsvg $PKGDEPENDS"
+	with_svg="--enable-svg"
+else
+	with_svg="--disable-svg"
+fi
+
+if [ "$X" = "yes" ]; then
+	PKGDEPENDS="x11/libxrender x11/libxext x11/libx11 x11/libxcb"
+	with_x="--enable-xlib $with_x"
+	with_x="--enable-xlib-xrender $with_x"
+	with_x="--enable-xcb=yes $with_x"
+	with_x="--enable-xlib-xcb $with_x"
+	with_x="--with-x $with_x"
+else
+	with_x="--enable-xlib $with_x"
+	with_x="--enable-xlib-xrender $with_x"
+	with_x="--enable-xcb $with_x"
+	with_x="--enable-xlib-xcb $with_x"
+	with_x="--with-x $with_x"
+fi
+
+build()
+{
+	rm -rf $PKGNAME-$PKGVERSION
+	tar xvaf $PKGNAME-$PKGVERSION.tar.xz
+	pushd $PKGNAME-$PKGVERSION
+
+	CC="$CC" \
+	CFLAGS="$CFLAGS" \
+	LDFLAGS="$LDFLAGS" \
+	LIBS="$LIBS" \
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr \
+		--disable-static \
+		--disable-valgrind \
+		--enable-shared \
+		$with_drm \
+		$with_fontconfig \
+		$with_freetype \
+		$with_egl \
+		$with_gles2 \
+		$with_gles3 \
+		$with_glib \
+		$with_pdf \
+		$with_png \
+		$with_svg \
+		$with_x
+	make
+	make install DESTDIR=$DESTDIR
+	rm -f $DESTDIR/usr/lib/cairo/libcairo-trace.la
+	rm -f $DESTDIR/usr/lib/libcairo-script-interpreter.la
+	rm -f $DESTDIR/usr/lib/libcairo.la
+
+	popd
+	rm -rf $PKGNAME-$PKGVERSION
+}