# You should first call rpmbuild with this .spec file in the usual manner # to create a binary package. # There are two ways if you want to have in addition the emacs-devel package # which contains the .el lisp source files: # 1. You can call rpmbuild with the option --define="with_devel 1". # The disadvantage of this method is that the emacs-devel package created # this way is architecture-dependent although it should be actuallly # "noarch". To avoid this use the other method: # 2. If you call rpmbuild with the option --target=noarch, then *only* the # emacs-devel*.noarch.rpm package is generated. # To avoid unnecessary recompilation in this step, if you created the # binary emacs before (and the build directory still contains the data # from this build), the data from the build directory is reused instead # of recompiling. # If you use the option --define="fake 1", it is always attempted to use the # data from the build directory (--target=noarch implicitly sets this option). %define info_files ada-mode autotype ccmode cl calc dired-x eudc ebrowse ediff elisp emacs efaq eintr emacs-xtra eshell forms gnus idlwave info mh-e emacs-mime message pcl-cvs reftex sc ses smtpmail speedbar tramp vip viper widget woman %define commongroup Productivity/Editors/Emacs %ifnarch noarch %define WITH_DEVEL %{?with_devel:%with_devel}%{!?with_devel:0} %else %define WITH_DEVEL 1 %endif Summary: Emacs - currently the best editor Name: emacs License: GPL Group: %{commongroup} PreReq: fileutils %install_info_prereq Autoreqprov: on Obsoletes: ctags emacs-nox emacs-x11 emacs-info elisp-manual emacs-lisp-intro ge_exec ge_site emac_nox emacmisc emacsbin emacsger ge_info ge_lisp Provides: ge_site ge_exec emacs_program emacs-info ctags elisp-manual emacs-x11 emacs-lisp-intro Version: 21.3.50 Release: mv.3.SuSE9.2 Packager: Martin Väth Source0: %{name}-%{version}.tar.bz2 #NoSource: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Prefix: %{_prefix} %description The lisp operating system with an editor. %package devel Summary: Emacs - the .el source files Group: %{commongroup} Requires: emacs = %{version} %description devel The lisp operating system with an editor. This package contains the source .el files. These files are usually not needed if you want to use emacs, but they may be useful when you customize emacs. %prep umask 022 test -n '%{buildroot}' || { echo "Must use buildroot" ; exit 1 ; } %if %{?fake:%fake}%{!?fake:0} BUILDFAKE=1 test -e "$RPM_BUILD_DIR"/%{name}-%{version}/src/emacs %else %ifarch noarch if [ -e "$RPM_BUILD_DIR"/%{name}-%{version}/src/emacs ]; then BUILDFAKE=1 else BUILDFAKE= fi %else BUILDFAKE= %endif %endif if [ -n "$BUILDFAKE" ]; then %setup -T -D -c else %setup -c chmod -R u+w,a+rX,go-w * test -d %{name}-%{version} && mv %{name}-%{version}/* . test -d %{name} && mv %{name}/* . fi %build umask 022 cd "$RPM_BUILD_DIR"/%{name}-%{version} if [ ! -e "$RPM_BUILD_DIR"/%{name}-%{version}/src/emacs ]; then ADDFLAGS="-pipe" # -DSYSTEM_PURESIZE_EXTRA=25000 \ # -DSITELOAD_PURESIZE_EXTRA=10000 \ # -D_GNU_SOURCE export CFLAGS="${CFLAGS:-%optflags} $ADDFLAGS" export CXXFLAGS="${CXXFLAGS:-%optflags} $ADDFLAGS" export CPPFLAGS="$CXXFLAG" export LDFLAGS=-s %configure --with-x --with-x-toolkit=gtk --with-pop --with-system-malloc \ --with-xpm --with-jpeg --with-tiff --with-gif --with-png \ --prefix='/usr' \ --bindir='%{_bindir}' --infodir='%{_infodir}' --mandir='%{_mandir}' \ --datadir='%{_datadir}' --libexecdir='%{_libdir}' \ --localstatedir='/var' --sharedstatedir='/var/lib' make bootstrap fi %install umask 022 cd "$RPM_BUILD_DIR"/%{name}-%{version} test -n '%{buildroot}' test -d '%{buildroot}' && rm -rf '%{buildroot}' #make DESTDIR='%{buildroot}' install make install prefix='%{buildroot}/usr' infodir='%{buildroot}%{_infodir}' \ mandir='%{buildroot}%{_mandir}' datadir='%{buildroot}%{_datadir}' \ libexecdir='%{buildroot}%{_libdir}' bindir='%{buildroot}%{_bindir}' \ localstatedir='%{buildroot}/var' sharedstatedir='%{buildroot}/var/lib' chmod -t,a+rx '%{buildroot}%{_bindir}'/* test -e '%{buildroot}%{_bindir}/%{name}-%{version}' && \ ln -sf '%{name}-%{version}' '%{buildroot}%{_bindir}/%{name}' # Let emacs-el.lst/emacs-el.fil be the list of all el-files in # %{_datadir}/emacs for which a corresponding elc-file exists. # Let emacs.lst/emacs.fil be the list of all remaining files. # Moreover, emacs.lst also contains the directories (with the dir-prefix) # and emacs.lst and emacs-el.lst start with defattr(-,root,root). find '%{buildroot}%{_datadir}/emacs' -type f | \ sed 's!^%{buildroot}!!' | sort > 'emacs.fil' grep '\.elc$' 'emacs.fil' | sed 's/c$//' > 'emacs-el.fil' comm -2 -3 'emacs.fil' 'emacs-el.fil' > 'emacs.lst' mv 'emacs.lst' 'emacs.fil' { echo %'defattr(-,root,root)' find '%{buildroot}%{_datadir}/emacs' -type d | \ sed 's!^%{buildroot}!%'dir' !' cat 'emacs.fil' } > 'emacs.lst' { echo %'defattr(-,root,root)' ; cat 'emacs-el.fil' ; } > 'emacs-el.lst' %ifnarch noarch # Compress infodir and manpages rm -f '%{buildroot}%{_infodir}/dir' gzip -9f '%{buildroot}%{_infodir}'/* gzip -9f '%{buildroot}%{_mandir}'/man*/* # install desktop file %suse_update_desktop_file -i emacs TextEditor %if %{WITH_DEVEL} %else # delete all *.el files for which a corresponding *.elc exists: find '%{buildroot}' -name "*.elc" -type f | sed 's/c$//' | xargs rm -f # sed 's!^!%{buildroot}!' 'emacs-el.fil' | xargs rm -f %endif %else # delete everything in emacs.fil and # everything which is not in %{_datadir}/emacs sed 's!^!%{buildroot}!' 'emacs.fil' | xargs rm -f find '%{buildroot}' -type f | \ sed '\!^%{buildroot}%{_datadir}/emacs! d' | xargs rm -f find '%{buildroot}' -type d | { xargs rmdir -p ; true ; } %endif rm 'emacs.fil' 'emacs-el.fil' %post for f in %info_files; do %install_info --info-dir='%{_infodir}' '%{_infodir}'/"$f.gz" done %postun for f in %info_files; do %install_info_delete --info-dir='%{_infodir}' '%{_infodir}'/"$f.gz" done %clean test -n '%{buildroot}' -a -d '%{buildroot}' && rm -rf '%{buildroot}' %ifnarch noarch %files -f emacs.lst %defattr(-,root,root) %doc COPYING README AUTHORS BUGS MAINTAINERS ChangeLog %{_bindir}/* %{_infodir}/* %{_mandir}/man1/* %{_libdir}/emacs /var/games/emacs /usr/share/applications/emacs.desktop #dir %{_datadir}/emacs #dir %{_datadir}/emacs/site-lisp #{_datadir}/emacs/site-lisp/* #{_datadir}/emacs/%{version} %endif %if %{WITH_DEVEL} %files devel -f emacs-el.lst %defattr(-,root,root) %endif %changelog * Sun Aug 29 2004 Martin Väth - Collect .el files into a new package * Fri Jul 16 2004 Martin Väth - built from scratch