-%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
-%define debug_package %{nil}
+%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
+%global debug_package %{nil}
Name: @PACKAGE_NAME@
Version: @PACKAGE_VERSION@
%install
-rm -rf $RPM_BUILD_ROOT
-
make DESTDIR=$RPM_BUILD_ROOT install
+%if %opt
# Remove bytecode library.
rm $RPM_BUILD_ROOT%{_libdir}/whenjobs/whenlib.cma
+%endif
# Strip binaries (why doesn't RPM do this?)
strip --strip-all $RPM_BUILD_ROOT%{_bindir}/whenjobs
%dir %{_libdir}/whenjobs
%{_libdir}/whenjobs/*.cmi
%{_libdir}/whenjobs/pa_when.cmo
+%if %opt
%{_libdir}/whenjobs/whenlib.cmxa
+%else
+%{_libdir}/whenjobs/whenlib.cma
+%endif
%{_mandir}/man1/*.1*
%{_mandir}/man8/*.8*