Merge pull request #580 from wigyori/cc-libpcap
[15.05/openwrt.git] / package / utils / busybox / Makefile
1 #
2 # Copyright (C) 2006-2015 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:=busybox
11 PKG_VERSION:=1.23.2
12 PKG_RELEASE:=1
13 PKG_FLAGS:=essential
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:=7925683d7dd105aabe9b6b618d48cc73
19
20 PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam
21 PKG_BUILD_PARALLEL:=1
22 PKG_CHECK_FORMAT_SECURITY:=0
23
24 PKG_LICENSE:=GPL-2.0
25 PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
26
27 include $(INCLUDE_DIR)/package.mk
28
29 ifeq ($(DUMP),)
30   STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
31 endif
32
33 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
34   BB_MAKE_VERBOSE := V=1
35 else
36   BB_MAKE_VERBOSE :=
37 endif
38
39 define Package/busybox
40   SECTION:=base
41   CATEGORY:=Base system
42   MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
43   TITLE:=Core utilities for embedded Linux
44   URL:=http://busybox.net/
45   DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam
46   MENU:=1
47 endef
48
49 define Package/busybox/description
50  The Swiss Army Knife of embedded Linux.
51  It slices, it dices, it makes Julian Fries.
52 endef
53
54 define Package/busybox/config
55         source "$(SOURCE)/Config.in"
56 endef
57
58 BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT)
59
60 define Build/Configure
61         rm -f $(PKG_BUILD_DIR)/.configured*
62         grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
63         yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) \
64                 CC="$(TARGET_CC)" \
65                 CROSS_COMPILE="$(TARGET_CROSS)" \
66                 KBUILD_HAVE_NLS=no \
67                 ARCH="$(ARCH)" \
68                 $(BB_MAKE_VERBOSE) \
69                 oldconfig
70 endef
71
72 LDLIBS:=m crypt
73 ifdef CONFIG_BUSYBOX_USE_LIBRPC
74   TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
75   export LDFLAGS=$(TARGET_LDFLAGS)
76   LDLIBS += rpc
77 endif
78
79 ifdef CONFIG_BUSYBOX_CONFIG_PAM
80   TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
81   export LDFLAGS=$(TARGET_LDFLAGS)
82   LDLIBS += pam pam_misc pthread
83 endif
84
85 define Build/Compile
86         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
87                 CC="$(TARGET_CC)" \
88                 CROSS_COMPILE="$(TARGET_CROSS)" \
89                 KBUILD_HAVE_NLS=no \
90                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
91                 ARCH="$(ARCH)" \
92                 SKIP_STRIP=y \
93                 LDLIBS="$(LDLIBS)" \
94                 $(BB_MAKE_VERBOSE) \
95                 all
96         rm -rf $(PKG_INSTALL_DIR)
97         $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
98         $(MAKE) -C $(PKG_BUILD_DIR) \
99                 CC="$(TARGET_CC)" \
100                 CROSS_COMPILE="$(TARGET_CROSS)" \
101                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
102                 ARCH="$(ARCH)" \
103                 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
104                 LDLIBS="$(LDLIBS)" \
105                 $(BB_MAKE_VERBOSE) \
106                 install
107 endef
108
109 define Package/busybox/install
110         $(INSTALL_DIR) $(1)/etc/init.d
111         $(CP) $(PKG_INSTALL_DIR)/* $(1)/
112         $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
113         $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
114         $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
115         -rm -rf $(1)/lib64
116 endef
117
118 $(eval $(call BuildPackage,busybox))