-%{__sed} -i -e 's|#!/bin/sh|#!/bin/bash|' test-suite/check
-%{__sed} -i -e 's|\(MAKE_TSOPTS=.*\) -s \(.*\)|\1 \2|' Makefile.build
+%{__sed} -ri '/FULLCONFIGDIR/s/OLDROOT|COQINSTALLPREFIX/&2/g' Makefile.install
+%{__sed} -i 's|-Wall.*-O2|%{rpmcflags} -Wno-unused|' configure.ml
+%{__sed} -i "s|-oc|-ccopt '%{rpmldflags}' -g &|" Makefile.build
+%{__sed} -i 's,-shared,& -g,g' tools/CoqMakefile.in Makefile.build
+
+%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+python3(\s|$),#!%{__python3}\1,' \
+ tools/make-both-single-timing-files.py \
+ tools/make-both-time-files.py \
+ tools/make-one-time-file.py
+
+%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+python2(\s|$),#!%{__python3}\1,' \
+ doc/tools/coqrst/notations/fontsupport.py