| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. -e |
| 2 | |
| 3 | do_lintian_overridescip-shell shell shell-project 0.0.0 do_lintian_override().() { |
| 4 | pkgname="$1" |
| 5 | |
| 6 | echoscip-shell system . . echo. "# Automatically generated file, modify debian/regen.sh or debian/pkgname.lintian-overrides.in instead" > debian/${pkgname}.lintian-overrides |
| 7 | sedscip-shell system . . sed. -e "s!#PKGNAME#!${pkgname}!g" debian/all.lintian-overrides.in >> debian/${pkgname}.lintian-overrides |
| 8 | } |
| 9 | |
| 10 | add_packagescip-shell shell shell-project 0.0.0 add_package().() { |
| 11 | pkgname="$1" |
| 12 | |
| 13 | if ! grepscip-shell system . . grep. -q "Package: ${pkgname}$" debian/control.tmp2 ; then |
| 14 | if [scip-shell system . . `[`. -z "${PACKAGES}" ] |
| 15 | then |
| 16 | PACKAGES="${pkgname} (= \${binary:Version})" |
| 17 | else |
| 18 | PACKAGES="${PACKAGES}, ${pkgname} (= \${binary:Version})" |
| 19 | fi |
| 20 | |
| 21 | devname=$(echoscip-shell system . . echo. ${target} | sedscip-shell system . . sed. -e 's!^[^/]*/!!g' -e 's!/! !g') |
| 22 | |
| 23 | # XXX: currently the packages depend on the exact |
| 24 | # linux-firmware-soc version that provides corresponding DSP |
| 25 | # binaries. This will be relaxed once linux-firmware-qcom-soc |
| 26 | # starts providing virtual package names for DSP binaries. |
| 27 | echoscip-shell system . . echo. >> debian/control.tmp2 |
| 28 | sedscip-shell system . . sed. -e "s!#PKGNAME#!${pkgname}!g" -e "s!#DEVNAME#!${devname}!g" -e "s!#VERSION#!${VERSION}!g" \ |
| 29 | debian/control.dev.in >> debian/control.tmp2 |
| 30 | |
| 31 | if [scip-shell system . . `[`. ! -e "debian/${pkgname}.install" ] |
| 32 | then |
| 33 | echoscip-shell system . . echo. "# Automatically generated file, modify debian/regen.sh instead" > debian/${pkgname}.install |
| 34 | |
| 35 | echoscip-shell system . . echo. "usr/share/hexagon-dsp/conf.d/${pkgname}.yaml" >> debian/${pkgname}.install |
| 36 | fi |
| 37 | |
| 38 | echoscip-shell system . . echo. "WHENCE" > debian/${pkgname}.docs |
| 39 | touchscip-shell system . . touch. debian/${pkgname}.tmp-deps |
| 40 | |
| 41 | do_lintian_overridescip-shell shell shell-project 0.0.0 do_lintian_override(). ${pkgname} |
| 42 | fi |
| 43 | } |
| 44 | |
| 45 | skip_socscip-shell shell shell-project 0.0.0 skip_soc().() { |
| 46 | # skip first pathname entry |
| 47 | sedscip-shell system . . sed. -e 's!^[^/]*/!!g' |
| 48 | } |
| 49 | |
| 50 | device_namescip-shell shell shell-project 0.0.0 device_name().() { |
| 51 | # keep first three pathname entries |
| 52 | sedscip-shell system . . sed. -e 's!\([^/]*/[^/]*/[^/]*\)/.*!\1!g' |
| 53 | } |
| 54 | |
| 55 | to_pkgnamescip-shell shell shell-project 0.0.0 to_pkgname().() { |
| 56 | trscip-shell system . . tr. A-Z/_ a-z-- | sedscip-shell system . . sed. -e 's!^!hexagon-dsp-binaries-!' |
| 57 | } |
| 58 | |
| 59 | do_install_dspscip-shell shell shell-project 0.0.0 do_install_dsp().() { |
| 60 | pkgname="$1" |
| 61 | target="$2" |
| 62 | |
| 63 | if ! grepscip-shell system . . grep. -q "${target}/dsp" debian/${pkgname}.install |
| 64 | then |
| 65 | echoscip-shell system . . echo. "usr/share/hexagon-dsp/${target}/dsp/" >> debian/${pkgname}.install |
| 66 | fi |
| 67 | } |
| 68 | |
| 69 | do_installscip-shell shell shell-project 0.0.0 do_install().() { |
| 70 | target="$1" |
| 71 | pkgname=$(echoscip-shell system . . echo. $target | skip_socscip-shell shell shell-project 0.0.0 skip_soc(). | to_pkgnamescip-shell shell shell-project 0.0.0 to_pkgname().) |
| 72 | add_packagescip-shell shell shell-project 0.0.0 add_package(). ${pkgname} |
| 73 | |
| 74 | if ! grepscip-shell system . . grep. -q unstripped debian/${pkgname}.lintian-overrides ; then |
| 75 | sedscip-shell system . . sed. -e "s!#PKGNAME#!${pkgname}!g" debian/pkgname.lintian-overrides.in >> debian/${pkgname}.lintian-overrides |
| 76 | fi |
| 77 | |
| 78 | do_install_dspscip-shell shell shell-project 0.0.0 do_install_dsp(). "$pkgname" "$target" |
| 79 | } |
| 80 | |
| 81 | do_linkscip-shell shell shell-project 0.0.0 do_link().() { |
| 82 | src="$1" |
| 83 | target="$2" |
| 84 | spkgname=$(echoscip-shell system . . echo. $src | device_namescip-shell shell shell-project 0.0.0 device_name(). | skip_socscip-shell shell shell-project 0.0.0 skip_soc(). | to_pkgnamescip-shell shell shell-project 0.0.0 to_pkgname().) |
| 85 | pkgname=$(echoscip-shell system . . echo. $target | device_namescip-shell shell shell-project 0.0.0 device_name(). | skip_socscip-shell shell shell-project 0.0.0 skip_soc(). | to_pkgnamescip-shell shell shell-project 0.0.0 to_pkgname().) |
| 86 | |
| 87 | add_packagescip-shell shell shell-project 0.0.0 add_package(). ${pkgname} |
| 88 | echoscip-shell system . . echo. "$spkgname" >> debian/${pkgname}.tmp-deps |
| 89 | |
| 90 | do_install_dspscip-shell shell shell-project 0.0.0 do_install_dsp(). "$pkgname" "$(echoscip-shell system . . echo. $target | device_namescip-shell shell shell-project 0.0.0 device_name().)" |
| 91 | } |
| 92 | |
| 93 | rmscip-shell system . . rm. -f debian/hexagon-dsp-binaries.lintian-overrides |
| 94 | rmscip-shell system . . rm. -f debian/hexagon-dsp-binaries-*.docs |
| 95 | rmscip-shell system . . rm. -f debian/hexagon-dsp-binaries-*.install |
| 96 | rmscip-shell system . . rm. -f debian/hexagon-dsp-binaries-*.lintian-overrides |
| 97 | rmscip-shell system . . rm. -f debian/hexagon-dsp-binaries-*.tmp-deps |
| 98 | rmscip-shell system . . rm. -f debian/control.tmp debian/control.tmp2 |
| 99 | |
| 100 | PACKAGES="" |
| 101 | VERSION="$1" |
| 102 | |
| 103 | catscip-shell system . . cat. debian/control.head.in > debian/control.tmp |
| 104 | |
| 105 | do_lintian_overridescip-shell shell shell-project 0.0.0 do_lintian_override(). hexagon-dsp-binaries |
| 106 | |
| 107 | touchscip-shell system . . touch. debian/control.tmp2 |
| 108 | while read verb target rest |
| 109 | do |
| 110 | case ${verb} in |
| 111 | "#" | "" ) |
| 112 | ;; |
| 113 | "Install:" ) |
| 114 | do_installscip-shell shell shell-project 0.0.0 do_install(). ${target} |
| 115 | ;; |
| 116 | "Link:" ) |
| 117 | do_linkscip-shell shell shell-project 0.0.0 do_link(). ${target} ${rest} |
| 118 | ;; |
| 119 | * ) |
| 120 | echoscip-shell system . . echo. "Unsupported clause ${verb}" >&2 |
| 121 | exit 1 |
| 122 | esac |
| 123 | done < config.txt |
| 124 | |
| 125 | echoscip-shell system . . echo. >> debian/control.tmp |
| 126 | sedscip-shell system . . sed. -e "s!#PACKAGES#!${PACKAGES}!g" debian/control.main.in >> debian/control.tmp |
| 127 | |
| 128 | for deps in debian/hexagon-dsp-binaries-*.tmp-deps ; do |
| 129 | pkg=$(basenamescip-shell system . . basename. $deps .tmp-deps) |
| 130 | deps=$(sortscip-shell system . . sort. $deps | uniqscip-shell system . . uniq. | sedscip-shell system . . sed. -e 's/$/ (= ${binary:Version}), /g') |
| 131 | sedscip-shell system . . sed. -i -e "s/#${pkg}-DEPS#/${deps}/g" debian/control.tmp2 |
| 132 | done |
| 133 | |
| 134 | catscip-shell system . . cat. debian/control.tmp2 >> debian/control.tmp |
| 135 | |
| 136 | mvscip-shell system . . mv. debian/control.tmp debian/control |
| 137 | |
| 138 | rmscip-shell system . . rm. -f debian/*.tmp* |