File emacs.spec of Package emacsdev

#
# spec file for package emacs
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           emacsdev
BuildRequires:  ImageMagick
BuildRequires:  ImageMagick-devel
%if %{with autoconf}
BuildRequires:  autoconf
BuildRequires:  automake
%endif
%if 0%{?suse_version}
BuildRequires:  alsa-devel
BuildRequires:  dbus-1-devel
BuildRequires:  fonts-config
BuildRequires:  freetype2-devel
BuildRequires:  gconf2-devel
BuildRequires:  libgnutls-devel
BuildRequires:  librsvg-devel
BuildRequires:  update-alternatives
BuildRequires:  update-desktop-files
BuildRequires:  xaw3d-devel
BuildRequires:  xorg-x11-devel
%else
BuildRequires:  alsa-lib-devel
BuildRequires:  dbus-devel
BuildRequires:  fontconfig
BuildRequires:  freetype-devel
BuildRequires:  GConf2-devel
BuildRequires:  gnutls-devel
BuildRequires:  librsvg2-devel
BuildRequires:  Xaw3d-devel
BuildRequires:  xorg-x11-server-devel
%endif
BuildRequires:  fdupes
BuildRequires:  giflib-devel
%if 0%{?suse_version} > 1130
BuildRequires:  gpm-devel
%else
BuildRequires:  gpm
%endif
BuildRequires:  gtk2-devel
%if 0%{?rhel} > 6 || 0%{?fedora} || 0%{?suse_version}
BuildRequires:  gtk3-devel
%endif
BuildRequires:  krb5-devel
BuildRequires:  libacl-devel
%if 0%{?suse_version} > 1140
BuildRequires:  libgnutls-openssl-devel
%endif
BuildRequires:  libjpeg-devel
BuildRequires:  libotf-devel
BuildRequires:  libpng-devel
BuildRequires:  libselinux-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml2-devel
BuildRequires:  m17n-lib-devel
BuildRequires:  ncurses-devel
%if 0%{?suse_version} > 1220
BuildRequires:  makeinfo
%else
BuildRequires:  texinfo
%endif
BuildRequires:  xz
Url:            http://www.gnu.org/software/emacs/
Version:        26.1
%define prerelease_version rc1
Release:        1.%{prerelease_version}
%if 0%{?suse_version} > 1300
Requires:       etagsdev
%endif
Requires:       emacsdev-info = %{version}
Requires:       emacs_program = %{version}-%{release}
Summary:        GNU Emacs Base Package
License:        GPL-3.0+
Group:          Productivity/Editors/Emacs
Provides:       nxml-mode = 20041004
Obsoletes:      nxml-mode < 20041004
Provides:       epg = 1.0.0
#Provides:       emacs = %{version}-%{release}
Obsoletes:      epg < 1.0.0
Requires(pre):  fileutils
# Stable versions
#Source:        ftp://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz
# Pretest versions
Source:         ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-%{version}-%{prerelease_version}.tar.xz
# Source:         ftp://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz
Source1:        app-defaults.Emacs
Source2:        site-lisp.tar.bz2
Source3:        dot.gnu-emacs
Source4:        emacs-rpmlintrc
Source5:        emacs.sh
Conflicts:      emacs
Patch:          emacs-24.3.dif
Patch5:         emacs-24.3-ps-bdf.patch
Patch7:         emacs-24.1-ps-mule.patch
Patch11:        emacs-24.3-xim.patch
Patch12:        emacs-24.3-x11r7.patch
Patch13:        gnus-group-get-new-news-this-group.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo /usr/X11R6)}
%if "%_exec_prefix" == "/usr/X11R6"
%define _x11lib     %{_exec_prefix}/%{_lib}
%define _x11data    %{_exec_prefix}/lib/X11
%define _libx11     %{_x11data}
%define _x11inc     %{_exec_prefix}/include
%define appDefaultsDir %{_x11data}/app-defaults
%define appDefaultsFile %{appDefaultsDir}/Emacs
%else
%define _x11lib     %{_libdir}
%define _x11data    %{_datadir}/X11
%define _libx11     %{_exec_prefix}/lib/X11
%define _x11inc     %{_includedir}
%define appDefaultsDir %{_x11data}/app-defaults
%define appDefaultsFile %{appDefaultsDir}/Emacs
%endif
%define info_files  ada-mode auth autotype bovine calc ccmode cl dbus dired-x ebrowse ede ediff edt efaq eieio eintr elisp emacs-gnutls emacs-mime emacs epa erc ert eshell eudc eww flymake forms gnus htmlfontify idlwave ido info mairix-el message mh-e newsticker nxml-mode octave-mode org pcl-cvs pgg rcirc reftex remember sasl sc semantic ses sieve smtpmail speedbar srecode todo-mode tramp url vhdl-mode vip viper widget wisent woman

%description
Basic package for the GNU Emacs editor. Requires emacsdev-x11 or
emacsdev-nox.

%package     -n emacsdev-nox
Requires(post): fileutils
Requires:       emacsdev = %{version}-%{release}
Provides:       emacs_program = %{version}-%{release}
#Provides:       emacs-nox = %{version}-%{release}
Conflicts:      emacs-nox
Summary:        GNU Emacs-nox: GNU Emacs without X11 support
Group:          Productivity/Editors/Emacs

%description -n emacsdev-nox
GNU Emacs without X11 support.

%package     -n emacsdev-x11
Requires(post): fileutils
Requires:       emacsdev = %{version}-%{release}
Provides:       emacs_program = %{version}-%{release}
#Provides:       emacs-x11 = %{version}-%{release}
%if 0%{?suse_version}
Requires:       efont-unicode
Requires:       xorg-x11-fonts
Requires:       xorg-x11-fonts-core
%else
Requires:       efont-unicode-bdf
Requires:       xorg-x11-fonts-100dpi
%endif
%if 0%{?suse_version}
Enhances:       libX11
%endif
Conflicts:      emacs-x11
Summary:        GNU Emacs-x11: GNU Emacs with X11 support
Group:          Productivity/Editors/Emacs

%description -n emacsdev-x11
GNU Emacs with X11 support.

%package     -n emacsdev-gtk2
Requires(post): fileutils
Requires:       emacsdev-x11 = %{version}-%{release}
#Provides:       emacs-x11 = %{version}-%{release}
%if 0%{?suse_version}
Requires:       efont-unicode
Requires:       xorg-x11-fonts
Requires:       xorg-x11-fonts-core
%else
Requires:       efont-unicode-bdf
Requires:       xorg-x11-fonts-100dpi
%endif
%if 0%{?suse_version}
Enhances:       libX11
%endif
Summary:        GNU Emacs-gtk2: GNU Emacs with a GTK+2 interface
Group:          Productivity/Editors/Emacs

%description -n emacsdev-gtk2
GNU Emacs with a GTK+2 interface.

%if 0%{?rhel} > 6 || 0%{?fedora} || 0%{?suse_version}
%package     -n emacsdev-gtk3
Requires(post): fileutils
Requires:       emacsdev-x11 = %{version}-%{release}
#Provides:       emacs-x11 = %{version}-%{release}
%if 0%{?suse_version}
Requires:       efont-unicode
Requires:       xorg-x11-fonts
Requires:       xorg-x11-fonts-core
%else
Requires:       efont-unicode-bdf
Requires:       xorg-x11-fonts-100dpi
%endif
%if 0%{?suse_version}
Enhances:       libX11
%endif
Summary:        GNU Emacs-gtk3: GNU Emacs with a GTK+2 interface
Group:          Productivity/Editors/Emacs

%description -n emacsdev-gtk3
GNU Emacs with a GTK+3 interface.
%endif

%package     -n emacsdev-el
Requires:       emacsdev = %{version}-%{release}
Summary:        Several Lisp Files for GNU Emacs
Conflicts:      emacs-common
Conflicts:      emacs-el
Group:          Productivity/Editors/Emacs
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
#Provides:       emacs-el = %{version}-%{release}

%description -n emacsdev-el
Several Lisp files not needed for running GNU Emacs. Most of these
files are pre-byte compiled and therefore not necessary.

%package     -n emacsdev-info
Summary:        Info files for GNU Emacs
Group:          Productivity/Editors/Emacs
%if 0%{?suse_version} >= 1120
Requires(post): %install_info_prereq
Requires(postun): %install_info_prereq
BuildArch:      noarch
%endif
#Provides:       emacs-info = %{version}-%{release}

%description -n emacsdev-info
This package contains all the Info files for GNU Emacs. These files can
be read online with GNU Emacs. They describe Emacs and some of its
modes.

%if 0%{?suse_version} >= 1300
%package      -n etagsdev
Summary:         Generate Tag Files for Use with Emacs
Group:           Development/Tools/Navigators
Requires(post):  coreutils update-alternatives
Requires(preun): coreutils update-alternatives
Conflicts:       etags
Provides:        ctags:%{_bindir}etags

%description -n etagsdev
ETags generates tag files from source code in Pascal, Cobol, Ada, Perl,
LaTeX, Scheme, Emacs Lisp/Common Lisp, Postscript, Erlang, Python, Prolog,
and most assembler-like syntaxes.
%endif

%prep
%setup -q -b 2 -n emacs-%{version}
%patch5  -p0
%patch7  -p0
%patch11 -p0
%patch12 -p0
%patch13 -p1
%patch   -p0

%if %{without autoconf}
# We don't want to run autoconf
touch configure src/stamp-h.in aclocal.m4 lib/Makefile.in
if test -s autogen.sh ; then
  mv autogen.sh autogen.sh.no
  ln -sf /bin/true autogen.sh
fi
%endif

%build
# make sure that the binaries work (pagesize on build must be the same as on target, bnc#726769)
%if 0%{?suse_version} >= 1110
%ifarch ppc ppc64 ia64
%if %(getconf PAGESIZE) != 65536
%error "Error: wrong build host, PAGESIZE must be 65536"
exit 1
%endif
%endif
%endif

  cflags ()
  {
      local flag=$1; shift
      local var=$1; shift
      test -n "${flag}" -a -n "${var}" || return
      case "${!var}" in
      *${flag}*) return
      esac
      case "$flag" in
      -Wl,*)
	  set -o noclobber
	  echo 'int main () { return 0; }' > ldtest.c
	  if ${CC:-gcc} -Werror $flag -o /dev/null -xc ldtest.c > /dev/null 2>&1 ; then
	      eval $var=\${$var:+\$$var\ }$flag
	  fi
	  set +o noclobber
	  rm -f ldtest.c
	  ;;
      *)
	  if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
	      eval $var=\${$var:+\$$var\ }$flag
	  fi
	  if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then
	      eval $var=\${$var:+\$$var\ }$flag
	  fi
      esac
  }

VERSION=%{version}
%ifarch noarch
    SYS="--build=%{_build_cpu}-suse-%{_build_os}
"
%else
    SYS="--build=%{_target_cpu}-suse-%{_build_os}
"
%endif
 CFLAGS="${RPM_OPT_FLAGS} -D_GNU_SOURCE"
LDFLAGS=
  cflags -pipe                   CFLAGS
  cflags -Wno-pointer-sign       CFLAGS
  cflags -Wno-unused-variable    CFLAGS
  cflags -Wno-unused-label       CFLAGS
  cflags -Wno-unprototyped-calls CFLAGS
  cflags -fno-optimize-sibling-calls CFLAGS
  cflags -Wl,-O2		 LDFLAGS
  cflags -Wl,--hash-size=65521	 LDFLAGS
  SMALL="-DSYSTEM_PURESIZE_EXTRA=25000 \
	 -DSITELOAD_PURESIZE_EXTRA=10000 \
"
  LARGE="-DSYSTEM_PURESIZE_EXTRA=55000 \
	 -DSITELOAD_PURESIZE_EXTRA=10000 \
"
   LANG=POSIX; LC_CTYPE=ISO-8859-1
export CC CFLAGS LANG LC_CTYPE LDFLAGS
 PREFIX="--prefix=%{_prefix} \
	 --mandir=%{_mandir} \
	 --infodir=%{_infodir} \
	 --datadir=%{_datadir} \
	 --localstatedir=%{_localstatedir} \
	 --sharedstatedir=%{_localstatedir}/lib \
	 --libexecdir=%{_prefix}/lib
"
DESKTOP="--with-x \
	 --with-sound \
	 --with-xpm \
	 --with-jpeg \
	 --with-tiff \
	 --with-gif \
	 --with-png \
	 --with-rsvg \
	 --with-dbus \
"
    GTK2="${DESKTOP} \
	 --with-x-toolkit=gtk2 \
	 --x-includes=%{_x11inc} \
	 --x-libraries=%{_x11lib} \
	 --with-xft \
	 --with-libotf \
	 --with-m17n-flt \
"
    GTK3="${DESKTOP} \
   --with-x-toolkit=gtk3 \
   --x-includes=%{_x11inc} \
   --x-libraries=%{_x11lib} \
   --with-xft \
   --with-libotf \
   --with-m17n-flt \
"
    X11="${DESKTOP} \
	 --with-x-toolkit=lucid \
	 --x-includes=%{_x11inc} \
	 --x-libraries=%{_x11lib} \
	 --with-xft \
	 --with-libotf \
	 --with-m17n-flt \
"
  NOX11="--without-x \
	 --without-sound \
	 --without-xpm \
	 --without-jpeg \
	 --without-tiff \
	 --without-gif \
	 --without-png \
	 --without-rsvg \
	 --without-dbus \
	 --without-xft \
	 --without-libotf \
	 --without-m17n-flt \
"
   COMP="--with-pop \
	 --without-hesiod \
	 --with-kerberos \
	 --with-kerberos5 \
	 --with-xim \
	 --with-wide-int \
	 --with-gpm \
	 --enable-autodepend \
	 --with-file-notification=gfile \
"

##OIFS="$IFS"; IFS=.
##set -- $(gcc -dumpversion 2>/dev/null)
##(($1 > 4 || ($1 == 4 && $2 > 4))) && COMP="$COMP --enable-link-time-optimization"
##IFS="$OIFS"

make_mchkoff ()
{
    local OMC=$MALLOC_CHECK_
    unset MALLOC_CHECK_
    rm -f src/emacs-%{version}*
    make %{?_smp_mflags} ${1+"$@"}
    set -- $(src/emacs -batch --eval "(print pure-space-overflow)")
    test "$1" = "nil" || exit 1
    if test -n "$OMC" ; then
	MALLOC_CHECK_=$OMC
	export MALLOC_CHECK_
    fi
}

CFLAGS="$CFLAGS $SMALL" ./configure ${COMP} ${PREFIX} ${NOX11} ${SYS}
make_mchkoff
make -C lisp updates compile
for i in `find site-lisp/ -name '*.el'`; do
    src/emacs -batch -q --no-site -f batch-byte-compile $i; \
done
cp src/emacs emacs-nox
make distclean
#
CFLAGS="$CFLAGS $LARGE" ./configure ${COMP} ${PREFIX} ${GTK2} ${SYS}
make_mchkoff
cp src/emacs emacs-gtk2
make distclean
#
%if 0%{?rhel} > 6 || 0%{?fedora} || 0%{?suse_version}
CFLAGS="$CFLAGS $LARGE" ./configure ${COMP} ${PREFIX} ${GTK3} ${SYS}
make_mchkoff
cp src/emacs emacs-gtk3
make distclean
%endif
#
CFLAGS="$CFLAGS $LARGE" ./configure ${COMP} ${PREFIX} ${X11} ${SYS}
make_mchkoff
cp src/emacs emacs-x11
#
cd ../site-lisp/
../emacs-%{version}/src/emacs -batch -q --no-site -f batch-byte-compile *.el
rm -vf site-start.elc
rm -vf site-start.el.orig

%install
#
PATH=/sbin:$PATH
##
VERSION=%{version}
# make the bin dir
mkdir -p %{buildroot}%{_bindir}
install -m 0755 emacs-nox %{buildroot}%{_bindir}
install -m 0755 emacs-gtk2 %{buildroot}%{_bindir}
%if 0%{?rhel} > 6 || 0%{?fedora} || 0%{?suse_version}
install -m 0755 emacs-gtk3 %{buildroot}%{_bindir}
%endif
install -m 0755 emacs-x11 %{buildroot}%{_bindir}
# install
make install DESTDIR=%{buildroot}
# emacs bin
rm -vf %{buildroot}%{_bindir}/emacs
install -p %{S:5} %{buildroot}%{_bindir}/emacs
chmod 0755 %{buildroot}%{_bindir}/emacs
tar cf - `find site-lisp/ -name '*.el'  -o -name '*.elc'` | \
tar -x -f - -C %{buildroot}%{_datadir}/emacs/%{version}/
mkdir -p %{buildroot}%{_docdir}/emacs
ln -sf %{_datadir}/emacs/%{version}/etc %{buildroot}%{_docdir}/emacs/doc
find %{buildroot}%{_datadir}/emacs/%{version}/ -name '*,v' -o -name '*.orig' | xargs -r rm -f
for f in %{buildroot}%{_infodir}/* ; do
    case "$f" in
	*.gz)			;;
	*/dir)	rm -f ${f}	;;
	*)	test -e  ${f}.gz && rm ${f}.gz
		gzip -9f ${f}
    esac
done
info_found=$(cd %{buildroot}%{_infodir}; echo *.gz | sed -e 's/\.info\.gz//g')
if test "$info_found" != "%info_files"
then
  echo Please update info_files >&2
  exit 1
fi
#
mkdir -p %{buildroot}%(dirname %{appDefaultsFile})
cp -p %{S:1} %{buildroot}%{appDefaultsFile}
pushd ../
mkdir -p %{buildroot}/etc/skel
install -m 0644 %{S:3} %{buildroot}/etc/skel/.gnu-emacs
mkdir -p %{buildroot}%{_datadir}/emacs/site-lisp/site-start.d
tar cf - site-lisp/ | tar xvvf - -C %{buildroot}%{_datadir}/emacs/
chmod -R a+r %{buildroot}%{_datadir}/emacs/site-lisp/
popd
(cd %{buildroot}
 find usr/share/emacs/site-lisp/ -type f	\
      \( -name site-start.el -printf "%%%%config " , \
	 -printf "/%%p\n" \)
) | sort > site-lisp.lst
#
# cleanup
#
unelc ()
{
    local elc=$1
    local elz=${elc%%.elc}.el.gz
    rm -vf $elc
    if test -n "$elz" -a -e "$elz" ; then
	gunzip "$elz"
    fi
}
%if 0%{?suse_version} < 1300
rm -vf %{buildroot}%{_datadir}/emacs/%{version}/etc/ctags.1
rm -vf %{buildroot}%{_datadir}/emacs/%{version}/etc/etags.1
%endif
unelc  %{buildroot}%{_datadir}/emacs/%{version}/site-lisp/term/func-keys.elc
unelc  %{buildroot}%{_datadir}/emacs/%{version}/site-lisp/term/gnome.elc
unelc  %{buildroot}%{_datadir}/emacs/%{version}/site-lisp/term/kvt.elc
unelc  %{buildroot}%{_datadir}/emacs/%{version}/site-lisp/term/linux.elc
unelc  %{buildroot}%{_datadir}/emacs/%{version}/site-lisp/term/locale.elc
find %{buildroot}%{_datadir}/emacs/%{version}/etc/ -name '*[a-z].[16]' | \
    xargs gzip -9f
rm -vf %{buildroot}%{_datadir}/emacs/%{version}/lisp/COPYING
ln -sf ../etc/COPYING \
       %{buildroot}%{_datadir}/emacs/%{version}/lisp/COPYING
rm -f %{buildroot}%{_datadir}/emacs/%{version}/lisp/gnus/.dir-locals.el
#
fdupes -q -r -1 %{buildroot}%{_datadir}/emacs/%{version}/etc/images/icons/ %{buildroot}%{_datadir}/icons/ |\
xargs -n 2 | while read first second; do
    case "${first}" in
    *emacs/%{version}/etc/*)
	target=$second
	file=$first
	;;
    *)  target=$first
	file=$second
    esac
    ln -sf ${file#%{buildroot}} ${target}
done
# install desktop file
test -e etc/emacs.desktop || exit 1
echo 'X-KDE-StartupNotify=false' >> etc/emacs.desktop
rm -vf %{buildroot}%{_datadir}/emacs/%{version}/etc/emacs.desktop
cp etc/images/icons/hicolor/32x32/apps/emacs.png $RPM_SOURCE_DIR/emacs.png
mkdir -p %{buildroot}%{_datadir}/pixmaps
cp $RPM_SOURCE_DIR/emacs.png %{buildroot}%{_datadir}/pixmaps
%if 0%{?suse_version}
%suse_update_desktop_file -r -i emacs TextEditor
%endif
cp %{buildroot}%{_datadir}/applications/emacs.desktop %{buildroot}%{_datadir}/applications/emacs-gtk2.desktop
sed -i -e 's/Emacs/GNU Emacs (GTK+2)/g' \
       -e 's/Exec=emacs/Exec=emacs-gtk2/g' %{buildroot}%{_datadir}/applications/emacs-gtk2.desktop
%if 0%{?rhel} > 6 || 0%{?fedora} || 0%{?suse_version}
mv %{buildroot}%{_datadir}/applications/emacs.desktop %{buildroot}%{_datadir}/applications/emacs-gtk3.desktop
sed -i -e 's/Emacs/GNU Emacs (GTK+3)/g' \
       -e 's/Exec=emacs/Exec=emacs-gtk3/g' %{buildroot}%{_datadir}/applications/emacs-gtk3.desktop
%else
rm %{buildroot}%{_datadir}/applications/emacs.desktop
%endif
%if 0%{?suse_version} >= 1300
touch %{buildroot}%{_bindir}/ctags %{buildroot}%{_mandir}/man1/ctags.1.gz
%else
rm -vf %{buildroot}%{_bindir}/etags
rm -vf %{buildroot}%{_bindir}/gnuctags
rm -vf %{buildroot}%{_mandir}/man1/gnuctags.1*
%endif
rm -rf %{buildroot}%{_infodir}/info.info.gz

%pre
test -L usr/bin/emacs && rm -f usr/bin/emacs || true

%post -n emacsdev-nox
if test -e usr/share/emacs/site-lisp/auctex/font-latex.elc ; then
  owd=$(pwd)
  cd usr/share/emacs/site-lisp/auctex || exit 1
  emacs -batch -no-site-file -no-init-file --eval '(setq load-path (cons "." load-path)
    byte-compile-warnings nil
    TeX-lisp-directory "<none>"
    TeX-auto-global "<none>")' -f batch-byte-compile font-latex.el > /dev/null 2>&1
  cd $owd
fi

%post -n emacsdev-x11
if test -e usr/share/emacs/site-lisp/auctex/font-latex.elc ; then
  owd=$(pwd)
  cd usr/share/emacs/site-lisp/auctex || exit 1
  emacs -batch -no-site-file -no-init-file --eval '(setq load-path (cons "." load-path)
    byte-compile-warnings nil
    TeX-lisp-directory "<none>"
    TeX-auto-global "<none>")' -f batch-byte-compile font-latex.el > /dev/null 2>&1
  cd $owd
fi

%post info
for f in %info_files; do
  test -e "$f" || f="${f}.info"
  %install_info --info-dir=%{_infodir} "%{_infodir}/$f.gz"
done

%postun info
for f in %info_files; do
  test -e "$f" || f="${f}.info"
  %install_info_delete --info-dir=%{_infodir} "%{_infodir}/$f.gz"
done

%if 0%{?suse_version} >= 1300
%post -n etagsdev
test -L %{_bindir}/ctags || rm -f %{_bindir}/ctags
%{_sbindir}/update-alternatives --quiet --force --install \
	  %{_bindir}/ctags		ctags	%{_bindir}/gnuctags 10 \
  --slave %{_mandir}/man1/ctags.1.gz	ctags.1	%{_mandir}/man1/gnuctags.1.gz
%{_sbindir}/update-alternatives --auto ctags

%preun -n etagsdev
if test $1 -eq 0 ; then
    %{_sbindir}/update-alternatives --quiet --remove ctags %{_bindir}/gnuctags
fi
%endif

%files -f site-lisp.lst -n emacsdev
%defattr(-, root, root)
%config /etc/skel/.gnu-emacs
%{_bindir}/ebrowse
%{_bindir}/emacs
%{_bindir}/emacsclient
%dir %{_prefix}/lib/emacs/
%dir %{_prefix}/lib/emacs/%{version}/
%dir %{_prefix}/lib/emacs/%{version}/*-suse-linux*/
%{_prefix}/lib/emacs/%{version}/*-suse-linux*/hexl
%{_prefix}/lib/emacs/%{version}/*-suse-linux*/movemail
%{_prefix}/lib/emacs/%{version}/*-suse-linux*/profile
%{_prefix}/lib/emacs/%{version}/*-suse-linux*/rcs2log
%{_prefix}/lib/emacs/%{version}/*-suse-linux*/update-game-score
%dir %{_docdir}/emacs/
%{_docdir}/emacs/doc
%dir %{_datadir}/emacs/
%dir %{_datadir}/emacs/%{version}/
%dir %{_datadir}/emacs/%{version}/etc/
%doc %{_datadir}/emacs/%{version}/etc/AUTHORS
%doc %{_datadir}/emacs/%{version}/etc/CENSORSHIP
%doc %{_datadir}/emacs/%{version}/etc/COPYING
%doc %{_datadir}/emacs/%{version}/etc/DEBUG
%doc %{_datadir}/emacs/%{version}/etc/DEVEL.HUMOR
%doc %{_datadir}/emacs/%{version}/etc/DISTRIB
%{_datadir}/emacs/%{version}/etc/DOC
%doc %{_datadir}/emacs/%{version}/etc/*-NEWS
%doc %{_datadir}/emacs/%{version}/etc/ETAGS.EBNF
%doc %{_datadir}/emacs/%{version}/etc/ETAGS.README
%doc %{_datadir}/emacs/%{version}/etc/FTP
%doc %{_datadir}/emacs/%{version}/etc/GNU
%doc %{_datadir}/emacs/%{version}/etc/HELLO
%doc %{_datadir}/emacs/%{version}/etc/HISTORY
%doc %{_datadir}/emacs/%{version}/etc/JOKES
%doc %{_datadir}/emacs/%{version}/etc/LINUX-GNU
%doc %{_datadir}/emacs/%{version}/etc/MACHINES
%doc %{_datadir}/emacs/%{version}/etc/MORE.STUFF
%{_datadir}/emacs/%{version}/etc/NEWS
%doc %{_datadir}/emacs/%{version}/etc/NEWS.*
%doc %{_datadir}/emacs/%{version}/etc/NEXTSTEP
%doc %{_datadir}/emacs/%{version}/etc/ORDERS
%doc %{_datadir}/emacs/%{version}/etc/PROBLEMS
%doc %{_datadir}/emacs/%{version}/etc/README
%doc %{_datadir}/emacs/%{version}/etc/TERMS
%doc %{_datadir}/emacs/%{version}/etc/THE-GNU-PROJECT
%doc %{_datadir}/emacs/%{version}/etc/TODO
%doc %{_datadir}/emacs/%{version}/etc/WHY-FREE
%dir %{_datadir}/emacs/%{version}/etc/charsets/
%{_datadir}/emacs/%{version}/etc/charsets/*.map
%doc %{_datadir}/emacs/%{version}/etc/charsets/README
%{_datadir}/emacs/%{version}/etc/*.txt
%dir %{_datadir}/emacs/%{version}/etc/e/
%doc %{_datadir}/emacs/%{version}/etc/e/README
%{_datadir}/emacs/%{version}/etc/e/eterm-color
%{_datadir}/emacs/%{version}/etc/e/eterm-color.ti
%{_datadir}/emacs/%{version}/etc/edt-user.el
%{_datadir}/emacs/%{version}/etc/emacs-buffer.gdb
%{_datadir}/emacs/%{version}/etc/emacs.appdata.xml
%{_datadir}/emacs/%{version}/etc/emacs.icon
%dir %{_datadir}/emacs/%{version}/etc/forms/
%doc %{_datadir}/emacs/%{version}/etc/forms/README
%{_datadir}/emacs/%{version}/etc/forms/*.dat
%{_datadir}/emacs/%{version}/etc/forms/*.el
%{_datadir}/emacs/%{version}/etc/future-bug
%dir %{_datadir}/emacs/%{version}/etc/gnus/
%{_datadir}/emacs/%{version}/etc/gnus/gnus-setup.ast
%{_datadir}/emacs/%{version}/etc/gnus/news-server.ast
%dir %{_datadir}/emacs/%{version}/etc/images/
%{_datadir}/emacs/%{version}/etc/images/README
%{_datadir}/emacs/%{version}/etc/images/*.pbm
%{_datadir}/emacs/%{version}/etc/images/*.xpm
%{_datadir}/emacs/%{version}/etc/images/*.png
%{_datadir}/emacs/%{version}/etc/images/*.svg
%dir %{_datadir}/emacs/%{version}/etc/images/custom/
%doc %{_datadir}/emacs/%{version}/etc/images/custom/README
%{_datadir}/emacs/%{version}/etc/images/custom/*.pbm
%{_datadir}/emacs/%{version}/etc/images/custom/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/ezimage/
%doc %{_datadir}/emacs/%{version}/etc/images/ezimage/README
%{_datadir}/emacs/%{version}/etc/images/ezimage/*.pbm
%{_datadir}/emacs/%{version}/etc/images/ezimage/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/gnus/
%doc %{_datadir}/emacs/%{version}/etc/images/gnus/README
%{_datadir}/emacs/%{version}/etc/images/gnus/*.pbm
%{_datadir}/emacs/%{version}/etc/images/gnus/*.xbm
%{_datadir}/emacs/%{version}/etc/images/gnus/*.xpm
%{_datadir}/emacs/%{version}/etc/images/gnus/*.png
%{_datadir}/emacs/%{version}/etc/images/gnus/*.svg
%dir %{_datadir}/emacs/%{version}/etc/images/gud/
%doc %{_datadir}/emacs/%{version}/etc/images/gud/README
%{_datadir}/emacs/%{version}/etc/images/gud/*.pbm
%{_datadir}/emacs/%{version}/etc/images/gud/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/icons/
%doc %{_datadir}/emacs/%{version}/etc/images/icons/README
%{_datadir}/emacs/%{version}/etc/images/icons/allout-widgets/
%{_datadir}/emacs/%{version}/etc/images/icons/hicolor/
%dir %{_datadir}/emacs/%{version}/etc/images/low-color/
%doc %{_datadir}/emacs/%{version}/etc/images/low-color/README
%{_datadir}/emacs/%{version}/etc/images/low-color/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/mail/
%doc %{_datadir}/emacs/%{version}/etc/images/mail/README
%{_datadir}/emacs/%{version}/etc/images/mail/*.pbm
%{_datadir}/emacs/%{version}/etc/images/mail/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/mpc/
%doc %{_datadir}/emacs/%{version}/etc/images/mpc/README
%{_datadir}/emacs/%{version}/etc/images/mpc/*.pbm
%{_datadir}/emacs/%{version}/etc/images/mpc/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/newsticker/
%doc %{_datadir}/emacs/%{version}/etc/images/newsticker/README
%{_datadir}/emacs/%{version}/etc/images/newsticker/rss-feed.*
%{_datadir}/emacs/%{version}/etc/images/newsticker/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/smilies/
%doc %{_datadir}/emacs/%{version}/etc/images/smilies/README
%{_datadir}/emacs/%{version}/etc/images/smilies/*.pbm
%{_datadir}/emacs/%{version}/etc/images/smilies/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/smilies/grayscale/
%doc %{_datadir}/emacs/%{version}/etc/images/smilies/grayscale/README
%{_datadir}/emacs/%{version}/etc/images/smilies/grayscale/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/smilies/medium/
%doc %{_datadir}/emacs/%{version}/etc/images/smilies/medium/README
%{_datadir}/emacs/%{version}/etc/images/smilies/medium/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/tree-widget/
%dir %{_datadir}/emacs/%{version}/etc/images/tree-widget/default/
%doc %{_datadir}/emacs/%{version}/etc/images/tree-widget/default/README
%{_datadir}/emacs/%{version}/etc/images/tree-widget/default/*.png
%{_datadir}/emacs/%{version}/etc/images/tree-widget/default/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/images/tree-widget/folder/
%doc %{_datadir}/emacs/%{version}/etc/images/tree-widget/folder/README
%{_datadir}/emacs/%{version}/etc/images/tree-widget/folder/*.png
%{_datadir}/emacs/%{version}/etc/images/tree-widget/folder/*.xpm
%dir %{_datadir}/emacs/%{version}/etc/nxml/
%doc %{_datadir}/emacs/%{version}/etc/nxml/README
%{_datadir}/emacs/%{version}/etc/nxml/*.el
%{_datadir}/emacs/%{version}/etc/nxml/*.xml
%{_datadir}/emacs/%{version}/etc/*.ps
%dir %{_datadir}/emacs/%{version}/etc/org/
%{_datadir}/emacs/%{version}/etc/org/*.xml
%doc %{_datadir}/emacs/%{version}/etc/org/README
%{_datadir}/emacs/%{version}/etc/package-keyring.gpg
%{_datadir}/emacs/%{version}/etc/publicsuffix.txt.gz
%dir %{_datadir}/emacs/%{version}/etc/refcards/
%{_datadir}/emacs/%{version}/etc/refcards/Makefile
%doc %{_datadir}/emacs/%{version}/etc/refcards/README
%doc %{_datadir}/emacs/%{version}/etc/refcards/*.pdf
%doc %{_datadir}/emacs/%{version}/etc/refcards/*.tex
%doc %{_datadir}/emacs/%{version}/etc/refcards/*.eps
%doc %{_datadir}/emacs/%{version}/etc/refcards/*.sty
%dir %{_datadir}/emacs/%{version}/etc/schema/
%doc %{_datadir}/emacs/%{version}/etc/schema/README
%{_datadir}/emacs/%{version}/etc/schema/*.rnc
%{_datadir}/emacs/%{version}/etc/schema/*.xml
%{_datadir}/emacs/%{version}/etc/ses-example.ses
%{_datadir}/emacs/%{version}/etc/spook.lines
%dir %{_datadir}/emacs/%{version}/etc/srecode/
%{_datadir}/emacs/%{version}/etc/srecode/*.srt
%dir %{_datadir}/emacs/%{version}/etc/themes/
%{_datadir}/emacs/%{version}/etc/themes/*.el
%dir %{_datadir}/emacs/%{version}/etc/tutorials/
%{_datadir}/emacs/%{version}/etc/tutorials/TUTORIAL
%{_datadir}/emacs/%{version}/etc/tutorials/TUTORIAL.*
%{_datadir}/emacs/%{version}/etc/yow.lines
%dir %{_datadir}/emacs/%{version}/lisp/
%{_datadir}/emacs/%{version}/lisp/COPYING
%doc %{_datadir}/emacs/%{version}/lisp/README
%dir %{_datadir}/emacs/%{version}/lisp/calc/
%dir %{_datadir}/emacs/%{version}/lisp/calendar/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/ede/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/analyze/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/bovine/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/decorate/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/symref/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/wisent/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/srecode/
%dir %{_datadir}/emacs/%{version}/lisp/emacs-lisp/
%dir %{_datadir}/emacs/%{version}/lisp/emulation/
%dir %{_datadir}/emacs/%{version}/lisp/erc/
%dir %{_datadir}/emacs/%{version}/lisp/eshell/
%dir %{_datadir}/emacs/%{version}/lisp/gnus/
%dir %{_datadir}/emacs/%{version}/lisp/international/
%doc %{_datadir}/emacs/%{version}/lisp/international/README
%dir %{_datadir}/emacs/%{version}/lisp/language/
%dir %{_datadir}/emacs/%{version}/lisp/leim/
%dir %{_datadir}/emacs/%{version}/lisp/leim/ja-dic/
%dir %{_datadir}/emacs/%{version}/lisp/leim/quail/
%dir %{_datadir}/emacs/%{version}/lisp/mail/
%dir %{_datadir}/emacs/%{version}/lisp/mh-e/
%dir %{_datadir}/emacs/%{version}/lisp/net/
%dir %{_datadir}/emacs/%{version}/lisp/nxml/
%dir %{_datadir}/emacs/%{version}/lisp/obsolete/
%dir %{_datadir}/emacs/%{version}/lisp/org/
%dir %{_datadir}/emacs/%{version}/lisp/play/
%dir %{_datadir}/emacs/%{version}/lisp/progmodes/
%dir %{_datadir}/emacs/%{version}/lisp/term/
%doc %{_datadir}/emacs/%{version}/lisp/term/README
%dir %{_datadir}/emacs/%{version}/lisp/textmodes/
%dir %{_datadir}/emacs/%{version}/lisp/url/
%dir %{_datadir}/emacs/%{version}/lisp/vc/
%dir %{_datadir}/emacs/%{version}/site-lisp/
%dir %{_datadir}/emacs/%{version}/site-lisp/term/
%{_datadir}/emacs/%{version}/lisp/*.el
%{_datadir}/emacs/%{version}/lisp/*.elc
%{_datadir}/emacs/%{version}/lisp/*/*.el
%{_datadir}/emacs/%{version}/lisp/*/*.elc
%{_datadir}/emacs/%{version}/lisp/*/*/*.el
%{_datadir}/emacs/%{version}/lisp/*/*/*.elc
%{_datadir}/emacs/%{version}/lisp/*/*/*/*.elc
%{_datadir}/emacs/%{version}/site-lisp/*.el
%{_datadir}/emacs/%{version}/site-lisp/*/*.el
%dir %{_datadir}/emacs/site-lisp/
%dir %{_datadir}/emacs/site-lisp/site-start.d
%{_mandir}/man1/*.1.gz
%exclude %{_mandir}/man1/*tags.1.gz
%dir %{_localstatedir}/games/emacs/
%{_localstatedir}/games/emacs/snake-scores
%{_localstatedir}/games/emacs/tetris-scores

%files       -n emacsdev-nox
%defattr(-, root, root)
%{_bindir}/emacs-nox

%files       -n emacsdev-x11
%defattr(-, root, root)
%{_bindir}/emacs-x11
%dir %{appDefaultsDir}
%{appDefaultsFile}
%dir %{_datadir}/appdata
%{_datadir}/appdata/emacs.appdata.xml
%{_datadir}/pixmaps/emacs.png
%{_datadir}/icons/hicolor

%files       -n emacsdev-gtk2
%{_bindir}/emacs-gtk2
%{_datadir}/applications/emacs-gtk2.desktop

%if 0%{?rhel} > 6 || 0%{?fedora} || 0%{?suse_version}
%files       -n emacsdev-gtk3
%{_bindir}/emacs-gtk3
%{_datadir}/applications/emacs-gtk3.desktop
%endif

%files       -n emacsdev-info
%defattr(-, root, root)
%doc %{_infodir}/*.gz

%files       -n emacsdev-el
%defattr(-, root, root)
%dir %{_datadir}/emacs/
%dir %{_datadir}/emacs/%{version}/
%dir %{_datadir}/emacs/%{version}/lisp/
%dir %{_datadir}/emacs/%{version}/lisp/calc/
%dir %{_datadir}/emacs/%{version}/lisp/calendar/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/ede/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/analyze/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/bovine/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/decorate/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/symref/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/semantic/wisent/
%dir %{_datadir}/emacs/%{version}/lisp/cedet/srecode/
%dir %{_datadir}/emacs/%{version}/lisp/emacs-lisp/
%dir %{_datadir}/emacs/%{version}/lisp/emulation/
%dir %{_datadir}/emacs/%{version}/lisp/erc/
%dir %{_datadir}/emacs/%{version}/lisp/eshell/
%dir %{_datadir}/emacs/%{version}/lisp/gnus/
%dir %{_datadir}/emacs/%{version}/lisp/international/
%dir %{_datadir}/emacs/%{version}/lisp/language/
%dir %{_datadir}/emacs/%{version}/lisp/leim/
%dir %{_datadir}/emacs/%{version}/lisp/leim/ja-dic/
%dir %{_datadir}/emacs/%{version}/lisp/leim/quail/
%dir %{_datadir}/emacs/%{version}/lisp/mail/
%dir %{_datadir}/emacs/%{version}/lisp/mh-e/
%dir %{_datadir}/emacs/%{version}/lisp/net/
%dir %{_datadir}/emacs/%{version}/lisp/nxml/
%dir %{_datadir}/emacs/%{version}/lisp/obsolete/
%dir %{_datadir}/emacs/%{version}/lisp/org/
%dir %{_datadir}/emacs/%{version}/lisp/play/
%dir %{_datadir}/emacs/%{version}/lisp/progmodes/
%dir %{_datadir}/emacs/%{version}/lisp/term/
%dir %{_datadir}/emacs/%{version}/lisp/textmodes/
%dir %{_datadir}/emacs/%{version}/lisp/url/
%dir %{_datadir}/emacs/%{version}/lisp/vc/
%{_datadir}/emacs/%{version}/lisp/*.el.gz
%{_datadir}/emacs/%{version}/lisp/*/*.el.gz
%{_datadir}/emacs/%{version}/lisp/*/*/*.el.gz
%{_datadir}/emacs/%{version}/lisp/*/*/*/*.el.gz

%if 0%{?suse_version} >= 1300
%files -n etagsdev
%defattr(-,root,root)
%doc etc/ETAGS.EBNF
%doc etc/ETAGS.README
%{_bindir}/etags
%{_bindir}/gnuctags
%{_mandir}/man1/etags.1.gz
%{_mandir}/man1/gnuctags.1.gz
%ghost %attr(755,root,root) %{_bindir}/ctags
%ghost %{_mandir}/man1/ctags.1.gz
%endif

%changelog