[Work Notes] PJSIP Package Build in OpenWrt

There is a default pjsip package in the openwrt but it links to the extension package of ltq-tapi and oss. What I need first is the package without extra packages. So I try to create the libraries using the latest version 2.1 for the experiment.

First, the Makefile of the package:

include $(TOPDIR)/rules.mk

PKG_NAME:=pjsip2
PKG_VERSION:=2.1
PKG_RELEASE:=0

PKG_SOURCE:=pjproject-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.pjsip.org/release/$(PKG_VERSION)/
PKG_MD5SUM:=310eb63638dac93095f6a1fc8ee1f578

PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/pjproject-$(PKG_VERSION).$(PKG_RELEASE)

include $(INCLUDE_DIR)/package.mk

define Package/pjsip2
  SECTION:=lib
  CATEGORY:=Libraries
  URL:=http://www.pjsip.org/
  MAINTAINER:=John Crispin <[email protected]>
  TITLE:=pjsip2
  DEPENDS:=+libuuid
endef

CONFIGURE_ARGS += \
  --disable-floating-point \
  --disable-g711-codec \
  --disable-l16-codec \
  --disable-g722-codec \
  --disable-g7221-codec \
  --disable-gsm-codec \
  --disable-ilbc-coder \
  --disable-libsamplerate \
  --disable-ipp \
  --disable-ssl \
  --disable-oss \
  --disable-sound

define Build/Configure
(cd $(PKG_BUILD_DIR); autoconf aconfigure.ac > aconfigure)
$(call Build/Configure/Default)
endef

define Build/Compile
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) -lc $(LIBGCC_S) -lm" \
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
endef

define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/pjsip2
$(CP) $(PKG_INSTALL_DIR)/usr $(1)/usr/pjsip2
endef

$(eval $(call BuildPackage,pjsip2))

We encounter the following problem:

arm-openwrt-linux-uclibcgnueabi-ar: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex
make[5]: *** [../lib/libpj-arm-openwrt-linux-gnu.a] Error 1

We need to patch aconfigure.ac as follows:

--- pjproject-2.1.0.orig/aconfigure.ac
+++ pjproject-2.1.0/aconfigure.ac
@@ -48,9 +48,8 @@
     CROSS_COMPILE=`echo ${CC} | sed 's/gcc//'`
 fi
-if test "$AR" = ""; then AR="${CROSS_COMPILE}ar rv"; fi
+AR="${AR} rv"
 AC_SUBST(AR)
-if test "$LD" = ""; then LD="$CC"; fi
 AC_SUBST(LD)

A new error then occurs:

arm-openwrt-linux-uclibcgnueabi-ld: cannot find libgcc.a

Check the toolchain build_dir in OpenWrt and copy libgcc.a into staging_dir/toolchain/lib. The error is resolved and the package can then be successfully built.

There are additional tasks to be done if we want to integrate with private audio and video modules.


Comments & Feedback