| 1 | #!/bin/sh |
| 2 | # © 2011 Cyril Brulebois <kibi@debian.org> |
| 3 | # |
| 4 | # Usage: |
| 5 | # Call this script from debian/rules, before dh_gencontrol is run, |
| 6 | # to get all needed variables computed in debian/$p.substvars for |
| 7 | # each package $p found through dh_listpackages. |
| 8 | # . |
| 9 | # This script has support for udebs. |
| 10 | set -e |
| 11 | |
| 12 | # Sanity check. All drivers build-depend on debhelper: |
| 13 | if ! which dh_listpackages >/dev/null 2>&1; then |
| 14 | echo "E: dh_listpackages not found, debhelper package missing?" |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
| 18 | # Read the dependencies once: |
| 19 | INPUTDEP=$(cat /usr/share/xserver-xorg/xinputdep 2>/dev/null) |
| 20 | VIDEODEP=$(cat /usr/share/xserver-xorg/videodrvdep 2>/dev/null) |
| 21 | |
| 22 | # Iterate on the packages: |
| 23 | for package in $(dh_listpackages); do |
| 24 | case $package in |
| 25 | *-udeb) |
| 26 | # udebs depend on udebs, tweak the dependency on the server: |
| 27 | inputdep=$(echo "$INPUTDEP"|sed 's/xserver-xorg-core/&-udeb/') |
| 28 | videodep=$(echo "$VIDEODEP"|sed 's/xserver-xorg-core/&-udeb/') |
| 29 | ;; |
| 30 | *) |
| 31 | # just copy the dependencies read previously: |
| 32 | inputdep="$INPUTDEP" |
| 33 | videodep="$VIDEODEP" |
| 34 | esac |
| 35 | |
| 36 | # To avoid having "unused substitution variable" warnings from |
| 37 | # dpkg-gencontrol, only set variables which make sense: |
| 38 | case $package in |
| 39 | *-dbg|*-dev|*-all) |
| 40 | # debug, devel, or meta package, no need for Depends/Provides. |
| 41 | : |
| 42 | ;; |
| 43 | xserver-xorg-input-*) |
| 44 | # input driver: |
| 45 | echo "xinpdriver:Depends=$inputdep" >> debian/$package.substvars |
| 46 | echo "xinpdriver:Provides=xorg-driver-input" >> debian/$package.substvars |
| 47 | ;; |
| 48 | xserver-xorg-video-*) |
| 49 | # video driver: |
| 50 | echo "xviddriver:Depends=$videodep" >> debian/$package.substvars |
| 51 | echo "xviddriver:Provides=xorg-driver-video" >> debian/$package.substvars |
| 52 | esac |
| 53 | done |