source: common/makefile-functions@ 0cc9d4e

ablfs
Last change on this file since 0cc9d4e was 0cc9d4e, checked in by Pierre Labastie <pierre@…>, 12 years ago

Merge trunk r3603, 3648, 3673, 3677

  • Property mode set to 100644
File size: 8.7 KB
Line 
1
2# $Id$
3
4BOLD = "[0;1m"
5RED = "[1;31m"
6GREEN = "[0;32m"
7ORANGE = "[0;33m"
8BLUE = "[1;34m"
9WHITE = "[00m"
10YELLOW = "[1;33m"
11
12OFF = "[0m"
13REVERSE = "[7m"
14
15tab_ = " "
16nl_ = ""
17
18#==== BUILD MESSAGES ===
19
20define echo_PHASE
21 @echo $(BOLD)--------------------------------------------------------------------------------
22 @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
23 @echo $(BOLD)--------------------------------------------------------------------------------
24 @echo $(WHITE)
25endef
26
27define sh_echo_PHASE
28 echo $(BOLD)--------------------------------------------------------------------------------;\
29 echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
30 echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
31endef
32
33define echo_SU_request
34 @echo $(BOLD)--------------------------------------------------------------------------------
35 @echo $(BLUE)$@
36 @echo $(WHITE)ROOT privilege is required to perform a number of commands
37 @echo sudo will request a password in order to execute all high privilege commands
38
39define echo_SULUSER_request
40 @echo $(BOLD)--------------------------------------------------------------------------------
41 @echo $(BOLD)$(BLUE)$@
42 @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
43 @echo sudo requires a password
44endef
45
46define echo_CHROOT_request
47 @echo $(BOLD)--------------------------------------------------------------------------------
48 @echo $(BOLD)$(BLUE)$@
49 @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
50 @echo a password is required
51endef
52
53define echo_message
54 @echo $(BOLD)--------------------------------------------------------------------------------
55 @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
56endef
57
58#=======================
59
60
61#=== BUILD FUNCTIONS ===
62
63define remove_existing_dirs
64 @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
65 ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
66 [ -n "$$ROOT" ] && \
67 if [ -d $(SRCSDIR)/$$ROOT ]; then \
68 rm -rf $(SRCSDIR)/$$ROOT && \
69 rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
70 fi;
71endef
72
73define remove_existing_dirs2
74 @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
75 ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
76 [ -n "$$ROOT" ] && \
77 if [ -d $(SRC)/$$ROOT ]; then \
78 rm -rf $(SRC)/$$ROOT && \
79 rm -rf $(SRC)/$${ROOT%-*}-build; \
80 fi;
81 @if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
82 rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
83 fi;
84endef
85
86#==#
87
88define unpack
89 @cd $(SRCSDIR) && \
90 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
91endef
92
93define unpack2
94 @cd $(SRC) && \
95 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
96endef
97
98#==#
99
100define get_pkg_root
101 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
102 if [ "$(1)" != "nouser" ]; then \
103 echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \
104 chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \
105 else \
106 echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \
107 fi;
108endef
109
110define get_pkg_root2
111 @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
112 echo "export PKGDIR=$(SRC)/$$ROOT" > envars; \
113 if [ "$(PKGMNGT)" = "y" ]; then \
114 echo "export PKG_DEST=$(SRC)/$@" >> envars; \
115 echo "source packInstall.sh" >> envars; \
116 echo "export -f packInstall" >> envars; \
117 fi;
118endef
119
120define get_pkg_root_LUSER
121 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
122 echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
123endef
124
125#==#
126
127define touch_timestamp
128 @touch $(SRC)/timestamp-marker && sleep 1
129endef
130
131define touch_timestamp_LUSER
132 @touch $(SRCSDIR)/timestamp-marker && sleep 1
133endef
134
135define log_new_files
136 @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
137 -newer $(SRC)/timestamp-marker -not -type d \
138 -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
139endef
140
141define log_new_files_LUSER
142 @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
143 -newer $(SRCSDIR)/timestamp-marker -not -type d \
144 -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
145endef
146
147#==@
148
149define remove_build_dirs
150 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
151 rm -rf $(SRCSDIR)/$$ROOT && \
152 rm -rf $(SRCSDIR)/$(1)-build
153endef
154
155define remove_build_dirs2
156 @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
157 rm -rf $(SRC)/$$ROOT && \
158 rm -rf $(SRC)/$(1)-build
159endef
160
161#==#
162
163define housekeeping
164 @touch $@ && \
165 sleep .25 && \
166 echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
167 echo --------------------------------------------------------------------------------$(WHITE) && \
168 if [ "$(BREAKPOINT)" = "$@" ] ; then \
169 echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \
170 false ; \
171 fi
172endef
173
174#=======================
175
176
177#==== FINAL MESSAGES ===
178
179define echo_report
180 echo ; \
181 echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
182 echo ; \
183 echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
184 echo file to $(BOLD)jhalfs-reports@linuxfromscratch.org$(WHITE) ; \
185 echo ; \
186 echo That will help us to keep more accurate SBU and ; \
187 echo disk usage values into the book. Thanks. ; \
188 echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
189endef
190
191define echo_finished
192 @echo $(BOLD)
193 @echo --------------------------------------------------------------------------------
194 @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
195 @echo --------------------------------------------------------------------------------
196 @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
197 @echo --------------------------------------------------------------------------------
198 @echo
199 @echo To be able to boot your new system you need to follow
200 @echo the next steps:$(WHITE)
201 @echo
202 @echo $(tab_)- Mount the virtual kernel file systems.
203 @echo
204 @echo $(tab_)- Enter to the chroot using the command found
205 @echo $(tab_)in the section -Entering the Chroot Environment-
206 @echo $(tab_)except if building CLFS with METHOD=boot.
207 @echo
208 @echo $(tab_)- Set a password for the root user.
209 @echo
210 @echo $(tab_)- Edit or create /etc/fstab,
211 @echo $(tab_) " /etc/hosts,"
212 @echo $(tab_) " /etc/sysconfig/clock,"
213 @echo $(tab_) " /etc/sysconfig/console,"
214 @echo $(tab_) " /etc/sysconfig/network,"
215 @echo $(tab_) " /etc/sysconfig/ifconfig.eth0"
216 @echo $(tab_)and any other configuration file required to suit your needs.
217 @echo
218 @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
219 @echo
220 @echo $(tab_)You can set-up the new boot-loader installed on the new system
221 @echo $(tab_)or the host bootloader.
222 @echo
223 @echo $(tab_)If the last, it is better to exit first from the chroot.
224 @echo
225 @echo $(tab_)- Exit from the chroot and umount the filesystems.
226 @echo
227 @echo If you are an experienced LFS user, several of those steps can be
228 @echo skipped or done in a different way. But then, that is something
229 @echo that you already know and there is no need to discuss it here.
230 @echo $(BOLD)
231 @echo --------------------------------------------------------------------------------
232 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
233 @echo --------------------------------------------------------------------------------$(WHITE)
234endef
235
236define echo_boot_finished
237 @echo $(BOLD)
238 @echo --------------------------------------------------------------------------------
239 @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
240 @echo --------------------------------------------------------------------------------
241 @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
242 @echo --------------------------------------------------------------------------------
243 @echo
244 @echo The build is not complete. Follow the next steps:$(WHITE)
245 @echo
246 @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
247 @echo $(tab_) and any other configuration file required to suit your needs.
248 @echo $(BOLD)
249 @echo $(BOLD)$(YELLOW)
250 @echo 1.If it is necessary, transfer the newly created partition to the target machine
251 @echo 2.Boot the new partition.
252 @echo 3.Once you are logged in issue the following commands
253 @echo $(tab_) $(BOLD)cd /jhalfs
254 @echo $(tab_) $(BOLD)make makesys
255 @echo The build process should resume. Follow any instructions that appear.
256 @echo --------------------------------------------------------------------------------
257 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
258 @echo --------------------------------------------------------------------------------$(WHITE)
259endef
Note: See TracBrowser for help on using the repository browser.