summaryrefslogtreecommitdiffstats
path: root/main/pjproject/APKBUILD
blob: 4215fe172db7e5ff4ee3d34d18e2a71964e46f05 (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
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pjproject
pkgver=2.0
pkgrel=0
pkgdesc="CLI Softphone"
url="http://www.pjsip.org/pjsua.htm"
arch="all"
license="GPL"
depends=
makedepends="openssl-dev pth-dev alsa-lib-dev gsm-dev speex-dev portaudio-dev"
install=
subpackages="$pkgname-dev pjsua"
source="http://www.pjsip.org/release/$pkgver/$pkgname-$pkgver.tar.bz2"

prepare() {
	cd "$srcdir/$pkgname-$pkgver"
	# 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
}

build() {
	cd "$srcdir/$pkgname-$pkgver"
	./configure --build=${CHOST:-i486-alpine-linux-uclibc} \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-external-speex \
		--with-external-gsm \
		--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 "$srcdir/$pkgname-$pkgver"
	make -j1 DESTDIR="$pkgdir" prefix=/usr install
}

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

md5sums="6d7291960f2f341eb39694754586e0e9  pjproject-2.0.tar.bz2"