mandoc: fix build on macos
authorSergey V. Lobanov <sergey@lobanov.in>
Sat, 29 Jan 2022 00:53:55 +0000 (03:53 +0300)
committerRosen Penev <rosenp@gmail.com>
Tue, 15 Feb 2022 01:21:21 +0000 (17:21 -0800)
./configure scripts compiles&runs test so it detects darwin
C-functions and defines that can not be used for Linux target.

This patches expicitly specifies Linux-specific parameters that
can not be detected correctly on Darwin.

This patch removes 010-mandoc-1.14.5-fix-gnu-make.patch. mandoc
provides its own way to redefine specific parameters (using
configure.local file). Defines from this patch are moved to
generated configure.local file.

CONFIGURE_VARS are removed by this patch due to ./configure script
does not use ENV vars specified by CONFIGURE_VARS

This commit does not change compilation on Linux hosts (the resulted
binary is exactly the same as before applying this commit). Binary
compiled on MacOS host is exactly the same as compiled on Linux.

Files generated by ./configure (config.h and Makefile.local) are
exactly the same on Linux and MacOS build hosts

Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
utils/mandoc/Makefile
utils/mandoc/patches/010-mandoc-1.14.5-fix-gnu-make.patch [deleted file]

index 00b505ebbe675e832d7a8a0d608a37f2198339a2..1d66b3676c952fc975147515dca990e5299f02dd 100644 (file)
@@ -34,10 +34,33 @@ based on the libmandoc validating compiler, to format output for UTF-8
 and ASCII UNIX terminals, HTML 5, PostScript, and PDF.
 endef
 
-CONFIGURE_VARS=\
-       CC=$(CC) \
-       HAVE_FTS=0 \
-       HAVE_REALLOCARRAY=0 \
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       { \
+           echo PREFIX=/usr; \
+           echo HAVE_FTS=0; \
+           echo HAVE_REALLOCARRAY=0; \
+           echo "#Fix build on Darwin host (that values must be used for target build):"; \
+           echo HAVE_DIRENT_NAMLEN=0; \
+           echo HAVE_ENDIAN=1; \
+           echo HAVE_SYS_ENDIAN=0; \
+           echo HAVE_EFTYPE=0; \
+           echo HAVE_PROGNAME=0; \
+           echo HAVE_REWB_BSD=0; \
+           echo HAVE_REWB_SYSV=1; \
+           echo HAVE_STRCASESTR=1; \
+           echo HAVE_STRINGLIST=0; \
+           echo HAVE_STRLCAT=0; \
+           echo HAVE_STRLCPY=0; \
+           echo HAVE_STRPTIME=1; \
+           echo HAVE_STRTONUM=0; \
+           echo HAVE_VASPRINTF=1; \
+           echo NEED_GNU_SOURCE=1; \
+           echo HAVE_WCHAR=1; \
+           echo UTF8_LOCALE=en_US.utf8; \
+           echo STATIC=-static; \
+       } > $(PKG_BUILD_DIR)/configure.local
+endef
 
 define Package/mandoc/install
        $(INSTALL_DIR) $(1)/usr/bin/
diff --git a/utils/mandoc/patches/010-mandoc-1.14.5-fix-gnu-make.patch b/utils/mandoc/patches/010-mandoc-1.14.5-fix-gnu-make.patch
deleted file mode 100644 (file)
index 45ccb96..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -62,7 +62,7 @@ HAVE_DIRENT_NAMLEN=
- HAVE_EFTYPE=
- HAVE_ENDIAN=
- HAVE_ERR=
--HAVE_FTS=
-+HAVE_FTS=0
- HAVE_FTS_COMPARE_CONST=
- HAVE_GETLINE=
- HAVE_GETSUBOPT=
-@@ -77,7 +77,7 @@ HAVE_OHASH=
- HAVE_PATH_MAX=
- HAVE_PLEDGE=
- HAVE_PROGNAME=
--HAVE_REALLOCARRAY=
-+HAVE_REALLOCARRAY=0
- HAVE_RECALLOCARRAY=
- HAVE_RECVMSG=
- HAVE_REWB_BSD=
-@@ -102,7 +102,7 @@ NEED_XPG4_2=0
- MANDOC_COBJS=
- SOELIM_COBJS=
--PREFIX="/usr/local"
-+PREFIX="/usr"
- BINDIR=
- SBINDIR=
- BIN_FROM_SBIN=