Automatic dependency generation and lots more goodness.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 4 Sep 2008 18:03:19 +0000 (19:03 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 4 Sep 2008 18:03:19 +0000 (19:03 +0100)
filesystem/mingw-defs [new file with mode: 0644]
filesystem/mingw-filesystem.spec
filesystem/mingw-find-provides.sh [new file with mode: 0755]
filesystem/mingw-find-requires.sh [new file with mode: 0755]
filesystem/mingw-macros.mingw

diff --git a/filesystem/mingw-defs b/filesystem/mingw-defs
new file mode 100644 (file)
index 0000000..b5e8cf2
--- /dev/null
@@ -0,0 +1,8 @@
+# Some standard definitions %-included at the top of most
+# of the MinGW RPM spec files.
+
+%define __strip %{_mingw_strip}
+%define __objdump %{_mingw_objdump}
+%define _use_internal_dependency_generator 0
+%define __find_requires /usr/lib/rpm/mingw-find-requires.sh
+%define __find_provides /usr/lib/rpm/mingw-find-provides.sh
index c91e5a9..a3839ed 100644 (file)
@@ -1,7 +1,7 @@
 %define debug_package %{nil}
 
 Name:           mingw-filesystem
-Version:        2
+Version:        14
 Release:        1%{?dist}
 Summary:        MinGW base filesystem and environment
 
@@ -15,10 +15,17 @@ Source0:        mingw-COPYING
 Source1:        mingw-macros.mingw
 Source2:        mingw.sh
 Source3:        mingw.csh
+Source4:        mingw-find-requires.sh
+Source5:        mingw-find-provides.sh
+Source6:        mingw-defs
 
 Requires:       setup
 Requires:       rpm
 
+# These are actually provided by Windows itself, or Wine.
+Provides:       mingw(msvcrt.dll)
+Provides:       mingw(kernel32.dll)
+
 
 %description
 This package contains the base filesystem layout, RPM macros and
@@ -76,6 +83,10 @@ mkdir -p $RPM_BUILD_ROOT%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man{
 # /usr/i686-pc-mingw32/sys-root/mingw/doc
 # but these are both packaging bugs.
 
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/rpm
+install -m 0755 %{SOURCE4} %{SOURCE5} $RPM_BUILD_ROOT%{_libdir}/rpm
+install -m 0644 %{SOURCE6} $RPM_BUILD_ROOT%{_libdir}/rpm
+
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -88,9 +99,28 @@ rm -rf $RPM_BUILD_ROOT
 %config(noreplace) %{_sysconfdir}/profile.d/mingw.sh
 %config(noreplace) %{_sysconfdir}/profile.d/mingw.csh
 %{_prefix}/i686-pc-mingw32/
+%{_libdir}/rpm/mingw-*
 
 
 %changelog
+* Mon Sep  4 2008 Richard W.M. Jones <rjones@redhat.com> - 14-1
+- Fix path to mingw-find-requires/provides scripts.
+
+* Mon Sep  4 2008 Richard W.M. Jones <rjones@redhat.com> - 12-1
+- Put CFLAGS on a single line to avoid problems in some configure scripts.
+
+* Mon Sep  4 2008 Richard W.M. Jones <rjones@redhat.com> - 10-1
+- Provides certain base Windows DLLs (not literally).
+
+* Mon Sep  4 2008 Richard W.M. Jones <rjones@redhat.com> - 9-1
+- Include RPM dependency generators and definitions.
+
+* Mon Sep  4 2008 Richard W.M. Jones <rjones@redhat.com> - 4-1
+- Add _mingw_cc/cflags/etc. and _mingw_configure macros.
+
+* Mon Sep  4 2008 Richard W.M. Jones <rjones@redhat.com> - 3-1
+- Add _mingw_host macro.
+
 * Mon Sep  4 2008 Richard W.M. Jones <rjones@redhat.com> - 2-1
 - Add _mingw_sysroot macro.
 - Add _mingw_target macro.
diff --git a/filesystem/mingw-find-provides.sh b/filesystem/mingw-find-provides.sh
new file mode 100755 (executable)
index 0000000..2815896
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# This script reads filenames from STDIN and outputs any relevant provides
+# information that needs to be included in the package.
+
+if [ "$1" ]
+then
+   package_name="$1"
+fi
+
+[ -z "$OBJDUMP" ] && OBJDUMP=i686-pc-mingw32-objdump
+
+filelist=`sed "s/['\"]/\\\&/g"`
+
+dlls=$(echo $filelist | tr [:blank:] '\n' | grep '\.dll')
+
+for f in $dlls; do
+    basename=`basename $f | tr [:upper:] [:lower:]`
+    echo "mingw($basename)"
+done
diff --git a/filesystem/mingw-find-requires.sh b/filesystem/mingw-find-requires.sh
new file mode 100755 (executable)
index 0000000..1a63fc3
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# This script reads filenames from STDIN and outputs any relevant provides
+# information that needs to be included in the package.
+
+if [ "$1" ]
+then
+   package_name="$1"
+fi
+
+[ -z "$OBJDUMP" ] && OBJDUMP=i686-pc-mingw32-objdump
+
+filelist=`sed "s/['\"]/\\\&/g"`
+
+dlls=$(echo $filelist | tr [:blank:] '\n' | grep '\.dll')
+
+for f in $dlls; do
+    $OBJDUMP -p $f | grep 'DLL Name' | grep -Eo '[[:alnum:]_]+\.dll' |
+        tr [:upper:] [:lower:] |
+        sed 's/\(.*\)/mingw(\1)/'
+done | sort -u
index 58c133e..2f8947e 100644 (file)
 %_mingw_includedir        %{_mingw_prefix}/include
 
 # Build macros.
+%_mingw_host              i686-pc-mingw32
 %_mingw_target            i686-pc-mingw32
+
+# Note: all flags must be on a single line.
+%_mingw_cflags            -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -I%{_mingw_includedir}
+
+%_mingw_cc               i686-pc-mingw32-gcc
+%_mingw_cpp              i686-pc-mingw32-gcc -E
+%_mingw_ar               i686-pc-mingw32-ar
+%_mingw_ranlib           i686-pc-mingw32-ranlib
+%_mingw_strip            i686-pc-mingw32-strip
+%_mingw_objdump                  i686-pc-mingw32-objdump
+
+%_mingw_configure \
+  CC="%{_mingw_cc}" \
+  CFLAGS="%{_mingw_cflags}" \
+  ./configure --build=%_build --host=%{_mingw_host} --target=%{_mingw_target}