view graphics/cairo/cairo.sh @ 549:bad483aace64

vanilla: use prefix= instead
author David Demelier <markand@malikania.fr>
date Sun, 23 Jun 2019 15:13:10 +0200
parents b1690d766bdb
children 25cecc6dca48
line wrap: on
line source

#!/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="graphics/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:=clang}
: ${CFLAGS:=-O2}
: ${LDFLAGS:=}
: ${LIBS:=}
: ${DRM:=no}
: ${EGL:=no}
: ${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="fonts/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="graphics/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= \
		--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/lib/cairo/libcairo-trace.la
	rm -f $DESTDIR/lib/libcairo-script-interpreter.la
	rm -f $DESTDIR/lib/libcairo{,-gobject}.la

	popd
	rm -rf $PKGNAME-$PKGVERSION
}