diff options
Diffstat (limited to 'system/mdcat-bin')
-rw-r--r-- | system/mdcat-bin/README | 24 | ||||
-rw-r--r-- | system/mdcat-bin/mdcat-bin.SlackBuild | 113 | ||||
-rw-r--r-- | system/mdcat-bin/mdcat-bin.info | 10 | ||||
-rw-r--r-- | system/mdcat-bin/slack-desc | 19 |
4 files changed, 166 insertions, 0 deletions
diff --git a/system/mdcat-bin/README b/system/mdcat-bin/README new file mode 100644 index 0000000000000..e7bb8ac06523a --- /dev/null +++ b/system/mdcat-bin/README @@ -0,0 +1,24 @@ +mdcat-bin (cat and less for markdown) + +mdcat is a fancy "cat" (or "less") for Markdown (aka CommonMark). +mdcat renders Markdown in a terminal, using escape codes for +highlighting and formatting. It works in any terminal, including the +Linux console, but some features (e.g. italics, strikethrough, images) +are only supported on certain terminals (such as kitty, for images). + +For convenience, mdcat is also installed as mdless (which behaves the +same as "mdcat -p"). + +The package installs completion support for bash (requires +bash-completion from Slackware /extra), zsh, and fish, and +tab-completion should "just work" after the package is installed. + +PowerShell completion is also included, but has to be manually +set up. To do this, edit your PowerShell profile (usually +~/.config/powershell/profile.ps1) and add the following lines: + +/usr/share/mdcat-bin/powershell-completions/_mdcat.ps1 +/usr/share/mdcat-bin/powershell-completions/_mdless.ps1 + +This is a repack of the official binary, which only exists for +x86_64. There are no 32-bit or aarch64 binaries, sorry. diff --git a/system/mdcat-bin/mdcat-bin.SlackBuild b/system/mdcat-bin/mdcat-bin.SlackBuild new file mode 100644 index 0000000000000..713d56a384dd4 --- /dev/null +++ b/system/mdcat-bin/mdcat-bin.SlackBuild @@ -0,0 +1,113 @@ +#!/bin/bash + +# Slackware build script for mdcat-bin + +# Written by B. Watson (urchlay@slackware.uk) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# This is a binary repack because the source is in Rust, and won't +# build with the Rust that ships with Slackware 15.0. It would be +# possible for someone to use rustup and deal with "cargo vendor" +# stuff to create build-from-source mdcat SlackBuild, but that +# someone will not be me. If you are that someone, I've named this one +# "mdcat-bin" so you can name yours "mdcat". + +# Despite the "musl" in the tarball filename, this works fine on +# Slackware, since it's 100% statically linked. Upstream probably used +# musl because glibc's not capable of creating a truly static binary +# that uses DNS... + +# Many thanks to chrisdent and pwshdooduk of libera.chat's #powershell, +# for making sense of the powershell completions and just generally +# being friendly folks. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=mdcat-bin +SRCNAM=mdcat +VERSION=${VERSION:-2.0.3} +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" = "x86_64" ]; then + SRCDIR="$SRCNAM-$VERSION-$ARCH-unknown-linux-musl" + TARBALL="$SRCDIR.tar.gz" +else + cat <<EOF + +*** ARCH "$ARCH" is not supported (only x86_64 is supported, sorry). + +EOF + exit 1 +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +# use e.g. /tmp/SBo/mdcat-bin/<blah>/, for easy cleanup. +rm -rf $PRGNAM +mkdir -p $PRGNAM +cd $PRGNAM +tar xvf $CWD/$TARBALL +cd $SRCDIR +chown -R root:root . +# no find|chmod, but we install everything with explicit permissions +# or redirection, below. + +PKGBIN=$PKG/usr/bin +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +PKGMAN1=$PKG/usr/man/man1 +PKGBASHC=$PKG/usr/share/bash-completion/completions +PKGZSHC=$PKG/usr/share/zsh/site-functions +PKGFISHC=$PKG/usr/share/fish/completions + +# powershell doesn't really have a completions directory, so I picked +# something plausible-looking. The README tells how to edit your +# profile to add these. +PKGPSHC="$PKG/usr/share/$PRGNAM/powershell-completions" + +mkdir -p $PKGBIN $PKGDOC $PKGMAN1 $PKGBASHC $PKGZSHC $PKGFISHC $PKGPSHC + +install -m0755 $SRCNAM $PKGBIN +ln -s $SRCNAM $PKGBIN/mdless + +INST="install -m0644" +$INST LICENSE *.md $PKGDOC +gzip -9c < $SRCNAM.1 > $PKGMAN1/$SRCNAM.1.gz +ln -s $SRCNAM.1.gz $PKGMAN1/mdless.1.gz + +cd completions +$INST mdcat.bash $PKGBASHC/mdcat +$INST mdless.bash $PKGBASHC/mdless +$INST _mdcat _mdless $PKGZSHC +$INST *.fish $PKGFISHC +$INST *.ps1 $PKGPSHC + +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/system/mdcat-bin/mdcat-bin.info b/system/mdcat-bin/mdcat-bin.info new file mode 100644 index 0000000000000..b30ea71d02608 --- /dev/null +++ b/system/mdcat-bin/mdcat-bin.info @@ -0,0 +1,10 @@ +PRGNAM="mdcat-bin" +VERSION="2.0.3" +HOMEPAGE="https://github.com/swsnr/mdcat/" +DOWNLOAD="https://github.com/swsnr/mdcat/releases/download/mdcat-2.0.3/mdcat-2.0.3-x86_64-unknown-linux-musl.tar.gz" +MD5SUM="621e828932a751ea0ac406494844846f" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/system/mdcat-bin/slack-desc b/system/mdcat-bin/slack-desc new file mode 100644 index 0000000000000..324f2236babb0 --- /dev/null +++ b/system/mdcat-bin/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------------------------------------------------------| +mdcat-bin: mdcat-bin (cat and less for markdown) +mdcat-bin: +mdcat-bin: mdcat is a fancy "cat" (or "less") for Markdown (aka CommonMark). +mdcat-bin: mdcat renders Markdown in a terminal, using escape codes for +mdcat-bin: highlighting and formatting. It works in any terminal, including the +mdcat-bin: Linux console, but some features (e.g. italics, strikethrough, images) +mdcat-bin: are only supported on certain terminals (such as kitty, for images). +mdcat-bin: +mdcat-bin: +mdcat-bin: +mdcat-bin: |