aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-06-21 13:23:06 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-06-21 13:23:06 +0000
commitb498b92c105554578b7856f31a0a1bb0cc75aa3f (patch)
treeb2e66c3d9f466c0f50745f29a324943126984658 /main
parentbe2a2f9d094176ef976bf375647a7d59f5d99892 (diff)
downloadaports-b498b92c105554578b7856f31a0a1bb0cc75aa3f.tar.bz2
aports-b498b92c105554578b7856f31a0a1bb0cc75aa3f.tar.xz
main/mansh: moved from testing
Diffstat (limited to 'main')
-rw-r--r--main/mansh/APKBUILD46
-rw-r--r--main/mansh/mansh.post-install6
-rw-r--r--main/mansh/mdocml-support.patch375
3 files changed, 427 insertions, 0 deletions
diff --git a/main/mansh/APKBUILD b/main/mansh/APKBUILD
new file mode 100644
index 0000000000..29617bbf7f
--- /dev/null
+++ b/main/mansh/APKBUILD
@@ -0,0 +1,46 @@
+# Contributor: blinkkin <blink@bojary.koba.pl>
+# Maintainer:
+
+pkgname=mansh
+pkgver=20110604
+pkgrel=0
+pkgdesc="man, whatis and apropos written in shell"
+url="http://svnweb.freebsd.org/base/head/usr.bin/man/"
+arch="noarch"
+license="BSD"
+depends=
+depends_dev=
+makedepends="cvs"
+install="$pkgname.post-install"
+subpackages="$pkgname-doc"
+source="http://dev.alpinelinux.org/~ncopa/mansh-$pkgver.tar.bz2
+ mdocml-support.patch"
+
+_builddir="$srcdir"/$pkgname
+mksource() {
+ mkdir /tmp/${pkgname}-${pkgver}
+ (cd /tmp/${pkgname}-${pkgver};
+ cvs -d :pserver:anoncvs@anoncvs.tw.FreeBSD.org:/home/ncvs checkout -D $pkgver -d $pkgname src/usr.bin/man/
+ rm -rf /tmp/${pkgname}-${pkgver}/$pkgname/CVS
+ tar cjf /tmp/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.bz2 mansh/)
+}
+
+prepare() {
+ cd "$_builddir"
+ for i in "$srcdir"/*.patch; do
+ msg "Applying ${i}"
+ patch -p0 -i $i || return 1
+ done
+}
+
+package() {
+ cd "$_builddir"
+ install -Dm 755 man.sh "$pkgdir"/usr/libexec/man.sh
+ for i in *.1; do
+ install -Dm 644 $i "$pkgdir"/usr/share/man/man1/$i
+ done
+ install -Dm 644 man.conf.5 "$pkgdir"/usr/share/man/man5/man.conf.5 || return 1
+}
+
+md5sums="0e25b2e02febf224709f4e2fabb12d6a mansh-20110604.tar.bz2
+f805bbd10a20d1f2c9aa318e83186ecf mdocml-support.patch"
diff --git a/main/mansh/mansh.post-install b/main/mansh/mansh.post-install
new file mode 100644
index 0000000000..45f2f8bb65
--- /dev/null
+++ b/main/mansh/mansh.post-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+ln -s /usr/libexec/man.sh /usr/bin/man
+ln -s /usr/libexec/man.sh /usr/bin/apropos
+ln -s /usr/libexec/man.sh /usr/bin/whatis
+ln -s /usr/libexec/man.sh /usr/bin/manpath
diff --git a/main/mansh/mdocml-support.patch b/main/mansh/mdocml-support.patch
new file mode 100644
index 0000000000..3ee6675497
--- /dev/null
+++ b/main/mansh/mdocml-support.patch
@@ -0,0 +1,375 @@
+--- man.orig
++++ man.sh
+@@ -88,45 +88,13 @@
+ decho "Using manual path: $MANPATH"
+ }
+
+-# Usage: check_cat catglob
+-# Checks to see if a cat glob is available.
+-check_cat() {
+- if exists "$1"; then
+- use_cat=yes
+- catpage=$found
+- setup_cattool $catpage
+- decho " Found catpage $catpage"
+- return 0
+- else
+- return 1
+- fi
+-}
+-
+ # Usage: check_man manglob catglob
+ # Given 2 globs, figures out if the manglob is available, if so, check to
+ # see if the catglob is also available and up to date.
+ check_man() {
+ if exists "$1"; then
+- # We have a match, check for a cat page
+ manpage=$found
+- setup_cattool $manpage
+ decho " Found manpage $manpage"
+-
+- if [ -n "${use_width}" ]; then
+- # non-standard width
+- unset use_cat
+- decho " Skipping catpage: non-standard page width"
+- elif exists "$2" && is_newer $found $manpage; then
+- # cat page found and is newer, use that
+- use_cat=yes
+- catpage=$found
+- setup_cattool $catpage
+- decho " Using catpage $catpage"
+- else
+- # no cat page or is older
+- unset use_cat
+- decho " Skipping catpage: not found or old"
+- fi
+ return 0
+ fi
+
+@@ -167,13 +135,11 @@
+ # Returns: true if something is matched and found.
+ # Search the given path/section combo for a given page.
+ find_file() {
+- local manroot catroot mann man0 catn cat0
++ local manroot mann man0
+
+ manroot="$1/man$2"
+- catroot="$1/cat$2"
+ if [ -n "$3" ]; then
+ manroot="$manroot/$3"
+- catroot="$catroot/$3"
+ fi
+
+ if [ ! -d "$manroot" ]; then
+@@ -183,19 +149,13 @@
+
+ mann="$manroot/$4.$2*"
+ man0="$manroot/$4.0*"
+- catn="$catroot/$4.$2*"
+- cat0="$catroot/$4.0*"
+
+ # This is the behavior as seen by the original man utility.
+ # Let's not change that which doesn't seem broken.
+- if check_man "$mann" "$catn"; then
++ if check_man "$mann"; then
+ return 0
+- elif check_man "$man0" "$cat0"; then
++ elif check_man "$man0"; then
+ return 0
+- elif check_cat "$catn"; then
+- return 0
+- elif check_cat "$cat0"; then
+- return 0
+ fi
+
+ return 1
+@@ -279,31 +239,13 @@
+ # Usage: man_display_page
+ # Display either the manpage or catpage depending on the use_cat variable
+ man_display_page() {
+- local EQN NROFF PIC TBL TROFF REFER VGRIND
+- local IFS l nroff_dev pipeline preproc_arg tool
++ local NROFF
++ local IFS l pipeline preproc_arg tool
+
+ # We are called with IFS set to colon. This causes really weird
+ # things to happen for the variables that have spaces in them.
+ unset IFS
+
+- # If we are supposed to use a catpage and we aren't using troff(1)
+- # just zcat the catpage and we are done.
+- if [ -z "$tflag" -a -n "$use_cat" ]; then
+- if [ -n "$wflag" ]; then
+- echo "$catpage (source: $manpage)"
+- ret=0
+- else
+- if [ $debug -gt 0 ]; then
+- decho "Command: $cattool $catpage | $MANPAGER"
+- ret=0
+- else
+- eval "$cattool $catpage | $MANPAGER"
+- ret=$?
+- fi
+- fi
+- return
+- fi
+-
+ # Okay, we are using the manpage, do we just need to output the
+ # name of the manpage?
+ if [ -n "$wflag" ]; then
+@@ -312,88 +254,17 @@
+ return
+ fi
+
+- # So, we really do need to parse the manpage. First, figure out the
+- # device flag (-T) we have to pass to eqn(1) and groff(1). Then,
+- # setup the pipeline of commands based on the user's request.
++ NROFF="$NROFF -Tutf8"
+
+- # If the manpage is from a particular charset, we need to setup nroff
+- # to properly output for the correct device.
+- case "${manpage}" in
+- *.${man_charset}/*)
+- # I don't pretend to know this; I'm just copying from the
+- # previous version of man(1).
+- case "$man_charset" in
+- KOI8-R) nroff_dev="koi8-r" ;;
+- ISO8859-1) nroff_dev="latin1" ;;
+- ISO8859-15) nroff_dev="latin1" ;;
+- UTF-8) nroff_dev="utf8" ;;
+- *) nroff_dev="ascii" ;;
+- esac
+-
+- NROFF="$NROFF -T$nroff_dev"
+- EQN="$EQN -T$nroff_dev"
+-
+- # Iff the manpage is from the locale and not just the charset,
+- # then we need to define the locale string.
+- case "${manpage}" in
+- */${man_lang}_${man_country}.${man_charset}/*)
+- NROFF="$NROFF -dlocale=$man_lang.$man_charset"
+- ;;
+- */${man_lang}.${man_charset}/*)
+- NROFF="$NROFF -dlocale=$man_lang.$man_charset"
+- ;;
+- esac
+-
+- # Allow language specific calls to override the default
+- # set of utilities.
+- l=$(echo $man_lang | tr [:lower:] [:upper:])
+- for tool in EQN NROFF PIC TBL TROFF REFER VGRIND; do
+- eval "$tool=\${${tool}_$l:-\$$tool}"
+- done
+- ;;
+- *) NROFF="$NROFF -Tascii"
+- EQN="$EQN -Tascii"
+- ;;
+- esac
+-
+- if [ -z "$MANCOLOR" ]; then
+- NROFF="$NROFF -P-c"
+- fi
+-
+ if [ -n "${use_width}" ]; then
+- NROFF="$NROFF -rLL=${use_width}n -rLT=${use_width}n"
++ NROFF="$NROFF -Owidth=${use_width}"
+ fi
+
+- if [ -n "$MANROFFSEQ" ]; then
+- set -- -$MANROFFSEQ
+- while getopts 'egprtv' preproc_arg; do
+- case "${preproc_arg}" in
+- e) pipeline="$pipeline | $EQN" ;;
+- g) ;; # Ignore for compatability.
+- p) pipeline="$pipeline | $PIC" ;;
+- r) pipeline="$pipeline | $REFER" ;;
+- t) pipeline="$pipeline | $TBL" ;;
+- v) pipeline="$pipeline | $VGRIND" ;;
+- *) usage ;;
+- esac
+- done
+- # Strip the leading " | " from the resulting pipeline.
+- pipeline="${pipeline#" | "}"
+- else
+- pipeline="$TBL"
+- fi
+-
+- if [ -n "$tflag" ]; then
+- pipeline="$pipeline | $TROFF"
+- else
+- pipeline="$pipeline | $NROFF | $MANPAGER"
+- fi
+-
+ if [ $debug -gt 0 ]; then
+- decho "Command: $cattool $manpage | $pipeline"
++ decho "Command: $NROFF $manpage | $MANPAGER"
+ ret=0
+ else
+- eval "$cattool $manpage | $pipeline"
++ eval "$NROFF $manpage | $MANPAGER"
+ ret=$?
+ fi
+ }
+@@ -408,9 +279,7 @@
+ case "$1" in
+ */*) if [ -f "$1" -a -r "$1" ]; then
+ decho "Found a usable page, displaying that"
+- unset use_cat
+ manpage="$1"
+- setup_cattool $manpage
+ if man_check_for_so $manpage $(dirname $manpage); then
+ found_page=yes
+ man_display_page
+@@ -428,33 +297,6 @@
+ p=$path/$locpath
+ p=${p%/.} # Rid ourselves of the trailing /.
+
+- # Check if there is a MACHINE specific manpath.
+- if find_file $p $sect $MACHINE "$1"; then
+- if man_check_for_so $manpage $p; then
+- found_page=yes
+- man_display_page
+- if [ -n "$aflag" ]; then
+- continue 2
+- else
+- return
+- fi
+- fi
+- fi
+-
+- # Check if there is a MACHINE_ARCH
+- # specific manpath.
+- if find_file $p $sect $MACHINE_ARCH "$1"; then
+- if man_check_for_so $manpage $p; then
+- found_page=yes
+- man_display_page
+- if [ -n "$aflag" ]; then
+- continue 2
+- else
+- return
+- fi
+- fi
+- fi
+-
+ # Check plain old manpath.
+ if find_file $p $sect '' "$1"; then
+ if man_check_for_so $manpage $p; then
+@@ -544,19 +386,6 @@
+ # Usage: man_setup
+ # Setup various trivial but essential variables.
+ man_setup() {
+- # Setup machine and architecture variables.
+- if [ -n "$mflag" ]; then
+- MACHINE_ARCH=${mflag%%:*}
+- MACHINE=${mflag##*:}
+- fi
+- if [ -z "$MACHINE_ARCH" ]; then
+- MACHINE_ARCH=$($SYSCTL -n hw.machine_arch)
+- fi
+- if [ -z "$MACHINE" ]; then
+- MACHINE=$($SYSCTL -n hw.machine)
+- fi
+- decho "Using architecture: $MACHINE_ARCH:$MACHINE"
+-
+ setup_pager
+
+ # Setup manual sections to search.
+@@ -582,14 +411,6 @@
+ use_width=$MANWIDTH
+ fi
+ ;;
+- [Tt][Tt][Yy])
+- if { sizes=$($STTY size 0>&3 2>/dev/null); } 3>&1; then
+- set -- $sizes
+- if [ $2 -gt 80 ]; then
+- use_width=$(($2-2))
+- fi
+- fi
+- ;;
+ esac
+ if [ -n "$use_width" ]; then
+ decho "Using non-standard page width: ${use_width}"
+@@ -601,38 +422,8 @@
+ # Usage: man_setup_locale
+ # Setup necessary locale variables.
+ man_setup_locale() {
+- local lang_cc
+
+ locpaths='.'
+- man_charset='US-ASCII'
+-
+- # Setup locale information.
+- if [ -n "$oflag" ]; then
+- decho 'Using non-localized manpages'
+- else
+- # Use the locale tool to give us the proper LC_CTYPE
+- eval $( $LOCALE )
+-
+- case "$LC_CTYPE" in
+- C) ;;
+- POSIX) ;;
+- [a-z][a-z]_[A-Z][A-Z]\.*)
+- lang_cc="${LC_CTYPE%.*}"
+- man_lang="${LC_CTYPE%_*}"
+- man_country="${lang_cc#*_}"
+- man_charset="${LC_CTYPE#*.}"
+- locpaths="$LC_CTYPE"
+- locpaths="$locpaths:$man_lang.$man_charset"
+- if [ "$man_lang" != "en" ]; then
+- locpaths="$locpaths:en.$man_charset"
+- fi
+- locpaths="$locpaths:."
+- ;;
+- *) echo 'Unknown locale, assuming C' >&2
+- ;;
+- esac
+- fi
+-
+ decho "Using locale paths: $locpaths"
+ }
+
+@@ -822,19 +613,6 @@
+ exit $rval
+ }
+
+-# Usage: setup_cattool page
+-# Finds an appropriate decompressor based on extension
+-setup_cattool() {
+- case "$1" in
+- *.bz) cattool='/usr/bin/bzcat' ;;
+- *.bz2) cattool='/usr/bin/bzcat' ;;
+- *.gz) cattool='/usr/bin/zcat' ;;
+- *.lzma) cattool='/usr/bin/lzcat' ;;
+- *.xz) cattool='/usr/bin/xzcat' ;;
+- *) cattool='/usr/bin/zcat -f' ;;
+- esac
+-}
+-
+ # Usage: setup_pager
+ # Correctly sets $MANPAGER
+ setup_pager() {
+@@ -932,22 +710,12 @@
+ }
+
+ # User's PATH setting decides on the groff-suite to pick up.
+-EQN=eqn
+-NROFF='groff -S -P-h -Wall -mtty-char -man'
+-PIC=pic
+-REFER=refer
+-TBL=tbl
+-TROFF='groff -S -man'
+-VGRIND=vgrind
++NROFF='mandoc'
+
+-LOCALE=/usr/bin/locale
+-STTY=/bin/stty
+-SYSCTL=/sbin/sysctl
+-
+ debug=0
+ man_default_sections='1:1aout:8:2:3:n:4:5:6:7:9:l'
+ man_default_path='/usr/share/man:/usr/share/openssl/man:/usr/local/man'
+-cattool='/usr/bin/zcat -f'
++cattool=/bin/cat
+
+ config_global='/etc/man.conf'
+