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