all repos — mgba @ 03c17cdc5637d3609b08caaa2c2c416fee9f9cbc

mGBA Game Boy Advance Emulator

tools/sanitize-deb.sh (view raw)

 1#!/bin/sh
 2# Clean up the caveats that CPack leaves behind
 3BINARY=mgba
 4
 5rmdep () {
 6    local DEP=$1
 7    echo Removing dependency $DEP
 8    sed -i~ "s/[^, ]*$DEP[^,]*//g" deb-temp/DEBIAN/control
 9}
10
11adddep() {
12    local DEP=$1
13    echo Adding dependency $DEP
14    sed -i~ "s/^Depends: /&$DEP,/" deb-temp/DEBIAN/control
15}
16
17while [ $# -gt 0 ]; do
18    DEB=$1
19    dpkg-deb -R $DEB deb-temp
20    PKG=`grep Package deb-temp/DEBIAN/control | cut -f2 -d ' '`
21    echo Found package $PKG
22
23    case $PKG in
24    *-base)
25        PKG=lib$BINARY
26        rmdep sdl
27        rmdep qt
28    ;;
29    *-qt)
30        PKG=$BINARY-qt
31        rmdep libav
32        rmdep libedit
33        rmdep libelf
34        rmdep libgl
35        rmdep libpng
36        rmdep libzip
37        rmdep libmagickwand
38        rmdep libsqlite3
39        rmdep libswresample
40        rmdep libswscale
41        rmdep zlib
42        adddep lib$BINARY
43    ;;
44    *-sdl)
45        PKG=$BINARY-sdl
46        rmdep libav
47        rmdep libedit
48        rmdep libelf
49        rmdep libgl
50        rmdep libpng
51        rmdep qt
52        rmdep libzip
53        rmdep libmagickwand
54        rmdep libsqlite3
55        rmdep libswresample
56        rmdep libswscale
57        rmdep zlib
58        adddep lib$BINARY
59    ;;
60    *)
61        echo Unknown package!
62    esac
63
64    sed -i~ "s/,,*/,/g" deb-temp/DEBIAN/control
65    sed -i~ "s/,$//g" deb-temp/DEBIAN/control
66    sed -i~ "/^[^:]*: $/d" deb-temp/DEBIAN/control
67    sed -i~ "s/^Package: .*$/Package: $PKG/" deb-temp/DEBIAN/control
68    rm deb-temp/DEBIAN/control~
69    chmod 644 deb-temp/DEBIAN/md5sums
70    chown -R root:root deb-temp
71    dpkg-deb -b deb-temp $PKG.deb
72    rm -rf deb-temp
73    shift
74done