]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - lfs/Config
Neues Verfahren fuer die Rootfiles.
[people/pmueller/ipfire-2.x.git] / lfs / Config
CommitLineData
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#
16URL_CPAN = http://www.cpan.org/modules/by-module
17URL_AGNU = ftp://alpha.gnu.org/gnu
18URL_DEBIAN = http://http.us.debian.org/debian/pool/main
19URL_GNU = http://ftp.gnu.org/gnu
e9a97e8e 20URL_KERNEL = http://www.kernel.org/pub
cd1a2927
MT
21URL_TUE = ftp://ftp.win.tue.nl/pub
22URL_LFS_FTP = http://ftp.at.linuxfromscratch.org/pub/lfs/lfs-packages/5.1.1
23URL_LFS = http://www.linuxfromscratch.org/patches/downloads
77527db8 24URL_SFNET = http://kent.dl.sourceforge.net/sourceforge
5162b7d0 25URL_IPFIRE = http://mirror.ipfire.org/source
e9a97e8e 26URL_IPCOP = http://ipcop.ath.cx
cd1a2927
MT
27
28# Default compiler optimizations.
29#
30FLAGS_OPT = -O2
31FLAGS_CPU = -mcpu=$(MACHINE)
32FLAGS_ARCH = -march=$(MACHINE)
33
34# Don't change this; it will be overridden by other makefiles where necessary.
35#
36ROOT =
37
38# For most packages tarballs are unpacked here and then deleted after
39# installation.
40#
41DIR_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#
48DIR_DL = $(LFS_BASEDIR)/cache
49DIR_CHK = $(LFS_BASEDIR)/cache/check
3796e3d5 50DIR_CONF = $(LFS_BASEDIR)/config
cd1a2927 51DIR_INFO = $(LFS_BASEDIR)/log
557a2e1a 52DIR_TMP = /var/tmp
cd1a2927 53
03ad5f93 54KGCC = gcc
cd1a2927
MT
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#
63define 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*'
67endef
68
69# This is common starting logic for builds.
70#
71ifeq "$(ROOT)" ""
72define 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
03ad5f93
MT
76 # Fix installation on partial rebuild, so modules install where they should
77 # and not everytime on the last compiled kernel
78 if [ -f $(DIR_SRC)/linux-$(KVER) ]; then \
79 if [ "$(SMP)" = "" ]; then \
80 cd $(DIR_SRC)/linux-$(KVER) && \
81 sed -i -e 's+^EXTRAVERSION.*$$+EXTRAVERSION\ =\ $(word 4,$(subst ., .,$(KVER)))+' Makefile; \
82 else \
83 cd $(DIR_SRC)/linux-$(KVER) && \
84 sed -i -e 's+^EXTRAVERSION.*$$+EXTRAVERSION\ =\ $(word 4,$(subst ., .,$(KVER)))-smp+' Makefile; \
85 fi; \
86 fi
cd1a2927
MT
87endef
88else
89define PREBUILD
90 echo "====================================== Installing $(THISAPP) ..."
91endef
92endif
93
94# Common end-of-installation logic for Stage 2 and beyond.
95#
96ifeq "$(ROOT)" ""
97define POSTBUILD
03ad5f93 98 @echo "Install done; saving file list to $(TARGET) ..."
cd1a2927 99 @$(FIND_FILES) > $(DIR_SRC)/lsalrnew
0145f271 100 @diff $(DIR_SRC)/lsalr $(DIR_SRC)/lsalrnew | grep '^> ' | sed 's/^> //' | sort > $(TARGET)_diff
cd1a2927
MT
101 @cp -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr
102 @rm -f $(DIR_SRC)/lsalrnew
0145f271 103 sed -i -e 's+.\/++' $(TARGET)_diff
cd1a2927
MT
104 # compare roofile ( same name as lfs script) with the list of installed files
105 # special cases
03ad5f93 106 # - if the corresponding rootfile is not found, touch $(TARGET)_missing_rootfile
0145f271 107 # - on a partial rebuild without a new file inside TARGET_diff, just touch TARGET
03ad5f93
MT
108 # $(TARGET)_diff : result of the diff
109 # ROOTFILE : reference of include/exclude files
110 # $(TARGET)_rootfile : ROOTFILE with KVER replacement
111 # $(TARGET) : log result with {commented|include|added} files
0145f271 112 if [ -s "$(TARGET)_diff" ]; then \
03ad5f93
MT
113 if [ "$(PASS)" = "SMP" ]; then LFS_SCRIPT=$(firstword $(MAKEFILE_LIST))-smp; \
114 else LFS_SCRIPT=$(firstword $(MAKEFILE_LIST)); \
115 fi; \
116 echo $(LFS_SCRIPT); \
117 ROOTFILE=`find $(DIR_SRC)/config/rootfiles/common -maxdepth 1 -type f -name $$LFS_SCRIPT`; \
118 if [ "$$ROOTFILE" = "" ]; then \
119 ROOTFILE=`find $(DIR_SRC)/config/rootfiles/ver_$(IPFVER) -type f -name $$LFS_SCRIPT`; \
120 fi; \
121 if [ "$$ROOTFILE" = "" ]; then \
122 touch $(TARGET)_missing_rootfile; \
123 ROOTFILE=$(TARGET)_missing_rootfile ; \
124 echo "error $$LFS_SCRIPT not found in config/rootfiles"; \
125 fi; \
0145f271
MT
126 sed "s/KVER/$(KVER)/g" $$ROOTFILE > $(TARGET)_rootfile; \
127 for line in `cat $(TARGET)_diff`; do \
03ad5f93 128 if grep -qE "^#$$line$$" $(TARGET)_rootfile; then echo "#$$line" >> $(TARGET); \
0145f271 129 elif grep -qE "^$$line$$" $(TARGET)_rootfile ; then echo "$$line" >> $(TARGET); \
cd1a2927
MT
130 else echo "+$$line" >> $(TARGET); \
131 fi; \
132 done; \
0145f271 133 rm -f $(TARGET)_rootfile; \
cd1a2927
MT
134 else \
135 touch $(TARGET); \
136 fi
0145f271 137 @rm -f $(TARGET)_diff
cd1a2927
MT
138endef
139else
140define POSTBUILD
141 @echo "===================================== Install done for $(THISAPP)."
142 touch $(TARGET)
143endef
144endif
145
146define CHECK
147 @echo -e "$(MESSAGE)Check: $($(notdir $@))"
148 wget -T 120 -t 1 --spider -nv $($(notdir $@)) -O /dev/null
149 @touch $(DIR_CHK)/$(notdir $@)
150endef
151
152define LOAD
153 @echo -e "$(MESSAGE)Download: $($(notdir $@))"
8a13df72 154 wget -T 60 -t 1 -c -nv $($(notdir $@)) -O $(DIR_TMP)/$(notdir $@)
cd1a2927
MT
155 [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ] # detect page not found answer
156 mv $(DIR_TMP)/$(notdir $@) $(DIR_DL)
157endef
158
159define MD5
160 # error mean file signature don't match the one in lfs script
161 [ "$($@_MD5)" = `md5sum $(DIR_DL)/$@ | awk '{ print $$1 }'` ]
162 echo "$@ checksum OK"
0145f271 163 echo "$@" >>$(DIR_INFO)/_build.othersrc-list.log
cd1a2927 164endef
a8b159e7
MT
165
166define PAK
483f59cd 167 /usr/local/bin/packager $(PROG) $(VER) $(PAK_VER)
a8b159e7 168endef