1 |
|
# Copyright 1999-2024 Gentoo Authors
|
|
1 |
# Copyright 1999-2025 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
|
3 |
# TODO: Figure out a way to disable SRTP from pjproject entirely.
|
|
4 |
EAPI=8
|
3 |
5 |
|
4 |
|
EAPI=7
|
5 |
|
|
6 |
|
inherit autotools flag-o-matic
|
7 |
|
|
8 |
|
DESCRIPTION="Tool for prepress preparation of PDF and PostScript documents"
|
9 |
|
HOMEPAGE="https://sourceforge.net/projects/pspdftool"
|
10 |
|
SRC_URI="https://downloads.sourceforge.net/${PN}/${P}.tar.bz2"
|
|
6 |
inherit autotools flag-o-matic toolchain-funcs
|
11 |
7 |
|
|
8 |
DESCRIPTION="Open source SIP, Media, and NAT Traversal Library"
|
|
9 |
HOMEPAGE="https://github.com/pjsip/pjproject https://www.pjsip.org/"
|
|
10 |
SRC_URI="https://github.com/pjsip/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
|
12 |
11 |
LICENSE="GPL-2"
|
13 |
|
SLOT="0"
|
14 |
|
KEYWORDS="~amd64 ~x86"
|
15 |
|
IUSE="zlib"
|
|
12 |
SLOT="0/${PV}"
|
|
13 |
KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc x86"
|
16 |
14 |
|
17 |
|
RDEPEND="zlib? ( sys-libs/zlib )"
|
|
15 |
# g729 not included due to special bcg729 handling.
|
|
16 |
CODEC_FLAGS="g711 g722 g7221 gsm ilbc speex l16"
|
|
17 |
VIDEO_FLAGS="sdl ffmpeg v4l2 openh264 libyuv vpx"
|
|
18 |
SOUND_FLAGS="alsa portaudio"
|
|
19 |
IUSE="amr debug epoll examples opus resample silk srtp ssl static-libs webrtc
|
|
20 |
${CODEC_FLAGS} g729
|
|
21 |
${VIDEO_FLAGS}
|
|
22 |
${SOUND_FLAGS}"
|
|
23 |
|
|
24 |
RDEPEND="
|
|
25 |
alsa? ( media-libs/alsa-lib )
|
|
26 |
amr? ( media-libs/opencore-amr )
|
|
27 |
ffmpeg? ( media-video/ffmpeg:= )
|
|
28 |
g729? ( media-libs/bcg729 )
|
|
29 |
gsm? ( media-sound/gsm )
|
|
30 |
ilbc? ( media-libs/libilbc )
|
|
31 |
openh264? ( media-libs/openh264 )
|
|
32 |
opus? ( media-libs/opus )
|
|
33 |
portaudio? ( media-libs/portaudio )
|
|
34 |
resample? ( media-libs/libsamplerate )
|
|
35 |
sdl? ( media-libs/libsdl2 )
|
|
36 |
speex? (
|
|
37 |
media-libs/speex
|
|
38 |
media-libs/speexdsp
|
|
39 |
)
|
|
40 |
srtp? ( >=net-libs/libsrtp-2.3.0:= )
|
|
41 |
ssl? ( dev-libs/openssl:0= )
|
|
42 |
"
|
18 |
43 |
DEPEND="${RDEPEND}"
|
|
44 |
BDEPEND="virtual/pkgconfig"
|
19 |
45 |
|
20 |
46 |
src_prepare() {
|
21 |
47 |
default
|
22 |
|
mv configure.{in,ac} || die
|
|
48 |
rm configure || die "Unable to remove unwanted wrapper"
|
|
49 |
mv aconfigure.ac configure.ac || die "Unable to rename configure script source"
|
23 |
50 |
eautoreconf
|
|
51 |
|
|
52 |
cp "${FILESDIR}/pjproject-2.13.1-r1-config_site.h" "${S}/pjlib/include/pj/config_site.h" \
|
|
53 |
|| die "Unable to create config_site.h"
|
24 |
54 |
}
|
25 |
55 |
|
26 |
|
src_configure() {
|
27 |
|
# -Werror=strict-aliasing; do not trust for LTO-safety either.
|
28 |
|
# https://bugs.gentoo.org/855023
|
29 |
|
# Upstream is dead for nearly a decade. Not forwarded.
|
30 |
|
append-flags -fno-strict-aliasing
|
31 |
|
filter-lto
|
|
56 |
_pj_enable() {
|
|
57 |
usex "$1" '' "--disable-${2:-$1}"
|
|
58 |
}
|
|
59 |
|
|
60 |
_pj_get_define() {
|
|
61 |
local r="$(sed -nre "s/^#define[[:space:]]+$1[[:space:]]+//p" "${S}/pjlib/include/pj/config_site.h")"
|
|
62 |
[[ -z "${r}" ]] && die "Unable to fine #define $1 in config_site.h"
|
|
63 |
echo "$r"
|
|
64 |
}
|
32 |
65 |
|
33 |
|
econf $(use_with zlib)
|
|
66 |
_pj_set_define() {
|
|
67 |
local c=$(_pj_get_define "$1")
|
|
68 |
[[ "$c" = "$2" ]] && return 0
|
|
69 |
sed -re "s/^#define[[:space:]]+$1[[:space:]].*/#define $1 $2/" -i "${S}/pjlib/include/pj/config_site.h" \
|
|
70 |
|| die "sed failed updating $1 to $2."
|
|
71 |
[[ "$(_pj_get_define "$1")" != "$2" ]] && die "sed failed to perform update for $1 to $2."
|
|
72 |
}
|
|
73 |
|
|
74 |
_pj_use_set_define() {
|
|
75 |
_pj_set_define "$2" $(usex "$1" 1 0)
|
|
76 |
}
|
|
77 |
|
|
78 |
src_configure() {
|
|
79 |
local myconf=()
|
|
80 |
local videnable="--disable-video"
|
|
81 |
local t
|
|
82 |
|
|
83 |
use debug || append-cflags -DNDEBUG=1
|
|
84 |
|
|
85 |
for t in ${CODEC_FLAGS}; do
|
|
86 |
myconf+=( $(_pj_enable ${t} ${t}-codec) )
|
|
87 |
done
|
|
88 |
myconf+=( $(_pj_enable g729 bcg729) )
|
|
89 |
|
|
90 |
for t in ${VIDEO_FLAGS}; do
|
|
91 |
myconf+=( $(_pj_enable ${t}) )
|
|
92 |
use "${t}" && videnable="--enable-video"
|
|
93 |
done
|
|
94 |
|
|
95 |
[ "${videnable}" = "--enable-video" ] && _pj_set_define PJMEDIA_HAS_VIDEO 1 || _pj_set_define PJMEDIA_HAS_VIDEO 0
|
|
96 |
|
|
97 |
LD="$(tc-getCXX)" econf \
|
|
98 |
--enable-shared \
|
|
99 |
${videnable} \
|
|
100 |
$(_pj_enable alsa sound) \
|
|
101 |
$(_pj_enable amr opencore-amr) \
|
|
102 |
$(_pj_enable epoll) \
|
|
103 |
$(_pj_enable opus) \
|
|
104 |
$(_pj_enable portaudio ext-sound) \
|
|
105 |
$(_pj_enable resample libsamplerate) \
|
|
106 |
$(_pj_enable resample resample-dll) \
|
|
107 |
$(_pj_enable resample) \
|
|
108 |
$(_pj_enable silk) \
|
|
109 |
$(_pj_enable speex speex-aec) \
|
|
110 |
$(_pj_enable ssl) \
|
|
111 |
$(_pj_enable webrtc libwebrtc) \
|
|
112 |
$(use_with gsm external-gsm) \
|
|
113 |
$(use_with portaudio external-pa) \
|
|
114 |
$(use_with speex external-speex) \
|
|
115 |
$(usex srtp --with-external-srtp --disable-libsrtp) \
|
|
116 |
"${myconf[@]}"
|
34 |
117 |
}
|
35 |
118 |
|
36 |
119 |
src_install() {
|
37 |
120 |
default
|
38 |
|
rm -rf "${ED}"/usr/share/doc/${PN}* || die
|
|
121 |
|
|
122 |
newbin pjsip-apps/bin/pjsua-${CHOST} pjsua
|
|
123 |
newbin pjsip-apps/bin/pjsystest-${CHOST} pjsystest
|
|
124 |
|
|
125 |
if use examples; then
|
|
126 |
insinto "/usr/share/doc/${PF}/examples"
|
|
127 |
doins -r pjsip-apps/src/samples
|
|
128 |
fi
|
|
129 |
|
|
130 |
use static-libs || rm "${ED}/usr/$(get_libdir)"/*.a || die "Error removing static archives"
|
39 |
131 |
}
|