#!/bin/sh # Slackware build script for graphviz # Copyright 2007 Robby Workman # Copyright 2011 Heinz Wiesinger # Copyright 2013-2015 Audrius Kažukauskas # 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=5.0.1 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!) 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 ## The primary purpose of this build is for 'dot' for kscope, tdeedu, ... ## To include the pdf and html documentation, build with 'GVZ_DOCS=y ./BUILD-TDE.sh' [[ ${GVZ_DOCS:-} != [yY1] ]] && { patch -p0 << EOF --- Makefile.in +++ Makefile.in @@ -614 +614 @@ -SUBDIRS = \$(subdirs) lib plugin cmd tclpkg doc contrib share graphs tests +SUBDIRS = \$(subdirs) lib plugin cmd tclpkg contrib share graphs tests EOF sed -i '/tcldot.html/d' tclpkg/tcldot/Makefile.in } ## relevant if including docs, but not installed otherwise sed -i 's|../doc/||;28,54s|../pdf/|../../../man/man1/|;58,71s|../pdf/|../../../man/man3/|;28,71s|\.pdf|\.gz|' doc/index.html sed -i '56,62d;s|pages (PDF)|pages|' doc/index.html sed -i '/dotty/d;/lefty/d;/circo/d;/fdp/d;/gv2gxl/d;/neato\.1/d;/twopi/d;/\/graph/d' doc/index.html sed -i 's|libguide.*$|&\n
  • cgraph tutorial|' doc/index.html listdocs_fn chown_fn cd_builddir_fn CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ CC=$COMPILER \ CXX=$COMPILER_CXX \ ../configure \ --prefix=/usr \ --libdir=/usr/lib$LIBDIRSUFFIX \ --mandir=/usr/man \ --enable-man-pdfs=no \ --enable-ocaml=no 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: ; EOF # Remove empty directories of language bindings that are absent. find $PKG/usr/lib$LIBDIRSUFFIX/graphviz -depth -type d -empty -exec rmdir {} \; # Configure plugins # (writes $PKG/usr/lib$LIBDIRSUFFIX/graphviz/config6 with available plugin information) LD_LIBRARY_PATH=$PKG/usr/lib$LIBDIRSUFFIX $PKG/usr/bin/dot -c installdocs_fn INSTALL_TDE=/usr 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: Homepage: graphviz.org $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: " > $PKG/install/slack-desc makepkg_fn