diff --git a/.dockerignore b/.dockerignore index c45d535..7deb038 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,3 +6,4 @@ /.dockerignore /.git /.gitignore +/.*swp diff --git a/Dockerfile b/Dockerfile index 7042449..c4783e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,46 +3,48 @@ ARG oscodename=stretch FROM $osdistro:$oscodename LABEL maintainer="Walter Doekes " +LABEL dockerfile-vcs=https://github.com/ossobv/asterisk-g72x-deb ARG DEBIAN_FRONTEND=noninteractive +# This time no "keeping the build small". We only use this container for +# building/testing and not for running, so we can keep files like apt +# cache. We do this before copying anything and before getting lots of +# ARGs from the user. That keeps this bit cached. +RUN echo 'APT::Install-Recommends "0";' >/etc/apt/apt.conf.d/01norecommends +# We'll be ignoring "debconf: delaying package configuration, since apt-utils +# is not installed" +RUN apt-get update -q && \ + apt-get dist-upgrade -y && \ + apt-get install -y \ + ca-certificates curl \ + build-essential devscripts dh-autoreconf dpkg-dev equivs quilt && \ + printf "%s\n" \ + QUILT_PATCHES=debian/patches QUILT_NO_DIFF_INDEX=1 \ + QUILT_NO_DIFF_TIMESTAMPS=1 'QUILT_DIFF_OPTS="--show-c-function"' \ + 'QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"' \ + >~/.quiltrc + +# Apt-get prerequisites according to control file. +COPY control /build/debian/control +RUN mk-build-deps --install --remove --tool "apt-get -y" /build/debian/control + # debian, deb, stretch, asterisk-g72x, 1.3+20+3058c45eb60d, '', 0osso1 -ARG osdistro -ARG osdistshort -ARG oscodename -ARG upname -ARG upversion -ARG debepoch= -ARG debversion +ARG osdistro osdistshort oscodename upname upversion debepoch= debversion -# Copy debian dir, check version -RUN mkdir -p /build/debian -COPY ./changelog /build/debian/changelog -RUN . /etc/os-release && fullversion="${upversion}-${debversion}+${osdistshort}${VERSION_ID}" && \ +COPY changelog /build/debian/changelog +RUN . /etc/os-release && \ + sed -i -e "1s/+[^+)]*)/+${osdistshort}${VERSION_ID})/;1s/) stable;/) ${oscodename};/" \ + /build/debian/changelog && \ + fullversion="${upversion}-${debversion}+${osdistshort}${VERSION_ID}" && \ expected="${upname} (${debepoch}${fullversion}) ${oscodename}; urgency=medium" && \ head -n1 /build/debian/changelog && \ if test "$(head -n1 /build/debian/changelog)" != "${expected}"; \ then echo "${expected} <-- mismatch" >&2; false; fi -# This time no "keeping the build small". We only use this container for -# building/testing and not for running, so we can keep files like apt -# cache. -RUN echo 'APT::Install-Recommends "0";' >/etc/apt/apt.conf.d/01norecommends -#RUN sed -i -e 's:deb.debian.org:apt.osso.nl:;s:security.debian.org:apt.osso.nl/debian-security:' /etc/apt/sources.list -#RUN sed -i -e 's:security.ubuntu.com:apt.osso.nl:;s:archive.ubuntu.com:apt.osso.nl:' /etc/apt/sources.list -RUN apt-get update -q -RUN apt-get install -y apt-utils -RUN apt-get dist-upgrade -y -RUN apt-get install -y \ - bzip2 ca-certificates curl mercurial \ - dirmngr gnupg \ - build-essential dh-autoreconf devscripts dpkg-dev equivs quilt - -# Set up upstream source, move debian dir and jump into dir. -# -# Trick to allow caching of asterisk*.tar.bz2/gz files. Download them +# Trick to allow caching of UPNAME*.tar.gz files. Download them # once using the curl command below into .cache/* if you want. The COPY -# is made conditional by the "[2]" "wildcard". (We need one existing +# is made conditional by the "[bg]" "wildcard". (We need one existing # file (README.rst) so the COPY doesn't fail.) COPY ./README.rst .cache/${upname}_${upversion}.orig.tar.[bg]* /build/ # RUN if ! test -s /build/${upname}_${upversion}.orig.tar.gz; then \ @@ -67,55 +69,43 @@ RUN (test -f /build/${upname}_${upversion}.orig.tar.bz2 || \ test $(md5sum /build/${upname}_${upversion}.orig.tar.bz2 | awk '{print $1}') = e99e153e88fe45cde0a7b04e22f1a414 RUN cd /build && tar jxf "${upname}_${upversion}.orig.tar.bz2" && \ mv debian "${upname}-${upversion}/" -WORKDIR "/build/${upname}-${upversion}" +COPY asterisk-g72x-g729-ast11.install asterisk-g72x-g729-ast13.install \ + asterisk-g72x-g729-ast16.install asterisk-g72x-g729-ast18.install \ + asterisk-g72x-g729-ast22.install \ + compat rules source /build/${upname}-${upversion}/debian/ +WORKDIR /build/${upname}-${upversion} -# We require (lib)bcg729 from elsewhere -RUN echo "deb http://ppa.osso.nl/${osdistro} ${oscodename} osso" >/etc/apt/sources.list.d/osso-ppa.list && \ - # apt-key adv --keyserver pgp.mit.edu --recv-keys 0xBEAD51B6B36530F5 && \ - curl https://ppa.osso.nl/support+ppa@osso.nl.gpg | apt-key add - && \ - apt-get update -# We could fetch asterisk-dev from elsewhere as well, but instead we'll -# use include-tars. +# We'll use include-tars so we can build for multiple asterisk versions. # RUN printf "%s\n" "Package: asterisk asterisk-*" "Pin: version 1:11.*" "Pin-Priority: 600" \ # >/etc/apt/preferences.d/asterisk.pref +# TODO: 22 no available at the URL below RUN set -x && \ - cd .. && for version in 11 13 16 18; do \ + cd .. && for version in 18 16 13 11; do \ curl --fail -O https://junk.devs.nu/a/asterisk/asterisk-$version-include.tar.bz2 && \ tar jxf asterisk-$version-include.tar.bz2; done && \ - test $(md5sum asterisk-11-include.tar.bz2 | awk '{print $1}') = 2d0e18839d469f0929bc45738faa1b77 && \ - test $(md5sum asterisk-13-include.tar.bz2 | awk '{print $1}') = cad97c28885add2c0b3fe7b7c713f2aa && \ + test $(md5sum asterisk-18-include.tar.bz2 | awk '{print $1}') = bddb6ba2a27e80470cccacc67a725ffb && \ test $(md5sum asterisk-16-include.tar.bz2 | awk '{print $1}') = f2135dd7204514f6899374618aa7873f && \ - test $(md5sum asterisk-18-include.tar.bz2 | awk '{print $1}') = f2135dd7204514f6899374618aa7873f && \ + test $(md5sum asterisk-13-include.tar.bz2 | awk '{print $1}') = cad97c28885add2c0b3fe7b7c713f2aa && \ + test $(md5sum asterisk-11-include.tar.bz2 | awk '{print $1}') = 2d0e18839d469f0929bc45738faa1b77 && \ set +x -# Apt-get prerequisites according to control file. -COPY ./control debian/control -RUN mk-build-deps --install --remove --tool "apt-get -y" debian/control - -# Set up build env -RUN printf "%s\n" \ - QUILT_PATCHES=debian/patches \ - QUILT_NO_DIFF_INDEX=1 \ - QUILT_NO_DIFF_TIMESTAMPS=1 \ - 'QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"' \ - 'QUILT_DIFF_OPTS="--show-c-function"' \ - >~/.quiltrc -COPY . debian/ -# Yuck -- we'd like to .dockerignore /.cache, but then loading files -# from the cache doesn't work. -RUN rm -rf debian/.cache - # Build! RUN DEB_BUILD_OPTIONS=parallel=1 dpkg-buildpackage -us -uc -sa -# TODO: for bonus points, we could run quick tests here; -# for starters dpkg -i tests? - -# Write output files (store build args in ENV first). +# Get build args so we can make a version string. ENV oscodename=$oscodename osdistshort=$osdistshort \ upname=$upname upversion=$upversion debversion=$debversion + +# Do a quick test that all subpackages got their own codec_g729.so file. +RUN . /etc/os-release && fullversion=${upversion}-${debversion}+${osdistshort}${VERSION_ID} && \ + packages=$(sed -e '/^Package:/!d;s/^[^:]*: //' debian/control) && \ + for pkg in $packages; do deb=../${pkg}_${fullversion}_amd64.deb; \ + echo "Checking .so in $deb" >&2; dpkg-deb -c "$deb" | \ + grep -F './usr/lib/asterisk/modules/codec_g729.so'; done + +# Write output files. RUN . /etc/os-release && fullversion=${upversion}-${debversion}+${osdistshort}${VERSION_ID} && \ mkdir -p /dist/${upname}_${fullversion} && \ - mv /build/*${fullversion}* /dist/${upname}_${fullversion}/ && \ mv /build/${upname}_${upversion}.orig.tar.bz2 /dist/${upname}_${fullversion}/ && \ + mv /build/*${fullversion}* /dist/${upname}_${fullversion}/ && \ cd / && find dist/${upname}_${fullversion} -type f >&2 diff --git a/Dockerfile.build b/Dockerfile.build index 9045b91..f7e1887 100755 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -1,45 +1,41 @@ -#!/bin/bash +#!/bin/sh cd "$(dirname "$0")" # jump to curdir +set -eu # Pass these on the command line. -oscodename=${1:-debian/stretch} # debian/stretch - +oscodename=${1:-debian/bullseye} # debian/stretch buildversion=$(sed -e '1!d;s/.*(//;s/).*//' changelog) upname=asterisk-g72x upversion=$(echo "$buildversion" | sed -e 's/-.*//;s/^[0-9]*://') debepoch=$(echo "$buildversion" | sed -e '/^[0-9]*:/!d;s/:.*/:/') debversion=$(echo "$buildversion" | sed -e 's/[^-]*-//;s/+[^+]*$//') -dockversion=$(echo "build-$upname-$buildversion" | - sed -e 's/^[0-9]*://;s/[^A-Za-z0-9.-]/_/g') echo "Usage: $0 [$oscodename]" echo ".. continuing" osdistro=${oscodename%/*} # debian (or ubuntu) oscodename=${oscodename#*/} # stretch (or bionic) -osdistshort=${osdistro:0:3} # deb (or ubu) case $osdistro/$oscodename in -debian/buster) oscodenum=10;; -debian/stretch) oscodenum=9;; -debian/jessie) oscodenum=8;; -debian/wheezy) oscodenum=7;; -ubuntu/bionic) oscodenum=18.04;; -ubuntu/xenial) oscodenum=16.04;; -ubuntu/trusty) oscodenum=14.04;; +debian/bullseye)osdistshort=deb; oscodenum=11;; +debian/buster) osdistshort=deb; oscodenum=10;; +debian/stretch) osdistshort=deb; oscodenum=9;; +debian/jessie) osdistshort=deb; oscodenum=8;; +debian/wheezy) osdistshort=deb; oscodenum=7;; +ubuntu/jammy) osdistshort=ubu; oscodenum=22.04;; +ubuntu/focal) osdistshort=ubu; oscodenum=20.04;; +ubuntu/bionic) osdistshort=ubu; oscodenum=18.04;; +ubuntu/xenial) osdistshort=ubu; oscodenum=16.04;; +ubuntu/trusty) osdistshort=ubu; oscodenum=14.04;; *) echo "ERROR: undefined OS: $osdistro/$oscodename" >&2 && exit 1 esac _shortver=$osdistshort$oscodenum -# Update changelog -sed -i -e "1s/+\\(deb\\|ubu\\)[0-9.]*) [a-z]\\+;/+$_shortver) $oscodename;/" \ - changelog - # Docker disallows certain tokens in versions. dockversion=$(echo build-${upname}-${upversion}-${debversion}-${oscodename} | sed -e 's/[^0-9A-Za-z_.-]/_/g') # Will build files. -if ! docker build \ +docker build \ --pull \ --ulimit nofile=512 \ --build-arg osdistro=$osdistro \ @@ -51,9 +47,8 @@ if ! docker build \ --build-arg debversion=$debversion \ -t $dockversion \ -f Dockerfile \ - . -then - ret=$? + . || ret=$? +if test ${ret:-0} -ne 0; then echo "fail" >&2 exit $ret fi diff --git a/asterisk-g72x-g729-ast22.install b/asterisk-g72x-g729-ast22.install new file mode 100644 index 0000000..30f452c --- /dev/null +++ b/asterisk-g72x-g729-ast22.install @@ -0,0 +1 @@ +tmp/modules-22/* usr/lib/asterisk/modules diff --git a/changelog b/changelog index fe5caea..8514e90 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,21 @@ +asterisk-g72x (1.4.3-0osso3+REL) stable; urgency=medium + + * Include asterisk 22 + + -- Dennis Kraus Fri, 23 Dec 2024 10:59:27 +0200 + +asterisk-g72x (1.4.3-0osso3+REL) stable; urgency=medium + + * Fix build for bullseye. + + -- Walter Doekes Fri, 24 Jun 2022 16:42:53 +0200 + +asterisk-g72x (1.4.3-0osso2+deb9) stretch; urgency=medium + + * New build, this time with asterisk-18 packages as well. + + -- Walter Doekes Tue, 16 Feb 2021 11:01:50 +0100 + asterisk-g72x (1.4.3-0osso1+deb10) buster; urgency=medium * Update to upstream 1.4.3 (which has a source package now). diff --git a/control b/control index 5706548..d42ea80 100644 --- a/control +++ b/control @@ -14,6 +14,29 @@ Homepage: http://asterisk.hosting.lv/ Vcs-Browser: https://bitbucket.org/arkadi/asterisk-g72x/src Vcs-Hg: https://bitbucket.org/arkadi/asterisk-g72x +Package: asterisk-g72x-g729-ast22 +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: + ${shlibs:Depends}, + ${misc:Depends} +Conflicts: + asterisk-g72x-g729-ast18, + asterisk-g72x-g729-ast16, + asterisk-g72x-g729-ast13, + asterisk-g72x-g729-ast11 +Recommends: asterisk (>= 1:22), asterisk (<< 1:17), asterisk-modules +Description: G.729 codec support for the Asterisk PBX + G.729 is a royalty-free narrow-band vocoder-based audio data + compression algorithm using a frame length of 10 milliseconds. + . + This package includes the G.729 codec driver (codec_g729.so) for + Asterisk PBX. + . + For more information about the Asterisk PBX, have a look at the Asterisk + package. + Package: asterisk-g72x-g729-ast18 Architecture: any Multi-Arch: same @@ -22,9 +45,10 @@ Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: - asterisk-g72x-g729-ast11, + asterisk-g72x-g729-ast22, + asterisk-g72x-g729-ast16, asterisk-g72x-g729-ast13, - asterisk-g72x-g729-ast16 + asterisk-g72x-g729-ast11 Recommends: asterisk (>= 1:18), asterisk (<< 1:17), asterisk-modules Description: G.729 codec support for the Asterisk PBX G.729 is a royalty-free narrow-band vocoder-based audio data @@ -44,9 +68,10 @@ Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: - asterisk-g72x-g729-ast11, + asterisk-g72x-g729-ast22, + asterisk-g72x-g729-ast18, asterisk-g72x-g729-ast13, - asterisk-g72x-g729-ast18 + asterisk-g72x-g729-ast11 Recommends: asterisk (>= 1:16), asterisk (<< 1:17), asterisk-modules Description: G.729 codec support for the Asterisk PBX G.729 is a royalty-free narrow-band vocoder-based audio data @@ -66,9 +91,10 @@ Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: - asterisk-g72x-g729-ast11, + asterisk-g72x-g729-ast22, + asterisk-g72x-g729-ast18, asterisk-g72x-g729-ast16, - asterisk-g72x-g729-ast18 + asterisk-g72x-g729-ast11 Recommends: asterisk (>= 1:13), asterisk (<< 1:14), asterisk-modules Description: G.729 codec support for the Asterisk PBX G.729 is a royalty-free narrow-band vocoder-based audio data @@ -88,9 +114,10 @@ Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: - asterisk-g72x-g729-ast13, + asterisk-g72x-g729-ast22, + asterisk-g72x-g729-ast18, asterisk-g72x-g729-ast16, - asterisk-g72x-g729-ast18 + asterisk-g72x-g729-ast13 Recommends: asterisk (>= 1:11), asterisk (<< 1:12), asterisk-modules Description: G.729 codec support for the Asterisk PBX G.729 is a royalty-free narrow-band vocoder-based audio data diff --git a/rules b/rules index 2d9eb1e..c12298c 100755 --- a/rules +++ b/rules @@ -27,6 +27,14 @@ override_dh_auto_configure: true override_dh_auto_build: + # Build for 22. + rm -f config.log + dh_auto_clean + dh_auto_configure -- --with-asterisk180 --with-bcg729 \ + --with-asterisk-includes=../asterisk-18/include \ + --libdir=$(AST_LIBDIR) + dh_auto_build "$@" + mkdir /tmp/modules-22 && mv .libs/codec_g729.so /tmp/modules-22/ # Build for 18. rm -f config.log dh_auto_clean