c672e5e677aaa9c47a63ccc79dde5a5596694e53
[people/pmueller/ipfire-2.x.git] / lfs / busybox
1
2 ###############################################################################
3 # This file is part of the IPCop Firewall. #
4 # #
5 # IPCop is free software; you can redistribute it and/or modify #
6 # it under the terms of the GNU General Public License as published by #
7 # the Free Software Foundation; either version 2 of the License, or #
8 # (at your option) any later version. #
9 # #
10 # IPCop is distributed in the hope that it will be useful, #
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
13 # GNU General Public License for more details. #
14 # #
15 # You should have received a copy of the GNU General Public License #
16 # along with IPCop; if not, write to the Free Software #
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
18 # #
19 # Makefiles are based on LFSMake, which is #
20 # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com> #
21 # #
22 ###############################################################################
23
24 ###############################################################################
25 # Definitions
26 ###############################################################################
27
28 include Config
29
30 VER = 0.60.5
31
32 THISAPP = busybox-$(VER)
33 DL_FILE = $(THISAPP).tar.gz
34 DL_FROM = $(URL_IPFIRE)
35 DIR_APP = $(DIR_SRC)/$(THISAPP)
36 TARGET = $(DIR_INFO)/$(THISAPP)
37
38 ###############################################################################
39 # Top-level Rules
40 ###############################################################################
41
42 objects = $(DL_FILE)
43
44 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
45
46 $(DL_FILE)_MD5 = 1dfe09e0b1db1aab2a5f7d03e47640a6
47
48 install : $(TARGET)
49
50 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
51
52 download :$(patsubst %,$(DIR_DL)/%,$(objects))
53
54 md5 : $(subst %,%_MD5,$(objects))
55
56 ###############################################################################
57 # Downloading, checking, md5sum
58 ###############################################################################
59
60 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
61 @$(CHECK)
62
63 $(patsubst %,$(DIR_DL)/%,$(objects)) :
64 @$(LOAD)
65
66 $(subst %,%_MD5,$(objects)) :
67 @$(MD5)
68
69 ###############################################################################
70 # Installation Details
71 ###############################################################################
72
73 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
74 @$(PREBUILD)
75 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
76 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/busybox-0.60.5-config.patch
77 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/busybox-0.60.5-gzip.patch
78 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/busybox-0.60.5-spider.patch
79 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/busybox-0.60.5-insmod_gpl_symbols.patch
80 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/busybox-0.60.5-wget-unlink.patch
81 if [ "$(MACHINE)" = "alpha" ]; then \
82 cd $(DIR_APP) && sed -i -e 's/#define BB_INSMOD//' Config.h; \
83 cd $(DIR_APP) && sed -i -e 's/#define BB_RMMOD//' Config.h; \
84 cd $(DIR_APP) && sed -i -e 's/#define BB_MODPROBE//' Config.h; \
85 fi
86 # cd $(DIR_APP) && sed -i -e 's/enum { NAME_SIZE = 100 };/enum { NAME_SIZE = 150 };/' tar.c; \
87
88 cd $(DIR_APP) && make
89 -mkdir -p /install/initrd/bin
90 cd $(DIR_APP) && install -m 0755 busybox /install/initrd/bin
91 cd /install/initrd/bin && for i in [ ash cat chroot dd df echo gzip \
92 gunzip halt insmod ifconfig init ls mkswap modprobe mount reboot \
93 rmmod sed sh sleep swapon swapoff syslogd tar umount wget ping \
94 sync; do \
95 ln -sf busybox $$i; \
96 done
97 if [ "$(MACHINE)" = "alpha" ]; then \
98 cd /install/initrd/bin && rm -f rmmod modprobe insmod; \
99 cp /sbin/insmod.static /install/initrd/bin/insmod; \
100 cd /install/initrd/bin && ln -s insmod modprobe; \
101 cd /install/initrd/bin && ln -s insmod rmmod; \
102 fi
103 @rm -rf $(DIR_APP)
104 @$(POSTBUILD)