]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - lfs/Config
Wrote nice initscripts for the installer.
[people/ms/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 #
16# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
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#
be472d5a 36URL_IPFIRE = http://source.ipfire.org/source-3.0
6b96312d 37URL_TOOLCHAIN = http://source.ipfire.org/toolchains
cd1a2927
MT
38
39# Default compiler optimizations.
40#
41FLAGS_OPT = -O2
42FLAGS_CPU = -mcpu=$(MACHINE)
43FLAGS_ARCH = -march=$(MACHINE)
44
45# Don't change this; it will be overridden by other makefiles where necessary.
46#
47ROOT =
48
49# For most packages tarballs are unpacked here and then deleted after
50# installation.
51#
be472d5a 52DIR_SRC = $(LFS)/usr/src
cd1a2927
MT
53
54# Files are downloaded into DIR_TMP and then moved to DIR_DL, to avoid
55# messes with partially retrieved files. DIR_DL is where we will
56# save all the files that are downloaded. DIR_INFO contains the
57# file lists of installed packages.
58#
59DIR_DL = $(LFS_BASEDIR)/cache
3796e3d5 60DIR_CONF = $(LFS_BASEDIR)/config
be472d5a 61DIR_INFO = $(LFS_BASEDIR)/log_$(MACHINE)
bdb1a79b 62DIR_TOOLS = $(LFS_BASEDIR)/tools
05207d69 63DIR_TMP = /tmp
be472d5a 64DIR_PATCHES = $(DIR_DL)
246556fe 65DIR_CONFIG = $(DIR_CONF)
084ab6f4 66DIR_SOURCE = $(DIR_SRC)/src
cd1a2927 67
03ad5f93 68KGCC = gcc
cd1a2927
MT
69
70###############################################################################
71# Common Macro Definitions
72###############################################################################
73
74# For each package we create a list of files that it installed under
75# log/<TARGET> name. Modified files are not identified
76#
77define FIND_FILES
3888140c
MT
78 cd $(LFS)/ && find -mount \
79 -not -path '.$(TOOLS_DIR)*' -not -path './tmp*' -not -path './usr/src*' \
80 -not -path './dev*' -not -path './proc*' -not -path './sys*' -not -path './install*'
cd1a2927
MT
81endef
82
83# This is common starting logic for builds.
84#
3888140c 85ifneq "$(STAGE)" "toolchain"
cd1a2927
MT
86define PREBUILD
87 echo "====================================== Installing $(THISAPP) ..."
3888140c
MT
88 echo "Install started; saving file list to $(DIR_SRC)/lsalr ..."
89 if [ ! -f $(DIR_SRC)/lsalr ]; then $(FIND_FILES) > $(DIR_SRC)/lsalr; fi
cd1a2927
MT
90endef
91else
92define PREBUILD
93 echo "====================================== Installing $(THISAPP) ..."
94endef
95endif
96
97# Common end-of-installation logic for Stage 2 and beyond.
98#
3888140c 99ifneq "$(STAGE)" "toolchain"
cd1a2927 100define POSTBUILD
03ad5f93 101 @echo "Install done; saving file list to $(TARGET) ..."
cd1a2927 102 @$(FIND_FILES) > $(DIR_SRC)/lsalrnew
3888140c
MT
103 @diff $(DIR_SRC)/lsalr $(DIR_SRC)/lsalrnew | grep '^> ' | sed 's+^> \./++' | sort > $(TARGET)_diff
104 @mv -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr
084ab6f4 105 # compare roofile (same name as lfs script) with the list of installed files
cd1a2927 106 # special cases
03ad5f93 107 # - if the corresponding rootfile is not found, touch $(TARGET)_missing_rootfile
0145f271 108 # - on a partial rebuild without a new file inside TARGET_diff, just touch TARGET
03ad5f93
MT
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
0145f271 113 if [ -s "$(TARGET)_diff" ]; then \
3888140c 114 LFS_SCRIPT=$(firstword $(MAKEFILE_LIST)); \
084ab6f4 115 ROOTFILE=`find $(DIR_SOURCE)/rootfiles/core -maxdepth 1 -type f -name $$LFS_SCRIPT`; \
03ad5f93 116 if [ "$$ROOTFILE" = "" ]; then \
084ab6f4 117 ROOTFILE=`find $(DIR_SOURCE)/rootfiles/extras -type f -name $$LFS_SCRIPT`; \
03ad5f93
MT
118 fi; \
119 if [ "$$ROOTFILE" = "" ]; then \
120 touch $(TARGET)_missing_rootfile; \
121 ROOTFILE=$(TARGET)_missing_rootfile ; \
084ab6f4 122 echo "error $$LFS_SCRIPT not found in $(DIR_SOURCE)/rootfiles"; \
03ad5f93 123 fi; \
3888140c
MT
124 sed "s/KVER/$(KVER)/g" $$ROOTFILE > $(TARGET)_rootfile; \
125 echo 'open (F,"$(TARGET)_rootfile"); \
126 while (<F>) { $$allfile{$$_} = "x" };close (F); \
127 while (<>) { \
128 if ( defined ($$allfile{"#$$_"}) ) {print "#$$_"} \
129 elsif ( defined ($$allfile{$$_}) ) {print $$_} \
130 else {print "+$$_"} \
131 }; \
132 ' > /tmp/perl.pl; \
133 perl /tmp/perl.pl <$(TARGET)_diff > $(TARGET); \
0145f271 134 rm -f $(TARGET)_rootfile; \
cd1a2927
MT
135 else \
136 touch $(TARGET); \
137 fi
0145f271 138 @rm -f $(TARGET)_diff
3888140c
MT
139
140 if [ "$(OTHER_SRC)" = "yes" ] && \
141 ! grep -qEi "^$(PKG_NAME),$(VER),$(STAGE_ORDER),$(STAGE)" $(DIR_SRC)/LIST_OF_SOFTWARE-$(MACHINE).txt; then \
142 echo "$(PKG_NAME),$(VER),$(STAGE_ORDER),$(STAGE)" >> $(DIR_SRC)/LIST_OF_SOFTWARE-$(MACHINE).txt; \
143 fi
144
145 @echo "===================================== Install done for $(THISAPP)."
cd1a2927
MT
146endef
147else
148define POSTBUILD
3888140c
MT
149 if [ "$(OTHER_SRC)" = "yes" ] && \
150 ! grep -qEi "^$(PKG_NAME),$(VER),$(STAGE_ORDER),$(STAGE)" $(DIR_SRC)/LIST_OF_SOFTWARE-$(MACHINE).txt; then \
151 echo "$(PKG_NAME),$(VER),$(STAGE_ORDER),$(STAGE)" >> $(DIR_SRC)/LIST_OF_SOFTWARE-$(MACHINE).txt; \
152 fi
153
cd1a2927
MT
154 @echo "===================================== Install done for $(THISAPP)."
155 touch $(TARGET)
156endef
157endif
158
cd1a2927 159define LOAD
bdb1a79b
MT
160 BASEDIR=$(LFS_BASEDIR) DIR_TMP=$(DIR_TMP) DIR_DL=$(DIR_DL) \
161 sh $(DIR_TOOLS)/downloader $(URL_IPFIRE) $(notdir $@)
cd1a2927 162endef
a8b159e7
MT
163
164define PAK
5c8cfc99 165 # Bringing the files to their right place.
5b2a12ff 166 @rm -rf /install/packages/package
5c8cfc99 167 @mkdir -p /install/packages/package
4c7fa778 168 if [ -e "/usr/src/src/paks/$(PROG)" ]; then \
3489ebac
MT
169 cp -f /usr/src/src/paks/$(PROG)/{,un}install.sh /usr/src/src/paks/$(PROG)/update.sh \
170 /install/packages/package; \
171 else \
172 cp -f /usr/src/src/paks/default/{,un}install.sh /usr/src/src/paks/default/update.sh \
173 /install/packages/package; \
174 fi
084ab6f4 175 sed -e "s/KVER/$(KVER)/g" < $(DIR_SOURCE)/rootfiles/packages/$(PROG) > /install/packages/package/ROOTFILES
99e6df8e 176 chmod 755 /install/packages/package/{{,un}install,update}.sh
fc4ac7ac
MT
177 cd / && tar cf /install/packages/package/files --files-from=/install/packages/package/ROOTFILES --exclude='#*' \
178 --preserve --numeric-owner
3489ebac 179 -cat /install/packages/package/ROOTFILES | grep -v "#" > /install/packages/package/ROOTFILES
7d3af7f7 180 cd /install/packages/package && tar cf ../$(PROG)-$(VER)-$(PAK_VER).ipfire --files-from=/usr/src/src/paks/files
cab737ed 181 rm -rf /install/packages/package
5c8cfc99
MT
182 sed -e s/NAME/$(PROG)/g \
183 -e s/VER/$(VER)/g \
184 -e s/RELEASE/$(PAK_VER)/g \
185 -e s/DEPS/$(DEPS)/g \
38965639 186 -e s/SIZE/`ls -l \/install\/packages\/$(PROG)-$(VER)-$(PAK_VER).ipfire | awk '{ print $$5 }'`/g \
5c8cfc99 187 < /usr/src/src/pakfire/meta > /install/packages/meta-$(PROG)
a8b159e7 188endef