move busybox init scripts from base-files into the busybox package and make them...
[openwrt.git] / package / busybox / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=busybox
12 PKG_VERSION:=1.2.1
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.busybox.net/downloads
17 PKG_MD5SUM:=362b3dc0f2023ddfda901dc1f1a74391
18 PKG_CAT:=bzcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 init-y :=
25 init-$(CONFIG_BUSYBOX_CONFIG_HTTPD) += httpd
26 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
27 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
28
29 define Package/busybox
30   SECTION:=base
31   CATEGORY:=Base system
32   TITLE:=Core utilities for embedded Linux
33   URL:=http://busybox.net/
34   MENU:=1
35 endef
36
37 define Package/busybox/description
38 The Swiss Army Knife of embedded Linux.
39         It slices, it dices, it makes Julian Fries.
40 endef
41
42 define Package/busybox/config
43         menu "Configuration"
44                 depends on PACKAGE_busybox
45                 source "$(SOURCE)/config/Config.in"
46         endmenu
47 endef
48
49 define Build/Configure
50         $(SCRIPT_DIR)/gen_busybox_config.pl $(TOPDIR)/.config > $(PKG_BUILD_DIR)/.config
51         yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
52                 CC="$(TARGET_CC)" \
53                 CROSS="$(TARGET_CROSS)" \
54                 oldconfig
55 endef
56
57 define Build/Compile
58         $(MAKE) -C $(PKG_BUILD_DIR) \
59                 CC="$(TARGET_CC)" \
60                 CROSS="$(TARGET_CROSS)" \
61                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
62                 IPKG_ARCH="$(ARCH)" \
63                 all
64 endef
65
66 define Package/busybox/install
67         $(MAKE) -C $(PKG_BUILD_DIR) \
68                 CC="$(TARGET_CC)" \
69                 CROSS="$(TARGET_CROSS)" \
70                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
71                 IPKG_ARCH="$(ARCH)" \
72                 PREFIX="$(1)" \
73                 install
74         mkdir -p $(1)/etc/init.d
75         for tmp in $(init-y); do \
76                 $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
77         done
78         -rm -rf $(1)/lib64
79 endef
80
81 $(eval $(call BuildPackage,busybox))