fix busybox+ipkg build
[openwrt.git] / openwrt / package / asterisk / Makefile
index 8077ffd..4703154 100644 (file)
@@ -3,9 +3,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=asterisk
-PKG_VERSION:=1.0.10
+PKG_VERSION:=1.2.1
 PKG_RELEASE:=1
-PKG_MD5SUM:=f60f4c4edc36fa61dc55a5385fd82e71
+PKG_MD5SUM:=04657086791e80f319c0d728af705001
 
 PKG_SOURCE_URL:=http://ftp.digium.com/pub/asterisk/ ftp://ftp.digium.com/pub/asterisk/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -16,8 +16,10 @@ PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
 include $(TOPDIR)/package/rules.mk
 $(eval $(call PKG_template,ASTERISK,asterisk,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,ASTERISK_MINI,asterisk-mini,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,ASTERISK_MYSQL,asterisk-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,ASTERISK_PGSQL,asterisk-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,ASTERISK_SQLITE,asterisk-sqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,ASTERISK_VOICEMAIL,asterisk-voicemail,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,ASTERISK_SOUNDS,asterisk-sounds,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,ASTERISK_CHAN_BLUETOOTH,asterisk-chan-bluetooth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
@@ -29,47 +31,54 @@ $(eval $(call PKG_template,ASTERISK_CODEC_SPEEX,asterisk-codec-speex,$(PKG_VERSI
 $(eval $(call PKG_template,ASTERISK_PBX_DUNDI,asterisk-pbx-dundi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,ASTERISK_RES_AGI,asterisk-res-agi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 
-ifneq ($(DEVELOPER),)
-APPS:=app_sql_mysql.so app_sql_postgres.so
-MODS:=cdr_mysql.so cdr_pgsql.so
-SPEEX:=codec_speex.so
-else
-APPS:=
-MODS:=
+EXTRA_CFLAGS := -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
+EXTRA_LDFLAGS := -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
+
 ifneq ($(BR2_PACKAGE_ASTERISK_MYSQL),)
-APPS += app_sql_mysql.so
-MODS += cdr_mysql.so
+EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/mysql
+EXTRA_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql
+EXTRA_APP_MODULES += app_sql_mysql.so
+EXTRA_CDR_MODULES += cdr_mysql.so
+EXTRA_RES_MODULES += res_config_mysql.so
 endif
 ifneq ($(BR2_PACKAGE_ASTERISK_PGSQL),)
-APPS += app_sql_postgres.so
-MODS += cdr_pgsql.so
+EXTRA_APP_MODULES += app_sql_postgres.so
+EXTRA_CDR_MODULES += cdr_pgsql.so
 endif
-ifneq ($(BR2_PACKAGE_ASTERISK_CODEC_SPEEX),)
-SPEEX:=codec_speex.so
+ifneq ($(BR2_PACKAGE_ASTERISK_SQLITE),)
+EXTRA_CDR_MODULES += cdr_sqlite.so
 endif
+ifneq ($(BR2_PACKAGE_ASTERISK_CODEC_SPEEX),)
+EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/speex
+EXTRA_CODEC_MODULES += codec_speex.so
 endif
 
 $(PKG_BUILD_DIR)/.configured:
        touch $@
 
 $(PKG_BUILD_DIR)/.built:
-       $(MAKE) -C "$(PKG_BUILD_DIR)/channels" \
-               CC="$(HOSTCC)" \
-               gentone 
        $(MAKE) -C "$(PKG_BUILD_DIR)" \
-               CC_FOR_BUILD="$(HOSTCC)" \
+               CROSS_ARCH="Linux" \
+               CROSS_COMPILE="$(TARGET_CROSS)" \
+               CROSS_COMPILE_BIN="/void/" \
+               CROSS_COMPILE_TARGET="/void/" \
                $(TARGET_CONFIGURE_OPTS) \
+               HOST_CC="$(HOSTCC)" \
                OPTIMIZE="$(TARGET_CFLAGS)" \
                PROC="$(ARCH)" \
-               CFLAGS_EXTRA="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/speex" \
-               LDFLAGS_EXTRA="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/mysql" \
-               CRYPTO_LIBS="-L$(STAGING_DIR)/usr/lib -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic" \
-               EXTRA_APPS="$(APPS)" \
-               EXTRA_MODS="$(MODS)" \
-               MODSPEEX="$(SPEEX)"
-       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DEBUG="" \
+               OPTIONS="-DLOW_MEMORY -Dlinux" \
+               NOCRYPTO="yes" \
+               EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
+               EXTRA_LDFLAGS="$(EXTRA_LDFLAGS)" \
+               EXTRA_APP_MODULES="$(EXTRA_APP_MODULES)" \
+               EXTRA_CDR_MODULES="$(EXTRA_CDR_MODULES)" \
+               EXTRA_CODEC_MODULES="$(EXTRA_CODEC_MODULES)" \
+               EXTRA_RES_MODULES="$(EXTRA_RES_MODULES)" \
                DESTDIR="$(PKG_INSTALL_DIR)" \
-               install samples
+               ASTVARLIBDIR="/usr/lib/asterisk" \
+               all install samples
+       rm -f $(PKG_INSTALL_DIR)/etc/asterisk/*.old
        touch $@
 
 $(IPKG_ASTERISK):
@@ -80,7 +89,7 @@ $(IPKG_ASTERISK):
        rm -rf $(IDIR_ASTERISK)/usr/include
        rm -rf $(IDIR_ASTERISK)/var
        (cd $(IDIR_ASTERISK)/usr/lib/asterisk; \
-               rm -rf agi-bin/*; \
+               rm -rf agi-bin; \
                rm -rf images; \
                rm -rf keys/*; \
                rm -rf mohmp3/*.mp3; \
@@ -106,8 +115,8 @@ $(IPKG_ASTERISK):
                rm -f skinny.conf ; \
                rm -f dundi.conf ; \
        )
-       $(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(IDIR_ASTERISK)/etc/asterisk/musiconhold.conf
-       rm -f $(IDIR_ASTERISK)/etc/asterisk/*.old
+       install -m0644 ./files/modules.conf $(IDIR_ASTERISK)/etc/asterisk/
+       $(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf
        install -d -m0755 $(IDIR_ASTERISK)/etc/default
        install -m0644  ./files/asterisk.default $(IDIR_ASTERISK)/etc/default/asterisk
        install -d -m0755 $(IDIR_ASTERISK)/etc/init.d
@@ -116,6 +125,34 @@ $(IPKG_ASTERISK):
        $(RSTRIP) $(IDIR_ASTERISK)
        $(IPKG_BUILD) $(IDIR_ASTERISK) $(PACKAGE_DIR)
 
+$(IPKG_ASTERISK_MINI):
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/etc/asterisk
+       for f in asterisk enum extconfig extensions features iax iaxprov logger manager modules musiconhold rtp sip; do \
+         cp -fpR $(PKG_INSTALL_DIR)/etc/asterisk/$$f.conf $(IDIR_ASTERISK_MINI)/etc/asterisk/ ; \
+       done
+       install -m0644 ./files/modules.conf $(IDIR_ASTERISK)/etc/asterisk/
+       $(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk
+       cp -fpR $(PKG_INSTALL_DIR)/usr/lib/asterisk/firmware $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/keys
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/modules
+       for f in chan_iax2 chan_local chan_sip codec_gsm codec_ulaw format_gsm format_pcm format_wav \
+         format_wav_gsm pbx_config res_features res_musiconhold; do \
+         cp -fpR $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$$f.so $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/modules/ ; \
+       done
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/mohmp3
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/sounds
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/sbin
+       cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/asterisk $(IDIR_ASTERISK_MINI)/usr/sbin/
+       cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/safe_asterisk $(IDIR_ASTERISK_MINI)/usr/sbin/
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/etc/default
+       install -m0644  ./files/asterisk.default $(IDIR_ASTERISK_MINI)/etc/default/asterisk
+       install -d -m0755 $(IDIR_ASTERISK_MINI)/etc/init.d
+       install -m0755  ./files/asterisk.init $(IDIR_ASTERISK_MINI)/etc/init.d/asterisk
+       ln -sf asterisk $(IDIR_ASTERISK_MINI)/etc/init.d/S60asterisk
+       $(RSTRIP) $(IDIR_ASTERISK_MINI)
+       $(IPKG_BUILD) $(IDIR_ASTERISK_MINI) $(PACKAGE_DIR)
+
 $(IPKG_ASTERISK_MYSQL):
        install -d -m0755 $(IDIR_ASTERISK_MYSQL)/etc/asterisk
        install -m0600 $(PKG_BUILD_DIR)/configs/cdr_mysql.conf.sample $(IDIR_ASTERISK_MYSQL)/etc/asterisk/cdr_mysql.conf
@@ -134,6 +171,12 @@ $(IPKG_ASTERISK_PGSQL):
        $(RSTRIP) $(IDIR_ASTERISK_PGSQL)
        $(IPKG_BUILD) $(IDIR_ASTERISK_PGSQL) $(PACKAGE_DIR)
 
+$(IPKG_ASTERISK_SQLITE):
+       install -d -m0755 $(IDIR_ASTERISK_SQLITE)/usr/lib/asterisk/modules
+       install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_sqlite.so $(IDIR_ASTERISK_SQLITE)/usr/lib/asterisk/modules/
+       $(RSTRIP) $(IDIR_ASTERISK_SQLITE)
+       $(IPKG_BUILD) $(IDIR_ASTERISK_SQLITE) $(PACKAGE_DIR)
+
 $(IPKG_ASTERISK_SOUNDS):
        install -d -m0755 $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds
        cp -fpR $(PKG_BUILD_DIR)/sounds/* $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/
@@ -204,6 +247,7 @@ $(IPKG_ASTERISK_PBX_DUNDI):
        $(IPKG_BUILD) $(IDIR_ASTERISK_PBX_DUNDI) $(PACKAGE_DIR)
 
 $(IPKG_ASTERISK_RES_AGI):
+       install -d -m0755 $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/agi-bin
        install -d -m0755 $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/modules
        install -m0755 $(PKG_BUILD_DIR)/res/res_agi.so $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/modules/
        $(RSTRIP) $(IDIR_ASTERISK_RES_AGI)
This page took 0.028331 seconds and 4 git commands to generate.