Le vendredi, 18 mars 2016, 18.43:41 Didier 'OdyX' Raboud a écrit :
> C) Get coreutils build a hashsums-win32 package containing cross-
> compiled win32 executables (as we're doing for gpgv-win32 and cpio-
> win32). It could also provide these files through byhand, to allow
> users to check images on Windows platforms themselves too [3].
Here would be the patches to build a (partial-) coreutils-win32 package.
The first patch's needed to make sure the two builds don't conflit with
eachother.
The second patch tries to cross-build everything, fails (as more patches
would be needed, but we don't care if we're only to build the *sum.exe
binaries), then builds the executables we want.
The package seems functional, at least under wine.
BUT… Making coreutils B-D-I on mingw-w64 is not really the type of
circular build dependency we enjoy, although this patch can certainly be
enhanced with build-profiles.
I'll see if I can follow Stephen's recommendation to use libgcrypt,
then, and file a formal bug against coreutils if that's the only way.
--
Cheers,
OdyX
>From e37afe1dfb02af7c9b14b1b3f91ecefcdd8d70d1 Mon Sep 17 00:00:00 2001
From: Didier Raboud <o...@debian.org>
Date: Fri, 18 Mar 2016 22:06:23 +0100
Subject: [PATCH 1/2] Use --builddirectory argument to dh_* to build
out-of-tree
---
debian/rules | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/debian/rules b/debian/rules
index 5b9a6bd..a7c3e48 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,10 +19,11 @@ BIN_PROGS = cat chgrp chmod chown cp date dd df dir echo false ln ls mkdir \
d=debian/coreutils
override_dh_auto_configure:
- dh_auto_configure -- --enable-install-program=arch
+ dh_auto_configure --builddirectory -- \
+ --enable-install-program=arch
%:
- dh $@
+ dh $@ --builddirectory
override_dh_auto_clean:
make distclean || true
@@ -31,7 +32,7 @@ override_dh_auto_test:
# tests fail a lot on the buildds
override_dh_auto_install:
- dh_auto_install --destdir=$(d)
+ dh_auto_install --builddirectory --destdir=$(d)
override_dh_install-arch:
dh_install -a
--
2.8.0.rc3
>From bbe47b3062801325ab14dcef9cc8e75c0a23d2ad Mon Sep 17 00:00:00 2001
From: Didier Raboud <o...@debian.org>
Date: Fri, 18 Mar 2016 22:29:12 +0100
Subject: [PATCH 2/2] Cross-build some hashsum executables to win32, in a
coreutils-win32 package
---
debian/control | 10 ++++
.../win32/00_allow_configure_to_succeed.patch | 31 ++++++++++++
debian/rules | 55 ++++++++++++++++++++--
3 files changed, 93 insertions(+), 3 deletions(-)
create mode 100644 debian/patches/win32/00_allow_configure_to_succeed.patch
diff --git a/debian/control b/debian/control
index 55b3f83..eae03bf 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Section: utils
Priority: required
Standards-Version: 3.9.6.0
Build-Depends: gettext (>= 0.10.37), debhelper (>= 9.20120115), autotools-dev, texinfo (>= 4.2), groff, libattr1-dev [linux-any], libacl1-dev [linux-any], libselinux1-dev (>= 1.32) [linux-any], gperf, bison
+Build-Depends-Indep: mingw-w64
Package: coreutils
Architecture: any
@@ -28,6 +29,15 @@ Description: GNU core utilities
uniq unlink users vdir wc who whoami yes
Homepage: http://gnu.org/software/coreutils
+Package: coreutils-win32
+Architecture: all
+Priority: extra
+Suggests: wine
+Description: selected GNU core utilities (win32 build)
+ This package contains some GNU core utilities built for Windows.
+ .
+ It contains md5sum.exe, and sha*sum.exe
+
Package: mktemp
Pre-Depends: coreutils (>= 7.4-1)
Depends: ${misc:Depends}
diff --git a/debian/patches/win32/00_allow_configure_to_succeed.patch b/debian/patches/win32/00_allow_configure_to_succeed.patch
new file mode 100644
index 0000000..0bfb19c
--- /dev/null
+++ b/debian/patches/win32/00_allow_configure_to_succeed.patch
@@ -0,0 +1,31 @@
+Description: Let the configure call finish
+Author: Didier Raboud <o...@debian.org>
+Last-Update: 2016-03-18
+
+diff --git a/configure b/configure
+index 4a6177f..8a98c2b 100755
+--- a/configure
++++ b/configure
+@@ -40686,7 +40686,8 @@ $as_echo "#define MOUNTED_INTERIX_STATVFS 1" >>confdefs.h
+ fi
+
+ if test -z "$ac_list_mounted_fs"; then
+- as_fn_error $? "could not determine how to read list of mounted file systems" "$LINENO" 5
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not determine how to read list of mounted file systems" >&5
++$as_echo "could not determine how to read list of mounted file systems" >&6; }
+ # FIXME -- no need to abort building the whole package
+ # Can't build mountlist.c or anything that needs its functions
+ fi
+diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4
+index 49f11be..91a420e 100644
+--- a/m4/ls-mntd-fs.m4
++++ b/m4/ls-mntd-fs.m4
+@@ -348,7 +348,7 @@ if test -z "$ac_list_mounted_fs"; then
+ fi
+
+ if test -z "$ac_list_mounted_fs"; then
+- AC_MSG_ERROR([could not determine how to read list of mounted file systems])
++ AC_MSG_RESULT([could not determine how to read list of mounted file systems])
+ # FIXME -- no need to abort building the whole package
+ # Can't build mountlist.c or anything that needs its functions
+ fi
diff --git a/debian/rules b/debian/rules
index a7c3e48..ba7833e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,9 +18,54 @@ BIN_PROGS = cat chgrp chmod chown cp date dd df dir echo false ln ls mkdir \
mktemp
d=debian/coreutils
-override_dh_auto_configure:
- dh_auto_configure --builddirectory -- \
- --enable-install-program=arch
+CONFIG_ARGS_COMMON = --enable-install-program=arch
+CONFIG_ARGS_W32 = --without-libintl-prefix \
+ --without-libiconv-prefix \
+ --enable-install-program=arch \
+ --enable-threads=windows \
+ --host=i686-w64-mingw32
+
+# Missing <sys/wait.h>, <pwd.h> or <grp.h>.
+MINGW32_UNBUILDABLE_SOURCES = lib/userspec.c lib/idcache.c lib/savewd.c
+MINGW32_PROGS = md5sum.exe sha1sum.exe sha224sum.exe sha256sum.exe \
+ sha384sum.exe sha512sum.exe
+
+
+override_dh_auto_configure-arch:
+ dh_auto_configure -a --builddirectory -- \
+ $(CONFIG_ARGS_COMMON)
+
+override_dh_auto_configure-indep:
+ set -e; if ! [ -e debian/patches/win32/stamp-applied ]; then \
+ echo " Apply the win32-specific patches"; \
+ for p in debian/patches/win32/*; do \
+ patch -p1 --no-backup-if-mismatch < $$p; \
+ done; \
+ touch debian/patches/win32/stamp-applied; \
+ fi
+ # mingw's ld doesn't understand -z
+ # -static is needed to avoid dynamic-linking against libssp0
+ LDFLAGS="" CFLAGS="-static $(CFLAGS)" \
+ dh_auto_configure -i --builddirectory=build-win32/ -- \
+ $(CONFIG_ARGS_COMMON) \
+ $(CONFIG_ARGS_W32)
+
+override_dh_auto_build-indep:
+ # Replace unbuildable files with placeholders
+ set -x; for file in $(MINGW32_UNBUILDABLE_SOURCES); do \
+ rename s/.c$$/.c-backup/ $$file && \
+ echo "/* Ignore */" > $$file || : ; \
+ done
+ # Try to build all, as it fails, only build the binaries we want
+ # (There's no way to build only these initially)
+ cd build-win32/; \
+ make all || : ; \
+ make $(addprefix src/,$(MINGW32_PROGS))
+ # Put the files back in place
+ set -x; for file in $(MINGW32_UNBUILDABLE_SOURCES); do \
+ rename -f s/.c-backup$$/.c/ $${file}-backup; \
+ done
+
%:
dh $@ --builddirectory
@@ -77,3 +122,7 @@ endif
TODO \
$(d)/usr/share/doc/coreutils
+override_dh_install-indep:
+ # Install the selected win32 binaries
+ mkdir -p debian/coreutils-win32/usr/share/win32/
+ install -D -m 644 $(addprefix build-win32/src/,$(MINGW32_PROGS)) debian/coreutils-win32/usr/share/win32/
--
2.8.0.rc3