summaryrefslogtreecommitdiff
path: root/libre/dpkg/PKGBUILD
blob: aa82d36e6172ec725fdb45d555040f1d85aa9502 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
# Maintainer (AUR): Jochen Schalanda <jochen+aur@schalanda.name>
# Contributor (AUR): Pierre Carrier <pierre@spotify.com>
# Contributor (AUR): Thomas Dziedzic <gostrc@gmail>
# Contributor (AUR): Chris Giles <Chris.G.27@gmail.com>
# Contributor (AUR): seblu <seblu+arch@seblu.net>
# Contributor (AUR): squiddo <squiddo@intheocean.net>

pkgbase=dpkg
#pkgname=(dpkg dpkg-devtools dselect libdpkg perl-dpkg)
pkgname=(dpkg-devtools perl-dpkg)
pkgdesc="Debian Package manager and utilities"
license=('GPL2')

pkgver=1.16.9
url="http://packages.debian.org/source/sid/dpkg"
_debrepo=http://ftp.debian.org/debian/pool/main # Debian Sid

pkgrel=1.1
debfile() { echo "${_debrepo}/${1:0:1}/${1}/${1}_${2}"; }
arch=('i686' 'x86_64' 'mips64el')
depends=('bzip2' 'xz' 'zlib' 'ncurses')
checkdepends=('perl-test-pod')
makedepends=('perl-io-string' 'perl-timedate')
source=("$(debfile ${pkgbase} ${pkgver}).tar.xz"
        dpkg-gzip-rsyncable.patch)

######################################################################

# This is really gross.
# It uses the debian control files to help us split the package.
# Shame on the dpkg developers for not putting that logic into the build system.
_destdir="$srcdir/$pkgbase-$pkgver/debian/pkg-makepkg"
_debhelper_install() {
  local debname=$1
  cd "$_destdir"

  # main files
  sed -e '/^\s*$/d' -e 's|usr/share/perl5/|&vendor_perl/|g' ../$debname.install \
    | while read pattern dest; do
    if [[ -z $dest ]]; then
      for file in $pattern; do
        install -d "$pkgdir/${file%/*}"
        cp -a "$file" "$pkgdir/$file" || true
      done
    else
      install -d "$pkgdir/$dest/"
      cp -a "$pattern" "$pkgdir/$dest/" || true
    fi
  done

  # manpages
  sed -e 's|^debian/tmp/||' -e '/^\s*$/d' ../$debname.manpages 2>/dev/null \
    | while read pattern; do
    for file in $pattern; do
      install -d "$pkgdir/${file%/*}"
      cp -a "$file" "$pkgdir/$file" || true
    done
  done

  # other documentation
  install -d "$pkgdir/usr/share/doc/$pkgname/"
  sed '/^\s*$/d' ../$debname.docs  2>/dev/null \
    | while read file; do
    gzip \
      < "$srcdir/$pkgbase-$pkgver/$file" \
      > "$pkgdir/usr/share/doc/$pkgname/${file##*/}.gz"
  done

  # symlinks
  sed '/^\s*$/d' ../$debname.links  2>/dev/null \
    | while read file link; do
    ln -s "/$file" "$pkgdir/$link"
  done
}

######################################################################

build() {
  cd "${srcdir}/${pkgbase}-${pkgver}"

  patch -p0 -i "${srcdir}/dpkg-gzip-rsyncable.patch"

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-zlib --with-bz2 --with-liblzma
  make
  make DESTDIR="$_destdir" install
}

check() {
  cd "${srcdir}/${pkgbase}-${pkgver}"
  make check
}

package_dpkg() {
  pkgdesc="Debian Package manager"
  provides+=(start-stop-daemon)
  conflicts+=(start-stop-daemon)
  _debhelper_install dpkg
}

package_dpkg-devtools() {
  pkgdesc="Debian Package development tools"
  arch=(any)
  depends+=(perl-dpkg)
  _debhelper_install dpkg-dev
}

package_dselect() {
  pkgdesc="Debian Package manager high-level interface"
  _debhelper_install dselect
}

package_libdpkg() {
  pkgdesc="Debian Package manager library (static)"
  _debhelper_install libdpkg-dev
}

package_perl-dpkg() {
  pkgdesc="Debian Package perl modules"
  arch=(any)
  _debhelper_install libdpkg-perl
}

md5sums=('4df9319b2d17e19cdb6fe94dacee44da'
         '5ab63758999e9bb10f84bce79a0307b2')