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