Hi all,

I didn't subscribe to the list since it has a huge volume of emails. I
might have missed some discussion on making LyX RPMs like lyx-common,
lyx-xforms and lyx-qt, though I did have checked the archive.

I modified the lyx.spec file from lyx-1.3.2 source tree so that it has
better relocation support and it builds separate packages, named
lyx-common, lyx-xforms, and lyx-qt. They can be installed together, or
separately (though lyx-xforms and lyx-qt will ask for lyx-common).

A shell script is also provided to pick an installed frontend. Here are
some situations, assuming lyx-common is installed

1. only lyx-qt installed: Type 'lyx' will give you the qt frontend

2. both lyx-xforms and lyx-qt installed: Type 'lyx' will give you the
xforms frontend, or see 3 for another case.

3. both installed and with environment var LYX_FRONTEND set to "qt":
Type 'lyx' will give you the qt frontend.

The design is flexible for more future frontends.

To support running lyx under the name lyx-xforms or lyx-qt while the
RPMs are not installed in the default locations, symbol links to
%_prefix/share/lyx are needed. That is, say, if lyx was compiled with
_prefix=/usr and relocated to /usr/local/lyx-1.3.2 when the RPM was
installed, lyx-qt expects lyxrc.defaults to be in
/usr/local/lyx-1.3.2/share/lyx-qt. LyX 1.4cvs seems to have a different
lyx_main.C and I am not sure if this is still needed for LyX 1.4.

Here I attach the lyx.spec and lyx-select.sh. The RPMs for RedHat Linux
9 are shared at http://apt.ling.li/rpms/. Release 1.3.2-4 uses pspell
while 1.3.2-3 doesn't. If you like either release, please put them in
LyX's ftp site since my machine could not afford (the possible) heavy
network traffic.

I noticed that there was a patch which allows to build several frontends
in the same tree. This will sure speed up the building process but I
haven't used it in my build.

--Ling
%define _latexdir %{_datadir}/texmf/tex/latex

Summary: LyX: A WYSIWYM document processor
Name: lyx
Version: 1.3.2
Release: 4.li
License: GPL
Group: Applications/Publishing
URL: http://www.lyx.org
Source0: ftp://ftp.lyx.org/pub/lyx/stable/%{name}-%{version}.tar.bz2
Source1: %{name}-%{version}-select.sh
Patch0: %{name}-%{version}-ui.patch
Packager: Ling Li <[EMAIL PROTECTED]>
Vendor: http://apt.ling.li
BuildRequires: gcc-c++ >= 2.96, pspell-devel
%define fe_requires %{name}-common = %{version}-%{release}, tetex-latex, tetex-xdvi, 
pspell
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Icon: %{name}.xpm
Prefix: %{_prefix}

%description
LyX is a modern approach to writing documents which breaks with the
obsolete "typewriter paradigm" of most other document preparation
systems.

It is designed for people who want professional quality output
with a minimum of time and effort, without becoming specialists in
typesetting.

The major innovation in LyX is WYSIWYM (What You See Is What You Mean).
That is, the author focuses on content, not on the details of formatting.
This allows for greater productivity, and leaves the final typesetting
to the backends (like LaTeX) that are specifically designed for the task.

With LyX, the author can concentrate on the contents of his writing,
and let the computer take care of the rest.

%package common
Summary: Common files of LyX (A WYSIWYM document processor)
Group: Applications/Publishing
Requires: tetex-latex, coreutils
Provides: %{name}
Obsoletes: tetex-lyx, %{name}

%description common
This package includes common files of LyX. To use LyX, you need also
install one or more frontends of LyX, such as lyx-xforms and lyx-qt.

LyX is a modern approach to writing documents which breaks with the
obsolete "typewriter paradigm" of most other document preparation
systems.

It is designed for people who want professional quality output
with a minimum of time and effort, without becoming specialists in
typesetting.

The major innovation in LyX is WYSIWYM (What You See Is What You Mean).
That is, the author focuses on content, not on the details of formatting.
This allows for greater productivity, and leaves the final typesetting
to the backends (like LaTeX) that are specifically designed for the task.

With LyX, the author can concentrate on the contents of his writing,
and let the computer take care of the rest.

%package xforms
Summary: XForms frontend of LyX (A WYSIWYM document processor)
Group: Applications/Publishing
BuildRequires: xforms-devel >= 1.0, xpm-devel >= 4.7
Requires: %fe_requires, xforms >= 1.0

%description xforms
This package includes the XForms frontend of LyX.
See package information of %{name}-common for more about LyX.

%package qt
Summary: Qt frontend of LyX (A WYSIWYM document processor)
Group: Applications/Publishing
BuildRequires: qt-devel >= 2.2.1
Requires: %fe_requires, qt >= 2.2.1

%description qt
This package includes the Qt frontend of LyX.
See package information of %{name}-common for more about LyX.

%prep
%setup -q
%patch -p1

%build
export QTDIR="/usr/lib/qt-3.1"
unset LINGUAS || true
%define optflags -O3 -march=%{_target_cpu} -mmmx -fno-exceptions
%define lyxflags --disable-warnings --disable-debug --with-pspell
%configure %{lyxflags} --with-frontend=xforms
%{__make}
%{__mv} src/%{name} src/%{name}-xforms
%{__make} clean  # It would speed up if we can do partial clean
%configure %{lyxflags} --with-frontend=qt
%{__make}

%install
unset LINGUAS || true
%{__rm} -rf ${RPM_BUILD_ROOT}
%makeinstall
%{__install} src/%{name}-* %{buildroot}%{_bindir}
%{__mv} %{buildroot}%{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}-qt
%{__install} %{SOURCE1} %{buildroot}%{_bindir}/%{name}
# To get around the LyX sysdir check, when RPM_DATADIR is not /usr/share
# we need a symbol link for each frontend:
%{__ln_s} %{name} %{buildroot}%{_datadir}/%{name}-xforms
%{__ln_s} %{name} %{buildroot}%{_datadir}/%{name}-qt

# Set up the lyx-specific class files where TeX can see them
%{__mkdir_p} ${RPM_BUILD_ROOT}%{_latexdir}
%{__mv} ${RPM_BUILD_ROOT}%{_datadir}/%{name}/tex \
        ${RPM_BUILD_ROOT}%{_latexdir}/%{name}

# Miscellaneous files
%{__cp} -a lib/images/%{name}.xpm ${RPM_BUILD_ROOT}%{_datadir}/%{name}/images/
%{__cp} -a lib/reLyX/README README.reLyX

%find_lang %name

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post common
# Make TeX understand where LyX-specific packages are
texhash

# Before configuring lyx for the local system
# Several pathes need to be updated / imported
_tmp="%{_prefix}";  _pre_len=${#_tmp}
_tmp="%{_datadir}"; RPM_DATADIR="$RPM_INSTALL_PREFIX${_tmp:$_pre_len}"
_tmp="%{_bindir}";  RPM_BINDIR="$RPM_INSTALL_PREFIX${_tmp:$_pre_len}"

if [ -f /etc/profile ]; then
    . /etc/profile
fi

# Now configure LyX
cd $RPM_DATADIR/%{name}
./configure --srcdir > /dev/null

# Fix reLyX if the datadir changes between rpmbuild and rpm install
if [ "%{_datadir}" != "$RPM_DATADIR" ]; then
    %{__perl} -pi -e "s!%{_datadir}/%{name}!$RPM_DATADIR/%{name}!" $RPM_BINDIR/reLyX
fi

%postun common
# Fix the TeX file hash
texhash

%files common -f %name.lang
%defattr(-,root,root)
%doc ABOUT-NLS ANNOUNCE COPYING
%doc README UPGRADING ChangeLog NEWS
%doc lib/CREDITS README.reLyX
%{_bindir}/%{name}
%{_bindir}/reLyX
%{_bindir}/noweb2lyx
%{_mandir}/man?/*
%{_datadir}/%{name}
%{_latexdir}/%{name}

%files xforms
%defattr(-,root,root)
%{_bindir}/%{name}-xforms
%{_datadir}/%{name}-xforms

%files qt
%defattr(-,root,root)
%{_bindir}/%{name}-qt
%{_datadir}/%{name}-qt

%changelog
* Tue Sep 16 2003 Ling Li <[EMAIL PROTECTED]> - 1.3.2-4.li
- Use pspell: automatically spell-check multi-language documents.
- Small layout changes (also used macro %find_lang).

* Mon Sep 15 2003 Ling Li <[EMAIL PROTECTED]> - 1.3.2-3.li
- Broke the package into lyx-common, lyx-xforms, and lyx-qt.
- Added a shell script to select an installed frontend.
- Better code for relocation (RPM_DATADIR and RPM_BINDIR).
- Revised package information.
- Get around the LyX sysdir check for non-standard datadir.

* Sun Sep 14 2003 Ling Li <[EMAIL PROTECTED]> 1.3.2-2
- Added macros for frontend qt.
- Replaced command names with predefined macros.

* Sat Sep 13 2003 Ling Li <[EMAIL PROTECTED]> 1.3.2-1.xforms
- Modified from lyx.spec of LyX 1.3.2.
- Require xforms instead of libforms.
- BuildRequires added.
- Small patch for user interface of LyX.
- More optimization for code generation.
- Better relocation code.
#!/bin/sh

# $Id: lyx-select.sh,v 1.3 2003/09/16 08:08:38 ling Exp $
# Check and select an installed LyX frontend to run.
#
#  * If only one frontend is installed, this one will be run;
#  * If no frontend is installed, prompt to install one;
#  * Otherwise, the one specified by the environment variable
#    LYX_FRONTEND will be run;
#  * Finally, if LYX_FRONTEND is empty, the first frontend in
#    LYX_ALL_FRONTENDS that is installed will be run.

NAME=lyx
KNOWN_FRONTENDS="xforms qt"

LYX_PATH=`dirname $0`

unset FFE FCMD;  # First frontend and its exec-file
for FE in ${LYX_ALL_FRONTENDS:=$KNOWN_FRONTENDS}; do
    # Try to find the frontend
    CMD=$NAME-$FE
    if [ -x "$LYX_PATH/$CMD" ]; then
        CMD="$LYX_PATH/$CMD";
    elif ! `which $CMD &> /dev/null`; then
        unset CMD
    fi
    if [ "$CMD" != "" ]; then
        FFE=${FFE:=$FE};
        FCMD=${FCMD:="$CMD"};
        if [ "$LYX_FRONTEND" = "$FE" ]; then
            FFE=$FE; FCMD="$CMD"; break;
        fi
    fi
done

if [ "$FFE" == "" ]; then
    echo "$0: No LyX frontends found! Please install at least one of" >&2
    echo -ne "\tthese packages:" >&2
    for FE in $KNOWN_FRONTENDS; do
        echo -n " "$NAME-$FE >&2
    done
    echo '.' >&2
    exit 1
elif [ "${LYX_FRONTEND:=$FFE}" != "$FFE" ]; then
    echo "$0: LYX_FRONTEND ($LYX_FRONTEND) not found. Use $NAME-$FFE." >&2
fi

IFS=''
exec "$FCMD" $*

Reply via email to