source: common/makefile-functions@ 7ce5a61

ablfs-more legacy trunk
Last change on this file since 7ce5a61 was 322226d, checked in by Pierre Labastie <pierre@…>, 7 years ago

Do not export the wrapInstall function when porg style is not in use

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