Am Freitag, 10. September 2004 16:06 schrieb Angus Leeming: > Georg Baum wrote: > >> Georg Baum wrote: > >>> %define frontdep @RPM_FRONTEND_DEPS@ %(eval > >>> %{_builddir}/%{name}-%{version}/development/find_dep) > >> > >> Can you not define it in the spec file itself? I have this in the spec > >> file for XForms (below). Can one not define arbitrary shell scripts in > >> a similar manner. > > > > I tried, but failed to create a macro with more than one line. You > > don't happen to have a working example? > > 'Fraid not. Try > > nttp://gmane.linux.redhat.rpm.general
I did that, and got some hints, although not all problems are solved. I circumvented the one line macro limitation via a temporary file that is created during the %prep stage. This works fine, but one problem still remains: rpm does not stop if the %prep script returns an error exit code. I don't know wether I am going to work on this further, since I am out of ideas. I have attached the current state in case somebody is interested. Georg
Index: config/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/ChangeLog,v retrieving revision 1.138 diff -u -r1.138 ChangeLog --- config/ChangeLog 29 Aug 2004 23:52:47 -0000 1.138 +++ config/ChangeLog 19 Sep 2004 06:46:00 -0000 @@ -1,3 +1,7 @@ +2004-09-15 Georg Baum <[EMAIL PROTECTED]> + + * lyxinclude.m4: set new variable RPM_VERSION_SUFFIX + 2004-08-30 Lars Gullik Bjonnes <[EMAIL PROTECTED]> * common.am: improve pch handling a tiny bit Index: config/lyxinclude.m4 =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/lyxinclude.m4,v retrieving revision 1.94 diff -u -r1.94 lyxinclude.m4 --- config/lyxinclude.m4 15 Aug 2004 21:45:23 -0000 1.94 +++ config/lyxinclude.m4 19 Sep 2004 06:46:01 -0000 @@ -41,8 +41,10 @@ ac_configure_args=`echo $ac_configure_args | sed "s,--with-version-suffix,--with-version-suffix=$withval,"` fi lyxname="lyx$withval" - program_suffix=$withval], + program_suffix=$withval + RPM_VERSION_SUFFIX="--with-version-suffix=$withval"], [lyxname=lyx]) +AC_SUBST(RPM_VERSION_SUFFIX) AC_MSG_RESULT([$lyxname]) ]) Index: development/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/development/ChangeLog,v retrieving revision 1.45 diff -u -r1.45 ChangeLog --- development/ChangeLog 19 Aug 2004 16:24:55 -0000 1.45 +++ development/ChangeLog 19 Sep 2004 06:46:01 -0000 @@ -1,3 +1,10 @@ +2004-09-15 Georg Baum <[EMAIL PROTECTED]> + + * lyx.spec.in: compute tex dependencies at build time to account + for different package names in different distributions + * lyx.spec.in: fix spec file if it is generated by + configure --with-version-suffix + 2004-08-19 José Matos <[EMAIL PROTECTED]> * FORMAT: document change to format 236. Index: development/lyx.spec.in =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/development/lyx.spec.in,v retrieving revision 1.19 diff -u -r1.19 lyx.spec.in --- development/lyx.spec.in 20 Feb 2003 20:45:22 -0000 1.19 +++ development/lyx.spec.in 19 Sep 2004 06:46:01 -0000 @@ -1,5 +1,8 @@ %define frontend @RPM_FRONTEND@ %define frontdep @RPM_FRONTEND_DEPS@ +%define version_suffix @RPM_VERSION_SUFFIX@ +%define dep_file %{_tmppath}/%{name}-%{version}-dependencies +%define find_dep %(eval cat %{dep_file}) Summary: A WYSIWYM (What You See Is What You Mean) frontend to LaTeX Name: @PACKAGE@ @@ -13,7 +16,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root Icon: %{name}.xpm Prefix: %{_prefix} -Requires: %{frontdep}, tetex-xdvi, tetex, tetex-latex +Requires: %{frontdep}, %{find_dep} Obsoletes: tetex-lyx %description @@ -38,11 +41,53 @@ %prep %setup +# find dependency information and output it to a file +# ideally this would be in the find_dep macro, but it seems to be impossible +# to define multi line macros in rpm. +( +packages="" +exe="" +# find latex package +for latex in "latex" "latex2e" "pplatex" +do + search=`which $latex 2>/dev/null` || continue + pkg=`rpm -q -f $search` || continue + packages=$pkg + exe=$search + break +done +if test "$packages" == ""; then + echo "Unable to find package providing a latex executable" >&2 + echo -n "Unable_to_find_package_providing_a_latex_executable" + exit 1 +fi +# find tetex package +exe=`which texconfig 2>/dev/null` +package=`rpm -q -f $exe` +if test "$package" == ""; then + echo "Unable to find tetex package" >&2 + echo -n "Unable_to_find_tetex_package" + exit 1 +fi +packages="$packages $package" +# find package containing xdvi +exe=`which xdvi 2>/dev/null` +package=`rpm -q -f $exe` +if test "$package" == ""; then + echo "Unable to find xdvi package" >&2 + echo -n "Unable_to_find_xdvi_package" + exit 1 +fi +packages="$packages $package" +echo -n "$packages" +) > %{dep_file} + %build unset LINGUAS || true ./configure --with-frontend=%{frontend} --prefix=%{_prefix} \ --mandir=%{_mandir} --bindir=%{_bindir} --datadir=%{_datadir} \ - --without-warnings --disable-debug --enable-optimization=-O2 + --without-warnings --disable-debug --enable-optimization=-O2 \ + %{version_suffix} make %install @@ -63,7 +110,8 @@ # # Miscellaneous files # -cp -a lib/images/%{name}.xpm ${RPM_BUILD_ROOT}%{_datadir}/%{name}/images/ +# Don't use %{name}.xpm, this will not work with --version-suffix +cp -a lib/images/lyx.xpm ${RPM_BUILD_ROOT}%{_datadir}/%{name}/images/ cp lib/reLyX/README README.reLyX %clean