From 6b4941ccbc48957622d5d5dcfb7b4b9f223d0372 Mon Sep 17 00:00:00 2001 From: Ørjan Malde Date: May 04 2024 15:42:06 +0000 Subject: groups.d/221.native_packages_dev.d/mandoc.package: build w/ autotools Signed-off-by: Ørjan Malde --- diff --git a/files/mandoc/Makefile.am b/files/mandoc/Makefile.am new file mode 100644 index 0000000..61145ef --- /dev/null +++ b/files/mandoc/Makefile.am @@ -0,0 +1,154 @@ +bin_PROGRAMS = \ +mandoc \ +demandoc \ +soelim + +man1_MANS = apropos.1 demandoc.1 man.1 mandoc.1 soelim.1 +man5_MANS = man.conf.5 mandoc.db.5 +man7_MANS = eqn.7 man.7 mandoc_char.7 mdoc.7 roff.7 tbl.7 +man8_MANS = makewhatis.8 + +install-exec-hook: + cd $(DESTDIR)$(bindir) && \ + $(MKDIR_P) $(DESTDIR)$(sbindir) && \ + $(LN_S) -f mandoc$(EXEEXT) man$(EXEEXT) && \ + $(LN_S) -f mandoc$(EXEEXT) apropos$(EXEEXT) && \ + $(LN_S) -f mandoc$(EXEEXT) whatis$(EXEEXT) && \ + cp mandoc$(EXEEXT) ../sbin/makewhatis$(EXEEXT) + +install-data-hook: + cd $(DESTDIR)$(mandir)/man1 && \ + $(LN_S) -f apropos.1 whatis.1 + +noinst_LIBRARIES = libmandoc.a libcompat.a + +libmandoc_a_SOURCES = \ +man.c \ +man_macro.c \ +man_validate.c \ +att.c \ +lib.c \ +mdoc.c \ +mdoc_argv.c \ +mdoc_macro.c \ +mdoc_state.c \ +mdoc_validate.c \ +st.c \ +eqn.c \ +roff.c \ +roff_validate.c \ +tbl.c \ +tbl_data.c \ +tbl_layout.c \ +tbl_opts.c \ +arch.c \ +chars.c \ +mandoc.c \ +mandoc_aux.c \ +mandoc_msg.c \ +mandoc_ohash.c \ +mandoc_xr.c \ +msec.c \ +preconv.c \ +read.c \ +tag.c + +libcompat_a_SOURCES = +if NEED_ERR_COMPAT +libcompat_a_SOURCES += compat_err.c +endif +if NEED_GETSUBOPT_COMPAT +libcompat_a_SOURCES += compat_getsubopt.c +endif +if NEED_MKSTEMPS_COMPAT +libcompat_a_SOURCES += compat_mkstemps.c +endif +if NEED_REALLOCARRAY_COMPAT +libcompat_a_SOURCES += compat_reallocarray.c +endif +if NEED_STRINGLIST_COMPAT +libcompat_a_SOURCES += compat_stringlist.c +endif +if NEED_STRNDUP_COMPAT +libcompat_a_SOURCES += compat_strndup.c +endif +if NEED_VASPRINTF_COMPAT +libcompat_a_SOURCES += compat_vasprintf.c +endif +if NEED_FTS_COMPAT +libcompat_a_SOURCES += compat_fts.c +endif +if NEED_ISBLANK_COMPAT +libcompat_a_SOURCES += compat_isblank.c +endif +if NEED_OHASH_COMPAT +libcompat_a_SOURCES += compat_ohash.c +endif +if NEED_RECALLOCARRAY_COMPAT +libcompat_a_SOURCES += compat_recallocarray.c +endif +if NEED_STRLCAT_COMPAT +libcompat_a_SOURCES += compat_strlcat.c +endif +if NEED_STRSEP_COMPAT +libcompat_a_SOURCES += compat_strsep.c +endif +if NEED_GETLINE_COMPAT +libcompat_a_SOURCES += compat_getline.c +endif +if NEED_MKDTEMP_COMPAT +libcompat_a_SOURCES += compat_mkdtemp.c +endif +if NEED_PROGNAME_COMPAT +libcompat_a_SOURCES += compat_progname.c +endif +if NEED_STRCASESTR_COMPAT +libcompat_a_SOURCES += compat_strcasestr.c +endif +if NEED_STRLCPY_COMPAT +libcompat_a_SOURCES += compat_strlcpy.c +endif +if NEED_STRTONUM_COMPAT +libcompat_a_SOURCES += compat_strtonum.c +endif + +mandoc_SOURCES = \ +eqn_html.c \ +html.c \ +man_html.c \ +mdoc_html.c \ +roff_html.c \ +tbl_html.c \ +eqn_term.c \ +man_term.c \ +mdoc_term.c \ +roff_term.c \ +term.c \ +term_ascii.c \ +term_ps.c \ +term_tab.c \ +term_tag.c \ +tbl_term.c \ +dbm.c \ +dbm_map.c \ +mansearch.c \ +dba.c \ +dba_array.c \ +dba_read.c \ +dba_write.c \ +mandocdb.c \ +main.c \ +manpath.c \ +mdoc_man.c \ +mdoc_markdown.c \ +out.c \ +tree.c +mandoc_LDADD = libmandoc.a libcompat.a -lz + +demandoc_SOURCES = \ +demandoc.c +demandoc_LDADD = libmandoc.a libcompat.a -lz + +soelim_SOURCES = \ +soelim.c +soelim_LDADD = libcompat.a diff --git a/files/mandoc/configure.ac b/files/mandoc/configure.ac new file mode 100644 index 0000000..e0fc320 --- /dev/null +++ b/files/mandoc/configure.ac @@ -0,0 +1,90 @@ +AC_INIT([mandoc], [1.14.6]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([foreign]) +AH_TOP([#define _GNU_SOURCE]) +AH_BOTTOM([#include ]) +AC_CONFIG_HEADERS([config.h]) +AM_PROG_AR +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_LN_S + +AC_CHECK_HEADER([endian.h], [AC_DEFINE([HAVE_ENDIAN], [1], [Define to 1 if you have the header file.])], []) +AC_CHECK_HEADER([sys/endian.h], [AC_DEFINE([HAVE_SYS_ENDIAN], [1], [Define to 1 if you have the header file.])], []) + +have_EFTYPE=no +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include +],[ +#ifndef EFTYPE +#error notfound +#endif +])], [have_EFTYPE=yes]) + +if test "x$have_EFTYPE" = "xno"; then + AC_DEFINE([EFTYPE], [EINVAL], [Define EFTYPE to EINVAL if it does not exist.]) +fi + +# +# Thanks OpenBSD. Guarding each compat file with an include macro is too hard ..... +# +have_err=no +have_stringlist=no +have_vasprintf=no +have_isblank=no +have_ohash=no +have_recallocarray=no +have_getline=no +have_mkdtemp=no +have_progname=no +have_getsubopt=no +have_mkstemps=no +have_reallocarray=no +have_strndup=no +have_strlcat=no +have_strlcpy=no +have_strsep=no +have_strcasestr=no +have_strtonum=no +have_fts=no +AC_CHECK_FUNC([err], [have_err=yes], [have_err=no]) +AC_CHECK_FUNC([stringlist], [have_stringlist=yes], [have_stringlist=no]) +AC_CHECK_FUNC([vasprintf], [have_vasprintf=yes], [have_vasprintf=no]) +AC_CHECK_FUNC([isblank], [have_isblank=yes], [have_isblank=no]) +AC_CHECK_FUNC([ohash], [have_ohash=yes], [have_ohash=no]) +AC_CHECK_FUNC([recallocarray], [have_recallocarray=yes], [have_recallocarray=no]) +AC_CHECK_FUNC([getline], [have_getline=yes], [have_getline=no]) +AC_CHECK_FUNC([mkdtemp], [have_mkdtemp=yes], [have_mkdtemp=no]) +AC_CHECK_FUNC([progname], [have_progname=yes], [have_progname=no]) +AC_CHECK_FUNC([getsubopt], [have_getsubopt=yes], [have_getsubopt=no]) +AC_CHECK_FUNC([mkstemps], [have_mkstemps=yes], [have_mkstemps=no]) +AC_CHECK_FUNC([reallocarray], [have_reallocarray=yes], [have_reallocarray=no]) +AC_CHECK_FUNC([strndup], [have_strndup=yes], [have_strndup=no]) +AC_CHECK_FUNC([strlcat], [have_strlcat=yes], [have_strlcat=no]) +AC_CHECK_FUNC([strlcpy], [have_strlcpy=yes], [have_strlcpy=no]) +AC_CHECK_FUNC([strsep], [have_strsep=yes], [have_strsep=no]) +AC_CHECK_FUNC([strcasestr], [have_strcasestr=yes], [have_strcasestr=no]) +AC_CHECK_FUNC([strtonum], [have_strtonum=yes], [have_strtonum=no]) +AC_CHECK_FUNC([fts_open], [have_fts=yes], [have_fts=no]) + +AM_CONDITIONAL([NEED_ERR_COMPAT], [test "x$have_err" != "xyes"]) +AM_CONDITIONAL([NEED_STRINGLIST_COMPAT], [test "x$have_stringlist" != "xyes"]) +AM_CONDITIONAL([NEED_VASPRINTF_COMPAT], [test "x$have_vasprintf" != "xyes"]) +AM_CONDITIONAL([NEED_ISBLANK_COMPAT], [test "x$have_isblank" != "xyes"]) +AM_CONDITIONAL([NEED_OHASH_COMPAT], [test "x$have_ohash" != "xyes"]) +AM_CONDITIONAL([NEED_RECALLOCARRAY_COMPAT], [test "x$have_recallocarray" != "xyes"]) +AM_CONDITIONAL([NEED_GETLINE_COMPAT], [test "x$have_getline" != "xyes"]) +AM_CONDITIONAL([NEED_MKDTEMP_COMPAT], [test "x$have_mkdtemp" != "xyes"]) +AM_CONDITIONAL([NEED_PROGNAME_COMPAT], [test "x$have_progname" != "xyes"]) +AM_CONDITIONAL([NEED_GETSUBOPT_COMPAT], [test "x$have_getsubopt" != "xyes"]) +AM_CONDITIONAL([NEED_MKSTEMPS_COMPAT], [test "x$have_mkstemps" != "xyes"]) +AM_CONDITIONAL([NEED_REALLOCARRAY_COMPAT], [test "x$have_reallocarray" != "xyes"]) +AM_CONDITIONAL([NEED_STRNDUP_COMPAT], [test "x$have_strndup" != "xyes"]) +AM_CONDITIONAL([NEED_STRLCAT_COMPAT], [test "x$have_strlcat" != "xyes"]) +AM_CONDITIONAL([NEED_STRLCPY_COMPAT], [test "x$have_strlcpy" != "xyes"]) +AM_CONDITIONAL([NEED_STRSEP_COMPAT], [test "x$have_strsep" != "xyes"]) +AM_CONDITIONAL([NEED_STRCASESTR_COMPAT], [test "x$have_strcasestr" != "xyes"]) +AM_CONDITIONAL([NEED_STRTONUM_COMPAT], [test "x$have_strtonum" != "xyes"]) +AM_CONDITIONAL([NEED_FTS_COMPAT], [test "x$have_fts" != "xyes"]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/files/mandoc/extern_config.h b/files/mandoc/extern_config.h new file mode 100644 index 0000000..aa40a09 --- /dev/null +++ b/files/mandoc/extern_config.h @@ -0,0 +1,73 @@ +#include +#include +#include + +#define OSENUM MANDOC_OS_OTHER +#define OSNAME "Midipix" +#define UTF8_LOCALE "en_US.UTF-8" + +#define MAN_CONF_FILE "/etc/man.conf" +#define MANPATH_BASE "/usr/share/man:/usr/X11R6/man" +#define MANPATH_DEFAULT "/usr/share/man" +#define BINM_MAN "man" +#define BINM_SOELIN "soelim" +#define BINM_WHATIS "whatis" +#define BINM_CATMAN "catman" +#define BINM_MAKEWHATIS "makewhatis" +#define BINM_APROPOS "apropos" +#define BINM_PAGER "less" + +#ifndef HAVE_ERR +extern void err(int, const char *, ...); +extern void errx(int, const char *, ...); +extern void warn(const char *, ...); +extern void warnx(const char *, ...); +#endif +#ifndef HAVE_GETLINE +extern ssize_t getline(char **, size_t *, FILE *); +#endif +#ifndef HAVE_GETSUBOPT +extern int getsubopt(char **, char * const *, char **); +#endif +#ifndef HAVE_ISBLANK +extern int isblank(int); +#endif +#ifndef HAVE_MKDTEMP +extern char *mkdtemp(char *); +#endif +#ifndef HAVE_MKSTEMPS +extern int mkstemps(char *, int); +#endif +#ifndef HAVE_GETPROGNAME +extern const char *getprogname(void); +#endif +#ifndef HAVE_SETPROGNAME +extern void setprogname(const char *); +#endif +#ifndef HAVE_REALLOCARRAY +extern void *reallocarray(void *, size_t, size_t); +#endif +#ifndef HAVE_RECALLOCARRAY +extern void *recallocarray(void *, size_t, size_t, size_t); +#endif +#ifndef HAVE_STRCASESTR +extern char *strcasestr(const char *, const char *); +#endif +#ifndef HAVE_STRLCAT +extern size_t strlcat(char *, const char *, size_t); +#endif +#ifndef HAVE_STRLCPY +extern size_t strlcpy(char *, const char *, size_t); +#endif +#ifndef HAVE_STRNDUP +extern char *strndup(const char *, size_t); +#endif +#ifndef HAVE_STRSEP +extern char *strsep(char **, const char *); +#endif +#ifndef HAVE_STRTONUM +extern long long strtonum(const char *, long long, long long, const char **); +#endif +#ifndef HAVE_VASPRINTF +extern int vasprintf(char **, const char *, va_list); +#endif diff --git a/groups.d/221.native_packages_dev.d/mandoc.package b/groups.d/221.native_packages_dev.d/mandoc.package index 4dddd22..9911bce 100644 --- a/groups.d/221.native_packages_dev.d/mandoc.package +++ b/groups.d/221.native_packages_dev.d/mandoc.package @@ -1,11 +1,8 @@ -: ${PKG_MANDOC_DEPENDS:="libz musl_fts"}; +: ${PKG_MANDOC_DEPENDS:="libz"}; : ${PKG_MANDOC_SHA256SUM:=8bf0d570f01e70a6e124884088870cbed7537f36328d512909eb10cd53179d9c}; : ${PKG_MANDOC_VERSION:=1.14.6}; : ${PKG_MANDOC_URL:=https://mandoc.bsd.lv/snapshots/mandoc-${PKG_MANDOC_VERSION}.tar.gz}; -: ${PKG_MANDOC_MAKEFLAGS_BUILD_EXTRA_LIST:="CC=${DEFAULT_NATIVE_CC}:LDADD=-Wl,-lz,-lfts"}; -: ${PKG_MANDOC_CFLAGS_BUILD_EXTRA:="-D_GNU_SOURCE ${DEFAULT_CFLAGS}"}; -: ${PKG_MANDOC_BUILD_STEPS_DISABLE:="configure"}; -: ${PKG_MANDOC_IN_TREE:=1}; +: ${PKG_MANDOC_FORCE_AUTORECONF:=1}; ex_pkg_register "mandoc" "${RTL_FILEOP_SOURCE_FNAME}" "native_packages"; diff --git a/patches/mandoc-1.14.6.local.patch b/patches/mandoc-1.14.6.local.patch deleted file mode 100644 index ebd3dac..0000000 --- a/patches/mandoc-1.14.6.local.patch +++ /dev/null @@ -1,109 +0,0 @@ -diff -ru mandoc-1.14.6.orig/Makefile mandoc-1.14.6/Makefile ---- mandoc-1.14.6.orig/Makefile 2021-09-23 20:03:23.000000000 +0200 -+++ mandoc-1.14.6/Makefile 2024-02-26 15:20:48.758788836 +0100 -@@ -369,11 +369,40 @@ - - # === USER CONFIGURATION =============================================== - --include Makefile.local -+MANDOC_COBJS = compat_fts.o compat_ohash.o compat_progname.o compat_recallocarray.o compat_strtonum.o -+SOELIM_COBJS = compat_progname.o compat_stringlist.o -+PREFIX = -+BINDIR = /bin -+SBINDIR = /sbin -+BIN_FROM_SBIN = ../bin -+INCLUDEDIR = /include/mandoc -+LIBDIR = /lib/mandoc -+MANDIR = /man -+WWWPREFIX = /var/www -+HTDOCDIR = /var/www/htdocs -+CGIBINDIR = /var/www/cgi-bin -+BINM_APROPOS = apropos -+BINM_CATMAN = catman -+BINM_MAKEWHATIS = makewhatis -+BINM_MAN = man -+BINM_SOELIM = soelim -+BINM_WHATIS = whatis -+MANM_MAN = man -+MANM_MANCONF = man.conf -+MANM_MDOC = mdoc -+MANM_ROFF = roff -+MANM_EQN = eqn -+MANM_TBL = tbl -+INSTALL = install -+INSTALL_PROGRAM = install -m 0555 -+INSTALL_LIB = install -m 0444 -+INSTALL_MAN = install -m 0444 -+INSTALL_DATA = install -m 0444 -+LN = ln -f - - # === DEPENDENCY HANDLING ============================================== - --all: mandoc man demandoc soelim $(BUILD_TARGETS) Makefile.local -+all: mandoc man demandoc soelim $(BUILD_TARGETS) - - install: base-install $(INSTALL_TARGETS) - -diff -ruN mandoc-1.14.6.orig/config.h mandoc-1.14.6/config.h ---- mandoc-1.14.6.orig/config.h 1970-01-01 01:00:00.000000000 +0100 -+++ mandoc-1.14.6/config.h 2024-02-26 14:41:39.744045181 +0100 -@@ -0,0 +1,59 @@ -+#ifdef __cplusplus -+#error "Do not use C++. See the INSTALL file." -+#endif -+ -+#include -+ -+#define MAN_CONF_FILE "/etc/man.conf" -+#define MANPATH_BASE "/usr/share/man:/usr/X11R6/man" -+#define MANPATH_DEFAULT "/share/man" -+#define OSENUM MANDOC_OS_OTHER -+#define OSNAME "Midipix" -+#define UTF8_LOCALE "en_US.UTF-8" -+#define EFTYPE EINVAL -+ -+#define HAVE_DIRENT_NAMLEN 0 -+#define HAVE_ENDIAN 1 -+#define HAVE_ERR 1 -+#define HAVE_FTS 1 -+#define HAVE_FTS_COMPARE_CONST 0 -+#define HAVE_GETLINE 1 -+#define HAVE_GETSUBOPT 1 -+#define HAVE_ISBLANK 1 -+#define HAVE_LESS_T 0 -+#define HAVE_MKDTEMP 1 -+#define HAVE_MKSTEMPS 1 -+#define HAVE_NTOHL 1 -+#define HAVE_PLEDGE 0 -+#define HAVE_PROGNAME 0 -+#define HAVE_REALLOCARRAY 1 -+#define HAVE_RECALLOCARRAY 0 -+#define HAVE_REWB_BSD 0 -+#define HAVE_REWB_SYSV 1 -+#define HAVE_SANDBOX_INIT 0 -+#define HAVE_STRCASESTR 1 -+#define HAVE_STRINGLIST 0 -+#define HAVE_STRLCAT 1 -+#define HAVE_STRLCPY 1 -+#define HAVE_STRNDUP 1 -+#define HAVE_STRPTIME 1 -+#define HAVE_STRSEP 1 -+#define HAVE_STRTONUM 0 -+#define HAVE_SYS_ENDIAN 0 -+#define HAVE_VASPRINTF 1 -+#define HAVE_WCHAR 1 -+#define HAVE_OHASH 0 -+#define NEED_XPG4_2 0 -+ -+#define BINM_APROPOS "apropos" -+#define BINM_CATMAN "catman" -+#define BINM_MAKEWHATIS "makewhatis" -+#define BINM_MAN "man" -+#define BINM_SOELIM "soelim" -+#define BINM_WHATIS "whatis" -+#define BINM_PAGER "less" -+ -+extern const char *getprogname(void); -+extern void setprogname(const char *); -+extern void *recallocarray(void *, size_t, size_t, size_t); -+extern long long strtonum(const char *, long long, long long, const char **); diff --git a/vars/mandoc.vars b/vars/mandoc.vars new file mode 100644 index 0000000..2573bf0 --- /dev/null +++ b/vars/mandoc.vars @@ -0,0 +1,17 @@ +# +# set +o errexit -o noglob -o nounset is assumed. +# + +pkg_mandoc_configure_patch_pre() { + rtl_fileop cp \ + "${MIDIPIX_BUILD_PWD}/files/mandoc/configure.ac" \ + "${PKG_BASE_DIR}/mandoc-${PKG_VERSION}/"; + rtl_fileop cp \ + "${MIDIPIX_BUILD_PWD}/files/mandoc/Makefile.am" \ + "${PKG_BASE_DIR}/mandoc-${PKG_VERSION}/"; + rtl_fileop cp \ + "${MIDIPIX_BUILD_PWD}/files/mandoc/extern_config.h" \ + "${PKG_BASE_DIR}/mandoc-${PKG_VERSION}/"; +}; + +# vim:filetype=sh textwidth=0