You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
6.0 KiB

#!/bin/sh
# Slackware build script for graphviz
# Copyright 2007 Robby Workman <rworkman@slackbuilds.org>
# Copyright 2011 Heinz Wiesinger <pprkut@slackbuilds.org>
# Copyright 2013-2015 Audrius Kažukauskas <audrius@neutrino.lt>
# Copyright 2016-2017 tde-slackbuilds - modified for inclusion in build method
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=graphviz
VERSION=8.1.0
BUILD=${BUILD:-1}
TAG=${TAG:-}
ARCHIVE_TYPE="tar.xz"
SRCURL="https://gitlab.com/api/v4/projects/4207231/packages/generic/$PRGNAM-releases/$VERSION/$PRGNAM-$VERSION.$ARCHIVE_TYPE"
source ../../get-source.sh
getsource_fn
untar_fn
# ghostscript918.patch from Arch (thanks!)
echo -e "\033[39;1m"
patch -p0 << EOF
--- plugin/gs/gvloadimage_gs.c
+++ plugin/gs/gvloadimage_gs.c
@@ -77,11 +77,11 @@
assert (err < 0);
- if (err >= e_VMerror)
+ if (err >= gs_error_VMerror)
errsrc = "PostScript Level 1";
- else if (err >= e_unregistered)
+ else if (err >= gs_error_unregistered)
errsrc = "PostScript Level 2";
- else if (err >= e_invalidid)
+ else if (err >= gs_error_invalidid)
errsrc = "DPS error";
else
errsrc = "Ghostscript internal error";
EOF
# Fix for php-5.4
patch -p0 << EOF
--- tclpkg/gv/gv_php_init.c
+++ tclpkg/gv/gv_php_init.c
@@ -27,2 +27,3 @@
+ TSRMLS_FETCH();
return PHPWRITE(s, len);
}
@@ -33,2 +34,3 @@
+ TSRMLS_FETCH();
return PHPWRITE(s, len);
}
EOF
## .. output man pages to pdf, sans-serif [helvetica] font, 10pt, indentation, page size, paper size
## with at least one line before a section heading
## User set paper size or as per locale - see groff_font for valid sizes
[[ ! ${PS:-} ]] && {
[[ $(locale LC_PAPER) == 297* ]] && PS=a4 || PS=letter
}
#
echo 'patching for man page pdfs'
find . -name "Makefile.*" | while read file
do
sed -i '/(PS2PDF)/d' $file
sed -i 's|psfile=$${pdffile%pdf}ps; ||' $file
sed -i 's|$(GROFF) -Tps.*$|sed "s^.PP^^;s^\.SH^\\n\&^" $< \| $(GROFF) -man -Tpdf -fH -rS10 -rIN=4n -dpaper='"$PS"' -P-p'"$PS"' > $$pdffile|' $file
done
echo -e "\033[0m"
## the pdfs are installed in the same directory as index.html
sed -i 's|../doc/||;s|../pdf/||' doc/index.html
## add the cgraph tutorial
sed -i 's|libguide.*$|&\n <li><a href="Agraph.pdf">cgraph tutorial</a>|' doc/index.html
## these don't exist
sed -i '/dotty/d;/lefty/d;/circo/d;/fdp/d;/gv2gxl/d;/neato\.1/d;/twopi/d;/>graph/d;/tkspline/d' doc/index.html
listdocs_fn
chown_fn
cd_builddir_fn
PRFX=/usr/local
## build machine id is based on config.sub which doesn't work for a 32bit os/64bit kernel combination
[[ $(getconf LONG_BIT) == 32 && $(uname -m) == *64 ]] && BLD=--build=i586-pc-linux-gnu
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
CC=$COMPILER \
CXX=$COMPILER_CXX \
../configure \
--prefix=$PRFX \
--libdir=$PRFX/lib$LIBDIRSUFFIX \
--mandir=$PRFX/man \
--enable-ocaml=no ${BLD:-}
make_fn
# Install config file for PHP.
mkdir -p $PKG/etc/php.d
cat << EOF > $PKG/etc/php.d/graphviz.ini.new
; Enable graphviz extension module
; extension=gv.so
; Graphviz' own documentation mentions a "gv.php" file that should
; be included. This file is however not necessary, it is just a
; wrapper class around functions that are already available after
; loading the extension, just leave out the "gv::" prefix.
; In case you still prefer to use the wrapper class you have to
; include it using its absolute path:
; <?php
; include ('$PRFX/lib$LIBDIRSUFFIX/graphviz/php/gv.php');
; ?>
EOF
# Remove empty directories of language bindings that are absent.
find $PKG$PRFX/lib$LIBDIRSUFFIX/graphviz -depth -type d -empty -exec rmdir {} \;
# Configure plugins
# (writes $PKG$PRFX/lib$LIBDIRSUFFIX/graphviz/config6 with available plugin information)
LD_LIBRARY_PATH=$PKG$PRFX/lib$LIBDIRSUFFIX $PKG$PRFX/bin/dot -c
installdocs_fn
INSTALL_TDE=$PRFX
mangzip_fn
strip_fn
mkdir_install_fn
cat << EOF > $PKG/install/doinst.sh
config() {
NEW="\$1"
OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r \$OLD ]; then
mv \$NEW \$OLD
elif [ "\$(cat \$OLD|md5sum)" = "\$(cat \$NEW|md5sum)" ]; then
# toss the redundant copy
rm \$NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
config etc/php.d/graphviz.ini.new
EOF
echo "
# HOW TO EDIT THIS FILE:
# The 'handy ruler' below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: graphviz (Graph Visualization)
$PRGNAM:
$PRGNAM: Graphviz is open source graph visualization software.
$PRGNAM: It has several main graph layout programs. It also has
$PRGNAM: web and interactive graphical interfaces, and auxiliary
$PRGNAM: tools, libraries, and language bindings.
$PRGNAM:
$PRGNAM: Documentation: $PRFX/share/doc/graphviz/index.html
$PRGNAM:
$PRGNAM: Homepage: graphviz.org
$PRGNAM:
" > $PKG/install/slack-desc
makepkg_fn