nbdkit/0004-common-replacements-win32-Make-windmc-tool-optional.patch
Richard W.M. Jones d89cffce88 Temporary workaround for binutils bug
https://sourceware.org/bugzilla/show_bug.cgi?id=31283

Use git to apply the patches since patch 0004 contains a binary patch.
2024-01-24 10:59:22 +00:00

193 lines
6.7 KiB
Diff

From 617f950de1d18d5ddd146c32d700afd81470a284 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 24 Jan 2024 10:46:26 +0000
Subject: [PATCH 4/4] common/replacements/win32: Make windmc tool optional
Make the windmc (mc.exe) tool option even on Windows.
Distribute the generated message catalogs, but regenerate them if
windmc is found at compile time.
I also changed mc -> mc.exe since "mc" on Linux is a program called
Midnight Commander and mc.exe would only be the name when compiling on
Windows. (If there's any confusion here, you can always define the
right binary to use by doing: ./configure MC=/path/to/mc.exe)
---
configure.ac | 10 ++--
common/replacements/win32/Makefile.am | 13 +++--
common/replacements/win32/nbdkit-cat.h | 68 ++++++++++++++++++++++++
common/replacements/win32/MSG00001.bin | Bin 0 -> 28 bytes
common/replacements/win32/nbdkit-cat.rc | 9 ++++
.gitignore | 3 --
6 files changed, 89 insertions(+), 14 deletions(-)
create mode 100644 common/replacements/win32/nbdkit-cat.h
create mode 100644 common/replacements/win32/MSG00001.bin
create mode 100644 common/replacements/win32/nbdkit-cat.rc
diff --git a/configure.ac b/configure.ac
index 08ba6287c..03c655638 100644
--- a/configure.ac
+++ b/configure.ac
@@ -584,13 +584,11 @@ AC_DEFINE_UNQUOTED([DIR_SEPARATOR_STR],["$DIR_SEPARATOR_STR"],
[String that separates path elements.])
AM_CONDITIONAL([IS_WINDOWS],[test "x$is_windows" = "xyes"])
+dnl Look for the mc/windmc utility (optional).
+AC_CHECK_TOOLS([MC],[windmc mc.exe],[no])
+AM_CONDITIONAL([HAVE_MC],[test "x$MC" != "xno"])
+
AS_IF([test "x$is_windows" = "xyes"],[
- dnl For Windows, look for the mc/windmc utility.
- dnl XXX Do we need to check for mc.exe as well?
- AC_CHECK_TOOLS([MC],[windmc mc],[no])
- AS_IF([test "x$MC" = "xno"],
- [AC_MSG_ERROR([mc/windmc utility must be available when compiling for Windows])])
-
dnl On Windows look for dlltool.
AC_CHECK_TOOLS([DLLTOOL],[dlltool],[no])
AS_IF([test "x$DLLTOOL" = "xno"],
diff --git a/common/replacements/win32/Makefile.am b/common/replacements/win32/Makefile.am
index b8c7c639e..45dcd6ac2 100644
--- a/common/replacements/win32/Makefile.am
+++ b/common/replacements/win32/Makefile.am
@@ -29,15 +29,18 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
+# The Windows message catalog.
+
include $(top_srcdir)/common-rules.mk
-EXTRA_DIST = nbdkit-cat.mc
-
-if IS_WINDOWS
-
-# Build the message catalog.
noinst_DATA = MSG00001.bin nbdkit-cat.h nbdkit-cat.rc
+# We distribute the generated message catalog files to save people
+# needing to install the windmc tool, but they are regenerated (below)
+# if windmc is found at configure time.
+EXTRA_DIST = nbdkit-cat.mc $(noinst_DATA)
+
+if HAVE_MC
CLEANFILES += stamp-data
$(noinst_DATA): stamp-data
diff --git a/common/replacements/win32/nbdkit-cat.h b/common/replacements/win32/nbdkit-cat.h
new file mode 100644
index 000000000..8081e453d
--- /dev/null
+++ b/common/replacements/win32/nbdkit-cat.h
@@ -0,0 +1,68 @@
+/* Do not edit this file manually.
+ This file is autogenerated by windmc. */
+
+//
+// The values are 32 bit layed out as follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-+-----------------------+-------------------------------+
+// |Sev|C|R| Facility | Code |
+// +---+-+-+-----------------------+-------------------------------+
+//
+// where
+//
+// C - is the Customer code flag
+//
+// R - is a reserved bit
+//
+// Code - is the facility's status code
+//
+// Sev - is the severity code
+//
+// Success - 00
+// Informational - 01
+// Warning - 02
+// Error - 03
+//
+// Facility - is the facility code
+//
+// System - 00ff
+// Application - 0fff
+//
+
+// nbdkit
+// Copyright Red Hat
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * Neither the name of Red Hat nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// MessageId: NBDKIT_SYSLOG_ERROR
+//
+#define NBDKIT_SYSLOG_ERROR 0xc0000001
+
diff --git a/common/replacements/win32/MSG00001.bin b/common/replacements/win32/MSG00001.bin
new file mode 100644
index 0000000000000000000000000000000000000000..f642ff3a4079b4b8b3b60b9ecefebe7c136a404b
GIT binary patch
literal 28
dcmZQ%U|?WmU^oE60zftokf+LE$iM|;0{|fO0s#O3
literal 0
HcmV?d00001
diff --git a/common/replacements/win32/nbdkit-cat.rc b/common/replacements/win32/nbdkit-cat.rc
new file mode 100644
index 000000000..6f6ce3344
--- /dev/null
+++ b/common/replacements/win32/nbdkit-cat.rc
@@ -0,0 +1,9 @@
+/* Do not edit this file manually.
+ This file is autogenerated by windmc. */
+
+
+// Country: United States
+// Language: English
+#pragma code_page(1252)
+LANGUAGE 0x9, 0x1
+1 MESSAGETABLE "MSG00001.bin"
diff --git a/.gitignore b/.gitignore
index 14f816c93..cce2de79b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,9 +52,6 @@ plugins/*/*.3
/common/protocol/protostrings.c
/common/replacements/libcompat.a
/common/replacements/test-current-dir-name
-/common/replacements/win32/MSG00001.bin
-/common/replacements/win32/nbdkit-cat.h
-/common/replacements/win32/nbdkit-cat.rc
/common/replacements/win32/stamp-data
/common/utils/test-quotes
/common/utils/test-vector
--
2.43.0