view graphics/graphviz/graphviz.sh @ 505:7828241c9634

graphics: convert packages to clang
author David Demelier <markand@malikania.fr>
date Tue, 09 Apr 2019 20:05:00 +0200
parents ea6c40075e00
children b1690d766bdb
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=graphviz
PKGVERSION=2.40.1
PKGREVISION=1
PKGLICENSE="CUSTOM"
PKGSUMMARY="graph drawing programs"
PKGDOWNLOAD="http://files.malikania.fr/distfiles/$PKGNAME-$PKGVERSION.tar.gz"
PKGDEPENDS="dev/libtool"
PKGOPTIONS="FONTCONFIG FREETYPE GD GTK PANGO WEBP X XML"

: ${CHOST:=$(uname -m)-linux-musl}
: ${CBUILD:=$(uname -m)-linux-musl}
: ${CC:=clang}
: ${CFLAGS:=-O2}
: ${CXX:=clang++}
: ${CXXFLAGS:=-O2}
: ${LDFLAGS:=}
: ${LIBS:=}
: ${FONTCONFIG:=yes}
: ${FREETYPE:=yes}
: ${GD:=yes}
: ${GTK:=yes}
: ${PANGO:=yes}
: ${WEBP:=no}
: ${X:=yes}
: ${XML:=yes}

if [ "$FONTCONFIG" = "yes" ]; then
	PKGDEPENDS="fonts/fontconfig $PKGDEPENDS"
	with_fontconfig="--with-fontconfig"
else
	with_fontconfig="--without-fontconfig"
fi

if [ "$FREETYPE" = "yes" ]; then
	PKGDEPENDS="fonts/freetype $PKGDEPENDS"
	with_freetype="--with-freetype2"
else
	with_freetype="--without-freetype2"
fi

if [ "$GD" = "yes" ]; then
	PKGDEPENDS="graphics/libgd $PKGDEPENDS"
	with_gd="--with-libgd"
else
	with_gd="--without-libgd"
fi

if [ "$GTK" = "yes" ]; then
	PKGDEPENDS="graphics/gtk $PKGDEPENDS"
	with_gtk="--with-gdk --with-gtk --with-gdk-pixbuf"
else
	with_gtk="--without-gdk --without-gtk --without-gdk-pixbuf"
fi

if [ "$PANGO" = "yes" ]; then
	PKGDEPENDS="fonts/pango $PKGDEPENDS"
	with_pango="--with-pangocairo"
else
	with_pango="--without-pangocairo"
fi

if [ "$WEBP" = "yes" ]; then
	PKGDEPENDS="graphics/webp $PKGDEPENDS"
	with_webp="--with-webp"
else
	with_webp="--without-webp"
fi

if [ "$X" = "yes" ]; then
	PKGDEPENDS="x11/libx11 $PKGDEPENDS"
	PKGDEPENDS="x11/libxaw $PKGDEPENDS"
	PKGDEPENDS="x11/libxmu $PKGDEPENDS"
	PKGDEPENDS="x11/libxpm $PKGDEPENDS"
	PKGDEPENDS="x11/libxt $PKGDEPENDS"
	with_x="--with-x"
else
	with_x="--without-x"
fi

if [ "$XML" = "yes" ]; then
	PKGDEPENDS="lib/expat $PKGDEPENDS"
	with_expat="--with-expat"
else
	with_expat="--without-expat"
fi

build()
{
	rm -rf $PKGNAME-$PKGVERSION
	tar xvaf $PKGNAME-$PKGVERSION.tar.gz
	pushd $PKGNAME-$PKGVERSION

	# TODO: enable features as they become available.
	CC="$CC" \
	CFLAGS="$CFLAGS" \
	CXX="$CXX" \
	CXXFLAGS="$CXXFLAGS" \
	LDFLAGS="$LDFLAGS" \
	LIBS="$LIBS" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-ltdl-install \
		--without-included-ltdl \
		--without-qt \
		--without-devil \
		--without-poppler \
		--without-rsvg \
		--without-ghostscript \
		--without-visio \
		--without-lasi \
		--without-glitz \
		--without-gtkgl \
		--without-gtkglext \
		--without-gts \
		--without-ann \
		--without-glade \
		--without-ming \
		--without-qt\
		--without-quartz \
		--without-gdiplus \
		--without-glut \
		--without-smyrna \
		--without-ortho \
		--without-digcola \
		--without-ipsepcola \
		--with-sfdp \
		$with_fontconfig \
		$with_freetype \
		$with_gd \
		$with_gtk \
		$with_pango \
		$with_webp \
		$with_x \
		$with_xml
	make
	make install DESTDIR=$DESTDIR
	rm -f $DESTDIR/usr/lib/graphviz/*.la
	rm -f $DESTDIR/usr/lib/graphviz/perl/*.la
	rm -f $DESTDIR/usr/lib/libcdt.la
	rm -f $DESTDIR/usr/lib/libcgraph.la
	rm -f $DESTDIR/usr/lib/libgvc.la
	rm -f $DESTDIR/usr/lib/libgvpr.la
	rm -f $DESTDIR/usr/lib/liblab_gamut.la
	rm -f $DESTDIR/usr/lib/libpathplan.la
	rm -f $DESTDIR/usr/lib/libxdot.la

	popd
	rm -rf $PKGNAME-$PKGVERSION
}