aboutsummaryrefslogtreecommitdiffstats
path: root/main/pjproject/APKBUILD
blob: 13db35b414f20c0da0173df79d63e6873159c578 (plain)
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
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pjproject
pkgver=2.4
pkgrel=0
pkgdesc="CLI Softphone"
url="http://www.pjsip.org/pjsua.htm"
arch="all"
license="GPL"
depends=
depends_dev="openssl-dev alsa-lib-dev gsm-dev speex-dev speexdsp-dev
	portaudio-dev libsrtp-dev libsamplerate-dev"
makedepends="$depends_dev"
install=
subpackages="$pkgname-dev pjsua"
source="http://www.pjsip.org/release/$pkgver/$pkgname-$pkgver.tar.bz2
	fix-bb-cp-uniqueness.patch
	musl-fixes.patch"

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	update_config_sub || return 1

	# Remove target name from lib names
	sed -i -e 's/-$(TARGET_NAME)//g' \
		-e 's/= $(TARGET_NAME).a/= .a/g' \
		-e 's/-$(LIB_SUFFIX)/$(LIB_SUFFIX)/g' \
		$(find . -name '*.mak*' -o -name Makefile) || return 1

	# Fix hardcoded prefix and flags
	sed -i \
		-e 's/poll@/poll@\nexport PREFIX := @prefix@\n/g' \
		-e 's!prefix = /usr/local!prefix = $(PREFIX)!' \
		-e '/PJLIB_CFLAGS/ s/(_CFLAGS)/(_CFLAGS) -fPIC/g' \
		-e '/PJLIB_UTIL_CFLAGS/ s/(_CFLAGS)/(_CFLAGS) -fPIC/g' \
		Makefile \
		build.mak.in || return 1

	# Use libsamplerate instead of bundled resample
	sed -i -e "s/resample//" third_party/build/Makefile
	sed -i -e "s#../../third_party/libsamplerate/src/samplerate.h#samplerate.h#" pjmedia/src/pjmedia/resample_libsamplerate.c
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-shared \
		--enable-libsamplerate \
		--with-external-speex \
		--with-external-gsm \
		--with-external-srtp \
		--with-external-pa \
		|| return 1

	# TODO: make it build with only shared libs from system
	# rm -r third_party
	make dep || return 1
	make -j1 all || return 1
}

package() {
	cd "$_builddir"
	install -d "$pkgdir"/usr/lib
	make -j1 DESTDIR="$pkgdir" prefix=/usr install
}

pjsua() {
	pkgdesc="pjsua is an open source command line SIP user agent (softphone)"
	cd "$_builddir"/pjsip-apps/bin/
	install -D -m755 pjsua "$subpkgdir"/usr/bin/pjsua
}

md5sums="39629ca3fcedbdc7dbd8c5a707060095  pjproject-2.4.tar.bz2
1f152ad611b5fb0e44676e2701b53a15  fix-bb-cp-uniqueness.patch
e92287afb144883546e39c382bd75cdd  musl-fixes.patch"
sha256sums="108015aeda8dce20d182ec9b4fc277026d2b1796e82947da106eeb406eb02059  pjproject-2.4.tar.bz2
cae0255ddb8b6b6e07f6da5b448ec669b0727dc6d6c795e0d1cd8ce9ae504d40  fix-bb-cp-uniqueness.patch
a9768e1ddc6e519048a5acc084ed1e9d2007bd0cd6291dde0828ea7efc837266  musl-fixes.patch"
sha512sums="164737bed8f688b2c555e2b4c701a568570a592fa7d1259da0be73a6a79f8c8157562cb941a1c00a0bea2954a8d13dd867bfc16b48c722ac4bde303986e4549a  pjproject-2.4.tar.bz2
cc4077c9999d4eb28cfc34080ea2cdfdc905726565afdca96d26979d734a1d70522c5e6307ec33c0d4f5f1a5b26699787cbd31fecb73b860b6b417eda50f37a1  fix-bb-cp-uniqueness.patch
1dd0d8dabe0c27f8d314a776b8873700755ae59346223a5bb5ec816ab42d4fa4c8d9281ed33ced9cba87177cdf6249e458c404c8fd0ac9ec0be8607b4a4e8a73  musl-fixes.patch"