# $Id: PKGBUILD 59095 2011-11-21 10:02:28Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Peter Simons <simons@cryp.to>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=rfc
pkgver=20111121
pkgrel=1
pkgdesc="RFCs from rfc-editor.org"
arch=('any')
url="http://www.rfc-editor.org/"
license=("custom:as-is")
options=('docs')
source=(http://www.rfc-editor.org/rfc/rfc-index.txt
        license
        http://www.rfc-editor.org/rfc/tar/RFCs0001-0500.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs0501-1000.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs1001-1500.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs1501-2000.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs2001-2500.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs2501-3000.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs3001-3500.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs3501-4000.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs4001-4500.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs4501-5000.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs5001-5500.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs5501-6000.tar.gz
        http://www.rfc-editor.org/rfc/tar/RFCs6001-latest.tar.gz)
md5sums=('6f08f1a8b2d15ff9d2d60c1141192b1a'
         '06a779406b45edddbd19fda96696ab4a'
         '2b5f22432bc5e8b450de37de039792ba'
         '424f79de8c5931cb6bcec8f76ab0920c'
         '7cbfda26348a4821890f1d560954eb51'
         '6b46c7bbc76ae910ebe0cad1dd9554ca'
         '5202bdf46c29aa3f8e577cbcce97f0cd'
         'e7459746999a1fba05a232d8df37ebce'
         'a266bb626d2aeda9e68a9c2fa2d621de'
         '732e30c8999439a1422f2acd69f91c75'
         'd8b96376eb8ef59876f7e834bcdfad85'
         '5213572b3ba2cf1f5854a966ae7afd83'
         '58b9f6a4ccfde48ab36c3d2ee536dfef'
         'a0596c9f0dfbc07ffde143b5bc0c3908'
         '7d4da085f1e8272c0068ebe8ac364858')

build() {
    cd "$srcdir"

    mkdir -p "$pkgdir/usr/share/doc/rfc"
    cp rfc-index.txt "$pkgdir/usr/share/doc/rfc/"
    rm -f rfc-index.txt

    tar xf rfc1305.tar
    rm -f rfc1305.tar
    for n in ntpv3*; do
      mv "$n" "rfc1305-$n"
    done

    for fmt in txt ps pdf; do
      mkdir -p "$pkgdir/usr/share/doc/rfc/${fmt}"
      mv *.${fmt} "$pkgdir/usr/share/doc/rfc/${fmt}/"
    done

    cd "$pkgdir/usr/share/doc/rfc"
    find . -type f -exec chmod 444 {} \;
    find . -type d -exec chmod 555 {} \;
    chown -R root:root .
    install -D -m0644 $srcdir/license $pkgdir/usr/share/licenses/$pkgname/license
}
