aboutsummaryrefslogtreecommitdiff
path: root/development/md2roff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-02-01 09:32:06 +0000
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-02-04 07:19:52 +0700
commit5362469fd289efdd367d1adf6684509210916b55 (patch)
tree65821e17bda86f855870e0431f459889bdefde86 /development/md2roff
parentad51fe14e2191a1e72e12ed460d2aac3e1cd5db3 (diff)
development/md2roff: Added (convert markdown to roff)
Signed-off-by: bedlam <dave@slackbuilds.org> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development/md2roff')
-rw-r--r--development/md2roff/README4
-rw-r--r--development/md2roff/git2tarxz.sh47
-rw-r--r--development/md2roff/manpage.diff14
-rw-r--r--development/md2roff/md2roff.SlackBuild91
-rw-r--r--development/md2roff/md2roff.info10
-rw-r--r--development/md2roff/slack-desc19
6 files changed, 185 insertions, 0 deletions
diff --git a/development/md2roff/README b/development/md2roff/README
new file mode 100644
index 000000000000..07156c50d39c
--- /dev/null
+++ b/development/md2roff/README
@@ -0,0 +1,4 @@
+md2roff (convert markdown to roff)
+
+md2roff is a utility to convert markdown documents to Unix *roff
+format (man, mdoc, mm and mom packages).
diff --git a/development/md2roff/git2tarxz.sh b/development/md2roff/git2tarxz.sh
new file mode 100644
index 000000000000..600ac02b4d51
--- /dev/null
+++ b/development/md2roff/git2tarxz.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Create source tarball from github repo.
+
+# Note that this script doesn't need to be run as root. It does need to
+# be able to write to the current directory it's run from.
+
+# Takes one optional argument, which is the commit or tag to create a
+# tarball of. With no arg, HEAD is used.
+
+# Upstream doesn't use tags for version numbers so this script is
+# a bit weird.
+
+PRGNAM=md2roff
+CLONE_URL=https://github.com/nereusx/md2roff
+
+set -e
+
+GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX )
+rm -rf $GITDIR
+git clone $CLONE_URL $GITDIR
+
+CWD="$( pwd )"
+cd $GITDIR
+
+if [ "$1" != "" ]; then
+ git reset --hard "$1" || exit 1
+fi
+
+GIT_SHA=$( git rev-parse --short HEAD )
+
+DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 )
+
+VERTAG=$( grep '#define *APPVER' md2roff.c | cut -d'"' -f2 )
+
+VERSION=${VERTAG}+${DATE}_${GIT_SHA}
+
+find . -name .git\* -print0 | xargs -0 rm -rf
+
+cd "$CWD"
+rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz
+mv $GITDIR $PRGNAM-$VERSION
+tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION
+
+echo
+echo "Created tarball: $PRGNAM-$VERSION.tar.xz"
+echo "VERSION=$VERSION"
diff --git a/development/md2roff/manpage.diff b/development/md2roff/manpage.diff
new file mode 100644
index 000000000000..03be19ab058b
--- /dev/null
+++ b/development/md2roff/manpage.diff
@@ -0,0 +1,14 @@
+diff -Naur md2roff-1.10+20230125_adb5a2b/md2roff.md md2roff-1.10+20230125_adb5a2b.patched/md2roff.md
+--- md2roff-1.10+20230125_adb5a2b/md2roff.md 2023-01-31 04:15:38.000000000 -0500
++++ md2roff-1.10+20230125_adb5a2b.patched/md2roff.md 2023-01-31 04:44:24.695862999 -0500
+@@ -100,8 +100,8 @@
+ $ md2roff mytext.md | groff -Tps -man | okular -
+ ```
+
+-This document is example, its written in markdown and produce a nice man page.
+-You can see the man page as exported to _pdf_ (by **groff**) in this directory.
++This document is an example: it's written in markdown and produces a nice man page.
++You can see the markdown source and man page as exported to _pdf_ (by **groff**) in the directory /usr/doc/md2roff-@VERSION@/
+
+ ## HOMEPAGE
+ [https://github.com/nereusx/md2roff](https://github.com/nereusx/md2roff)
diff --git a/development/md2roff/md2roff.SlackBuild b/development/md2roff/md2roff.SlackBuild
new file mode 100644
index 000000000000..d4defa782355
--- /dev/null
+++ b/development/md2roff/md2roff.SlackBuild
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+# Slackware build script for md2roff
+
+# Written by B. Watson (urchlay@slackware.uk)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=md2roff
+VERSION=${VERSION:-1.10+20230125_adb5a2b}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+# Make the man page give the right directory for the PDF example:
+patch -p1 < $CWD/manpage.diff
+sed -i "s,@VERSION@,$VERSION," $PRGNAM.md
+
+# Slackware 15.0's groff is slightly broken (and -current's too, I'm
+# told), the -Tpdf option looks in the wrong dir for fonts (sent a bug
+# report about this to PV). There's another way to convert a man page
+# to a PDF that works fine, though:
+sed -i 's,-groff.*,roff2pdf -K utf8 md2roff.1 > md2roff.1.pdf,' Makefile
+
+# ...above I said "works fine", this is almost true: roff2pdf will
+# fail if DISPLAY isn't set in the environment... although it can be
+# set to literally anything (roff2pdf never tries to connect to X at
+# all, it just insists the variable has to be set). So:
+export DISPLAY=${DISPLAY:-no_such_display}
+
+make install \
+ CFLAGS="$SLKCFLAGS" \
+ prefix=/usr \
+ man1dir=/usr/man/man1 \
+ DESTDIR=$PKG
+
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC
+cp -a LICENSE* *.md *.pdf examples $PKGDOC
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/development/md2roff/md2roff.info b/development/md2roff/md2roff.info
new file mode 100644
index 000000000000..02449b33e184
--- /dev/null
+++ b/development/md2roff/md2roff.info
@@ -0,0 +1,10 @@
+PRGNAM="md2roff"
+VERSION="1.10+20230125_adb5a2b"
+HOMEPAGE="https://github.com/nereusx/md2roff"
+DOWNLOAD="https://slackware.uk/~urchlay/src/md2roff-1.10+20230125_adb5a2b.tar.xz"
+MD5SUM="4c063834adc663881205781ab2a340ba"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="urchlay@slackware.uk"
diff --git a/development/md2roff/slack-desc b/development/md2roff/slack-desc
new file mode 100644
index 000000000000..871ca4bfd705
--- /dev/null
+++ b/development/md2roff/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+md2roff: md2roff (convert markdown to roff)
+md2roff:
+md2roff: md2roff is a utility to convert markdown documents to Unix *roff
+md2roff: format (man, mdoc, mm and mom packages).
+md2roff:
+md2roff:
+md2roff:
+md2roff:
+md2roff:
+md2roff:
+md2roff: