hp for Arch

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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
pkgname=haskell-platform
pkgrel=1
pkgver=2010.2.0.0
pkgdesc="The Haskell Platform"
url="http://hackage.haskell.org/package/haskell-platform"
license=('custom:BSD3')
arch=('i686' 'x86_64')
makedepends=()
depends=(
    'mesa'
    'freeglut'
    'ghc=6.12.3'
    'cabal-install=0.8.2'
    'alex=2.3.3'
    'happy=1.18.5'
    )
provides=(
    'haskell-mtl=1.1.0.2'
    'haskell-zlib=0.5.2.0'
    'haskell-parsec=2.1.0.1'
    'haskell-quickcheck=2.1.1.1'
    'haskell-network=2.2.1.7'
    'haskell-http=4000.0.9'
    'haskell-opengl=2.2.3.0'
    'haskell-glut=2.1.2.1'
    'haskell-hunit=1.2.2.1'
    'haskell-xhtml=3000.2.0.1'
    'haskell-cgi=3001.1.7.3'
    'haskell-deepseq=1.1.0.0'
    'haskell-fgl=5.4.2.3'
    'haskell-haskell-src=1.0.1.3'
    'haskell-html=1.0.1.2'
    'haskell-parallel=2.2.0.1'
    'haskell-stm=2.1.2.1'
    'haskell-regex-base=0.93.2'
    'haskell-regex-posix=0.94.2'
    'haskell-regex-compat=0.93.1'
    )
options=('strip')
source=(
    http://hackage.haskell.org/packages/archive/mtl/1.1.0.2/mtl-1.1.0.2.tar.gz
    http://hackage.haskell.org/packages/archive/zlib/0.5.2.0/zlib-0.5.2.0.tar.gz
    http://hackage.haskell.org/packages/archive/parsec/2.1.0.1/parsec-2.1.0.1.tar.gz
    http://hackage.haskell.org/packages/archive/QuickCheck/2.1.1.1/QuickCheck-2.1.1.1.tar.gz
    http://hackage.haskell.org/packages/archive/network/2.2.1.7/network-2.2.1.7.tar.gz
    http://hackage.haskell.org/packages/archive/HTTP/4000.0.9/HTTP-4000.0.9.tar.gz
    http://hackage.haskell.org/packages/archive/OpenGL/2.2.3.0/OpenGL-2.2.3.0.tar.gz
    http://hackage.haskell.org/packages/archive/GLUT/2.1.2.1/GLUT-2.1.2.1.tar.gz
    http://hackage.haskell.org/packages/archive/HUnit/1.2.2.1/HUnit-1.2.2.1.tar.gz
    http://hackage.haskell.org/packages/archive/xhtml/3000.2.0.1/xhtml-3000.2.0.1.tar.gz
    http://hackage.haskell.org/packages/archive/cgi/3001.1.7.3/cgi-3001.1.7.3.tar.gz
    http://hackage.haskell.org/packages/archive/deepseq/1.1.0.0/deepseq-1.1.0.0.tar.gz
    http://hackage.haskell.org/packages/archive/fgl/5.4.2.3/fgl-5.4.2.3.tar.gz
    http://hackage.haskell.org/packages/archive/haskell-src/1.0.1.3/haskell-src-1.0.1.3.tar.gz
    http://hackage.haskell.org/packages/archive/html/1.0.1.2/html-1.0.1.2.tar.gz
    http://hackage.haskell.org/packages/archive/parallel/2.2.0.1/parallel-2.2.0.1.tar.gz
    http://hackage.haskell.org/packages/archive/stm/2.1.2.1/stm-2.1.2.1.tar.gz
    http://hackage.haskell.org/packages/archive/regex-base/0.93.2/regex-base-0.93.2.tar.gz
    http://hackage.haskell.org/packages/archive/regex-posix/0.94.2/regex-posix-0.94.2.tar.gz
    http://hackage.haskell.org/packages/archive/regex-compat/0.93.1/regex-compat-0.93.1.tar.gz
    )
install=haskell-platform.install

hp_build_pkg() { # {{{1
    hkg_pkg=$1
    hp_pkg=$2
    hp_ver=$3

    cd ${srcdir}/${hkg_pkg}-${hp_ver}
    ghc --make Setup
    ./Setup configure --prefix=/usr \
        --docdir=/usr/share/doc/haskell-platform/${hp_pkg} \
        --package-db=${srcdir}/temp-pkg-db
    ./Setup build
    ./Setup haddock
    ./Setup register --gen-script
    ./Setup unregister --gen-script
    ./Setup register --inplace
}

hp_package_pkg() { # {{{1
    hkg_pkg=$1
    hp_pkg=$2
    hp_ver=$3

    cd ${srcdir}/${hkg_pkg}-${hp_ver}
    sed -i -e "s/'--package-conf=.*'//" register.sh
    sed -i -e "s/'--package-conf=.*'//" unregister.sh
    install -D -m744 register.sh ${pkgdir}/usr/share/haskell/haskell-platform/${hp_pkg}/register.sh
    install    -m744 unregister.sh ${pkgdir}/usr/share/haskell/haskell-platform/${hp_pkg}/unregister.sh
    install -d -m755 ${pkgdir}/usr/share/doc/ghc/html/libraries/haskell-platform
    ln -s /usr/share/doc/haskell-platform/${hp_pkg}/html ${pkgdir}/usr/share/doc/ghc/html/libraries/haskell-platform-${hp_pkg}
    ./Setup copy --destdir=${pkgdir}
    install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/haskell-platform/${hp_pkg}/LICENSE
    rm -f ${pkgdir}/usr/share/doc/haskell-platform/${hp_pkg}/LICENSE
}

build() { # {{{1
    [[ -d ${srcdir}/temp-pkg-db ]] && rm -rf ${srcdir}/temp-pkg-db
    ghc-pkg init ${srcdir}/temp-pkg-db
    GHC_PACKAGE_PATH=${srcdir}/temp-pkg-db:

    hp_build_pkg mtl mtl 1.1.0.2
    hp_build_pkg zlib zlib 0.5.2.0
    hp_build_pkg parsec parsec 2.1.0.1
    hp_build_pkg QuickCheck quickcheck 2.1.1.1
    hp_build_pkg network network 2.2.1.7
    hp_build_pkg HTTP http 4000.0.9
    hp_build_pkg OpenGL opengl 2.2.3.0
    hp_build_pkg GLUT glut 2.1.2.1
    hp_build_pkg HUnit hunit 1.2.2.1
    hp_build_pkg xhtml xhtml 3000.2.0.1
    hp_build_pkg cgi cgi 3001.1.7.3
    hp_build_pkg deepseq deepseq 1.1.0.0
    hp_build_pkg fgl fgl 5.4.2.3
    hp_build_pkg haskell-src haskell-src 1.0.1.3
    hp_build_pkg html html 1.0.1.2
    hp_build_pkg parallel parallel 2.2.0.1
    hp_build_pkg stm stm 2.1.2.1
    hp_build_pkg regex-base 0.93.2
    hp_build_pkg regex-posix 0.94.2
    hp_build_pkg regex-compat 0.93.1
}

package() { # {{{1
    hp_package_pkg mtl mtl 1.1.0.2
    hp_package_pkg zlib zlib 0.5.2.0
    hp_package_pkg parsec parsec 2.1.0.1
    hp_package_pkg QuickCheck quickcheck 2.1.1.1
    hp_package_pkg network network 2.2.1.7
    hp_package_pkg HTTP http 4000.0.9
    hp_package_pkg OpenGL opengl 2.2.3.0
    hp_package_pkg GLUT glut 2.1.2.1
    hp_package_pkg HUnit hunit 1.2.2.1
    hp_package_pkg xhtml xhtml 3000.2.0.1
    hp_package_pkg cgi cgi 3001.1.7.3
    hp_package_pkg deepseq deepseq 1.1.0.0
    hp_package_pkg fgl fgl 5.4.2.3
    hp_package_pkg haskell-src haskell-src 1.0.1.3
    hp_package_pkg html html 1.0.1.2
    hp_package_pkg parallel parallel 2.2.0.1
    hp_package_pkg stm stm 2.1.2.1
    hp_package_pkg regex-base regex-base 0.93.2
    hp_package_pkg regex-posix regex-posix 0.94.2
    hp_package_pkg regex-compat regex-compat 0.93.1
}

sha256sums=('a225aaf2b1e337f40c31e5c42f95eec9a4608322b0e4c135d2b31b8421a58d36'
            '4119fb627e0adc2b129acd86fe5724cf05a49d8de5b64eb7a6e519d3befd3b8f'
            '2d85e5b5c8b2b1f341037ce67e1db7fa47b31c083136796cfef9e5b945c656df'
            '626a6f7a69e2bea3b4fe7c573d0bc8da8c77f97035cb2d3a5e1c9fca382b59c9'
            '0e65b28a60764245c1ab6661a3566f286feb36e0e6f0296d6cd2b84adcd45d58'
            '1e2b4a8b782ad1417c8755bb0d248851bc142b351366ed460e07f2945a5e95ba'
            'a75c3277bb20fda9a4ac1eb0e838fe4b5baf92f5539466b92bd255626afb0502'
            '0230bfacbfb85c126f1fba45fcd8d02f20da9ee19180b5ada698224362d17264'
            '47235503b666658588181795540d29212283059b21edc42e1b4f1998e46ac853'
            '60d7a44ae6d607475e2d60c5bf9909b8a3bd88850d52b08ff1532aa6d58bec96'
            'f1f4bc6b06e8a191db4ddb43617fee3ef37635e380d6a17c29efb5641ce91df0'
            '947c45e7ee862159f190fb8e905c1328f7672cb9e6bf3abd1d207bbcf1eee50a'
            'e72142b555a5ab6c5cdced317b42e8cafdbb54b7e2e46ed14e6ca18d71d486b8'
            'a7872900acd2293775a6bdc6dc8f70438ccd80e62d2d1e2394ddff15b1883e89'
            '0c35495ea33d65e69c69bc7441ec8e1af69fbb43433c2aa3406c0a13a3ab3061'
            '255310023138ecf618c8b450203fa2fc65feb68cd08ee4d369ceae72054168fd'
            '0d7d8babd2f07c726909030461e1f9b3aaf02dc809fd5e1c0509a67d23b784b8'
            '20dc5713a16f3d5e2e6d056b4beb9cfdc4368cd09fd56f47414c847705243278'
            'ea0c1ed0ab49ade4dba1eea7a42197652ccb18b7a98c4040e37ba11d26f33067'
            'ee0374f780378e8c04a63d9cbaca525e116dbe2bdce4cff3abaffc28d4e99afe')



HP_PKGS=(
    'mtl'
    'zlib'
    'parsec'
    'quickcheck'
    'network'
    'http'
    'opengl'
    'glut'
    'hunit'
    'xhtml'
    'cgi'
    'deepseq'
    'fgl'
    'haskell-src'
    'html'
    'parallel'
    'stm'
    'regex-base'
    'regex-posix'
    'regex-compat'
    )

post_install() {
    for d in ${HP_PKGS[@]}; do
        /usr/share/haskell/haskell-platform/$d/register.sh
    done
        
    (cd /usr/share/doc/ghc/html/libraries; ./gen_contents_index)
}

pre_upgrade() {
    for d in ${HP_PKGS[@]}; do
        /usr/share/haskell/haskell-platform/$d/unregister.sh
    done
}

post_upgrade() {
    for d in ${HP_PKGS[@]}; do
        /usr/share/haskell/haskell-platform/$d/register.sh
    done

    (cd /usr/share/doc/ghc/html/libraries; ./gen_contents_index)
}

pre_remove() {
    for d in ${HP_PKGS[@]}; do
        /usr/share/haskell/haskell-platform/$d/unregister.sh
    done
}

post_remove() {
    (cd /usr/share/doc/ghc/html/libraries; ./gen_contents_index)
}

op=$1
shift
$op $*