From b2ee7dcc8c6196246b6e867ea8ce8edac70953d2 Mon Sep 17 00:00:00 2001 From: "Ralf S. Engelschall" Date: Thu, 17 Feb 2005 19:07:43 +0000 Subject: [PATCH] sed(1) usages which include a newline are not portable and multiple and conditional 'shtool subst' are not very maintainable anyway, so replace the substitutions with a patch and this way get the package building under Solaris again --- antiword/antiword.patch | 110 ++++++++++++++++++++++++++++++++++++++++ antiword/antiword.spec | 26 +--------- 2 files changed, 112 insertions(+), 24 deletions(-) create mode 100644 antiword/antiword.patch diff --git a/antiword/antiword.patch b/antiword/antiword.patch new file mode 100644 index 0000000000..15807336ff --- /dev/null +++ b/antiword/antiword.patch @@ -0,0 +1,110 @@ +Index: antiword.h +--- antiword.h.orig 2004-09-30 20:55:56.000000000 +0200 ++++ antiword.h 2005-02-17 20:04:40.364083736 +0100 +@@ -194,7 +194,7 @@ + #define FONTNAMES_FILE "fontname.txt" + #elif defined(__amigaos) + #define GLOBAL_ANTIWORD_DIR "SYS:.antiword" +-#define ANTIWORD_DIR ".antiword" ++#define ANTIWORD_DIR "antiword" + #define FONTNAMES_FILE "fontnames" + #elif defined(N_PLAT_NLM) + #define GLOBAL_ANTIWORD_DIR "SYS:/antiword" +@@ -218,7 +218,7 @@ + #define FONTNAMES_FILE "fontnames" + #else /* All others */ + #define GLOBAL_ANTIWORD_DIR "/usr/share/antiword" +-#define ANTIWORD_DIR ".antiword" ++#define ANTIWORD_DIR "antiword" + #define FONTNAMES_FILE "fontnames" + #endif /* __dos */ + /* The names of grouped mapping files */ +Index: chartrans.c +--- chartrans.c.orig 2004-09-13 13:17:37.000000000 +0200 ++++ chartrans.c 2005-02-17 20:04:40.364604120 +0100 +@@ -6,10 +6,15 @@ + * Translate Word characters to local representation + */ + ++#if defined(__FreeBSD__) ++#include ++#endif ++ + #include + #include + #include +-#if defined(__STDC_ISO_10646__) ++#if defined(__STDC_ISO_10646__) || defined(__FreeBSD__) || defined(__NetBSD__) ++#include + #include + #endif /* __STDC_ISO_10646__ */ + #include "antiword.h" +@@ -700,7 +705,8 @@ + */ + return ulChar & ~0x20; + } +-#if defined(__STDC_ISO_10646__) ++#if defined(__STDC_ISO_10646__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) || defined(__NetBSD__) ++#include + /* + * If this is ISO C99 and all locales have wchar_t = ISO 10646 + * (e.g., glibc 2.2 or newer), then use standard function +Index: fonts_u.c +--- fonts_u.c.orig 2004-09-07 17:16:42.000000000 +0200 ++++ fonts_u.c 2005-02-17 20:04:40.364855447 +0100 +@@ -56,7 +56,6 @@ + } + + /* Try the local version of the fontnames file */ +- szHome = szGetHomeDirectory(); + if (strlen(szHome) + + sizeof(FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR FONTNAMES_FILE) >= + sizeof(szLocalFile)) { +Index: main_u.c +--- main_u.c.orig 2004-10-14 18:49:18.000000000 +0200 ++++ main_u.c 2005-02-17 20:05:46.016037658 +0100 +@@ -29,7 +29,8 @@ + #include + #include + #endif /* __dos */ +-#if defined(__STDC_ISO_10646__) ++#if defined(__STDC_ISO_10646__) || defined(__FreeBSD__) || defined(__NetBSD__) ++#include + #include + #endif /* __STDC_ISO_10646__ */ + #if defined(N_PLAT_NLM) +@@ -245,7 +246,8 @@ + + #if !defined(__dos) + if (is_locale_utf8()) { +-#if defined(__STDC_ISO_10646__) ++#if defined(__STDC_ISO_10646__) || defined(__FreeBSD__) || defined(__NetBSD__) ++#include + /* + * If the user wants UTF-8 and the envirionment variables + * support UTF-8, than set the locale accordingly +@@ -261,11 +263,13 @@ + } + #endif /* __STDC_ISO_10646__ */ + } else { ++#ifdef LC_CTYPE + if (setlocale(LC_CTYPE, "") == NULL) { + werr(0, "Can't set the locale! Will use defaults"); + (void)setlocale(LC_CTYPE, "C"); + } + DBG_MSG("The locale has been set"); ++#endif + } + #endif /* !__dos */ + +Index: options.c +--- options.c.orig 2004-10-08 20:54:36.000000000 +0200 ++++ options.c 2005-02-17 20:04:40.365514131 +0100 +@@ -216,7 +216,6 @@ + } + + /* Try the local version of the mapping file */ +- szHome = szGetHomeDirectory(); + if (strlen(szHome) + tFilenameLen < + sizeof(szMappingFile) - + sizeof(ANTIWORD_DIR) - diff --git a/antiword/antiword.spec b/antiword/antiword.spec index ed7b87b03b..f44b61d1a2 100644 --- a/antiword/antiword.spec +++ b/antiword/antiword.spec @@ -38,6 +38,7 @@ Release: 20041212 # list of sources Source0: http://www.winfield.demon.nl/linux/antiword-%{version}.tar.gz +Patch0: antiword.patch # build information Prefix: %{l_prefix} @@ -59,32 +60,9 @@ AutoReqProv: no %prep %setup -q + %patch -p0 %build - %{l_shtool} subst \ - -e 's;".antiword";"antiword";g' \ - antiword.h - %{l_shtool} subst \ - -e 's;const char.*szHome;const char *szHome = "%{l_prefix}/share";g' \ - fonts_u.c options.c - %{l_shtool} subst \ - -e 's;szHome = szGetHomeDirectory()\;;;g' \ - fonts_u.c options.c - case "%{l_platform -t}" in - *-freebsd4* ) - %{l_shtool} subst \ - -e 's;\(^#if defined(__STDC_ISO_10646__)\);\1 || defined(__FreeBSD__);' \ - main_u.c - ;; - *-freebsd5* | *-netbsd* | *-linux2* | sun4*-sunos5* ) - %{l_shtool} subst \ - -e 's;\(^#if defined(__STDC_ISO_10646__)\);\1 || defined(__FreeBSD__) || defined(__NetBSD__)\n#include;' \ - *.[ch] - ;; - * ) echo "Platform %{l_platform -t} not supported" | %{l_rpmtool} msg -b - exit 1 - ;; - esac CC="%{l_cc}" \ CFLAGS="%{l_cflags -O}" \ %{l_make} %{l_mflags -O} antiword