#
-# Conditional build:
-%bcond_with mmx # MMX optimization
-# Optimization must be chosen at compile time :(
-# Maybe some patch...? But not yet.
-#
-%ifarch athlon
-%define with_mmx 1
+%ifarch i586 i686 athlon pentium2 pentium3 pentium4
+%define do_mmx 1
+%else
+%define do_mmx 0
+%endif
+%ifarch i586 i686
+%define do_mmxfb 1
+%define optmmxfb -DCPU_FALLBACK=1
+%else
+%define do_mmxfb 0
+%undefine optmmxfb
%endif
Summary: Password cracker
Summary(pl): £amacz hase³
%build
cd src
-# bleh... MMX code must be chosen at compile time :(
-# cannot use MMX for generic i586 nor i686 (Pentium/Pentium Pro have no MMX)
+%if %{do_mmxfb}
+%{__make} linux-x86-any \
+ CFLAGS="-c -Wall -fomit-frame-pointer %{rpmcflags} -DJOHN_SYSTEMWIDE=1" \
+ CC="%{__cc}"
+mv ../run/john ../run/john-non-mmx
+%{__make} clean
+%endif
+
%ifarch %{ix86}
- %if %{with mmx}
+ %if %{do_mmx}
TARG=linux-x86-mmx
%else
TARG=linux-x86-any
%endif
%{__make} $TARG \
- CFLAGS="-c -Wall -fomit-frame-pointer %{rpmcflags} -DJOHN_SYSTEMWIDE=1" \
+ CFLAGS="-c -Wall -fomit-frame-pointer %{rpmcflags} -DJOHN_SYSTEMWIDE=1 -DJOHN_SYSTEMWIDE_EXEC=\\\"%{_libdir}/john\\\" %{?optmmxfb}" \
CC="%{__cc}"
%install
install -d $RPM_BUILD_ROOT{%{_bindir},%{_datadir}/john}
install run/{*.conf,*.chr,*.lst} $RPM_BUILD_ROOT%{_datadir}/john
install run/john $RPM_BUILD_ROOT%{_bindir}
+%if %{do_mmxfb}
+install -d $RPM_BUILD_ROOT%{_libdir}/john
+install run/john-non-mmx $RPM_BUILD_ROOT%{_libdir}/john
+%endif
rm -f doc/INSTALL
%defattr(644,root,root,755)
%doc doc/* run/mailer
%attr(755,root,root) %{_bindir}/*
+%if %{do_mmxfb}
+%dir %{_libdir}/john
+%attr(755,root,root) %{_libdir}/john/john-non-mmx
+%endif
%{_datadir}/john