%bcond_with php
%if "%{php_version}" < "5.6"
%global ini_name %{name}.ini
%else
%global ini_name 40-%{name}.ini
%endif
%global pluginsver 8
%global php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
Name: graphviz
Version: 15.1.1
Release: 1
Summary: Graph Visualization Tools
License: EPL-1.0
URL: https://www.graphviz.org/
Source0: https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/%{version}/%{name}-%{version}.tar.xz
Patch0: add-loongarch64-support-graphviz.patch
Patch1: graphviz-12.0.0-gvpack-neato-static.patch
BuildRequires: gcc-g++ make
BuildRequires: autoconf automake libtool libtool-devel
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(gdk-3.0)
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
BuildRequires: pkgconfig(gdlib) >= 2.0.33
BuildRequires: pkgconfig(gtk+-2.0) >= 2.7.0
BuildRequires: guile-devel
BuildRequires: pkgconfig(libglade-2.0)
BuildRequires: pkgconfig(librsvg-2.0)
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(pangocairo) >= 1.22.0
BuildRequires: pkgconfig(poppler-glib)
BuildRequires: pkgconfig(xrender)
BuildRequires: freeglut-devel
BuildRequires: ghostscript-devel
BuildRequires: urw-base35-fonts
BuildRequires: java-devel rpm_macro(java_home)
BuildRequires: lua-devel
BuildRequires: perl-devel perl-generators
BuildRequires: python3-devel
BuildRequires: ruby-devel
BuildRequires: tcl-devel
BuildRequires: swig >= 1.3.0
BuildRequires: /usr/bin/ps2pdf
%if %{with php}
BuildRequires: php-devel
%endif
Requires: urw-base35-fonts xorg-x11-fonts-ISO8859-1-100dpi
%description
Graphviz is open source graph visualization software. Graph visualization is a way of representing structural
information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics,
software engineering, database and web design, machine learning, and in visual interfaces for other technical domains.
%package devel
Summary: Development headers and libraries for interfacing to the graphviz
Requires: %{name} = %{version}-%{release}
%description devel
Header files for using the graphviz libraries. The
libdhcpctl and libomapi static libraries are also included in this package.
%package docs
Buildarch: noarch
Summary: Documentation files for graphviz
%description docs
The docs package contains documentation files.
%package gd
Summary: Graphviz plugin for renderers based on gd
Requires: %{name} = %{version}-%{release}
Requires(post): %{_bindir}/dot
Requires(postun): %{_bindir}/dot
%description gd
Graphviz plugin for renderers based on gd. (Unless you absolutely have to use
GIF, you are recommended to use the PNG format instead because of the better
quality anti-aliased lines provided by the cairo+pango based renderer.)
%package graphs
Summary: Demo graphs for graphviz
%description graphs
Some demo graphs for graphviz.
%package guile
Summary: Guile extension for graphviz
Requires: %{name} = %{version}-%{release} guile
%description guile
Guile extension for graphviz.
%package java
Summary: Java extension for graphviz
Requires: %{name} = %{version}-%{release}
%description java
Java extension for graphviz.
%package lua
Summary: Lua extension for graphviz
Requires: %{name} = %{version}-%{release} lua
%description lua
Lua extension for graphviz.
%package perl
Summary: Perl extension for graphviz
Requires: %{name} = %{version}-%{release} perl
%description perl
Perl extension for graphviz.
%package ruby
Summary: Ruby extension for graphviz
Requires: %{name} = %{version}-%{release} ruby
%description ruby
Ruby extension for graphviz.
%package tcl
Summary: Tcl extension & tools for graphviz
Requires: %{name} = %{version}-%{release} tcl >= 8.3 tk
%description tcl
Various tcl packages (extensions) for the graphviz tools.
%if %{with php}
%package php
Summary: PHP extension for graphviz
Requires: %{name} = %{version}-%{release} php-common php
%description php
PHP extension for graphviz.
%endif
%package python3
Summary: Python 3 extension for graphviz
Requires: %{name} = %{version}-%{release}
Provides: python3dist(gv) = %{version}
Provides: python%{python3_version}dist(gv) = %{version}
%description python3
Python 3 extension for graphviz.
%prep
%autosetup -n graphviz-%{version} -p1
find -type f -regex '.*\.\(c\|h\)$' -exec chmod a-x {} ';'
%build
autoreconf -fi
# Hack in the java includes we need
sed -i 's|for try_java_include in|& %{java_home}/include/ %{java_home}/include/linux/|' configure
# Rewrite config_ruby.rb to work with Ruby 2.2
sed -i 's|expand(|expand(RbConfig::|' config/config_ruby.rb
sed -i 's|sitearchdir|vendorarchdir|' config/config_ruby.rb
# get the path to search for ruby/config.h to CPPFLAGS, so that configure can find it
export CPPFLAGS=-I`ruby -e "puts File.join(RbConfig::CONFIG['includedir'], RbConfig::CONFIG['sitearch'])" || echo /dev/null`
%configure --with-x --disable-static --disable-dependency-tracking \
--without-mylibgd --with-ipsepcola --with-pangocairo \
--with-gdk-pixbuf --with-visio --disable-silent-rules \
--without-lasi --without-gts --disable-sharp --without-ming \
--disable-r --without-devil --without-qt
# drop rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fno-strict-overflow %{?FFSTORE}" \
CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fno-strict-overflow %{?FFSTORE}" \
TCL_LIBS=-ltcl PYTHON3_LIBS=`python3-config --embed --libs`
%install
%make_install docdir=%{_docdir}/%{name} \
pkgconfigdir=%{_libdir}/pkgconfig
%delete_la
%if %{with php}
%{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d
%{__cat} << __EOF__ > %{buildroot}%{_sysconfdir}/php.d/%{ini_name}
; Enable %{name} extension module
extension=gv.so
__EOF__
%endif
find $RPM_BUILD_ROOT%{_datadir}/%{name}/demo -type f -exec chmod a-x {} ';'
# Remove dot_builtins, on demand loading should be sufficient
rm -f %{buildroot}%{_bindir}/dot_builtins
# python 3
pushd tclpkg/gv
install -pD .libs/libgv_python3.so $RPM_BUILD_ROOT%{python3_sitearch}/_gv.so
install -p gv.py $RPM_BUILD_ROOT%{python3_sitearch}/gv.py
popd
rm -rf $RPM_BUILD_ROOT%{_libdir}/graphviz/python
# Ghost plugins config
touch %{buildroot}%{_libdir}/graphviz/config%{pluginsver}
%check
%if %{with php}
LD_LIBRARY_PATH=$RPM_BUILD_ROOT%{_libdir} \
php --no-php-ini --define extension_dir=$RPM_BUILD_ROOT%{_libdir}/graphviz/php/ \
--define extension=libgv_php.so --modules | grep gv
%endif
%post
%{_bindir}/dot -c
%files
%doc %{_docdir}/%{name}
%{_bindir}/*
%dir %{_libdir}/graphviz
%{_libdir}/*.so.*
%{_libdir}/graphviz/*.so.*
%exclude %{_libdir}/graphviz/libgvplugin_gd.*
%{_datadir}/graphviz
%ghost %{_libdir}/graphviz/config%{pluginsver}
%if %{with php}
%files php
%config(noreplace)
%{_sysconfdir}/php.d/%{ini_name}
%{_libdir}/graphviz/php/
%{php_extdir}/gv.so
%{_datadir}/php*/*
%endif
%files devel
%{_includedir}/graphviz
%{_libdir}/*.so
%{_libdir}/graphviz/*.so
%{_libdir}/pkgconfig/*.pc
%files docs
%doc %{_docdir}/%{name}/*.html
%doc %{_docdir}/%{name}/*.pdf
%doc %{_datadir}/%{name}/demo
%{_mandir}/man1/*
%{_mandir}/man3/*
%{_mandir}/man7/*
%files gd
%{_libdir}/graphviz/libgvplugin_gd.so.*
%files graphs
%dir %{_datadir}/graphviz
%{_datadir}/graphviz/graphs
%files guile
%{_libdir}/graphviz/guile/
%files java
%{_libdir}/graphviz/java/
%files lua
%{_libdir}/graphviz/lua/
%{_libdir}/lua*/*
%files perl
%{_libdir}/graphviz/perl/
%{_libdir}/perl*/*
%files python3
%{python3_sitearch}/*
%{_libdir}/graphviz/python3/*
%files ruby
%{_libdir}/graphviz/ruby/
%{_libdir}/*ruby*/*
%files tcl
%{_libdir}/graphviz/tcl/
%{_libdir}/tcl*/*
%changelog
* Thu Aug 06 2026 Funda Wang <fundawang@yeah.net> - 15.1.1-1
- update to 15.1.1
* Thu Jul 02 2026 lvgenggeng <lvgenggeng@uninotech.com> - 15.1.0-1
- update to 15.1.0
* Mon May 25 2026 Funda Wang <fundawang@yeah.net> - 15.0.0-1
- update to 15.0.0
* Fri Sep 26 2025 Funda Wang <fundawang@yeah.net> - 14.0.0-1
- update to 14.0.0
* Thu Jan 09 2025 Funda Wang <fundawang@yeah.net> - 12.2.1-2
- deal with rpm 4.17 won't recognize boolean builddepencies
* Tue Dec 10 2024 Funda Wang <fundawang@yeah.net> - 12.2.1-1
- update to 12.2.1
* Tue Oct 01 2024 Funda Wang <fundawang@yeah.net> - 12.1.2-1
- update to 12.1.2
* Mon Mar 11 2024 liweigang <izmirvii@gmail.com> - 10.0.1-1
- update to version 10.0.1
- Dropped ocaml plugins (dropped upstream)
* Tue Feb 06 2024 yaoxin <yao_xin001@hoperun.com> - 8.1.0-2
- Fix CVE-2023-46045
* Thu Sep 07 2023 yaoxin <yao_xin001@hoperun.com> - 8.1.0-1
- Update to 8.1.0
* Mon Nov 21 2022 huajingyun <huajingyun@loongson.cn> - 2.48.0-3
- add loongarch support
* Sat Jan 8 2022 wuchaochao <wuchaochao4@huawei.com> - 2.48.0-2
- delete redundant Provides and Obsoletes
* Wed Dec 15 2021 wuchaochao <wuchaochao4@huawei.com> - 2.48.0-1
- update version to 2.48.0
* Wed May 26 2021 liuyumeng <liuyumeng5@huawei.com> -2.44.1-4
- Add a BuildRequires for gcc-g++
* Tue May 11 2021 wangkerong <wangkerong@huawei.com> - 2.44.1-3
- Type:CVE
- ID:CVE-2020-18032
- SUG:NA
- DESC:fix cve-2020-18032
* Wed Oct 21 2020 jinzhimin<jinzhimin2@huawei.com> - 2.44.1-2
- remove graphviz-python2 subpackage
* Fri Jul 24 2020 hanhui <hanhui15@huawei.com> - 2.44.1-1
- update to 2.44.1
* Tue Jun 23 2020 xinghe <xinghe1@huawei.com> - 2.40.1-39
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Repair compilation failure
* Tue Dec 31 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.40.1-38
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:optimization the spec
* Thu Sep 19 2019 hufeng <solar.hu@huawei.com> - 2.40.1-37
-Create spec