move ppp plugins default search path and (hopefully) fix pppoe reconnect issue
[openwrt.git] / package / ppp / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME := ppp
6 PKG_VERSION := 2.4.3
7 PKG_RELEASE := 3
8 PKG_MD5SUM := 848f6c3cafeb6074ffeb293c3af79b7c
9
10 PKG_SOURCE_SITE := ftp://ftp.samba.org/pub/ppp/
11 PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_SOURCE_CAT := zcat
13 PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION)
14 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR)
15
16 PKG_PPP := $(PACKAGE_DIR)/ppp_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
17 PKG_PPP_PPPOE_PLUGIN := $(PACKAGE_DIR)/ppp-pppoe-plugin_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
18 PKG_PPP_RADIUS_PLUGIN := $(PACKAGE_DIR)/ppp-radius-plugin_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
19 PKG_PPPSTATS := $(PACKAGE_DIR)/pppstats_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
20 PKG_PPPDUMP := $(PACKAGE_DIR)/pppdump_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
21
22 I_PPP := $(PKG_BUILD_DIR)/ipkg/ppp
23 I_PPP_PPPOE_PLUGIN := $(PKG_BUILD_DIR)/ipkg/ppp-pppoe-plugin
24 I_PPP_RADIUS_PLUGIN := $(PKG_BUILD_DIR)/ipkg/ppp-radius-plugin
25 I_PPPDUMP := $(PKG_BUILD_DIR)/ipkg/pppdump
26 I_PPPSTATS := $(PKG_BUILD_DIR)/ipkg/pppstats
27
28 TARGETS := $(PKG_PPP)
29 ifneq ($(BR2_PACKAGE_PPP_PPPOE),)
30 TARGETS += $(PKG_PPP_PPPOE_PLUGIN)
31 endif
32 ifneq ($(BR2_PACKAGE_PPP_RADIUS),)
33 TARGETS += $(PKG_PPP_RADIUS_PLUGIN)
34 endif
35 ifneq ($(BR2_PACKAGE_PPPDUMP),)
36 TARGETS += $(PKG_PPPDUMP)
37 endif
38 ifneq ($(BR2_PACKAGE_PPPSTATS),)
39 TARGETS += $(PKG_PPPSTATS)
40 endif
41
42 INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/ppp.list
43 ifeq ($(BR2_PACKAGE_PPP_PPPOE),y)
44 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/ppp-pppoe-plugin.list
45 endif
46 ifeq ($(BR2_PACKAGE_PPP_RADIUS),y)
47 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/ppp-radius-plugin.list
48 endif
49 ifeq ($(BR2_PACKAGE_PPPDUMP),y)
50 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/pppdump.list
51 endif
52 ifeq ($(BR2_PACKAGE_PPPSTATS),y)
53 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/pppstats.list
54 endif
55
56 $(DL_DIR)/$(PKG_SOURCE_FILE):
57         mkdir -p $(DL_DIR)
58         $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) $(PKG_MD5SUM) $(PKG_SOURCE_SITE)
59
60 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
61         mkdir -p $(TOOL_BUILD_DIR)
62         $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
63         $(PATCH) $(PKG_BUILD_DIR) . $(PKG_NAME).patch
64         touch $(PKG_BUILD_DIR)/.patched
65
66 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched
67         (cd $(PKG_BUILD_DIR); \
68         rm -f config.cache; \
69         $(TARGET_CONFIGURE_OPTS) \
70         CFLAGS="$(TARGET_CFLAGS)" \
71         ./configure \
72          --target=$(GNU_TARGET_NAME) \
73          --host=$(GNU_TARGET_NAME) \
74          --build=$(GNU_HOST_NAME) \
75          --prefix=/usr \
76          --exec-prefix=/usr \
77          --bindir=/usr/bin \
78          --datadir=/usr/share \
79          --infodir=/usr/share/info \
80          --libexecdir=/usr/lib \
81          --localstatedir=/var \
82          --mandir=/usr/share/man \
83          --sbindir=/usr/sbin \
84          --sysconfdir=/etc \
85          $(DISABLE_NLS))
86         touch $(PKG_BUILD_DIR)/.configured
87
88 $(PKG_BUILD_DIR)/pppd/pppd $(PKG_BUILD_DIR)/pppd/plugins/radius/radius.so: $(PKG_BUILD_DIR)/.configured
89         $(MAKE) -C $(PKG_BUILD_DIR) \
90           CC=$(TARGET_CC) \
91           COPTS="$(TARGET_CFLAGS)" \
92          all
93
94 $(PKG_PPP): $(PKG_BUILD_DIR)/pppd/pppd
95         mkdir -p $(I_PPP)
96         cp -af ./ipkg/ppp/* $(I_PPP)
97         $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPP) control/ppp.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) 
98         mkdir -p $(I_PPP)/etc/ppp
99         ln -sf /tmp/resolv.conf $(I_PPP)/etc/ppp/resolv.conf
100         mkdir -p $(I_PPP)/usr/sbin
101         cp -af $(PKG_BUILD_DIR)/pppd/pppd $(I_PPP)/usr/sbin/
102         $(STRIP) $(I_PPP)/usr/sbin/*
103         mkdir -p $(I_PPP)/usr/lib/pppd
104         cp $(PKG_BUILD_DIR)/pppd/plugins/*.so $(I_PPP)/usr/lib/pppd/
105         $(STRIP) $(I_PPP)/usr/lib/pppd/*.so
106         mkdir -p $(I_PPP)/$(MODULES_SUBDIR)
107         cp $(MODULES_DIR)/kernel/drivers/net/ppp_async.o $(I_PPP)/$(MODULES_SUBDIR)
108         cp $(MODULES_DIR)/kernel/drivers/net/ppp_deflate.o $(I_PPP)/$(MODULES_SUBDIR)
109         cp $(MODULES_DIR)/kernel/drivers/net/bsd_comp.o $(I_PPP)/$(MODULES_SUBDIR)
110         find $(I_PPP) -name CVS | xargs rm -rf
111         $(IPKG_BUILD) $(I_PPP) $(PACKAGE_DIR)
112         
113 $(IPKG_STATE_DIR)/info/ppp.list: $(PKG_PPP)
114         $(IPKG) install $(PKG_PPP)
115
116 $(PKG_PPP_PPPOE_PLUGIN): $(PKG_PPP)
117         $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPP_PPPOE_PLUGIN) control/ppp-pppoe-plugin.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
118         cp -af ./ipkg/ppp-pppoe-plugin/* $(I_PPP_PPPOE_PLUGIN)
119         mkdir -p $(I_PPP_PPPOE_PLUGIN)/usr/lib/pppd/$(PKG_VERSION)
120         cp -af $(PKG_BUILD_DIR)/pppd/plugins/rp-pppoe/rp-pppoe.so \
121                 $(I_PPP_PPPOE_PLUGIN)/usr/lib/pppd/$(PKG_VERSION)
122         $(STRIP) $(I_PPP_PPPOE_PLUGIN)/usr/lib/pppd/$(PKG_VERSION)/*.so
123         mkdir -p $(I_PPP_PPPOE_PLUGIN)/$(MODULES_SUBDIR)
124         cp $(MODULES_DIR)/kernel/drivers/net/pppo*.o $(I_PPP_PPPOE_PLUGIN)/$(MODULES_SUBDIR)
125         find $(I_PPP_PPPOE_PLUGIN) -name CVS | xargs rm -rf
126         $(IPKG_BUILD) $(I_PPP_PPPOE_PLUGIN) $(PACKAGE_DIR)
127
128 $(IPKG_STATE_DIR)/info/ppp-pppoe-plugin.list: $(PKG_PPP_PPPOE_PLUGIN)
129         $(IPKG) install $(PKG_PPP_PPPOE_PLUGIN)
130
131 $(PKG_PPP_RADIUS_PLUGIN): $(PKG_PPP)
132         $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPP_RADIUS_PLUGIN) control/ppp-radius-plugin.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
133         mkdir -p $(I_PPP_RADIUS_PLUGIN)/usr/lib/pppd/$(PKG_VERSION)
134         cp -af $(PKG_BUILD_DIR)/pppd/plugins/radius/radius.so \
135           $(I_PPP_RADIUS_PLUGIN)/usr/lib/pppd/$(PKG_VERSION)
136         $(STRIP) $(I_PPP_RADIUS_PLUGIN)/usr/lib/pppd/$(PKG_VERSION)/*.so
137         find $(I_PPP_RADIUS_PLUGIN) -name CVS | xargs rm -rf
138         $(IPKG_BUILD) $(I_PPP_RADIUS_PLUGIN) $(PACKAGE_DIR)
139
140 $(IPKG_STATE_DIR)/info/ppp-radius-plugin.list: $(PKG_PPP_RADIUS_PLUGIN)
141         $(IPKG) install $(PKG_PPP_RADIUS_PLUGIN)
142
143 $(PKG_PPPDUMP): $(PKG_PPP)
144         $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPPDUMP) control/pppdump.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
145         mkdir -p $(I_PPPDUMP)/usr/sbin
146         cp -af $(PKG_BUILD_DIR)/pppdump/pppdump $(I_PPPDUMP)/usr/sbin/
147         $(STRIP) $(I_PPPDUMP)/usr/sbin/*
148         find $(I_PPPDUMP) -name CVS | xargs rm -rf
149         $(IPKG_BUILD) $(I_PPPDUMP) $(PACKAGE_DIR)
150
151 $(IPKG_STATE_DIR)/info/pppdump.list: $(PKG_PPPDUMP)
152         $(IPKG) install $(PKG_PPPDUMP)
153
154 $(PKG_PPPSTATS): $(PKG_PPP)
155         $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPPSTATS) control/pppstats.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
156         mkdir -p $(I_PPPSTATS)/usr/sbin
157         cp -af $(PKG_BUILD_DIR)/pppstats/pppstats $(I_PPPSTATS)/usr/sbin/
158         $(STRIP) $(I_PPPSTATS)/usr/sbin/*
159         find $(I_PPPSTATS) -name CVS | xargs rm -rf
160         $(IPKG_BUILD) $(I_PPPSTATS) $(PACKAGE_DIR)
161
162 $(IPKG_STATE_DIR)/info/pppstats.list: $(PKG_PPPSTATS)
163         $(IPKG) install $(PKG_PPPSTATS)
164
165 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
166 prepare: $(PKG_BUILD_DIR)/.patched
167 compile: $(TARGETS)
168 install: $(INSTALL_TARGETS)
169
170 clean:
171         rm -rf $(PKG_BUILD_DIR)
172         rm -f $(PKG_PPP) $(PKG_PPP_PPPOE_PLUGIN) $(PKG_PPP_RADIUS_PLUGIN) $(PKG_PPPSTATS) $(PKG_PPPDUMP)