]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | ############################################################################### |
2 | # LFSMake # | |
3 | # by Rod Roark <rod@sunsetsystems.com> # | |
4 | # # | |
5 | # Copyright (C) 2002 Rod Roark # | |
6 | # # | |
7 | # See http://www.lfsmake.org/ for the most current standard version. # | |
8 | # # | |
9 | # These Makefiles are made available under the terms of the Artistic License, # | |
10 | # found at http://www.opensource.org/licenses/artistic-license.html. # | |
11 | ############################################################################### | |
12 | ||
13 | # URLs that are common sources of downloads. If you're having trouble with | |
14 | # a site you should change its URL to that of a suitable mirror site. | |
15 | # | |
16 | URL_CPAN = http://www.cpan.org/modules/by-module | |
17 | URL_AGNU = ftp://alpha.gnu.org/gnu | |
18 | URL_DEBIAN = http://http.us.debian.org/debian/pool/main | |
19 | URL_GNU = http://ftp.gnu.org/gnu | |
20 | URL_KERNEL = http://www.kernel.org/pub | |
21 | URL_TUE = ftp://ftp.win.tue.nl/pub | |
22 | URL_LFS_FTP = http://ftp.at.linuxfromscratch.org/pub/lfs/lfs-packages/5.1.1 | |
23 | URL_LFS = http://www.linuxfromscratch.org/patches/downloads | |
24 | URL_SFNET = http://switch.dl.sourceforge.net/sourceforge | |
25 | ||
26 | # Default compiler optimizations. | |
27 | # | |
28 | FLAGS_OPT = -O2 | |
29 | FLAGS_CPU = -mcpu=$(MACHINE) | |
30 | FLAGS_ARCH = -march=$(MACHINE) | |
31 | ||
32 | # Don't change this; it will be overridden by other makefiles where necessary. | |
33 | # | |
34 | ROOT = | |
35 | ||
36 | # For most packages tarballs are unpacked here and then deleted after | |
37 | # installation. | |
38 | # | |
39 | DIR_SRC = $(ROOT)/usr/src | |
40 | ||
41 | # Files are downloaded into DIR_TMP and then moved to DIR_DL, to avoid | |
42 | # messes with partially retrieved files. DIR_DL is where we will | |
43 | # save all the files that are downloaded. DIR_INFO contains the | |
44 | # file lists of installed packages. | |
45 | # | |
46 | DIR_DL = $(LFS_BASEDIR)/cache | |
47 | DIR_CHK = $(LFS_BASEDIR)/cache/check | |
48 | DIR_INFO = $(LFS_BASEDIR)/log | |
49 | DIR_TMP = /tmp | |
50 | ||
51 | KGCC = ccache /usr/bin/gcc | |
79748d69 | 52 | KVER = 2.4.31 |
cd1a2927 MT |
53 | |
54 | ############################################################################### | |
55 | # Common Macro Definitions | |
56 | ############################################################################### | |
57 | ||
58 | # For each package we create a list of files that it installed under | |
59 | # log/<TARGET> name. Modified files are not identified | |
60 | # | |
61 | define FIND_FILES | |
62 | cd $(ROOT)/ && find -mount \ | |
63 | -not -path './tools*' -not -path './tmp*' -not -path './usr/src*' \ | |
64 | -not -path './dev*' -not -path './proc*' -not -path './install*' | |
65 | endef | |
66 | ||
67 | # This is common starting logic for builds. | |
68 | # | |
69 | ifeq "$(ROOT)" "" | |
70 | define PREBUILD | |
71 | echo "====================================== Installing $(THISAPP) ..." | |
72 | @echo "Install started; saving file list to $(DIR_SRC)/lsalr ..." | |
73 | @if [ ! -f $(DIR_SRC)/lsalr ]; then $(FIND_FILES) > $(DIR_SRC)/lsalr; fi | |
74 | endef | |
75 | else | |
76 | define PREBUILD | |
77 | echo "====================================== Installing $(THISAPP) ..." | |
78 | endef | |
79 | endif | |
80 | ||
81 | # Common end-of-installation logic for Stage 2 and beyond. | |
82 | # | |
83 | ifeq "$(ROOT)" "" | |
84 | define POSTBUILD | |
85 | @echo "Install done; saving file list to $(DIR_INFO)/$(THISAPP) ..." | |
86 | @$(FIND_FILES) > $(DIR_SRC)/lsalrnew | |
87 | @diff $(DIR_SRC)/lsalr $(DIR_SRC)/lsalrnew | grep '^> ' | sed 's/^> //' | sort > $(TARGET)_1 | |
88 | @cp -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr | |
89 | @rm -f $(DIR_SRC)/lsalrnew | |
90 | sed -i -e 's+.\/++' $(TARGET)_1 | |
91 | # compare roofile ( same name as lfs script) with the list of installed files | |
92 | # special cases | |
93 | # - on a partial rebuild without a new file inside TARGET_1, just touch TARGET | |
94 | if [ -s "$(TARGET)_1" ]; then \ | |
95 | ROOTFILE=$(DIR_SRC)/src/ROOTFILES.$(MACHINE); \ | |
96 | for line in `cat $(TARGET)_1`; do \ | |
97 | if grep -qE "^#$$line$$" $$ROOTFILE ; then echo "#$$line" >> $(TARGET); \ | |
98 | elif grep -qE "^$$line$$" $$ROOTFILE ; then echo "$$line" >> $(TARGET); \ | |
99 | else echo "+$$line" >> $(TARGET); \ | |
100 | fi; \ | |
101 | done; \ | |
102 | else \ | |
103 | touch $(TARGET); \ | |
104 | fi | |
105 | @rm -f $(TARGET)_1 | |
106 | endef | |
107 | else | |
108 | define POSTBUILD | |
109 | @echo "===================================== Install done for $(THISAPP)." | |
110 | touch $(TARGET) | |
111 | endef | |
112 | endif | |
113 | ||
114 | define CHECK | |
115 | @echo -e "$(MESSAGE)Check: $($(notdir $@))" | |
116 | wget -T 120 -t 1 --spider -nv $($(notdir $@)) -O /dev/null | |
117 | @touch $(DIR_CHK)/$(notdir $@) | |
118 | endef | |
119 | ||
120 | define LOAD | |
121 | @echo -e "$(MESSAGE)Download: $($(notdir $@))" | |
8a13df72 | 122 | wget -T 60 -t 1 -c -nv $($(notdir $@)) -O $(DIR_TMP)/$(notdir $@) |
cd1a2927 MT |
123 | [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ] # detect page not found answer |
124 | mv $(DIR_TMP)/$(notdir $@) $(DIR_DL) | |
125 | endef | |
126 | ||
127 | define MD5 | |
128 | # error mean file signature don't match the one in lfs script | |
129 | [ "$($@_MD5)" = `md5sum $(DIR_DL)/$@ | awk '{ print $$1 }'` ] | |
130 | echo "$@ checksum OK" | |
131 | endef |