Skip to content

Commit

Permalink
Add libasound.a
Browse files Browse the repository at this point in the history
  • Loading branch information
negbie committed May 24, 2021
1 parent 1edfd67 commit 26e153f
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 3,558 deletions.
44 changes: 33 additions & 11 deletions build_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,36 @@ mkdir -p git
mkdir -p re
mkdir -p rem
mkdir -p baresip
mkdir -p opus/include
mkdir -p alsa
mkdir -p opus
mkdir -p openssl/include

my_base_modules="account b2bua contact cons ctrl_tcp debug_cmd echo httpd menu natpmp ice stun turn serreg uuid stdio"
my_audio_modules="aubridge aufile auloop ausine"
my_audio_modules="alsa aubridge aufile auloop ausine"
my_codec_modules="g711 g722 opus"
my_tls_modules="dtls_srtp srtp"

opus="1.3.1"
openssl="1.1.1k"
alsa="1.2.4"

cd git

if [ ! -d "re" ]; then
git clone https://github.com/baresip/re.git
fi
cd re; make clean; make USE_ZLIB= RELEASE=1 libre.a; cp libre.a ../../re; cd ..
cd re; make clean; make -j16 USE_ZLIB= RELEASE=1 libre.a; cp libre.a ../../re; cd ..

if [ ! -d "rem" ]; then
git clone https://github.com/baresip/rem.git
fi
cd rem; make clean; make USE_ZLIB= RELEASE=1 librem.a; cp librem.a ../../rem; cd ..
cd rem; make clean; make -j16 USE_ZLIB= RELEASE=1 librem.a; cp librem.a ../../rem; cd ..

if [ ! -d "openssl-${openssl}" ]; then
wget https://www.openssl.org/source/openssl-${openssl}.tar.gz
tar -xzf openssl-${openssl}.tar.gz
fi
cd openssl-${openssl}; ./config no-shared; make clean; make -j4 build_libs; cd ..
cd openssl-${openssl}; ./config no-shared; make clean; make -j16 build_libs; cd ..
cp openssl-${openssl}/*.a ../openssl
cp openssl-${openssl}/include/openssl/*.h ../openssl/include
sed -ri 's/<openssl\/(.*)>/"\1"/g' ../openssl/include/*
Expand All @@ -45,11 +47,29 @@ if [ ! -d "opus-${opus}" ]; then
wget "https://archive.mozilla.org/pub/opus/opus-${opus}.tar.gz"
tar -xzf opus-${opus}.tar.gz
fi
cd opus-${opus}; ./configure; make clean; make -j4; cd ..
cd opus-${opus}; ./configure; make clean; make -j16; cd ..
mkdir opus
mkdir -p my_include/opus
cp opus-${opus}/.libs/libopus.a ../opus; cp opus-${opus}/.libs/libopus.a opus
cp opus-${opus}/include/*.h ../opus/include; cp opus-${opus}/include/*.h my_include/opus
cp opus-${opus}/include/*.h my_include/opus


if [ ! -d "alsa-lib-${alsa}" ]; then
wget "https://github.com/alsa-project/alsa-lib/archive/refs/tags/v${alsa}.tar.gz" -O alsa-lib-${alsa}.tar.gz
tar -xzf alsa-lib-${alsa}.tar.gz
fi
cd alsa-lib-${alsa};
libtoolize --force --copy --automake
aclocal
autoheader
automake --foreign --copy --add-missing
autoconf
./configure --enable-shared=no --enable-static=yes
make clean; make -j16; cd ..
mkdir alsa
mkdir -p my_include/alsa
cp alsa-lib-${alsa}/src/.libs/libasound.a ../alsa; cp alsa-lib-${alsa}/src/.libs/libasound.a alsa
cp alsa-lib-${alsa}/include/*.h my_include/alsa

if [ ! -d "baresip" ]; then
git clone https://github.com/baresip/baresip.git
Expand All @@ -58,24 +78,25 @@ cd baresip
rm -rf modules/g722
cp -ap ../../../g722 modules/

make clean; make -j4 LIBRE_SO=../re LIBREM_PATH=../rem USE_ZLIB= RELEASE=1 STATIC=1 libbaresip.a \
make clean; make -j16 LIBRE_SO=../re LIBREM_PATH=../rem USE_ZLIB= RELEASE=1 STATIC=1 libbaresip.a \
MODULES="$my_base_modules $my_audio_modules $my_codec_modules $my_tls_modules" \
EXTRA_CFLAGS="-I ../my_include" EXTRA_LFLAGS="-L ..opus"
EXTRA_CFLAGS="-I ../my_include" EXTRA_LFLAGS="-L ..opus -L ..alsa"

cp libbaresip.a ../../baresip; cd ..
cp -R re/include ../re
cp -R rem/include ../rem
cp -R baresip/include ../baresip
cd ../..

: '
cd espeak
if [ ! -d "espeak-ng" ]; then
git clone https://github.com/espeak-ng/espeak-ng.git
fi
cd espeak-ng
./autogen.sh
./configure --without-async --without-mbrola --without-sonic --without-speechplayer
make
make -j16
cp src/.libs/libespeak-ng.a ../
cp src/include/espeak-ng/speak_lib.h ../
make clean
Expand All @@ -86,7 +107,8 @@ if [ ! -d "soxr-code" ]; then
fi
cd soxr-code
cmake -DWITH_OPENMP=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=0 -DBUILD_EXAMPLES=0 .
make
make -j16
cp src/libsoxr.a src/soxr.h ../
make clean
cd ..
'
5 changes: 1 addition & 4 deletions gobaresip.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package gobaresip
#cgo linux LDFLAGS: ${SRCDIR}/libbaresip/re/libre.a
#cgo linux LDFLAGS: ${SRCDIR}/libbaresip/rem/librem.a
#cgo linux LDFLAGS: ${SRCDIR}/libbaresip/opus/libopus.a
#cgo linux LDFLAGS: ${SRCDIR}/libbaresip/alsa/libasound.a
#cgo linux LDFLAGS: ${SRCDIR}/libbaresip/openssl/libssl.a
#cgo linux LDFLAGS: ${SRCDIR}/libbaresip/openssl/libcrypto.a
#cgo linux LDFLAGS: -ldl -lm
Expand All @@ -14,10 +15,6 @@ package gobaresip
#include <libbaresip/re/include/re.h>
#include <libbaresip/rem/include/rem.h>
#include <libbaresip/baresip/include/baresip.h>
#include <libbaresip/opus/include/opus.h>
#include <libbaresip/openssl/include/ssl.h>
#include <libbaresip/openssl/include/crypto.h>
static void signal_handler(int sig)
{
Expand Down
Binary file added libbaresip/alsa/libasound.a
Binary file not shown.
29 changes: 2 additions & 27 deletions libbaresip/baresip/include/baresip.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const char *call_id(const struct call *call);
const char *call_peeruri(const struct call *call);
const char *call_peername(const struct call *call);
const char *call_localuri(const struct call *call);
const char *call_alerturi(const struct call *call);
struct audio *call_audio(const struct call *call);
struct video *call_video(const struct call *call);
struct list *call_streaml(const struct call *call);
Expand Down Expand Up @@ -853,6 +854,7 @@ int ua_call_alloc(struct call **callp, struct ua *ua,
bool use_rtp);
struct call *ua_find_call_state(const struct ua *ua, enum call_state st);
int ua_raise(struct ua *ua);
int ua_set_autoanswer_value(struct ua *ua, const char *value);


/* One instance */
Expand Down Expand Up @@ -1467,33 +1469,6 @@ int sip_req_send(struct ua *ua, const char *method, const char *uri,
sip_resp_h *resph, void *arg, const char *fmt, ...);


/*
* H.264
*/


/** Fragmentation Unit header */
struct h264_fu {
unsigned s:1; /**< Start bit */
unsigned e:1; /**< End bit */
unsigned r:1; /**< The Reserved bit MUST be equal to 0 */
unsigned type:5; /**< The NAL unit payload type */
};

int h264_fu_hdr_encode(const struct h264_fu *fu, struct mbuf *mb);
int h264_fu_hdr_decode(struct h264_fu *fu, struct mbuf *mb);

const uint8_t *h264_find_startcode(const uint8_t *p, const uint8_t *end);

int h264_packetize(uint64_t rtp_ts, const uint8_t *buf, size_t len,
size_t pktsize, videnc_packet_h *pkth, void *arg);
int h264_nal_send(bool first, bool last,
bool marker, uint32_t ihdr, uint64_t rtp_ts,
const uint8_t *buf, size_t size, size_t maxsz,
videnc_packet_h *pkth, void *arg);
bool h264_is_keyframe(int type);


/*
* Modules
*/
Expand Down
Binary file modified libbaresip/baresip/libbaresip.a
Binary file not shown.
Binary file modified libbaresip/openssl/libcrypto.a
Binary file not shown.
Loading

0 comments on commit 26e153f

Please sign in to comment.