asterisk-chan-lantiq: Fix nonshared builds
[feed/telephony.git] / net / asterisk-chan-lantiq / Makefile
1 #
2 # Copyright (C) 2017 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=chan-lantiq
11 PKG_VERSION:=20170304
12 PKG_RELEASE:=1
13
14 PKG_LICENSE:=GPL-2.0
15 PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
16
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
18
19 PKG_FLAGS:=nonshared
20
21 # WARNING: Because this module is target specific ("nonshared") it cannot depend
22 # on the shared Asterisk package. Asterisk needs to be built _before_ this
23 # package, though, to generate the necessary headers.
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/version.mk
27
28 define Package/$(PKG_NAME)/Default
29 SUBMENU:=Telephony
30 SECTION:=net
31 CATEGORY:=Network
32 TITLE:=Lantiq channel driver
33 URL:=https://github.com/kochstefan/asterisk_channel_lantiq
34 DEPENDS:=@(TARGET_lantiq_falcon||TARGET_lantiq_xway||TARGET_lantiq_xrx200) +kmod-ltq-vmmc
35 endef
36
37 define Package/$(PKG_NAME)-asterisk13
38 $(call Package/$(PKG_NAME)/Default)
39 VARIANT:=asterisk13
40 endef
41
42 define Package/description/Default
43 An implementation of a Lantiq TAPI channel driver for Asterisk.
44 endef
45
46 Package/$(PKG_NAME)-asterisk13/description = $(Package/description/Default)
47
48 define Package/conffiles/Default
49 /etc/asterisk/lantiq.conf
50 endef
51
52 Package/$(PKG_NAME)-asterisk13/conffiles = $(Package/conffiles/Default)
53
54 define Package/Install/Default
55 $(INSTALL_DIR) $(1)/etc/asterisk
56 $(INSTALL_CONF) $(SOURCE)/files/lantiq-$(BUILD_VARIANT).conf.sample \
57 $(1)/etc/asterisk/lantiq.conf
58 $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
59 $(INSTALL_BIN) $(PKG_BUILD_DIR)/chan_lantiq.so \
60 $(1)/usr/lib/asterisk/modules
61 endef
62
63 Package/$(PKG_NAME)-asterisk13/install = $(Package/Install/Default)
64
65 define Build/Prepare
66 $(CP) $(SOURCE)/files/chan_lantiq-$(BUILD_VARIANT).c $(PKG_BUILD_DIR)/chan_lantiq.c
67 $(CP) $(SOURCE)/files/default.exports $(PKG_BUILD_DIR)/chan_lantiq.exports
68 $(TAR) --extract --no-same-owner --no-same-permissions --xz \
69 --file=$(DL_DIR)/$(BUILD_VARIANT)-$(call qstrip,$(CONFIG_TARGET_ARCH_PACKAGES))-headers-for-chan-lantiq-$(VERSION_NUMBER).tar.xz \
70 --directory=$(PKG_BUILD_DIR)
71 endef
72
73 define Build/Configure
74 endef
75
76 define Build/Compile
77 cd $(PKG_BUILD_DIR) && \
78 $(TARGET_CC) -o chan_lantiq.o -c chan_lantiq.c -MD -MT chan_lantiq.o \
79 -MF .chan_lantiq.o.d -MP -pthread \
80 $(TARGET_CFLAGS) \
81 -I$(PKG_BUILD_DIR)/include \
82 $(TARGET_CPPFLAGS) \
83 -Wall -Wstrict-prototypes -Wmissing-prototypes \
84 -Wmissing-declarations $(FPIC) -DAST_MODULE=\"chan_lantiq\" && \
85 $(TARGET_CC) -o chan_lantiq.so -pthread $(TARGET_LDFLAGS) -shared \
86 -Wl,--version-script,chan_lantiq.exports,--warn-common \
87 chan_lantiq.o
88 endef
89
90 $(eval $(call BuildPackage,$(PKG_NAME)-asterisk13))