Blob Blame History Raw
%global upstreamver 4r8p3
%global pkgdate 2016_03_19-22_17
%global gapdirname gap%(cut -dp -f1 <<< %upstreamver)
%global gapdir %{_prefix}/lib/gap
%global icondir %{_datadir}/icons/hicolor

Name:           gap
Version:        %(sed -r "s/r|p/./g" <<< %upstreamver)
Release:        2%{?dist}
Summary:        Computational discrete algebra

License:        GPLv2+
URL:            http://www.gap-system.org/
Source0:        http://www.gap-system.org/pub/gap/gap48/tar.bz2/%{name}%{upstreamver}_%{pkgdate}.tar.bz2
Source1:        gap-README.fedora
Source2:        update-gap-workspace
Source3:        gap.xml
Source4:        gap.desktop
Source5:        gap.appdata.xml
Source6:        gap.1.in
Source7:        gac.1.in
Source8:        update-gap-workspace.1
Source9:        gap.vim
# This patch from Debian rearranges some paths to match Linux conventions.
Patch0:         %{name}-paths.patch
# This patch applies a change from Debian to allow help files to be in gzip
# compressed DVI files, and also adds support for viewing with xdg-open.
Patch1:         %{name}-help.patch
# Filed as an upstream git pull request.  Force use of the 64-bit stat()
# routines to avoid overflow of the inode and size fields.
Patch2:         %{name}-stat.patch
# Fix 2 bugs in pperm.c that manifest on big endian machines.
# See https://github.com/gap-system/gap/pull/782.
Patch3:         %{name}-pperm.patch

# Fix some unescaped curly braces in the tools
Patch100:       %{name}-escape.patch

BuildRequires:  desktop-file-utils
BuildRequires:  gcc
BuildRequires:  gmp-devel
BuildRequires:  m4
BuildRequires:  netpbm-progs
BuildRequires:  parallel
BuildRequires:  procps
BuildRequires:  readline-devel
BuildRequires:  tex(a4wide.sty)
BuildRequires:  tex(amssymb.sty)
BuildRequires:  tex(babelbib.sty)
BuildRequires:  tex(color.sty)
BuildRequires:  tex(english.ldf)
BuildRequires:  tex(enumitem.sty)
BuildRequires:  tex(fancyvrb.sty)
BuildRequires:  tex(hyperref.sty)
BuildRequires:  tex(inputenc.sty)
BuildRequires:  tex(makeidx.sty)
BuildRequires:  tex(pslatex.sty)
BuildRequires:  tex(psnfss.map)
BuildRequires:  tex-bibtex
BuildRequires:  tex-cm
BuildRequires:  tex-cm-super
BuildRequires:  tex-dvips
BuildRequires:  tex-ec
BuildRequires:  tex-helvetic
BuildRequires:  tex-latex-bin
BuildRequires:  tex-makeindex
BuildRequires:  tex-rsfs
BuildRequires:  tex-symbol
BuildRequires:  tex-times

Requires:       %{name}-libs = %{version}-%{release}
Requires:       %{name}-core%{?_isa} = %{version}-%{release}
Requires:       %{name}-online-help = %{version}-%{release}

%description
GAP is a system for computational discrete algebra, with particular
emphasis on Computational Group Theory.  GAP provides a programming
language, a library of thousands of functions implementing algebraic
algorithms written in the GAP language as well as large data libraries
of algebraic objects.  GAP is used in research and teaching for studying
groups and their representations, rings, vector spaces, algebras,
combinatorial structures, and more.

This is a metapackage that requires the standard GAP components.

%package libs
Summary:        Essential GAP libraries
BuildArch:      noarch

%description libs
This package contains the essential GAP libraries: lib and grp, as well as
the primitive, small, and transitive group databases.

%package core
Summary:        GAP core components
Requires:       %{name}-libs = %{version}-%{release}
Requires:       GAPDoc
# The gap binary executes gunzip
Requires:       gzip
Requires:       hicolor-icon-theme

%description core
This package contains the core GAP system.

%package online-help
Summary:        Online help for GAP
Requires:       %{name}-core = %{version}-%{release}
BuildArch:      noarch

%description online-help
This package contains the documentation in TeX format needed for GAP's
online help system.

%package devel
Summary:        GAP compiler and development files
Requires:       %{name}-core%{?isa} = %{version}-%{release}
Requires:       %{name}-online-help = %{version}-%{release}
Requires:       gcc
Requires:       gmp-devel%{?_isa}

%description devel
This package contains the GAP compiler (gac) and the header files necessary
for developing GAP programs.

%package vim
Summary:        Edit GAP files with VIM
Requires:       %{name}-core = %{version}-%{release}
Requires:       vim-filesystem
BuildArch:      noarch

%description vim
This package provides VIM add-on files to support editing GAP sources.
Both syntax highlighting and indentation are supported.

%prep
%setup -q -n %{gapdirname}
%patch0
%patch1
%patch2
%patch3

# Replace the CFLAGS and LDFLAGS
sed -re "s|(gp_cv_prog_cc_cdynoptions=)\"-fPIC -Wall -O2|\1\"\$RPM_OPT_FLAGS -fPIC -D_GNU_SOURCE|" \
    -e "s|(gp_cv_prog_cc_cdynlinking=)\"-shared -g[[:digit:]]*|\1\"\-Wl,-z,relro -shared|" \
    -i cnf/configure.out

# Get the README
cp -p %{SOURCE1} README.fedora

# Unpack the tools
pushd etc
./install-tools.sh
popd
mv doc/gapmacrodoc.pdf .

# Fix unescaped curly braces in the tools
%patch100

%build
# -Wl,-z,now breaks use of RTLD_LAZY
%configure --with-gmp=system LIBS="-lm" LDFLAGS="-Wl,-z,relro" \
  CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DSYS_DEFAULT_PATHS=\"%{gapdir}\"'
make %{?_smp_mflags}

# Get the value of the GAParch variable
source ./sysinfo.gap

# Prepare to build packages
sed -i "s|@gaparch@|$GAParch|" bin/$GAParch/gac
mkdir -p bin/$GAParch/extern/gmp/include
ln -s %{_includedir}/gmp.h bin/$GAParch/extern/gmp/include

# Rebuild the manuals from source
export GAP_DIR=$PWD
make manuals

# Compress help files
find doc -name \*.toc | parallel %{?_smp_mflags} --no-notice gzip --best

# Compress large group files
find -O3 small -mindepth 2 -type f | \
  parallel %{?_smp_mflags} --no-notice gzip --best -f
parallel %{?_smp_mflags} --no-notice gzip --best ::: prim/grps/*.g trans/*.grp

# Create an RPM macro file for GAP packages
cat > macros.%{name} << EOF
%%_gap_version %{version}
%%_gap_upstream_version %{upstreamver}
%%_gap_dir %{gapdir}
EOF

%install
# Get the value of the GAParch variable
source ./sysinfo.gap

# Install the binaries
mkdir -p %{buildroot}%{_bindir}
ln -s %{gapdir}/bin/gap.sh %{buildroot}%{_bindir}/gap
cp -p %{SOURCE2} %{buildroot}%{_bindir}

# Install the data
mkdir -p %{buildroot}%{gapdir}/etc
cp -a grp lib prim small trans tst %{buildroot}%{gapdir}
cp -p etc/{convert.pl,packpack,buildman.pe} %{buildroot}%{gapdir}/etc

# Install the arch-specific files
cp -a sysinfo.gap* %{buildroot}%{gapdir}

# Create the system workspace, initially empty
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}
touch %{buildroot}%{_localstatedir}/lib/%{name}/workspace.gz

# Install the header and object files where the GAP compiler can find them
mkdir -p %{buildroot}%{gapdir}/src
cp -p src/*.h %{buildroot}%{gapdir}/src
mkdir -p %{buildroot}%{gapdir}/bin
cp -p bin/gap*.sh %{buildroot}%{gapdir}/bin
cp -a bin/$GAParch %{buildroot}%{gapdir}/bin

# Make an empty directory to hold the GAP packages
mkdir -p %{buildroot}%{gapdir}/pkg

# Intall the documentation
cp -a doc %{buildroot}%{gapdir}
rm -f %{buildroot}%{gapdir}/doc/*/*.{aux,bbl,blg,brf,idx,ilg,ind,log,out,pnr}
chmod a+x %{buildroot}%{gapdir}/doc/manualindex

# Install the icon; the original is 1024x1024
bmptopnm bin/gapicon.bmp > gapicon.pnm
for size in 32 48 64 96 128 192 256 512; do
  mkdir -p %{buildroot}%{icondir}/${size}x${size}
  pamscale -xsize=$size -ysize=$size gapicon.pnm | pnmtopng -compression=9 \
    > %{buildroot}%{icondir}/${size}x${size}/%{name}.png
done

# Install the MIME type
mkdir -p %{buildroot}%{_datadir}/mime/packages
cp -p %{SOURCE3} %{buildroot}%{_datadir}/mime/packages

# Install the desktop file
mkdir -p %{buildroot}%{_datadir}/applications
desktop-file-install --mode=644 --dir=%{buildroot}%{_datadir}/applications \
  %{SOURCE4}

# Install the AppData file
mkdir -p %{buildroot}%{_datadir}/appdata
install -pm 644 %{SOURCE5} %{buildroot}%{_datadir}/appdata

# Install the RPM macro file
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d
cp -p macros.%{name} %{buildroot}%{_rpmconfigdir}/macros.d

# Install the VIM support
mkdir -p %{buildroot}%{_datadir}/vim/vimfiles/indent
cp -p etc/gap_indent.vim %{buildroot}%{_datadir}/vim/vimfiles/indent
mkdir -p %{buildroot}%{_datadir}/vim/vimfiles/syntax
cp -p etc/gap.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax
mkdir -p %{buildroot}%{_datadir}/vim/vimfiles/ftdetect
cp -p %{SOURCE9} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect

# Install the man pages
mkdir -p %{buildroot}%{_mandir}/man1
sed "s|@VERSION@|%{version}|" %{SOURCE6} > %{buildroot}%{_mandir}/man1/gap.1
sed "s|@VERSION@|%{version}|" %{SOURCE7} > %{buildroot}%{_mandir}/man1/gac.1
cp -p %{SOURCE8} %{buildroot}%{_mandir}/man1

%post core
%{_bindir}/update-desktop-database %{_datadir}/applications &>/dev/null ||:
/bin/touch --no-create %{icondir} >&/dev/null ||:
/bin/touch --no-create %{_datadir}/mime/packages &> /dev/null || :

%posttrans
%{_bindir}/gtk-update-icon-cache %{icondir} >&/dev/null ||:
%{_bindir}/update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :

%preun
if [ $1 -eq 0 ]; then
  {_bindir}/update-gap-workspace delete &> /dev/null || :
fi

%postun core
%{_bindir}/update-desktop-database %{_datadir}/applications &>/dev/null ||:
if [ $1 -eq 0 ] ; then
  /bin/touch --no-create %{icondir} >&/dev/null ||:
  %{_bindir}/gtk-update-icon-cache %{icondir} >&/dev/null ||:
  /bin/touch --no-create %{_datadir}/mime/packages &> /dev/null || :
  %{_bindir}/update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
fi

%transfiletriggerin -- %{gapdir}/pkg
%{_bindir}/update-gap-workspace > /dev/null || :

%transfiletriggerpostun -- %{gapdir}/pkg
%{_bindir}/update-gap-workspace > /dev/null || :

%check
sed -e "s|^GAP_DIR=.*|GAP_DIR=$PWD|" \
    -e "s|\$GAP_DIR/bin/\$GAP_PRG|$PWD/bin/\$GAP_PRG|" \
    -i bin/gap.sh bin/gap-default*.sh
sed -i "s|80 -r|& -l $PWD|" Makefile-default*
make testinstall

%files
# No files in the metapackage

%files libs
%doc small/README
%license etc/GPL
%dir %{gapdir}
%{gapdir}/grp/
%{gapdir}/lib/
%{gapdir}/prim/
%{gapdir}/small/
%{gapdir}/trans/

%files core
%doc README.fedora
%{_bindir}/gap
%{_bindir}/update-gap-workspace
%{gapdir}/bin/
%exclude %{gapdir}/bin/*/gac
%{gapdir}/sysinfo.gap*
%{gapdir}/pkg/
%{_mandir}/man1/gap.1*
%{_mandir}/man1/update-gap-workspace.1*
%{_datadir}/appdata/gap.appdata.xml
%{_datadir}/applications/gap.desktop
%{_datadir}/mime/packages/gap.xml
%{icondir}/32x32/gap.png
%{icondir}/48x48/gap.png
%{icondir}/64x64/gap.png
%{icondir}/96x96/gap.png
%{icondir}/128x128/gap.png
%{icondir}/192x192/gap.png
%{icondir}/256x256/gap.png
%{icondir}/512x512/gap.png
%dir %{_localstatedir}/lib/%{name}/
%verify(user group mode) %{_localstatedir}/lib/%{name}/workspace.gz

%files online-help
%{gapdir}/doc/

%files devel
%doc etc/README.tools gapmacrodoc.pdf
%{gapdir}/bin/*/gac
%{gapdir}/etc/
%{gapdir}/src/
%{gapdir}/tst/
%{_mandir}/man1/gac.1*
%{_rpmconfigdir}/macros.d/macros.%{name}

%files vim
%doc etc/debug.vim etc/debugvim.txt etc/README.vim-utils
%{_datadir}/vim/vimfiles/ftdetect/gap.vim
%{_datadir}/vim/vimfiles/indent/gap_indent.vim
%{_datadir}/vim/vimfiles/syntax/gap.vim

%changelog
* Thu May  5 2016 Jerry James <loganjerry@gmail.com> - 4.8.3-2
- Fix PowerPC64 build failure (bz 1330108)

* Thu Apr  7 2016 Jerry James <loganjerry@gmail.com> - 4.8.3-1
- New upstream release

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 4.7.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Dec  2 2015 Jerry James <loganjerry@gmail.com> - 4.7.9-1
- New upstream release

* Wed Nov 11 2015 Jerry James <loganjerry@gmail.com> - 4.7.8-3
- Use file triggers
- Rebuild documentation from source
- Compress files in parallel
- Unpack the tools archive

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.7.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Jun 12 2015 Jerry James <loganjerry@gmail.com> - 4.7.8-1
- New upstream release

* Wed May 20 2015 Jerry James <loganjerry@gmail.com> - 4.7.7-2
- Fix gac compiler flags for dynamic objects
- Update appdata

* Mon Feb 16 2015 Jerry James <loganjerry@gmail.com> - 4.7.7-1
- New upstream release

* Fri Jan 23 2015 Jerry James <loganjerry@gmail.com> - 4.7.6-3
- Fix scriptlets so they don't complain when uninstalling
- Drop obsolete Group tags

* Thu Jan 15 2015 Jerry James <loganjerry@gmail.com> - 4.7.6-2
- Fix crash with nameless TTYs, such as in mock shell environments

* Wed Dec 10 2014 Jerry James <loganjerry@gmail.com> - 4.7.6-1
- New upstream release
- Fix license handling
- Install more icon sizes

* Sat Aug 16 2014 Rex Dieter <rdieter@fedoraproject.org> 4.7.5-3
- update scriplets

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.7.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Thu Jun 19 2014 Jerry James <loganjerry@gmail.com> - 4.7.5-1
- New upstream release
- Fix ownership of workspace.gz

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.7.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Mar 19 2014 Jerry James <loganjerry@gmail.com> - 4.7.4-1
- New upstream release

* Wed Feb  5 2014 Jerry James <loganjerry@gmail.com> - 4.7.2-2
- Update location of rpm macro file for rpm >= 4.11
- Add an AppData file

* Tue Jan 14 2014 Jerry James <loganjerry@gmail.com> - 4.7.2-1
- New upstream release
- Upstream no longer distributes an (X)Emacs interface

* Mon Jul 29 2013 Jerry James <loganjerry@gmail.com> - 4.6.5-1
- New upstream release

* Wed May 22 2013 Jerry James <loganjerry@gmail.com> - 4.6.4-2
- Update -stat patch to provide large integer conversion (for, e.g., loff_t)
- Drop meataxe Requirement as it has been replaced with internal routines

* Thu May 16 2013 Jerry James <loganjerry@gmail.com> - 4.6.4-1
- New upstream release

* Thu Mar 28 2013 Jerry James <loganjerry@gmail.com> - 4.6.3-1
- New upstream release

* Sat Mar 09 2013 Ralf Cors├ępius <corsepiu@fedoraproject.org> - 4.6.2-2
- Remove %%config from %%{_sysconfdir}/rpm/macros.*
  (https://fedorahosted.org/fpc/ticket/259).

* Wed Feb 20 2013 Jerry James <loganjerry@gmail.com> - 4.6.2-1
- New upstream release
- Move update-gap-workspace call to posttrans (bz 912067)
- Add -stat patch and -D_FILE_OFFSET_BITS=64 to CPPFLAGS to use 64-bit
  stat interface on 32-bit systems

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.5.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Dec 21 2012 Rex Dieter <rdieter@fedoraproject.org> 4.5.7-2
- optimize/update icon scriptlets

* Mon Dec 17 2012 Jerry James <loganjerry@gmail.com> - 4.5.7-1
- New upstream release

* Mon Oct 22 2012 Jerry James <loganjerry@gmail.com> - 4.5.6-3
- Further fixes for the -m32/-m64 issue
- Many packages need the primitive, small, or transitive groups; collapse them
  all into the -libs subpackage so they are always available
- Provide sysinfo-default[32|64], as required by some packages
- Provide symbolic links to gac and gap from the bin directory, as required by
  some packages

* Sat Oct 20 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 4.5.6-2
- -m32/-m64 should come from RPM_OPT_FLAGS. Fix build issues on non x86 arches

* Mon Sep 24 2012 Jerry James <loganjerry@gmail.com> - 4.5.6-1
- New upstream release
- Remove unused patches from git

* Thu Sep 13 2012 Jerry James <loganjerry@gmail.com> - 4.5.5-1
- New upstream release
- Drop upstreamed patches
- Sources are now UTF-8; no conversion necessary

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.4.12-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Jan 31 2012 Jerry James <loganjerry@gmail.com> - 4.4.12-4
- Add an RPM macro file for GAP packages
- Fix the location of config.h

* Wed Jan 11 2012 Jerry James <loganjerry@gmail.com> - 4.4.12-3
- Fix problems found on review

* Tue Jan  3 2012 Jerry James <loganjerry@gmail.com> - 4.4.12-2
- Mimic Debian's subpackage structure

* Wed Oct 12 2011 Jerry James <loganjerry@gmail.com> - 4.4.12-1
- Initial RPM