%global py_major 3.9 %global python_major python%{py_major} # This is for sitearch for manual install of gv.py using install command from coreutils. %global python3_sitearch %(/opt/freeware/bin/%{python_major} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") # Required for NOT having $BUILD/@PaxHeader files when autobuilding %define __tar /opt/freeware/bin/tar # This is needed as it is the version number for the configure plugin. Across versions this is expected to change. %global pluginsver 6 Summary: Graph Visualization Tools Name: graphviz %define major_version 8 %define minor_version 0 %define micro_version 5 Version: %{major_version}.%{minor_version}.%{micro_version} Release: 1 License: EPL-1.0 URL: https://www.graphviz.org/ Group: Development/Libraries Source0: https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/%{version}/graphviz-%{version}.tar.gz Source1: graphviz-8.0.5-getopt_long_for_graphviz_in_AIX_v1.c # Patch to fix incorrectly imported getopt.h in AIX. Patch1: graphviz-8.0.5-remove_getopt.patch # Patch to implement get_opt_long Patch2: graphviz-8.0.5-add_get_opt_long.patch # gcc - To compile. # gtk2 - Package uses some symbols from the same. # pango, tcl and tk - We use it in configure. # python3.9 - Uses latest version of python3.9. # libpng and gdk-pixbuf - packages used to construc the images. # coreutils - For the install command in the install section. # swig - This package uses swig with python for python bindings. # The make file for this pacakge can be run well with bash shell only. BuildRequires: gcc >= 10.3.0 BuildRequires: gtk2-devel >= 2.24.30 BuildRequires: tcl-devel >= 8.6.11 BuildRequires: tk-devel >= 8.6.11 BuildRequires: python3.9-devel >= 3.9.16 BuildRequires: libpng-devel >= 1.6.37 BuildRequires: gdk-pixbuf-devel >= 2.35.1 BuildRequires: coreutils >= 9.0 BuildRequires: swig >= 4.1.1 BuildRequires: pango-devel >= 1.40.1 BuildRequires: cairo-devel >= 1.14.6 BuildRequires: ncurses-devel >= 6.4 BuildRequires: perl >= 5.34.1 BuildRequires: zlib-devel >= 1.2.13 BuildRequires: freetype2-devel >= 2.12.1 BuildRequires: gettext-devel >= 0.21 BuildRequires: /opt/freeware/bin/bash Requires: tcl >= 8.6.11 Requires: tk >= 8.6.11 Requires: python3.9 >= 3.9.16 Requires: libpng >= 1.6.37 Requires: gdk-pixbuf >= 2.35.1 Requires: pango >= 1.40.1 Requires: swig >= 4.1.1 Requires: cairo >= 1.14.6 Requires: ncurses >= 6.4 Requires: perl >= 5.34.1 Requires: glib2 >= 2.72.1 Requires: libwebp >= 1.0.2 Requires: expat >= 2.5.0 Requires: zlib >= 1.2.13 Requires: freetype2 >= 2.12.1 Requires: gettext >= 0.21 %define _libdir64 %{_prefix}/lib64 %description A collection of tools for the manipulation and layout of graphs (as in nodes and edges, not as in barcharts). This package contains development files for graphviz %package devel Summary: Development package for graphviz Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: pkg-config %description devel A collection of tools for the manipulation and layout of graphs (as in nodes and edges, not as in barcharts). This package contains development files for graphviz. %prep export PATH=/opt/freeware/bin:$PATH %setup -q -n graphviz-%{version} %patch1 -p0 %patch2 -p0 # The get_opt_long guy. cp %{SOURCE1} . %build # Nothing as complex as GDB. These exports will help configure recoginse the right place. export CONFIG_SHELL=/opt/freeware/bin/bash export CONFIG_ENV_ARGS=/opt/freeware/bin/bash export CC="gcc -maix64 -O2 -pthread" export CXX="g++ -maix64 -O2 -pthread" export OBJECT_MODE=64 export LIBPATH=/opt/freeware/lib:/usr/lib:$LIBPATH ./configure --with-x \ --disable-static \ --disable-dependency-tracking \ --enable-java=no \ --without-mylibgd \ --with-ipsepcola \ --with-pangocairo \ --with-gdk-pixbuf \ --disable-silent-rules \ --enable-lefty \ --without-lasi \ --without-gtk \ --without-gtkgl \ --without-gtkglext \ --without-glade \ --without-gts \ --without-smyrna \ --disable-sharp \ --disable-ocaml \ --without-ming \ --disable-r \ --without-devil \ --without-qt \ --enable-guile=no \ --prefix=/opt/freeware \ --with-tclconfig=/opt/freeware/lib \ --with-tcllib=/opt/freeware/lib \ --with-tclsh=/opt/freeware/lib \ --enable-ruby=no \ --enable-python3=yes \ --enable-lua=no gmake V=1 %install # If you do not export then 64 bit symbols won't be shipped which will fail the plugin generation. # and generate this error # Could not load program ./dot: # Dependent module libgvc.a(libgvc.so.6) could not be loaded. # Could not load module libgvc.a(libgvc.so.6). # System error: No such file or directory export OBJECT_MODE=64 gmake install DESTDIR=${RPM_BUILD_ROOT} # Broken symlinks cannot be installed. Hence we unarchive and then ship the .so as well. cd ${RPM_BUILD_ROOT}/%{_libdir}/graphviz/python3/ ar -X64 -xv libgv_python3.a # Since these files are in /opt/freeware/lib/graphviz/python3 which is a private directory, # And AIX python3.9 recognises /opt/freeware/lib64/python3.9 we need to ship them in the # /opt/freeware/lib64/python3.9 path. install -p ${RPM_BUILD_ROOT}/%{_libdir}/graphviz/python3/_gv.so %{buildroot}/%{python3_sitearch}/ install -p ${RPM_BUILD_ROOT}/%{_libdir}/graphviz/python3/gv.py %{buildroot}/%{python3_sitearch}/ install -p ${RPM_BUILD_ROOT}/%{_libdir}/graphviz/python3/libgv_python3.a %{buildroot}/%{python3_sitearch}/ install -p ${RPM_BUILD_ROOT}/%{_libdir}/graphviz/python3/libgv_python3.so %{buildroot}/%{python3_sitearch}/ # For shipping the .so's which the plugin recognises. cd ${RPM_BUILD_ROOT}/opt/freeware/lib/graphviz/ for fic in $(ls *.a*) do ar -x -X64 $fic done # Create an empty plugin touch config%{pluginsver} # If you do not export this then the plugin will be zero sized i.e. an empty file. export GVBINDIR=${RPM_BUILD_ROOT}/opt/freeware/lib/graphviz # Always export LIBPATH before plugin, otherwise graphviz cannot locate the .a files which dot -c command needs. # Otherwise you will get the below error # Could not load program ./dot: # Dependent module libgvc.a(libgvc.so.6) could not be loaded. export LIBPATH=${RPM_BUILD_ROOT}/opt/freeware/lib:${RPM_BUILD_ROOT}/opt/freeware/lib/graphviz:/opt/freeware/lib:/usr/lib:/lib # Run the dot -c to generate the plugin ${RPM_BUILD_ROOT}/%{_bindir}/dot -c # strip binaries /usr/bin/strip -X32_64 ${RPM_BUILD_ROOT}%{_bindir}/* || : %files %defattr(-,root,system,-) %{python3_sitearch}/* %{_bindir}/* # Plugin and Shared libaries will be here. %{_libdir}/graphviz/ %{_libdir}/*.a # Documentation and examples /opt/freeware/share/doc/graphviz/* #AUTHORS, License, news and readme %doc AUTHORS COPYING NEWS CHANGELOG.md %doc README doc/build.html %files devel %defattr(-,root,system,-) %{_includedir}/graphviz %{_libdir}/pkgconfig/*.pc %changelog * Fri Jul 28 2023 Aditya Kamath 8.0.5-1 - Launch new version 8.0.5