Re: Proposed SIG: Windows MinGW cross-compiler SIG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK, here is a 'fragment'.

What I have done is to take the current GnuTLS package from Fedora
Rawhide and patch it so that it generates a mingw-gnutls subpackage.
Attached to this message is the patch, and below I discuss the various
parts of the patch.

If you want to see the original vs modified spec files, go here:

  http://hg.et.redhat.com/misc/fedora-mingw--devel?cmd=manifest;manifest=91a808c59de63589367c7bd9750da1fca342c529;path=/gnutls-fragment/

Discussion of the patch follows below.

Rich.

  +%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.  Therefore we must disable
stripping.  I'd love to know how to force RPM to either ignore files
in certain directories, or to call the correct strip binary on them.
The original SRPMs that I was working with contained a very long and
hairy bit of code which apparently did this, but I wasn't daring
enough to include it.

  +%package -n mingw-gnutls
  +Summary:        MinGW Windows cross-compile of %{name} package
  +Group:          Development/Libraries
  +
  +BuildRequires:  mingw-gcc
  +BuildRequires:  mingw-binutils
  +BuildRequires:  mingw-libgpg-error
  +BuildRequires:  mingw-libgcrypt
  +
  +Requires:       mingw-runtime
  +Requires:       mingw-libgpg-error
  +Requires:       mingw-libgcrypt

Main package definition.  Note that we don't have any automatic
find-requires working at the moment, so we need to define dependent
packages explicitly.

   %build
  +mkdir build
  +pushd build
  +echo '../configure "$@"' > configure; chmod +x configure
   %configure --with-libtasn1-prefix=%{_prefix} \
              --with-included-libcfg \
              --disable-srp-authentication
   make
  +popd
  +
  +mkdir i686-pc-mingw32
  +pushd i686-pc-mingw32
  +CFLAGS="$RPM_OPT_FLAGS -fno-stack-protector" \
  +../configure \
  +  --build=%_build \
  +  --host=i686-pc-mingw32 \
  +  --prefix=%{_prefix}/i686-pc-mingw32/sys-root/mingw \
  +  --disable-cxx \
  +  --with-included-libtasn1 \
  +  --with-included-libcfg \
  +  --disable-srp-authentication
  +make
  +popd

I've split the build by configuring & building in two subdirectories,
ie. the general pattern is:

pushd build
../configure &c
popd
pushd i686-pc-mingw32
../configure --host=i686-pc-mingw32 &c
popd

Note the hack to make %configure work in a subdirectory.  Any easier way?

  +%files -n mingw-gnutls
  +%defattr(-,root,root)
  +%{_prefix}/i686-pc-mingw32/sys-root/mingw/bin/*
  +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/*
  +%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/*
  +%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/aclocal/*
  +%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/info/*
  +%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man1/*
  +%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man3/*

This is the filelist for the mingw-specific files.


-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
--- gnutls-original.spec	2008-07-08 18:45:02.000000000 +0100
+++ gnutls.spec	2008-07-08 20:08:19.000000000 +0100
@@ -1,7 +1,12 @@
+# XXX This prevents binaries from being stripped.  Using ordinary 'strip'
+# on a MinGW library actually corrupts the library, hence we must disable
+# this action.  However we would still like Fedora binaries to be stripped.
+%define __os_install_post /usr/lib/rpm/brp-compress %{nil}
+
 Summary: A TLS protocol implementation
 Name: gnutls
 Version: 2.4.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 # The libgnutls library is LGPLv2+, utilities and remaining libraries are GPLv3+
 License: GPLv3+ and LGPLv2+
 Group: System Environment/Libraries
@@ -33,6 +38,20 @@
 Group: Applications/System
 Requires: %{name} = %{version}-%{release}
 
+%package -n mingw-gnutls
+Summary:        MinGW Windows cross-compile of %{name} package
+Group:          Development/Libraries
+
+BuildRequires:  mingw-gcc
+BuildRequires:  mingw-binutils
+BuildRequires:  mingw-libgpg-error
+BuildRequires:  mingw-libgcrypt
+
+Requires:       mingw-runtime
+Requires:       mingw-libgpg-error
+Requires:       mingw-libgcrypt
+
+
 %description
 GnuTLS is a project that aims to develop a library which provides a secure 
 layer, over a reliable transport layer. Currently the GnuTLS library implements
@@ -52,6 +71,14 @@
 This package contains command line TLS client and server and certificate
 manipulation tools.
 
+%description -n mingw-gnutls
+GnuTLS is a project that aims to develop a library which provides a secure 
+layer, over a reliable transport layer. Currently the GnuTLS library implements
+the proposed standards by the IETF's TLS working group.
+This package contains a MinGW Windows cross-compiled library so that
+you can build programs that depend on GnuTLS library for Windows from
+a Fedora host.
+
 %prep
 %setup -q
 %patch1 -p1 -b .nosrp
@@ -61,13 +88,32 @@
 done
 
 %build
+mkdir build
+pushd build
+echo '../configure "$@"' > configure; chmod +x configure
 %configure --with-libtasn1-prefix=%{_prefix} \
            --with-included-libcfg \
            --disable-srp-authentication
 make
+popd
+
+mkdir i686-pc-mingw32
+pushd i686-pc-mingw32
+CFLAGS="$RPM_OPT_FLAGS -fno-stack-protector" \
+../configure \
+  --build=%_build \
+  --host=i686-pc-mingw32 \
+  --prefix=%{_prefix}/i686-pc-mingw32/sys-root/mingw \
+  --disable-cxx \
+  --with-included-libtasn1 \
+  --with-included-libcfg \
+  --disable-srp-authentication
+make
+popd
 
 %install
 rm -fr $RPM_BUILD_ROOT
+pushd build
 %makeinstall
 rm -f $RPM_BUILD_ROOT%{_bindir}/srptool
 rm -f $RPM_BUILD_ROOT%{_bindir}/gnutls-srpcrypt
@@ -78,9 +124,16 @@
 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
 rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
 %find_lang %{name}
+popd
+
+pushd i686-pc-mingw32
+make DESTDIR=$RPM_BUILD_ROOT install
+popd
 
 %check
+pushd build
 make check
+popd
 
 %clean
 rm -fr $RPM_BUILD_ROOT
@@ -99,7 +152,7 @@
    /sbin/install-info --delete %{_infodir}/gnutls.info.gz %{_infodir}/dir || :
 fi
 
-%files -f %{name}.lang
+%files -f build/%{name}.lang
 %defattr(-,root,root,-)
 %{_libdir}/*.so.*
 %doc COPYING COPYING.LIB README AUTHORS
@@ -122,7 +175,20 @@
 %{_bindir}/gnutls*
 %{_mandir}/man1/*
 
+%files -n mingw-gnutls
+%defattr(-,root,root)
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/bin/*
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/*
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/*
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/aclocal/*
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/info/*
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man1/*
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man3/*
+
 %changelog
+* Tue Jul  8 2008 Richard W.M. Jones <rjones@xxxxxxxxxx> 2.4.1-2
+- Build mingw-gnutls subpackage.
+
 * Tue Jul  1 2008 Tomas Mraz <tmraz@xxxxxxxxxx> 2.4.1-1
 - new upstream version
 - correct the license tag
-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux