source: common/makefile-functions@ 9af9dfa

2.4 ablfs-more legacy new_features trunk
Last change on this file since 9af9dfa was 9af9dfa, checked in by Matthew Burgess <matthew@…>, 13 years ago

Fix a couple of typos

  • 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)manuel@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_)- Enter to the chroot using the command found
203 @echo $(tab_)in the section -Entering the Chroot Environment-
204 @echo $(tab_)except if building CLFS with METHOD=boot.
205 @echo
206 @echo $(tab_)- Set a password for the root user.
207 @echo
208 @echo $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
209 @echo $(tab_)/etc/sysconfig/console, /etc/sysconfig/network,
210 @echo $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
211 @echo $(tab_)any other configuration file required to suit your needs.
212 @echo
213 @echo $(tab_)- Exit from the chroot.
214 @echo
215 @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
216 @echo $(tab_)You can set-up the host bootloader or the new boot-loader
217 @echo $(tab_)installed on the new system.
218 @echo $(tab_)If the last, you must to mount the virtual filesystems, re-enter
219 @echo $(tab_)the chroot and be sure that /dev is populated with the
220 @echo $(tab_)required devices before configure the boot-loader. When ready,
221 @echo $(tab_)exit from the chroot and umount the filesystems
222 @echo
223 @echo If you are an experienced LFS user, several of those steps can be
224 @echo skipped or done in a different way. But then, that is something
225 @echo that you already know and there is no need to discuss it here.
226 @echo $(BOLD)
227 @echo --------------------------------------------------------------------------------
228 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
229 @echo --------------------------------------------------------------------------------$(WHITE)
230endef
231
232define echo_boot_finished
233 @echo $(BOLD)
234 @echo --------------------------------------------------------------------------------
235 @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
236 @echo --------------------------------------------------------------------------------
237 @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
238 @echo --------------------------------------------------------------------------------
239 @echo
240 @echo The build is not complete. Follow the next steps:$(WHITE)
241 @echo
242 @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
243 @echo $(tab_) and any other configuration file required to suit your needs.
244 @echo $(BOLD)
245 @echo $(BOLD)$(YELLOW)
246 @echo 1.If it is necessary, transfer the newly created partition to the target machine
247 @echo 2.Boot the new partition.
248 @echo 3.Once you are logged in issue the following commands
249 @echo $(tab_) $(BOLD)cd /jhalfs
250 @echo $(tab_) $(BOLD)make makesys
251 @echo The build process should resume. Follow any instructions that appear.
252 @echo --------------------------------------------------------------------------------
253 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
254 @echo --------------------------------------------------------------------------------$(WHITE)
255endef
Note: See TracBrowser for help on using the repository browser.