From 6b4941ccbc48957622d5d5dcfb7b4b9f223d0372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98rjan=20Malde?= Date: Sat, 4 May 2024 17:40:03 +0200 Subject: groups.d/221.native_packages_dev.d/mandoc.package: build w/ autotools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ørjan Malde --- files/mandoc/Makefile.am | 154 +++++++++++++++++++++++++++++++++++++++++++ files/mandoc/configure.ac | 90 +++++++++++++++++++++++++ files/mandoc/extern_config.h | 73 ++++++++++++++++++++ 3 files changed, 317 insertions(+) create mode 100644 files/mandoc/Makefile.am create mode 100644 files/mandoc/configure.ac create mode 100644 files/mandoc/extern_config.h (limited to 'files/mandoc') diff --git a/files/mandoc/Makefile.am b/files/mandoc/Makefile.am new file mode 100644 index 00000000..61145efc --- /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 00000000..e0fc320c --- /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 00000000..aa40a09f --- /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 -- cgit v1.2.3