]>
Commit | Line | Data |
---|---|---|
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://kent.dl.sourceforge.net/sourceforge | |
25 | URL_IPFIRE = http://mirror.ipfire.org/source | |
26 | URL_IPCOP = http://ipcop.ath.cx | |
27 | ||
28 | # Default compiler optimizations. | |
29 | # | |
30 | FLAGS_OPT = -O2 | |
31 | FLAGS_CPU = -mcpu=$(MACHINE) | |
32 | FLAGS_ARCH = -march=$(MACHINE) | |
33 | ||
34 | # Don't change this; it will be overridden by other makefiles where necessary. | |
35 | # | |
36 | ROOT = | |
37 | ||
38 | # For most packages tarballs are unpacked here and then deleted after | |
39 | # installation. | |
40 | # | |
41 | DIR_SRC = $(ROOT)/usr/src | |
42 | ||
43 | # Files are downloaded into DIR_TMP and then moved to DIR_DL, to avoid | |
44 | # messes with partially retrieved files. DIR_DL is where we will | |
45 | # save all the files that are downloaded. DIR_INFO contains the | |
46 | # file lists of installed packages. | |
47 | # | |
48 | DIR_DL = $(LFS_BASEDIR)/cache | |
49 | DIR_CHK = $(LFS_BASEDIR)/cache/check | |
50 | DIR_CONF = $(LFS_BASEDIR)/config | |
51 | DIR_INFO = $(LFS_BASEDIR)/log | |
52 | DIR_TMP = /var/tmp | |
53 | ||
54 | KGCC = ccache /usr/bin/gcc | |
55 | ||
56 | ############################################################################### | |
57 | # Common Macro Definitions | |
58 | ############################################################################### | |
59 | ||
60 | # For each package we create a list of files that it installed under | |
61 | # log/<TARGET> name. Modified files are not identified | |
62 | # | |
63 | define FIND_FILES | |
64 | cd $(ROOT)/ && find -mount \ | |
65 | -not -path './tools*' -not -path './tmp*' -not -path './usr/src*' \ | |
66 | -not -path './dev*' -not -path './proc*' -not -path './install*' | |
67 | endef | |
68 | ||
69 | # This is common starting logic for builds. | |
70 | # | |
71 | ifeq "$(ROOT)" "" | |
72 | define PREBUILD | |
73 | echo "====================================== Installing $(THISAPP) ..." | |
74 | @echo "Install started; saving file list to $(DIR_SRC)/lsalr ..." | |
75 | @if [ ! -f $(DIR_SRC)/lsalr ]; then $(FIND_FILES) > $(DIR_SRC)/lsalr; fi | |
76 | endef | |
77 | else | |
78 | define PREBUILD | |
79 | echo "====================================== Installing $(THISAPP) ..." | |
80 | endef | |
81 | endif | |
82 | ||
83 | # Common end-of-installation logic for Stage 2 and beyond. | |
84 | # | |
85 | ifeq "$(ROOT)" "" | |
86 | define POSTBUILD | |
87 | @echo "Install done; saving file list to $(DIR_INFO)/$(THISAPP) ..." | |
88 | @$(FIND_FILES) > $(DIR_SRC)/lsalrnew | |
89 | @diff $(DIR_SRC)/lsalr $(DIR_SRC)/lsalrnew | grep '^> ' | sed 's/^> //' | sort > $(TARGET)_diff | |
90 | @cp -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr | |
91 | @rm -f $(DIR_SRC)/lsalrnew | |
92 | sed -i -e 's+.\/++' $(TARGET)_diff | |
93 | # compare roofile ( same name as lfs script) with the list of installed files | |
94 | # special cases | |
95 | # - on a partial rebuild without a new file inside TARGET_diff, just touch TARGET | |
96 | if [ -s "$(TARGET)_diff" ]; then \ | |
97 | ROOTFILE=$(DIR_SRC)/src/ROOTFILES.$(MACHINE); \ | |
98 | sed "s/KVER/$(KVER)/g" $$ROOTFILE > $(TARGET)_rootfile; \ | |
99 | for line in `cat $(TARGET)_diff`; do \ | |
100 | if grep -qE "^#$$line$$" $(TARGET)_rootfile ; then echo "#$$line" >> $(TARGET); \ | |
101 | elif grep -qE "^$$line$$" $(TARGET)_rootfile ; then echo "$$line" >> $(TARGET); \ | |
102 | else echo "+$$line" >> $(TARGET); \ | |
103 | fi; \ | |
104 | done; \ | |
105 | rm -f $(TARGET)_rootfile; \ | |
106 | else \ | |
107 | touch $(TARGET); \ | |
108 | fi | |
109 | @rm -f $(TARGET)_diff | |
110 | endef | |
111 | else | |
112 | define POSTBUILD | |
113 | @echo "===================================== Install done for $(THISAPP)." | |
114 | touch $(TARGET) | |
115 | endef | |
116 | endif | |
117 | ||
118 | define CHECK | |
119 | @echo -e "$(MESSAGE)Check: $($(notdir $@))" | |
120 | wget -T 120 -t 1 --spider -nv $($(notdir $@)) -O /dev/null | |
121 | @touch $(DIR_CHK)/$(notdir $@) | |
122 | endef | |
123 | ||
124 | define LOAD | |
125 | @echo -e "$(MESSAGE)Download: $($(notdir $@))" | |
126 | wget -T 60 -t 1 -c -nv $($(notdir $@)) -O $(DIR_TMP)/$(notdir $@) | |
127 | [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ] # detect page not found answer | |
128 | mv $(DIR_TMP)/$(notdir $@) $(DIR_DL) | |
129 | endef | |
130 | ||
131 | define MD5 | |
132 | # error mean file signature don't match the one in lfs script | |
133 | [ "$($@_MD5)" = `md5sum $(DIR_DL)/$@ | awk '{ print $$1 }'` ] | |
134 | echo "$@ checksum OK" | |
135 | echo "$@" >>$(DIR_INFO)/_build.othersrc-list.log | |
136 | endef | |
137 | ||
138 | define PAK | |
139 | /usr/local/bin/packager $(PROG) $(VER) $(PAK_VER) | |
140 | endef |