]>
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 | ||
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 | 36 | URL_IPFIRE = http://source.ipfire.org/download |
da1befdd MT |
37 | URL_TOOLCHAIN = source.ipfire.org:/pub/source/toolchains |
38 | URL_SOURCE = source.ipfire.org:/pub/source/source-3.x | |
e70deaa8 | 39 | URL_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 | 44 | DIR_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 | 51 | DIR_DL = $(LFS_BASEDIR)/cache/tarballs |
3796e3d5 | 52 | DIR_CONF = $(LFS_BASEDIR)/config |
11f0ec61 | 53 | DIR_INFO = $(LFS_BASEDIR)/log_$(TARGET) |
cb5bd21c | 54 | DIR_LFS = $(LFS_BASEDIR)/lfs |
bdb1a79b | 55 | DIR_TOOLS = $(LFS_BASEDIR)/tools |
05207d69 | 56 | DIR_TMP = /tmp |
fa0dac0f | 57 | DIR_PATCHES = $(DIR_DL)/../patches |
246556fe | 58 | DIR_CONFIG = $(DIR_CONF) |
084ab6f4 | 59 | DIR_SOURCE = $(DIR_SRC)/src |
cd1a2927 | 60 | |
fa0dac0f MT |
61 | VPATH = $(DIR_DL):$(DIR_PATCHES) |
62 | ||
4b8442ea MT |
63 | INITSCRIPT = $(PKG_NAME) |
64 | ||
d19b68a0 | 65 | CONFIGURE_ARCH = \ |
aade3613 | 66 | --build=$(IFS_TARGET) |
d19b68a0 | 67 | |
cd1a2927 MT |
68 | ############################################################################### |
69 | # Common Macro Definitions | |
70 | ############################################################################### | |
71 | ||
db918e56 MT |
72 | DO_LOAD = DIR_TMP=$(DIR_TMP) DIR_DL=$(DIR_DL) DIR_PATCHES=$(DIR_PATCHES) \ |
73 | python $(DIR_TOOLS)/downloader $(URL_IPFIRE)/$@ | |
74 | LOAD = $(DO_LOAD) # To be compatible to the current build system. | |
75 | ||
76 | EXTRACTOR = bash $(DIR_SOURCE)/scripts/extractor | |
77 | ||
e52cf98b MT |
78 | INSTALL_CONFIG = sed \ |
79 | -e "s/@NAME@/$(NAME)/g" \ | |
80 | -e "s/@SNAME@/$(SNAME)/g" \ | |
81 | -e "s/@VERSION@/$(VERSION)/g" \ | |
82 | -e "s/@DATE@/$(shell date '+%Y%m%d')/g" | |
83 | ||
db918e56 MT |
84 | INSTALL_INITSCRIPT = echo "Installing initscript \"$(INITSCRIPT)\" -> /etc/init.d"; \ |
85 | install -m 754 $(DIR_SOURCE)/initscripts/extras/$(INITSCRIPT) /etc/init.d/ | |
86 | ||
87 | PYTHON_COMPILE = find /usr/lib/python*/ -name *.py | xargs /usr/bin/py-compile | |
88 | ||
0fbb41b8 MT |
89 | define DO_PKG_INFO |
90 | @## ALPHABETICAL ORDER ## | |
91 | @echo "DEBUG=\"$(DEBUG)\"" | |
2a5ec6a1 | 92 | @echo "DEPS=\"$(DEPS)\"" |
8507c2e5 | 93 | @echo "DESC=\"$(value LONG_DESC)\"" |
0fbb41b8 | 94 | @echo "EXTRA=\"$(EXTRA)\"" |
6c5f9f29 | 95 | @echo "FILES=\"$(objects)\"" |
0fbb41b8 MT |
96 | @echo "GROUP=\"$(GROUP)\"" |
97 | @echo "LICENSE=\"$(LICENSE)\"" | |
98 | @echo "MAINTAINER=\"$(MAINTAINER)\"" | |
99 | @echo "NAME=\"$(PKG_NAME)\"" | |
100 | @echo "VERSION=\"$(VER)\"" | |
101 | @echo "RELEASE=\"$(PKG_VER)\"" | |
8507c2e5 | 102 | @echo "SHORT=\"$(value SHORT_DESC)\"" |
0fbb41b8 MT |
103 | @echo "URL=\"$(URL)\"" |
104 | endef | |
105 | ||
cd1a2927 | 106 | # For each package we create a list of files that it installed under |
c4032324 | 107 | # log/<OBJECT> name. Modified files are not identified |
cd1a2927 MT |
108 | # |
109 | define FIND_FILES | |
082078c8 | 110 | cd $(LFS)/ && $(TOOLS_DIR)/bin/find -mount \ |
3888140c | 111 | -not -path '.$(TOOLS_DIR)*' -not -path './tmp*' -not -path './usr/src*' \ |
de1f9d00 MT |
112 | -not -path './dev*' -not -path './proc*' -not -path './sys*' \ |
113 | -not -path '.$(INSTALLER_DIR)*' | |
cd1a2927 MT |
114 | endef |
115 | ||
116 | # This is common starting logic for builds. | |
117 | # | |
3888140c | 118 | ifneq "$(STAGE)" "toolchain" |
cd1a2927 | 119 | define PREBUILD |
db918e56 MT |
120 | echo "### STARTING INSTALL #################################################" |
121 | echo "# Application: $(THISAPP)" | |
122 | echo "# Description: $(SHORT_DESC)" | |
123 | echo "######################################################################" | |
cff099a4 | 124 | echo "# Saving file list..." |
3888140c | 125 | if [ ! -f $(DIR_SRC)/lsalr ]; then $(FIND_FILES) > $(DIR_SRC)/lsalr; fi |
cd1a2927 MT |
126 | endef |
127 | else | |
128 | define PREBUILD | |
db918e56 MT |
129 | echo "### STARTING INSTALL #################################################" |
130 | echo "# Application: $(THISAPP)" | |
131 | echo "# Description: $(SHORT_DESC)" | |
132 | echo "######################################################################" | |
cd1a2927 MT |
133 | endef |
134 | endif | |
135 | ||
136 | # Common end-of-installation logic for Stage 2 and beyond. | |
137 | # | |
3888140c | 138 | ifneq "$(STAGE)" "toolchain" |
cd1a2927 | 139 | define POSTBUILD |
db918e56 MT |
140 | echo "### INSTALL DONE #####################################################" |
141 | echo "# Application: $(THISAPP)" | |
6679675b | 142 | echo "# Saving file list to $(OBJECT)..." |
cd1a2927 | 143 | @$(FIND_FILES) > $(DIR_SRC)/lsalrnew |
6679675b | 144 | @diff $(DIR_SRC)/lsalr $(DIR_SRC)/lsalrnew | grep '^> ' | sed 's+^> \./++' | sort > $(OBJECT)_diff |
3888140c | 145 | @mv -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr |
084ab6f4 | 146 | # compare roofile (same name as lfs script) with the list of installed files |
cd1a2927 | 147 | # special cases |
6679675b | 148 | # - if the corresponding rootfile is not found, touch $(OBJECT)_missing_rootfile |
0145f271 | 149 | # - on a partial rebuild without a new file inside TARGET_diff, just touch TARGET |
6679675b | 150 | # $(OBJECT)_diff : result of the diff |
03ad5f93 | 151 | # ROOTFILE : reference of include/exclude files |
6679675b MT |
152 | # $(OBJECT)_rootfile : ROOTFILE with KVER replacement |
153 | # $(OBJECT) : log result with {commented|include|added} files | |
154 | if [ -s "$(OBJECT)_diff" ]; then \ | |
5eaf9865 MT |
155 | LFS_SCRIPT="$(firstword $(MAKEFILE_LIST))"; \ |
156 | if [ "x$(PASS)" != "x" ]; then LFS_SCRIPT="$$LFS_SCRIPT.p$(PASS)"; fi; \ | |
b8606ede | 157 | ROOTFILE=$$(find $(DIR_SOURCE)/rootfiles/{core,extras,debug}/{$(TARGET),} -maxdepth 1 -type f -name $$LFS_SCRIPT 2>/dev/null | head -1); \ |
03ad5f93 | 158 | if [ "$$ROOTFILE" = "" ]; then \ |
6679675b MT |
159 | touch $(OBJECT)_missing_rootfile; \ |
160 | ROOTFILE=$(OBJECT)_missing_rootfile ; \ | |
084ab6f4 | 161 | echo "error $$LFS_SCRIPT not found in $(DIR_SOURCE)/rootfiles"; \ |
03ad5f93 | 162 | fi; \ |
1954a4dd | 163 | sed -e "s@KVER@$(KVER)@g" \ |
c1663ecd | 164 | -e "s@IFS_TARGET@$(IFS_TARGET)@g" \ |
1954a4dd | 165 | -e "s@^/@@g" -e "s@^#/@#@g" \ |
6679675b MT |
166 | $$ROOTFILE > $(OBJECT)_rootfile; \ |
167 | echo 'open (F,"$(OBJECT)_rootfile"); \ | |
1954a4dd MT |
168 | while (<F>) { $$allfile{$$_} = "x" };close (F); \ |
169 | while (<>) { \ | |
170 | if ( defined ($$allfile{"#$$_"}) ) {print "#$$_"} \ | |
171 | elsif ( defined ($$allfile{$$_}) ) {print $$_} \ | |
172 | else {print "+$$_"} \ | |
173 | }; \ | |
174 | ' > /tmp/perl.pl; \ | |
6679675b | 175 | perl /tmp/perl.pl < $(OBJECT)_diff \ |
c1663ecd | 176 | | sed -e "s@$(KVER)@KVER@g" -e "s@$(IFS_TARGET)@IFS_TARGET@g" > $(OBJECT); \ |
6679675b | 177 | rm -f $(OBJECT)_rootfile; \ |
bfdbe3b6 | 178 | if [ "$$ROOTFILE" != "" ]; then \ |
6679675b MT |
179 | if ! cmp -s $(OBJECT) $$ROOTFILE; then \ |
180 | touch $(OBJECT)_changed; \ | |
42698214 | 181 | if ! grep -q "^+" $(OBJECT); then cp -f $(OBJECT) $$ROOTFILE; fi; \ |
bfdbe3b6 MT |
182 | fi; \ |
183 | fi; \ | |
cd1a2927 | 184 | else \ |
6679675b | 185 | touch $(OBJECT); \ |
cd1a2927 | 186 | fi |
6679675b | 187 | @rm -f $(OBJECT)_diff |
cff099a4 | 188 | echo "######################################################################" |
cd1a2927 MT |
189 | endef |
190 | else | |
191 | define POSTBUILD | |
db918e56 MT |
192 | echo "### INSTALL DONE #####################################################" |
193 | echo "# Application: $(THISAPP)" | |
cff099a4 | 194 | echo "######################################################################" |
6679675b | 195 | touch $(OBJECT) |
cd1a2927 MT |
196 | endef |
197 | endif |