Proposed SIG: Windows MinGW cross-compiler SIG

Ralf Corsepius rc040203 at freenet.de
Fri Jul 11 09:37:16 UTC 2008


On Fri, 2008-07-11 at 09:48 +0100, Richard W.M. Jones wrote:
> On Thu, Jul 10, 2008 at 12:05:02PM +0100, Daniel P. Berrange wrote:
> > On Tue, Jul 08, 2008 at 08:32:26PM +0100, Richard W.M. Jones wrote:
> > > 
> > >   +%define __os_install_post /usr/lib/rpm/brp-compress %{nil}
> > > 
> > > Using ordinary /usr/bin/strip on MinGW lib*.a files not only doesn't
> > > work, but actually corrupts the files. 

My hack to work around this issues (and others related to brp-* stuff)
is this hack:

...
%define _use_internal_dependency_generator 0
...
%build
...
%install
...
# Extract %%__os_install_post into os_install_post~
cat << \EOF > os_install_post~
%__os_install_post
EOF

# Generate customized brp-*scripts
cat os_install_post~ | while read a x y; do
case $a in
# Prevent brp-strip* from trying to handle foreign binaries
*/brp-strip*)
  b=$(basename $a)
  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
  chmod a+x $b
  ;;
# Fix up brp-compress to handle %%_prefix != /usr
*/brp-compress*)
  b=$(basename $a)
  sed -e 's,\./usr/,.%{_prefix}/,g' < $a > $b
  chmod a+x $b
  ;;
esac
done

sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
  -e 's,^[ ]*/usr/lib/rpm.*/brp-compress,./brp-compress,' \
< os_install_post~ > os_install_post 
%define __os_install_post . ./os_install_post


cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
#!/bin/sh
grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/%tool_target/(lib|include|sys-root)' \
  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/%tool_target/' | %__find_provides
EOF
chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
%define __find_provides %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides


cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
#!/bin/sh
grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/%tool_target/(lib|include|sys-root)' \
  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/%tool_target/' | %__find_requires
EOF
chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
%define __find_requires %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires


I know, this looks ugly (and it is), but guess you can get the idea:
Dynamically hackuping rpm's brp-* and find-* scripts to not mistreat
files. Works quite well for me, even on non-Fedora-distros and
non-RH-distros.


Ralf





More information about the devel mailing list