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
RevLine 
[877cc6a]1
2# $Id$
3
[045b2dc]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
[fc6076c]15tab_ = " "
16nl_ = ""
[045b2dc]17
[1f81129]18#==== BUILD MESSAGES ===
19
[045b2dc]20define echo_PHASE
21 @echo $(BOLD)--------------------------------------------------------------------------------
[f4d9a48]22 @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
[045b2dc]23 @echo $(BOLD)--------------------------------------------------------------------------------
[39a93a4]24 @echo $(WHITE)
[045b2dc]25endef
26
[79da297]27define sh_echo_PHASE
28 echo $(BOLD)--------------------------------------------------------------------------------;\
29 echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
[7072e1f]30 echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
[79da297]31endef
32
[045b2dc]33define echo_SU_request
34 @echo $(BOLD)--------------------------------------------------------------------------------
35 @echo $(BLUE)$@
[0cc9d4e]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
[045b2dc]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)
[3e7ceed]43 @echo sudo requires a password
[045b2dc]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
[877cc6a]52
53define echo_message
[045b2dc]54 @echo $(BOLD)--------------------------------------------------------------------------------
55 @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
[877cc6a]56endef
57
[1f81129]58#=======================
59
60
61#=== BUILD FUNCTIONS ===
62
[401f81e]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@/.*@@'` && \
[3abe9d7]66 [ -n "$$ROOT" ] && \
[b533b78]67 if [ -d $(SRCSDIR)/$$ROOT ]; then \
[3abe9d7]68 rm -rf $(SRCSDIR)/$$ROOT && \
69 rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
70 fi;
[401f81e]71endef
72
73define remove_existing_dirs2
[045b2dc]74 @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
[401f81e]75 ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
[3abe9d7]76 [ -n "$$ROOT" ] && \
77 if [ -d $(SRC)/$$ROOT ]; then \
78 rm -rf $(SRC)/$$ROOT && \
79 rm -rf $(SRC)/$${ROOT%-*}-build; \
80 fi;
[7072e1f]81 @if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
82 rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
83 fi;
[401f81e]84endef
85
[1f81129]86#==#
[401f81e]87
[1f81129]88define unpack
89 @cd $(SRCSDIR) && \
90 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
[401f81e]91endef
92
[1f81129]93define unpack2
94 @cd $(SRC) && \
95 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
[401f81e]96endef
97
[1f81129]98#==#
99
[401f81e]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@/.*@@'` && \
[7072e1f]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;
[401f81e]118endef
119
[045b2dc]120define get_pkg_root_LUSER
121 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
122 echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
123endef
124
[1f81129]125#==#
126
[93346ee]127define touch_timestamp
128 @touch $(SRC)/timestamp-marker && sleep 1
129endef
130
[f546320]131define touch_timestamp_LUSER
[a60ed79]132 @touch $(SRCSDIR)/timestamp-marker && sleep 1
[f546320]133endef
134
[93346ee]135define log_new_files
[6dfed89]136 @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
[93346ee]137 -newer $(SRC)/timestamp-marker -not -type d \
[c6f33fb]138 -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
[93346ee]139endef
140
[f546320]141define log_new_files_LUSER
[a60ed79]142 @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
143 -newer $(SRCSDIR)/timestamp-marker -not -type d \
[f546320]144 -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
145endef
146
[93346ee]147#==@
148
[1f81129]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
[877cc6a]153endef
154
[1f81129]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
[877cc6a]159endef
160
[1f81129]161#==#
162
163define housekeeping
164 @touch $@ && \
165 sleep .25 && \
166 echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
[dbcdfd7]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
[877cc6a]172endef
173
[1f81129]174#=======================
175
176
177#==== FINAL MESSAGES ===
178
[453bef0]179define echo_report
[7fe73c8]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) ; \
[76f8888]184 echo file to $(BOLD)jhalfs-reports@linuxfromscratch.org$(WHITE) ; \
[7fe73c8]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)
[453bef0]189endef
190
[877cc6a]191define echo_finished
192 @echo $(BOLD)
193 @echo --------------------------------------------------------------------------------
194 @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
195 @echo --------------------------------------------------------------------------------
[f4d9a48]196 @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
[877cc6a]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
[76f8888]202 @echo $(tab_)- Mount the virtual kernel file systems.
203 @echo
[f4d9a48]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.
[877cc6a]207 @echo
[f4d9a48]208 @echo $(tab_)- Set a password for the root user.
[877cc6a]209 @echo
[76f8888]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.
[877cc6a]217 @echo
[f4d9a48]218 @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
[76f8888]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.
[877cc6a]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 --------------------------------------------------------------------------------
[f4d9a48]232 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
[877cc6a]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 --------------------------------------------------------------------------------
[f4d9a48]241 @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
[877cc6a]242 @echo --------------------------------------------------------------------------------
243 @echo
244 @echo The build is not complete. Follow the next steps:$(WHITE)
245 @echo
[f4d9a48]246 @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
247 @echo $(tab_) and any other configuration file required to suit your needs.
[877cc6a]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
[d981bde]253 @echo $(tab_) $(BOLD)cd /jhalfs
[f4d9a48]254 @echo $(tab_) $(BOLD)make makesys
[877cc6a]255 @echo The build process should resume. Follow any instructions that appear.
256 @echo --------------------------------------------------------------------------------
[f4d9a48]257 @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
[877cc6a]258 @echo --------------------------------------------------------------------------------$(WHITE)
259endef
Note: See TracBrowser for help on using the repository browser.