Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1584981
 поиск   регистрация   авторизация 
 
Группа :: Редакторы
Пакет: emacs22

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

# -*- coding: utf-8; mode: rpm-spec -*-
# $Id: emacs22.spec,v 1.57 2006/06/14 06:45:20 eugene Exp $

%define cvsdate 20060614
%define emacs_version 22.0.50
%define cvsversion 22.0.50.1
%define gnus_version 5.11
%define shortname emacs
%define tramp_version 2.0.53
%define speedbar_version 1.0
%define erc_version 5.1.2
%define alternatives_version 0.1.0-alt2

# subpackages to build;

%def_enable nox
%def_enable athena
%def_enable gtk

# temporary disable build motif binary for x86_64

%ifarch x86_64
%def_disable motif
%else
%def_enable motif
%endif

Name: emacs22
Version: %emacs_version
Release: alt0.13.%cvsdate.M24.1

Group: Editors
Summary: GNU Emacs text editor
License: GPL

URL: http://www.gnu.org/software/emacs/


Source0: %shortname-%cvsdate.tar.bz2

# Included into upstream

# Source1: rsync://ftp.gnu.org/gnu/%shortname/leim-%version.tar.bz2

# Included into upstream

# Source2: TUTORIAL.ru
# Included into upstream
# Source3: smtpmail.el

Source7: README.KOI8-U

#Source110: http://prdownloads.sourceforge.net/php-mode/php-mode.el

#Source111: emacs-mode-php.site-start.el

# Source12: gnu-mini.xpm

# Source13: gnu-normal.xpm
# Source14: gnu-large.xpm

# from Serhij Hlodin

Source16: CHANGES.ukr
Source17: INSTALL.ukr
Source18: README.UK

Source24: %name-nox.alternatives
Source25: %name-athena.alternatives
Source26: %name-motif.alternatives
Source27: %name-gtk.alternatives

# Mdk's and ALT's global configs merged: the X resources

Source31: %shortname-22.0.50-alt0.1-xresources-ALT

# List of some large .elc files to be compressed:

#Source40: %shortname-21.2-el-to-compress.ls

Source41: emacs21-rus-win-keyboard-alt2.el

Source50: README.ALT-ru_RU.KOI8-R
Source51: check-shadows

Source60: %name.desktop

################### Patches  ##########################

# ALT's libtinfo; POSIX locks via fcntl convention:
Patch0: %shortname-22.0.50-alt-system.patch

# Try to load also bzipped2 .el/.elc files

# as well as with gzipped and uncompressed variants (supported before)
# Patch1: %shortname-21.2-alt14-load-el_bz2.patch
# Instead of load-el_bz2 patch short patch to modify default value
# of jka-compr-load-suffixes:
Patch1: %shortname-22.0.50-alt0.10-jka-compr_bz2_load.patch

# isn't applied (21.2-alt1): indicator is already disabled in the GNU release:

# Patch2: %shortname-21.1-enc-kb-short-indicator.patch

Patch3: %shortname-22.0.50-alt0.7-clipboard.patch

# We don't want the whole pkg depend on rcs

# just because someone may want to use it:
Patch4: %shortname-22.0.50-hide-rcs-deps.patch

Patch5: %shortname-22.0.50-Meta-Alt-Ctrl-Hyper-super-discard-state.patch

# already freshest

# Patch6: %shortname-21.2-HEAD-pc-select.diff
Patch7: %shortname-22.0.50-pc-select-private-mark.patch
# Merged into upstream
# Patch8: %shortname-21.2-ediff-diff-options-check-c.patch
# Disabled
# Patch10: %shortname-22.0.50-face-font-selection-slant-important.patch
# Fixes from CVS - not needed for CVS sources
# Patch11: %shortname-21.3-use-handler-for-load-of-absolute.patch
# Patch12: %shortname-21.3-use-handler-for-load-of-suffixed.patch

# FIXME

# Patch13: %shortname-21.3-vc-cvs-registered-autoload-parts.patch

Patch14: %shortname-22.0.50-rh-no_rpath.patch
# Merged into upstream
# Patch15: %shortname-21.2-x86_64.patch

# New fix for finding aspell dictionaries. This is only replace

# elements in ispell-dictionary-alist for dictionaries that found
# .dat file
# Patch16: %shortname-22.0.50-ispell-nofind_dict.patch
# Merged in upstream
# Patch16: %shortname-22.0.50-ispell-find_noclean.patch

# These two patches make the real work for ukrainisation:

Patch20: %shortname-22.0.50-alt0.9-uk.patch
Patch21: leim-22.0.50-uk.patch
Patch22: leim-22.0.50-belarusian.patch
# added belarussian and proprer russianw dictionary support
Patch23: %shortname-22.0.50-ispell-belarusian.patch
Patch24: %shortname-22.0.50-ispell-russianw.patch

Patch33: %shortname-22.0.50-alt0.4-more-cyrillic-support.patch
#Patch33: %shortname-21.2-alt10-cyrillic-cp-lang-envs.patch

# FIXME: Merged into upstream?

# Patch34: %shortname-21.1-lang-env-prereqs.patch

Patch35: %shortname-22.0.50-tutorial-ru.patch

# Bug with scroll-margin patch - fixed in upstream

# Patch40: %shortname-22.0.50-margin_scroll.patch

# Decode invalid encoded headers

Patch41: %shortname-22.0.50-gnus-invalid_decode.patch

# rms fix for flyspell-buffer - merged into upstream

# Patch45: %shortname-22.0.50-flyspell-tex_fix.patch
# fix for work with aspell in locale encoding other than dictionary encoding
Patch46: %shortname-22.0.50-ispell-aspell_noencode.patch

# Check save-place-alist elements after loading from ~/.emacs-places

Patch47: %shortname-22.0.50-saveplace_check_cell.patch

# Fix info installation

Patch50: %shortname-22.0.50-info_install.patch

# Increase PURESIZE

Patch55: %shortname-22.0.50-incr_puresize.patch

# Fix hooks.texi syntax - fixed in upstream

# Patch60: %shortname-22.0.50-hooks_texi-syntax.patch

# End of Patches #

##################

# We use awk for output parsing and error-msg detection:

BuildRequires(build): awk
# We use zme:
BuildRequires(install): bzip2-utils
# <term.h> is there since then:
BuildRequires(build): libtinfo >= 5.2.20020622-alt2
# Emacs now requires Texinfo version 4.2.
BuildRequires(build): texinfo >= 4.2

# %_configure_target must set --host= for a correct emacs build;

# added since then:
BuildRequires(build): rpm >= 4.0.4-alt12

# We need sendmail to properly dump emacs during bootstrap

BuildRequires(build): sendmail-common

# We need emacs-base

BuildPreReq: %shortname-base >= 0.0.4-alt2

BuildPreReq: python-base python-modules-compiler python-modules-encodings rpm-build-python rpm-build-compat

# el-pkgutils in emacs-base (=0.0.4). emacs-devel is for macrodefinions

BuildPreReq: %shortname-devel
# All emacs pkgs should be removed from the list.
# XFree86-devel or XFree86-devel-static?

BuildPreReq: tetex-core tetex-latex

# Strange build deps:

#BuildRequires: inews  postfix

# We need new alternatives system for build:

BuildPreReq: libalternatives-devel >= %alternatives_version

# Automatically added by buildreq on Mon Sep 05 2005

BuildRequires: ImageMagick alternatives aspell cvs ddd fontconfig freetype2 glib2-devel libXaw3d-devel libatk-devel cairo-devel libgtk+2-devel libjpeg-devel libpango-devel libpng-devel libtiff-devel libtinfo-devel libungif-devel openmotif-devel openssl pkgconfig postfix sox wget XFree86-devel XFree86-libs xpm-devel XFree86-locales zlib-devel

%description
Emacs is an extensible, customizable, self-documenting real-time
display editor.  Emacs contains special code editing features, an
extension language (Emacs Lisp), and the capability to read mail, news
and more without leaving the editor.

This package includes things you need to run the Emacs editor, so you
need to install this package if you intend to use Emacs.  You also
need to install the actual Emacs program package (%name-nox or
%name-X11).  Install %name-nox if you are not going to use the X
Window System; install %name-X11 if you will be using X.

#

%package common
Summary: Things needed to run the GNU Emacs text editor
Summary(ru_RU.UTF-8): п²п╣п╬п╠я┘п╬п╢п╦п╪п╬п╣ п╢п╩я▐ п╥п╟п©я┐я│п╨п╟ я┌п╣п╨я│я┌п╬п╡п╬пЁп╬ я─п╣п╢п╟п╨я┌п╬я─п╟ GNU Emacs
Group: Editors
Provides: %_libexecdir/%shortname
Obsoletes: %name
Obsoletes: %shortname-common
Provides: %shortname-common = %emacs_version-%release
# now emacs22 obsoletes emacs21
Obsoletes: emacs21-common
Provides: emacs21-common = %emacs_version-%release
# Common is useless without an Emacs binary:
Requires: %name = %emacs_version-%release
# speedbar now separate package
Requires: %shortname-speedbar

Requires: %shortname-base >= 0.0.4-alt2

Conflicts: etcskel < 2.0.2-alt1
Conflicts: emacs-prog-modes < 0.1-alt7
# ispell-uk 0.5 is broken, and can cause hang in flyspell mode
Conflicts: ispell-uk < 0.6-alt1
# emacs22 have tramp inside
Obsoletes: %shortname-tramp
Provides: %shortname-tramp = %tramp_version-%release
# emacs22 have ses inside
Obsoletes: %shortname-ses <= 1.0-alt2.031130
Provides: %shortname-ses = %emacs_version-%release
# emacs22 conflicts with old emacs-w3 (with url package inside)
Conflicts: %shortname-w3 <= 4.0-alt0.8.pre.47
Provides: %shortname-url = %emacs_version-%release
# gnuserv seems needed to be build with emacs22
Conflicts: %shortname-gnuserv <= 3.12.7-alt1

# otherwise we have heavy useless dependency on python

AutoReq: yes, nopython

%description common
GNU Emacs is an extensible, customizable, self-documenting real-time
display editor.  Emacs contains special code editing features, an
extension language (Emacs Lisp), and the capability to read mail, news
and more without leaving the editor.

This package includes things you need to run the Emacs editor, so you
need to install this package if you intend to use Emacs.  You also
need to install the actual Emacs program package (%name-nox or
%name-X11).  Install %name-nox if you are not going to use the X
Window System; install %name-X11 if you will be using X.

#

%package el
Summary: The sources for Lisp programs included with GNU Emacs
Summary(ru_RU.UTF-8): п≤я│я┘п╬п╢п╫я▀п╧ п╨п╬п╢ Lisp п©я─п╬пЁя─п╟п╪п╪, п©п╬я│я┌п╟п╡п╩я▐п╣п╪я▀я┘ я│ GNU Emacs
Group: Development/Other
Requires: %name-common = %emacs_version-%release
Obsoletes: %shortname-el
Provides: %shortname-el = %emacs_version-%release
# now emacs22 obsoletes emacs21
Obsoletes: emacs21-el
Provides: emacs21-el = %emacs_version-%release

%description el
Emacs-el contains the Emacs Lisp sources for many of the programs
included with the main GNU Emacs text editor package.

You need to install %name-el only if you intend to modify any of the
Emacs packages or see some Lisp examples.

If you need the sources for %name-leim, install %name-leim-el.

#

%package leim
Summary: GNU Emacs Lisp code for input methods for internationalization
Summary(ru_RU.UTF-8): п п╬п╢ GNU Emacs Lisp п╢п╩я▐ п╪п╣я┌п╬п╢п╬п╡ п╡п╡п╬п╢п╟
Group: Editors
Requires: %name-common = %emacs_version-%release
Obsoletes: %shortname-leim
Provides: %shortname-leim = %emacs_version-%release
# now emacs22 obsoletes emacs21
Obsoletes: emacs21-leim
Provides: emacs21-leim = %emacs_version-%release

%description leim
The Lisp code for input methods for various international scripts for GNU Emacs.

#

%package leim-el
Summary: The Emacs Lisp source code for input methods included in %name-leim
Summary(ru_RU.UTF-8): п≤я│я┘п╬п╢п╫я▀п╧ п╨п╬п╢ Lisp п╢п╩я▐ п╪п╣я┌п╬п╢п╬п╡ п╡п╡п╬п╢п╟, п©п╬я│я┌п╟п╡п╩я▐п╣п╪я▀я┘ я│ %name-leim
Group: Development/Other
Requires: %name-leim = %emacs_version-%release
Obsoletes: %shortname-leim-el
Provides: %shortname-leim-el = %emacs_version-%release
# now emacs22 obsoletes emacs21
Obsoletes: emacs21-leim-el
Provides: emacs21-leim-el = %emacs_version-%release

%description leim-el
Emacs-leim-el contains the Emacs Lisp sources for the Emacs Lisp code
for input methods for various international scripts of GNU Emacs.

You need to install %name-leim-el only if you intend to modify any of theses
GNU Emacs packages, see some Lisp examples or for reference for configuring your
localized input methods.

#

%if_enabled nox
%package nox
Summary: The GNU Emacs text editor without support for the X Window System
Summary(ru_RU.UTF-8): п╒п╣п╨я│я┌п╬п╡я▀п╧ я─п╣п╢п╟п╨я┌п╬я─ GNU Emacs п╠п╣п╥ п©п╬п╢п╢п╣я─п╤п╨п╦ X Window System
Group: Editors
PreReq: %name-common = %emacs_version-%release
Provides: %name = %emacs_version-%release
Provides: emacsen
Provides: %shortname = %emacs_version-%release
Obsoletes: %shortname-nox
Provides: %shortname-nox = %emacs_version-%release
# now emacs22 obsoletes emacs21
Obsoletes: emacs21-nox
Provides: emacs21-nox = %emacs_version-%release
# 0.2.0 for new alternatives format
PreReq: alternatives >= %alternatives_version

%description nox
Emacs-nox is the GNU Emacs text editor program without support for
the X Window System.

You need to install this package only if you plan on exclusively using
GNU Emacs without the X Window System (%name-X11-athena, %name-X11-motif,
%name-X11-gtk will work both in X and out of X, but %name-nox will only work
outside of X). You will also need to install the %name-common package in
order to run GNU Emacs.
%endif

#

%package X11
Summary: Things needed to run the GNU Emacs text editor in X Window System
Summary(ru_RU.UTF-8): п²п╣п╬п╠я┘п╬п╢п╦п╪п╬п╣ п╢п╩я▐ п╥п╟п©я┐я│п╨п╟ я─п╣п╢п╟п╨я┌п╬я─п╟ GNU Emacs п╡ X Window System
Group: Editors
PreReq: %name-common = %emacs_version-%release
Requires: emacs-X11-program
Conflicts: app-defaults < 0.2.1-alt1
Obsoletes: %shortname-X11

%description X11
This package includes things you need to run the Emacs editor in X Window
System, so you need to install this package if you intend to use Emacs with X
Window.  You also need to install the actual Emacs program package
(%name-X11-athena, %name-X11-motif or %name-X11-gtk). You will also need to
install the %name-common package in order to run GNU Emacs.

#

%if_enabled athena
%package X11-athena
Summary: The GNU Emacs text editor for the X Window System (athena)
Summary(ru_RU.UTF-8): п╒п╣п╨я│я┌п╬п╡я▀п╧ я─п╣п╢п╟п╨я┌п╬я─ GNU Emacs п╢п╩я▐ X Window System (athena)
Group: Editors
PreReq: %name-common = %emacs_version-%release
PreReq: %name-X11 = %emacs_version-%release
Provides: %name = %emacs_version-%release
Provides: emacsen
Provides: emacs-X11-program
Provides: %shortname = %emacs_version-%release
Provides: %shortname-X11 = %emacs_version-%release
# now emacs22 obsoletes emacs21
Obsoletes: emacs21-X11
Provides: emacs21-X11 = %emacs_version-%release
# 0.2.0 for new alternatives format
PreReq: alternatives >= %alternatives_version

%description X11-athena
Emacs-X11-athena includes the GNU Emacs text editor program for use with the X
Window System using athena widget set (it provides support for the mouse and
other GUI elements).  Emacs-X11-athena will also run GNU Emacs outside of X,
but it has a larger memory footprint than the 'non-X' GNU Emacs package
(%name-nox).

Install %name-X11-athena if you are going to use Emacs with the X Window
System and you like athena look.  You should also install %name-X11-athena if
you are going to run GNU Emacs both with and without X (it will work fine both
ways).  You will also need to install the %name-common and %name-X11 package
in order to run Emacs.
%endif

#

%if_enabled motif
%package X11-motif
Summary: The GNU Emacs text editor for the X Window System (motif)
Summary(ru_RU.UTF-8): п╒п╣п╨я│я┌п╬п╡я▀п╧ я─п╣п╢п╟п╨я┌п╬я─ GNU Emacs п╢п╩я▐ X Window System (motif)
Group: Editors
PreReq: %name-common = %emacs_version-%release
PreReq: %name-X11 = %emacs_version-%release
Provides: %name = %emacs_version-%release
Provides: emacsen
Provides: emacs-X11-program
Provides: %shortname = %emacs_version-%release
Provides: %shortname-X11 = %emacs_version-%release
# 0.2.0 for new alternatives format
PreReq: alternatives >= %alternatives_version

%description X11-motif
Emacs-X11-motif includes the GNU Emacs text editor program for use with the X
Window System using motif toolkit (it provides support for the mouse and
other GUI elements).  Emacs-X11-motif will also run GNU Emacs outside of X, but
it has a larger memory footprint than the 'non-X' GNU Emacs package
(%name-nox).

Install %name-X11-motif if you are going to use Emacs with the X Window
System and you like motif look.  You should also install %name-X11-motif if you
are going to run GNU Emacs both with and without X (it will work fine both
ways).  You will also need to install the %name-common and %name-X11 package in
order to run Emacs.
%endif

#

%if_enabled gtk
%package X11-gtk
Summary: The GNU Emacs text editor for the X Window System (gtk)
Summary(ru_RU.UTF-8): п╒п╣п╨я│я┌п╬п╡я▀п╧ я─п╣п╢п╟п╨я┌п╬я─ GNU Emacs п╢п╩я▐ X Window System (gtk)
Group: Editors
PreReq: %name-common = %emacs_version-%release
PreReq: %name-X11 = %emacs_version-%release
Provides: %name = %emacs_version-%release
Provides: emacsen
Provides: emacs-X11-program
Provides: %shortname = %emacs_version-%release
Provides: %shortname-X11 = %emacs_version-%release
# 0.2.0 for new alternatives format
PreReq: alternatives >= %alternatives_version

%description X11-gtk
Emacs-X11-gtk includes the GNU Emacs text editor program for use with the X
Window System using gtk+ toolkit v.2 (it provides support for the mouse and
other GUI elements).  Emacs-X11-gtk will also run GNU Emacs outside of X, but
it has a larger memory footprint than the 'non-X' GNU Emacs package
(%name-nox).

Install %name-X11-gtk if you are going to use Emacs with the X Window
System and you like gtk+ look.  You should also install %name-X11-gtk if you
are going to run GNU Emacs both with and without X (it will work fine both
ways).  You will also need to install the %name-common and %name-X11 package
in order to run Emacs.
%endif

#

%package elisp-manual
Summary: Emacs Lisp Manual
Summary(ru_RU.UTF-8): п═я┐п╨п╬п╡п╬п╢я│я┌п╡п╬ п©п╬ я▐п╥я▀п╨я┐ Emacs Lisp
Group: Editors
Requires: %name-common = %emacs_version-%release
# obsoletes old elisp-manual
Obsoletes: %shortname-elisp-manual <= 2.8-alt1
Provides: %shortname-elisp-manual = %emacs_version-%release

%description elisp-manual
This package contain full description of Emacs Lisp language

#

%package gnus
Version: %gnus_version
Summary: Gnus package for Emacs
Summary(ru_RU.UTF-8): п÷п╟п╨п╣я┌ Gnus п╢п╩я▐ Emacs
Group: Editors
Requires: %name-common = %emacs_version-%release
Conflicts: %shortname-ngnus
Provides: gnus
# obsoletes old gnus
Obsoletes: %shortname-gnus <= 5.10.6
Provides: %shortname-gnus = %gnus_version-%release

%description gnus
Gnus is a program for Emacs which enable read news and mail from Emacs.

All Emacs Lisp code is byte-copmpiled, install %name-gnus-el for sources.

#

%package gnus-el
Version: %gnus_version
Summary: The Emacs Lisp sources for bytecode included in %name-gnus
Summary(ru_RU.UTF-8): п≤я│я┘п╬п╢п╫я▀п╧ п╨п╬п╢ Lisp п╢п╩я▐ п╠п╟п╧я┌п╨п╬п╢п╟ п╦п╥ %name-gnus
Group: Development/Other
Requires: %name-common = %emacs_version-%release
Requires: %name-gnus = %gnus_version-%release
# obsoletes old gnus
Obsoletes: %shortname-gnus-el <= 5.10.6
Provides: %shortname-gnus-el = %gnus_version-%release

%description gnus-el
%name-gnus-el contains the Emacs Lisp sources for the bytecode
included in the %name-gnus package, that extends the Emacs editor.

You need to install %name-gnus-el only if you intend to modify any of the
%name-gnus code or see some Lisp examples.

#

%package speedbar
Version: %speedbar_version
Summary: Speedbar package for Emacs
Group: Editors
Requires: %name-common = %emacs_version-%release
Provides: speedbar
Provides: %shortname-speedbar = %speedbar_version-%release
# obsoletes old speedbar
Conflicts: %shortname-cedet <= 1.0-alt0.7.beta3b
Obsoletes: %shortname-cedet-speedbar <= 0.15beta2-alt0.8.beta3b
Provides: %shortname-cedet-speedbar = %speedbar_version-%release

%description speedbar
Speedbar - Everything browser for Emacs.

#

%package erc
Version: %erc_version
Summary: Emacs client for IRC
Summary(ru_RU.UTF-8): IRC п п╩п╦п╣п╫я┌ п╢п╩я▐ Emacs
Group: Networking/IRC
Requires: %name-common = %emacs_version-%release
Provides: %shortname-erc = %erc_version-%release
# obsoletes old emacs-erc
Obsoletes: %shortname-erc <= 5.0.4-alt1

%description erc
ERC is an IRC client for Emacs.

#

%package erc-el
Version: %erc_version
Summary: The Emacs Lisp sources for bytecode included in %name-erc
Summary(ru_RU.UTF-8): п≤я│я┘п╬п╢п╫я▀п╧ п╨п╬п╢ Lisp п╢п╩я▐ п╠п╟п╧я┌п╨п╬п╢п╟ п╦п╥ %name-erc
Group: Development/Other
Requires: %name-common = %emacs_version-%release
Requires: %name-erc = %erc_version-%release

%description erc-el
%name-erc-el contains the Emacs Lisp sources for the bytecode
included in the %name-erc package, that extends the Emacs editor.

You need to install %name-erc-el only if you intend to modify any of the
%name-erc code or see some Lisp examples.


%prep
%setup -q -n %shortname

%patch0 -p1
%patch1 -p1
# The indicator turned off in GNU's 21.2 release, the patch no needed so far.
# %patch2 -p1
%patch3 -p1

%patch4 -p1
%patch5 -p1 -b .ctrl
# %patch6 -p2
%patch7 -p1
# %patch8 -p1
# %patch10 -p1
# %patch11 -p1
# %patch12 -p1
# %patch13 -p1
%patch14 -p1
# %patch15 -p1

# FIXME Fixed?

# %patch16 -p1

# Ukrainian docs:

%__cp %SOURCE16 .
%__cp %SOURCE17 .
%__cp %SOURCE18 .
%__cp %SOURCE7 .

%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1

# add support for prereq-features of language-environment-info

# %patch34 -p1
# add CP*-based lang-envs and font support:
%patch33 -p1

%patch35 -p1

# Fixed in upstream

# %patch40 -p1

%patch41 -p1

# Merged into upstream

# %patch45 -p1
%patch46 -p1

%patch47 -p1

%patch50 -p1
%patch55 -p1
# %patch60 -p1

# support for russianw ispell dictionary is moved to Patch24


# README.ALT

%__cp %SOURCE50 .

perl -pi -e 's|(\.\./info/[[:alpha:]-]+)|$1.info|g' man/*
# rm -rf info/*

%define Substage printf 'Substage #%%s. %%s:\\n'

# We build two binaries (with X and without X support)

# in several symmetric substages.

%Substage 0 "Clear and create the build directories"
[ -d build-nox ] && %__rm -rf build-nox; %__mkdir_p build-nox
[ -d build-athena ] && %__rm -rf build-athena; %__mkdir_p build-athena
[ -d build-motif ] && %__rm -rf build-motif; %__mkdir_p build-motif
[ -d build-gtk ] && %__rm -rf build-gtk; %__mkdir_p build-gtk

%build
%__autoconf
# Try to detect errors and break on errors:
%define detect_elisp_errs 2>&1 | awk '/!! /{ r++; } END{ if (r) printf "There were %%d errors while recompiling Emacs Lisp modules.\\n", r; exit r; } /.*/'

# We do not want to use anything from an existing Emacs installation:

export EMACSLOADPATH="$(pwd)"/lisp

# we require at least one binary to use at substage 3 and later

%if_enabled gtk
 %define stage3bin gtk
%else
 %if_enabled athena
   %define stage3bin athena
 %else
   %if_enabled motif
     %define stage3bin motif
   %else
     %if_enabled nox
       %define stage3bin nox
     %else
       echo "ERROR: You disabled all %shortname binary subpackages!"
       echo "enable at least one (nox, athena, motif or gtk) binary subpackage."
       exit 11;
     %endif
   %endif
 %endif
%endif

%Substage 1 "Configure"

# we need Makefile for printable formats of elisp-manual

pushd lispintro
chmod 755 ./configure
%configure
popd
pushd lispref
%configure
popd

%define _configure_script ../configure
%if_enabled nox
pushd build-nox
%configure --sharedstatedir=/var --with-gcc --with-pop --with-x=no
popd
%endif
%if_enabled athena
pushd build-athena
%configure --sharedstatedir=/var --with-gcc --with-pop --with-x-toolkit=athena --with-png --with-jpeg --with-xpm --with-gif --with-tiff
popd
%endif
%if_enabled gtk
pushd build-gtk
%configure --sharedstatedir=/var --with-gcc --with-pop --with-x-toolkit=gtk --with-png --with-jpeg --with-xpm --with-gif --with-tiff
popd
%endif
%if_enabled motif
# export CFLAGS="%optflags -I%_prefix/X11R6/include"
# export LDFLAGS="-Wl,-L%_prefix/X11R6/%_lib"
pushd build-motif
%configure --sharedstatedir=/var --with-gcc --with-pop --with-x-toolkit=motif --with-png --with-jpeg --with-xpm --with-gif --with-tiff
popd
%endif

# MH-E autoloads fixed

# %__mkdir_p build-nox/lisp/mh-e
# %__mkdir_p build-athena/lisp/mh-e
# %__mkdir_p build-motif/lisp/mh-e
# %__mkdir_p build-gtk/lisp/mh-e

%Substage 2 "Initial make all"
#no SMP
%if_enabled nox
pushd build-nox; make bootstrap; popd
%endif
%if_enabled athena
pushd build-athena; make bootstrap; popd
%endif
%if_enabled motif
pushd build-motif; make bootstrap; popd
%endif
%if_enabled gtk
pushd build-gtk; make bootstrap; popd
%endif

%Substage 3 "Make supplementary (and important) things only once (asymmetricly)
(for possibly more capabilities -- in the X build)"

pushd build-%stage3bin
make -C man
{
   # Recompile so that the patches we have applied are effective:
   # The goal `updates' should update all the generated code
   # (autoloads, custom-deps etc.).
   # Also compile php-mode and the small new file for Cyrillic support.
   make -C lisp \
       updates \
       international/cyrillic-codepages-setup.elc \
       recompile
#       progmodes/php-mode.elc \
} %detect_elisp_errs
popd # build-%stage3bin

%Substage 4 "Final make all (now that we have all patched Lisp code compiled,
also a bit asymmetric), clean previous binaries"

%define override_from_stage3() if [ ! '%stage3bin'=='%{1}' ]; then rm -rf etc leim; %__ln_s -f ../build-%stage3bin/{etc,leim} . ; fi

# no SMP

%if_enabled athena
pushd build-athena
 # Override some data with more complete from the X build
 # (exactly the X variant of the data will be included in the package,
 # so emacs-athena has to work correctly in this environment):
 %override_from_stage3 athena
 %__rm -f src/emacs src/emacs-*
 make
popd
%endif
%if_enabled motif
pushd build-motif
 # Override some data with more complete from the X build
 # (exactly the X variant of the data will be included in the package,
 # so emacs-motif has to work correctly in this environment):
 %override_from_stage3 motif
 %__rm -f src/emacs src/emacs-*
 make
popd
%endif
%if_enabled nox
pushd build-nox
 # Override some data with more complete from the X build
 # (exactly the X variant of the data will be included in the package,
 # so emacs-nox has to work correctly in this environment):
 %override_from_stage3 nox
 %__rm -f src/emacs src/emacs-*
 make
popd
%endif
%if_enabled gtk
pushd build-gtk
 # Override some data with more complete from the X build
 # (exactly the X variant of the data will be included in the package,
 # so emacs-nox has to work correctly in this environment):
 %override_from_stage3 gtk
 %__rm -f src/emacs src/emacs-*
 make
popd
%endif

# printable formats of elisp-manual

pushd lispintro
     make emacs-lisp-intro.dvi
popd
pushd lispref
     make elisp.dvi
popd


%install
%__mkdir_p %buildroot%prefix
# GZIP_PROG= for disable compress installed .el files - this function better
# realized in el-pkgutils
%makeinstall -C build-%stage3bin GZIP_PROG=
%if_enabled nox
%__install -p -m755 build-nox/src/%shortname %buildroot%_bindir/%name-nox
%endif
%if_enabled athena
%__install -p -m755 build-athena/src/%shortname %buildroot%_bindir/%name-athena
%endif
%if_enabled motif
%__install -p -m755 build-motif/src/%shortname %buildroot%_bindir/%name-motif
%endif
%if_enabled gtk
%__install -p -m755 build-gtk/src/%shortname %buildroot%_bindir/%name-gtk
%endif
# remove the installed duplicate emacs binary
# -- it'll be a link managed by `alternatives':
%__rm -f %buildroot%_bindir/%shortname
%__rm -f %buildroot%_bindir/%shortname-%emacs_version

################

# Menu support #
################
%if_with menu
 %__install -d %buildroot%_menudir
 cat <<'EOF' > %buildroot%_menudir/%name-X11
?package(%name-X11): \
needs="X11" \
section="Applications/Editors" \
icon="%name.png" \
title="GNU Emacs 22" \
longtitle="Powerful editor from the GNU project" \
command="emacs-X11"
EOF
%else
 %__install -d %buildroot%_desktopdir
 %__install -p -m644  %SOURCE60 %buildroot%_desktopdir/%name.desktop
%endif
# backwards compatibility with Master 2x/Compact 30
%{?!_niconsdir:%define _niconsdir %_iconsdir}
# New emacs icons (from Andrew Zhilin)
%__install -p -m644 -D etc/images/icons/emacs_16.png %buildroot%_miconsdir/%name.png
%__install -p -m644 -D etc/images/icons/emacs_32.png %buildroot%_niconsdir/%name.png
%__install -p -m644 -D etc/images/icons/emacs_48.png %buildroot%_liconsdir/%name.png

# All the install's below have nothing to do with the Source directory

# So we want to make the command arguments shorter
# by replacing "%buildroot" with "."

pushd %buildroot # there will be a popd below

# leim's Makefile doesn't ignore .orig; remove them:

find .%_datadir/%shortname/%emacs_version/leim -type f -name '*.orig' -print0 \
    | xargs -0 rm -f

# Site start configuration:

# Link to a file provided by emacsen-startscripts pkg:
(cd .%_datadir/emacs/%emacs_version/lisp; %__ln_s ../../../../..%_sysconfdir/emacs/site-start.el)
# making start scripts
%__mkdir_p %buildroot%_emacs_sitestart_dir
%__install -p -m0644 %SOURCE41 %buildroot%_emacs_sitestart_dir/rus-win-keyboard.el

#######################

# Various other stuff #
#######################

# %__mkdir_p .%_libdir/%shortname/site-lisp


%__mv .%_mandir/man1/{,g}ctags.1
%__mv .%_bindir/{,g}ctags

# Exclude speedbar:

# %__rm -f .{%_datadir/%shortname/%emacs_version/lisp,%_infodir}/speedbar*

# Exclude antlr-mode:

# %__rm -f .%_datadir/%shortname/%emacs_version/lisp/progmodes/antlr-mode.el*

# Remove Gnus:

# %__rm -f .%_datadir/%shortname/%emacs_version/lisp/gnus/format-spec*
# %__rm -rf .%_datadir/%shortname/%emacs_version/lisp/gnus
# %__rm -f .%_infodir/{gnus,emacs-mime,message}*
# %__rm -rf .%_datadir/%shortname/%emacs_version/etc/gnus*

%__rm -f .%_infodir/info*
%__rm -f .%_infodir/dir

########################

# Alternatives support #
########################
%__install -d %buildroot%_altdir
%if_enabled nox
%__install -p -m644 %SOURCE24 %buildroot%_altdir/%name-nox
%endif
%if_enabled athena
%__install -p -m644 %SOURCE25 %buildroot%_altdir/%name-athena
%endif
%if_enabled motif
%__install -p -m644 %SOURCE26 %buildroot%_altdir/%name-motif
%endif
%if_enabled gtk
%__install -p -m644 %SOURCE27 %buildroot%_altdir/%name-gtk
%endif

###############

# X resources #
###############
xrdir=%_sysconfdir/X11/app-defaults
%__mkdir_p ."$xrdir"
%__install -p -m0644 %SOURCE31 ."$xrdir/Emacs"
unset xrdir

popd # "%buildroot"

#####################

# Create file lists #
#####################
# INFO
%define common_infos ada-mode,autotype,calc,ccmode,cl,dired-x,ebrowse,ediff,efaq,%shortname,eshell,eudc,flymake,forms,idlwave,mh-e,newsticker,org,pcl-cvs,pgg,rcirc,reftex,sc,ses,smtpmail,tramp,url,vip,viper,widget,woman
%define gnus_infos emacs-mime,gnus,message,sieve
%define gnus_infos_pattern gnus\\|emacs-mime\\|message\\|sieve
%define speedbar_infos_pattern speedbar
%define erc_infos_pattern erc
%define elisp_infos_pattern elisp\\|eintr

# source emacs pgktools (bash functions that call el-functions)

. %_libdir/%shortname/el-pkgutils.sh
EMACS_BIN="%name-%stage3bin"
EMACS_SEARCH_ROOT="%buildroot"
EL_PKGUTILS_ROOT=""
# Clear the lists:
%__rm -f {main,leim}{,-el}.ls info.ls

# Generate them:

# INFO
common_infos=( $(ls "%buildroot"%_infodir/*.info* \
| sed -e "s:^%buildroot%_infodir/::" \
| sed -e 's:\.info.*$::' | sort -u \
| egrep -v %gnus_infos_pattern \
| egrep -v %speedbar_infos_pattern \
| egrep -v %erc_infos_pattern \
| egrep -v %elisp_infos_pattern ) )

( # save IFS
IFS=,
if [[ '%common_infos' != "${common_infos[*]}" ]]; then
     echo "common_infos lists do not match, correct them!"
     exit 1
fi
) || false

# fraction \

#  '(dirs "%_libexecdir/%shortname/%emacs_version" "%%dir") "main.ls"' \
#  '(files "%_libexecdir/%shortname/%emacs_version"
#     (lambda(f) (if (string-match "/movemail$" f) "%%attr(-,root,mail)")) )
#   "main.ls"' \
#  \
#  '(dirs "%_datadir/%shortname/%emacs_version/etc" "%%dir") "main.ls"' \
#  '(files "%_datadir/%shortname/%emacs_version/etc"
#     (lambda(f) (if (string-match "gnus" f) "#")) )
#   "main.ls"'

find "%buildroot%_libexecdir/%shortname/%emacs_version" \
   "%buildroot%_datadir/%shortname/%emacs_version/etc" -type d -print \
   | awk '// {gsub ("%buildroot","",$0); print "%%dir " $0}' > main.ls
find "%buildroot%_libexecdir/%shortname/%emacs_version" -type f -print | awk '/\/movemail$/ { printf "%%attr(-,root,mail) "} // {gsub ("%buildroot","",$0); print $0}' >> main.ls
find "%buildroot%_datadir/%shortname/%emacs_version/etc" -type f -print | awk '/gnus/ { printf "#"} // {gsub ("%buildroot","",$0); print $0}' >> main.ls

standard_fraction_el_elc main "%_datadir/%shortname/%emacs_version/lisp"
standard_fraction_el_elc leim "%_datadir/%shortname/%emacs_version/leim"

# INFO

printf '%%s\n' %_infodir/{%common_infos}'.info*' >> main.ls
# mv %buildroot%_infodir/dir %buildroot%_infodir/elisp.dir

# Prepare the trick for linking etc/ into docs:

%__ln_s $(relative %_emacs_datadir/%emacs_version/etc %_docdir/%name-%emacs_version/etc) etc/

# Substitute emacs22-common with emacs-common for buildreq

%__mkdir_p %buildroot%_sysconfdir/buildreqs/packages/substitute.d
echo %shortname-common > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-common
# Substitute emacs22-leim with emacs-leim for buildreq
echo %shortname-leim > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-leim
# Substitute emacs22-gnus with emacs-gnus for buildreq
echo %shortname-gnus > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-gnus
# Substitute emacs22-X11.* with emacs-X11 for buildreq
echo %shortname-X11 > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-X11
%if_enabled athena
echo %shortname-X11 > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-X11-athena
%endif
%if_enabled motif
echo %shortname-X11 > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-X11-motif
%endif
%if_enabled gtk
echo %shortname-X11 > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-X11-gtk
%endif
%if_enabled nox
# Substitute emacs22-nox with emacs-nox for buildreq
echo %shortname-nox > %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-nox
%endif

# check-shadows script

%__install -p -m755 %SOURCE51 %buildroot%_bindir/check-shadows

# fix main.ls backup files list

%__subst '/\.bak$/d' *.ls

# Scripts


# common

%post common
%install_info {%common_infos}.info

%preun common
%uninstall_info {%common_infos}.info

# nox

%if_enabled nox
%post nox
%register_alternatives %name-nox

%preun nox
%unregister_alternatives %name-nox
%endif

%post X11
%update_menus

%postun X11
%clean_menus

# athena

%if_enabled athena
%post X11-athena
%register_alternatives %name-athena

%preun X11-athena
%unregister_alternatives %name-athena
%endif

# motif

%if_enabled motif
%post X11-motif
%register_alternatives %name-motif

%preun X11-motif
%unregister_alternatives %name-motif
%endif

# gtk

%if_enabled gtk
%post X11-gtk
%register_alternatives %name-gtk

%preun X11-gtk
%unregister_alternatives %name-gtk
%endif

# elisp-manual

%post elisp-manual
%install_info elisp.info
%install_info eintr.info

%preun elisp-manual
%uninstall_info elisp.info
%uninstall_info eintr.info

# gnus

%post gnus
%install_info gnus.info
%install_info message.info
%install_info emacs-mime.info
%install_info sieve.info

%preun gnus
%uninstall_info gnus.info
%uninstall_info message.info
%uninstall_info emacs-mime.info
%uninstall_info sieve.info

# speedbar

%post speedbar
%install_info speedbar.info

%preun speedbar
%uninstall_info speedbar.info

# erc

%post erc
%install_info erc.info

%preun erc
%uninstall_info erc.info

#

%files common -f main.ls
%doc AUTHORS BUGS README README.KOI8-U README.UK CHANGES.ukr INSTALL.ukr README.ALT-ru_RU.KOI8-R
# The trick for symlinking etc/:
%doc --no-dereference etc/etc

# %config(noreplace) %_sysconfdir/emacs/site-start.d/php.el


%_bindir/*
#%_bindir/b2m
#%_bindir/check-shadows
#%_bindir/ebrowse
#%_bindir/emacsclient
#%_bindir/etags
#%_bindir/gctags
#%_bindir/grep-changelog
#%_bindir/rcs-checkin
%if_enabled nox
%exclude %_bindir/%name-nox
%endif
%if_enabled athena
%exclude %_bindir/%name-athena
%endif
%if_enabled motif
%exclude %_bindir/%name-motif
%endif
%if_enabled gtk
%exclude %_bindir/%name-gtk
%endif

%_mandir/man?/*

%dir %_libexecdir/%shortname
# %dir %_libdir/%shortname/site-lisp

# For now game scores stored separately in each user's home directory

# %attr(2755, root, games) %_libdir/%shortname/%emacs_version/%_target_platform/update-game-score

#%dir %_emacslispdir

%_emacslispdir/*.el*
%dir %_emacs_datadir/%emacs_version
%dir %_emacs_datadir/%emacs_version/site-lisp
%_emacs_datadir/%emacs_version/site-lisp/*
%dir %_emacs_datadir/%emacs_version/leim

# Some .el-files that have .elc-companions,

# but are still preferrable to have in the main
# package (for reference) may be listed here:
#%_datadir/%name/%emacs_version/lisp/bindings.el -- probably there is no need for this
#%_datadir/%name/%emacs_version/lisp/mail/sc.el
#%_datadir/%name/%emacs_version/lisp/term-nasty.el

# This should be a symlink

%_emacs_datadir/%emacs_version/lisp/site-start.el

%exclude %_emacs_datadir/%emacs_version/etc/images/gnus
%exclude %_emacs_datadir/%emacs_version/etc/images/smilies

# speedbar into separate package

%exclude %_emacs_datadir/%emacs_version/lisp/dframe.elc
%exclude %_emacs_datadir/%emacs_version/lisp/sb-image.elc
%exclude %_emacs_datadir/%emacs_version/lisp/speedbar.elc
# erc into separate package
%exclude %_emacs_datadir/%emacs_version/lisp/erc/

%_emacs_sitestart_dir/*

# Game scores

# %dir %attr(775, games, games) %_localstatedir/games/%shortname
# %config(noreplace) %attr(664, games, games) %_localstatedir/games/%shortname/*

# Substitute for buidreq

%_sysconfdir/buildreqs/packages/substitute.d/%name-common

# %exclude %_infodir/dir

%exclude %_localstatedir/games/%shortname

#

%files el -f main-el.ls

#

%files leim -f leim.ls
# Substitute for buidreq
%_sysconfdir/buildreqs/packages/substitute.d/%name-leim

#

%files leim-el -f leim-el.ls

#

%if_enabled nox
%files nox
%_bindir/%name-nox
%_altdir/%name-nox
# Substitute for buidreq
%_sysconfdir/buildreqs/packages/substitute.d/%name-nox
%endif

#

%files X11
%config(noreplace) %_sysconfdir/X11/app-defaults/*
%if_with menu
 %_menudir/%name-X11
%else
 %_desktopdir/%name.desktop
%endif
# backwards compatibility with Master 2x/Compact 30
%{?!_niconsdir:%define _niconsdir %_iconsdir}
%_niconsdir/%name.png
%_miconsdir/%name.png
%_liconsdir/%name.png
# Substitute for buidreq
%_sysconfdir/buildreqs/packages/substitute.d/%name-X11

#

%if_enabled athena
%files X11-athena
%_bindir/%name-athena
%_altdir/%name-athena
# Substitute for buidreq
%_sysconfdir/buildreqs/packages/substitute.d/%name-X11-athena
%endif

#

%if_enabled motif
%files X11-motif
%_bindir/%name-motif
%_altdir/%name-motif
# Substitute for buidreq
%_sysconfdir/buildreqs/packages/substitute.d/%name-X11-motif
%endif

#

%if_enabled gtk
%files X11-gtk
%_bindir/%name-gtk
%_altdir/%name-gtk
# Substitute for buidreq
%_sysconfdir/buildreqs/packages/substitute.d/%name-X11-gtk
%endif

#

%files elisp-manual
%doc lispintro/emacs-lisp-intro.dvi lispref/elisp.dvi
%_infodir/eintr*
%_infodir/elisp*

#

%files gnus
%doc %_emacs_datadir/%emacs_version/etc/GNUS-NEWS
%doc lisp/gnus/ChangeLog*
%dir %_emacs_datadir/%emacs_version/lisp/gnus
%_emacs_datadir/%emacs_version/lisp/gnus/*.elc
%_emacs_datadir/%emacs_version/etc/gnus*
%_emacs_datadir/%emacs_version/etc/images/gnus/
%_emacs_datadir/%emacs_version/etc/images/smilies/
%_infodir/gnus*
%_infodir/message*
%_infodir/emacs-mime*
%_infodir/sieve*
# Substitute for buidreq
%_sysconfdir/buildreqs/packages/substitute.d/%name-gnus

#

%files gnus-el
%_emacs_datadir/%emacs_version/lisp/gnus/*.el.*

#

%files speedbar
%_emacs_datadir/%emacs_version/lisp/dframe.elc
%_emacs_datadir/%emacs_version/lisp/sb-image.elc
%_emacs_datadir/%emacs_version/lisp/speedbar.elc
%_infodir/speedbar*

#

%files erc
%dir %_emacs_datadir/%emacs_version/lisp/erc
%_emacs_datadir/%emacs_version/lisp/erc/*.elc
%_infodir/erc*

%files erc-el
%_emacs_datadir/%emacs_version/lisp/erc/*.el.*


%changelog

Полный changelog можно просмотреть здесь

 
design & coding: Vladimir Lettiev aka crux © 2004-2005