2013/03/12

[工作點滴] pjsip package build in openwrt

There is a default pjsip package in the openwrt but it link to the extension package of ltq-tapi and oss. But what I need first is the package without extra packages. So I try to create the libraries by using the latest version 2.1 for the experiment.
First, the Makefile of the package as following.

# 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 <blogic@openwrt.org>
  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))


Here we will encounter the problem as follow. 

--target=BFDNAME - specify the target object format as BFDNAMEemulation options: 
No emulation specific options
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
make[5]: Leaving directory `/home/ubnt/aircam_temp/openwrt/build_dir/target-arm_v6k_uClibc-0.9.33.2_eabi/pjproject-2.1.0/pjlib/build'
make[4]: *** [pjlib] Error 2
make[4]: Leaving directory `/home/ubnt/aircam_temp/openwrt/build_dir/target-arm_v6k_uClibc-0.9.33.2_eabi/pjproject-2.1.0/pjlib/build'
make[3]: *** [all] Error 1



Then we need to patch the aconfigure.ac as follow, this is reference to original content in pjsip patches.

--- pjproject-2.1.0.orig/aconfigure.ac 2013-01-23 14:18:18.000000000 +0800
+++ pjproject-2.1.0/aconfigure.ac 2013-03-11 18:26:43.705804028 +0800
@@ -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)
 if test "$LDOUT" = ""; then LDOUT="-o "; fi
 AC_SUBST(LDOUT)




New error occur that cannot find libgcc.a. This is quite weird.

arm-openwrt-linux-uclibcgnueabi-ld: cannot find libgcc.a
make[5]: *** [../bin/pjlib-test-arm-openwrt-linux-gnu] Error 1
make[5]: Leaving directory `/home/ubnt/aircam_temp/openwrt/build_dir/target-arm_v6k_uClibc-0.9.33.2_eabi/pjproject-2.1.0/pjlib/build'
make[4]: *** [pjlib-test] Error 2
make[4]: Leaving directory `/home/ubnt/aircam_temp/openwrt/build_dir/target-arm_v6k_uClibc-0.9.33.2_eabi/pjproject-2.1.0/pjlib/build'
make[3]: *** [all] Error 1



I check the toolchain build_dir in openwrt and copy the libgcc.a in staging_dir toolchain/lib. The error solved and the package could successfully be built.
There are tasks to be done if we want to integrate with private audio and video modules.

沒有留言: