add a default for PKG_BUILD_DIR and PKG_INSTALL_DIR (will use KERNEL_BUILD_DIR if...
[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.4.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                 http://distfiles.gentoo.org/distfiles/
18 PKG_MD5SUM:=5728403bce309cdabcffa414e2e64052
19 PKG_CAT:=bzcat
20
21 include $(INCLUDE_DIR)/package.mk
22
23 init-y :=
24 init-$(CONFIG_BUSYBOX_CONFIG_HTTPD) += httpd
25 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
26 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
27
28 define Package/busybox
29   SECTION:=base
30   CATEGORY:=Base system
31   TITLE:=Core utilities for embedded Linux
32   URL:=http://busybox.net/
33   MENU:=1
34 endef
35
36 define Package/busybox/description
37 The Swiss Army Knife of embedded Linux.
38         It slices, it dices, it makes Julian Fries.
39 endef
40
41 define Package/busybox/config
42         source "$(SOURCE)/target-config.in"
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_COMPILE="$(TARGET_CROSS)" \
54                 ARCH="$(ARCH)" \
55                 oldconfig
56 endef
57
58 define Build/Compile
59         $(MAKE) -C $(PKG_BUILD_DIR) \
60                 CC="$(TARGET_CC)" \
61                 CROSS_COMPILE="$(TARGET_CROSS)" \
62                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
63                 ARCH="$(ARCH)" \
64                 IPKG_ARCH="$(ARCH)" \
65                 all
66 endef
67
68 define Package/busybox/install
69         $(MAKE) -C $(PKG_BUILD_DIR) \
70                 CC="$(TARGET_CC)" \
71                 CROSS_COMPILE="$(TARGET_CROSS)" \
72                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
73                 ARCH="$(ARCH)" \
74                 IPKG_ARCH="$(ARCH)" \
75                 CONFIG_PREFIX="$(1)" \
76                 install
77         $(INSTALL_DIR) $(1)/etc/init.d
78         for tmp in $(init-y); do \
79                 $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
80         done
81         -rm -rf $(1)/lib64
82 endef
83
84 $(eval $(call BuildPackage,busybox))