]> git.ipfire.org Git - ipfire-3.x.git/blame - lfs/Config
s/TARGET/OBJECT/g
[ipfire-3.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
70df8302
MT
13###############################################################################
14# #
15# IPFire.org - A linux based firewall #
b977f4f7 16# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt #
70df8302
MT
17# #
18# This program is free software: you can redistribute it and/or modify #
19# it under the terms of the GNU General Public License as published by #
20# the Free Software Foundation, either version 3 of the License, or #
21# (at your option) any later version. #
22# #
23# This program is distributed in the hope that it will be useful, #
24# but WITHOUT ANY WARRANTY; without even the implied warranty of #
25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
26# GNU General Public License for more details. #
27# #
28# You should have received a copy of the GNU General Public License #
29# along with this program. If not, see <http://www.gnu.org/licenses/>. #
30# #
31###############################################################################
32
cd1a2927
MT
33# URLs that are common sources of downloads. If you're having trouble with
34# a site you should change its URL to that of a suitable mirror site.
35#
fa0dac0f 36URL_IPFIRE = http://source.ipfire.org/download
da1befdd
MT
37URL_TOOLCHAIN = source.ipfire.org:/pub/source/toolchains
38URL_SOURCE = source.ipfire.org:/pub/source/source-3.x
e70deaa8 39URL_TARGET = source.ipfire.org:/srv/anonftp/pub/nightly-builds
cd1a2927 40
cd1a2927
MT
41# For most packages tarballs are unpacked here and then deleted after
42# installation.
43#
be472d5a 44DIR_SRC = $(LFS)/usr/src
cd1a2927
MT
45
46# Files are downloaded into DIR_TMP and then moved to DIR_DL, to avoid
47# messes with partially retrieved files. DIR_DL is where we will
48# save all the files that are downloaded. DIR_INFO contains the
49# file lists of installed packages.
50#
fa0dac0f 51DIR_DL = $(LFS_BASEDIR)/cache/tarballs
3796e3d5 52DIR_CONF = $(LFS_BASEDIR)/config
11f0ec61 53DIR_INFO = $(LFS_BASEDIR)/log_$(TARGET)
cb5bd21c 54DIR_LFS = $(LFS_BASEDIR)/lfs
bdb1a79b 55DIR_TOOLS = $(LFS_BASEDIR)/tools
05207d69 56DIR_TMP = /tmp
fa0dac0f 57DIR_PATCHES = $(DIR_DL)/../patches
246556fe 58DIR_CONFIG = $(DIR_CONF)
084ab6f4 59DIR_SOURCE = $(DIR_SRC)/src
cd1a2927 60
fa0dac0f
MT
61VPATH = $(DIR_DL):$(DIR_PATCHES)
62
d19b68a0
MT
63CONFIGURE_ARCH = \
64 --build=$(IFS_TARGET) \
65 --host=$(IFS_TARGET)
66
cd1a2927
MT
67###############################################################################
68# Common Macro Definitions
69###############################################################################
70
db918e56
MT
71DO_LOAD = DIR_TMP=$(DIR_TMP) DIR_DL=$(DIR_DL) DIR_PATCHES=$(DIR_PATCHES) \
72 python $(DIR_TOOLS)/downloader $(URL_IPFIRE)/$@
73LOAD = $(DO_LOAD) # To be compatible to the current build system.
74
75EXTRACTOR = bash $(DIR_SOURCE)/scripts/extractor
76
e52cf98b
MT
77INSTALL_CONFIG = sed \
78 -e "s/@NAME@/$(NAME)/g" \
79 -e "s/@SNAME@/$(SNAME)/g" \
80 -e "s/@VERSION@/$(VERSION)/g" \
81 -e "s/@DATE@/$(shell date '+%Y%m%d')/g"
82
db918e56
MT
83INSTALL_INITSCRIPT = echo "Installing initscript \"$(INITSCRIPT)\" -> /etc/init.d"; \
84 install -m 754 $(DIR_SOURCE)/initscripts/extras/$(INITSCRIPT) /etc/init.d/
85
86PYTHON_COMPILE = find /usr/lib/python*/ -name *.py | xargs /usr/bin/py-compile
87
cd1a2927
MT
88# For each package we create a list of files that it installed under
89# log/<TARGET> name. Modified files are not identified
90#
91define FIND_FILES
082078c8 92 cd $(LFS)/ && $(TOOLS_DIR)/bin/find -mount \
3888140c 93 -not -path '.$(TOOLS_DIR)*' -not -path './tmp*' -not -path './usr/src*' \
de1f9d00
MT
94 -not -path './dev*' -not -path './proc*' -not -path './sys*' \
95 -not -path '.$(INSTALLER_DIR)*'
cd1a2927
MT
96endef
97
98# This is common starting logic for builds.
99#
3888140c 100ifneq "$(STAGE)" "toolchain"
cd1a2927 101define PREBUILD
db918e56
MT
102 echo "### STARTING INSTALL #################################################"
103 echo "# Application: $(THISAPP)"
104 echo "# Description: $(SHORT_DESC)"
105 echo "######################################################################"
cff099a4 106 echo "# Saving file list..."
3888140c 107 if [ ! -f $(DIR_SRC)/lsalr ]; then $(FIND_FILES) > $(DIR_SRC)/lsalr; fi
cd1a2927
MT
108endef
109else
110define PREBUILD
db918e56
MT
111 echo "### STARTING INSTALL #################################################"
112 echo "# Application: $(THISAPP)"
113 echo "# Description: $(SHORT_DESC)"
114 echo "######################################################################"
cd1a2927
MT
115endef
116endif
117
118# Common end-of-installation logic for Stage 2 and beyond.
119#
3888140c 120ifneq "$(STAGE)" "toolchain"
cd1a2927 121define POSTBUILD
db918e56
MT
122 echo "### INSTALL DONE #####################################################"
123 echo "# Application: $(THISAPP)"
6679675b 124 echo "# Saving file list to $(OBJECT)..."
cd1a2927 125 @$(FIND_FILES) > $(DIR_SRC)/lsalrnew
6679675b 126 @diff $(DIR_SRC)/lsalr $(DIR_SRC)/lsalrnew | grep '^> ' | sed 's+^> \./++' | sort > $(OBJECT)_diff
3888140c 127 @mv -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr
084ab6f4 128 # compare roofile (same name as lfs script) with the list of installed files
cd1a2927 129 # special cases
6679675b 130 # - if the corresponding rootfile is not found, touch $(OBJECT)_missing_rootfile
0145f271 131 # - on a partial rebuild without a new file inside TARGET_diff, just touch TARGET
6679675b 132 # $(OBJECT)_diff : result of the diff
03ad5f93 133 # ROOTFILE : reference of include/exclude files
6679675b
MT
134 # $(OBJECT)_rootfile : ROOTFILE with KVER replacement
135 # $(OBJECT) : log result with {commented|include|added} files
136 if [ -s "$(OBJECT)_diff" ]; then \
1954a4dd
MT
137 LFS_SCRIPT="$(STAGE_ORDER).$(firstword $(MAKEFILE_LIST))"; \
138 if [ "x$(PASS)" != "x" ]; then LFS_SCRIPT="$$LFS_SCRIPT.$(PASS)"; fi; \
de1f9d00 139 ROOTFILE=$$(find $(DIR_SOURCE)/rootfiles/core $(DIR_SOURCE)/rootfiles/extras -maxdepth 1 -type f -name $$LFS_SCRIPT | head -1); \
03ad5f93 140 if [ "$$ROOTFILE" = "" ]; then \
6679675b
MT
141 touch $(OBJECT)_missing_rootfile; \
142 ROOTFILE=$(OBJECT)_missing_rootfile ; \
084ab6f4 143 echo "error $$LFS_SCRIPT not found in $(DIR_SOURCE)/rootfiles"; \
03ad5f93 144 fi; \
1954a4dd 145 sed -e "s@KVER@$(KVER)@g" \
1954a4dd 146 -e "s@^/@@g" -e "s@^#/@#@g" \
6679675b
MT
147 $$ROOTFILE > $(OBJECT)_rootfile; \
148 echo 'open (F,"$(OBJECT)_rootfile"); \
1954a4dd
MT
149 while (<F>) { $$allfile{$$_} = "x" };close (F); \
150 while (<>) { \
151 if ( defined ($$allfile{"#$$_"}) ) {print "#$$_"} \
152 elsif ( defined ($$allfile{$$_}) ) {print $$_} \
153 else {print "+$$_"} \
154 }; \
155 ' > /tmp/perl.pl; \
6679675b
MT
156 perl /tmp/perl.pl < $(OBJECT)_diff \
157 | sed -e "s@$(KVER)@KVER@g" > $(OBJECT); \
158 rm -f $(OBJECT)_rootfile; \
bfdbe3b6 159 if [ "$$ROOTFILE" != "" ]; then \
6679675b
MT
160 if ! cmp -s $(OBJECT) $$ROOTFILE; then \
161 touch $(OBJECT)_changed; \
162 if ! grep -q "^+" $(OBJECT); then cp -f $(TARGET) $$ROOTFILE; fi; \
bfdbe3b6
MT
163 fi; \
164 fi; \
cd1a2927 165 else \
6679675b 166 touch $(OBJECT); \
cd1a2927 167 fi
6679675b 168 @rm -f $(OBJECT)_diff
cff099a4 169 echo "######################################################################"
3888140c 170
f771efdc 171 touch $(DIR_INFO)/_build.00-software.log
db918e56
MT
172 if [ "x$(objects)" != "x" ] && \
173 ! grep -qEi "^$(PKG_NAME);$(VER);" $(DIR_INFO)/_build.00-software.log; then \
174 echo "$(PKG_NAME);$(VER);" >> $(DIR_INFO)/_build.00-software.log; \
3888140c 175 fi
cd1a2927
MT
176endef
177else
178define POSTBUILD
db918e56
MT
179 echo "### INSTALL DONE #####################################################"
180 echo "# Application: $(THISAPP)"
cff099a4 181 echo "######################################################################"
f771efdc 182 touch $(DIR_INFO)/_build.00-software.log
db918e56
MT
183 if [ "x$(objects)" != "x" ] && \
184 ! grep -qEi "^$(PKG_NAME);$(VER);" $(DIR_INFO)/_build.00-software.log; then \
185 echo "$(PKG_NAME);$(VER);" >> $(DIR_INFO)/_build.00-software.log; \
3888140c 186 fi
6679675b 187 touch $(OBJECT)
cd1a2927
MT
188endef
189endif