source: common/libs/func_wrt_Makefile@ 3722d31

ablfs-more trunk
Last change on this file since 3722d31 was 924a237, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Fix $(BUILDDIR)/jhalfs/Makefile

Now that we have only lfs, some lines in the Makefile have been
removed, but still some shell continuation (&& \) were left. This
leads to weird error message (@ non existing command, or so).
Remove the continuation characters.

  • Property mode set to 100644
File size: 7.3 KB
Line 
1#!/bin/bash
2
3#=== MAKEFILE HEADER ===
4
5#----------------------------------#
6wrt_Makefile_header() { #
7#----------------------------------#
8(
9 cat << EOF
10# This file is automatically generated by jhalfs
11# DO NOT EDIT THIS FILE MANUALLY
12#
13# Generated on `date "+%F %X %Z"`
14
15
16SHELL = /bin/bash
17
18SRC = /sources
19MOUNT_PT = $BUILDDIR
20PKG_LST = $PKG_LST
21LUSER = $LUSER
22LGROUP = $LGROUP
23LHOME = $LHOME
24SCRIPT_ROOT = $SCRIPT_ROOT
25
26BASEDIR = \$(MOUNT_PT)
27SRCSDIR = \$(BASEDIR)/sources
28CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$COMMANDS
29LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE
30TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
31
32crCMDSDIR = /\$(SCRIPT_ROOT)/$COMMANDS
33crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE
34crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
35crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
36
37SU_LUSER = sudo -H -u \$(LUSER) sh -c
38LUSER_HOME = \$(LHOME)/\$(LUSER)
39PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n"
40PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found --exclude /var/lib / \`\n"
41
42ADD_REPORT = $REPORT
43ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
44ADD_BLFS_TOOLS = $BLFS_TOOL
45PKGMNGT = $PKGMNGT
46WRAP_INSTALL = $WRAP_INSTALL
47
48
49export PATH := \${PATH}:/usr/sbin
50
51include makefile-functions
52
53EOF
54) > $MKFILE
55}
56
57#=======================
58
59
60#==== TARGET HEADER ====
61
62#----------------------------------#
63LUSER_wrt_target() { # Create target and initialize log file
64#----------------------------------#
65 local i=$1
66 local PREV=$2
67 local version
68 if [ "$3" != "" ]; then
69 version=-$3
70 fi
71(
72cat << EOF
73
74$i: $PREV
75 @\$(call echo_message, Building)
76${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
77 @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
78 @ : > envars
79EOF
80) >> $MKFILE.tmp
81}
82
83#----------------------------------#
84CHROOT_wrt_target() { # Create target and initialize log file
85#----------------------------------#
86 local i=$1
87 local PREV=$2
88 local version
89 if [ "$3" != "" ]; then
90 version=-$3
91 fi
92(
93cat << EOF
94
95$i: $PREV
96 @\$(call echo_message, Building)
97${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
98 @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
99 @ : > envars
100EOF
101) >> $MKFILE.tmp
102}
103
104#=======================
105
106
107#======== UNPACK =======
108
109#----------------------------------#
110LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
111#----------------------------------#
112 local FILE="$1"
113 local optSAVE_PREVIOUS="$2"
114 local version
115 if [ "$3" != "" ]; then
116 version=-"$3"
117 fi
118
119 if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
120(
121cat << EOF
122 @\$(call remove_existing_dirs,$FILE)
123EOF
124) >> $MKFILE.tmp
125 fi
126
127(
128cat << EOF
129 @\$(PRT_DU) >>logs/\$@$version
130 @\$(call unpack,$FILE)
131 @\$(call get_pkg_root_LUSER)
132EOF
133) >> $MKFILE.tmp
134}
135
136#----------------------------------#
137CHROOT_Unpack() { #
138#----------------------------------#
139 local FILE=$1
140 local optSAVE_PREVIOUS=$2
141 local version
142 if [ "$3" != "" ]; then
143 version=-"$3"
144 fi
145
146 if [ "${optSAVE_PREVIOUS}" != "1" ]; then
147(
148cat << EOF
149 @\$(call remove_existing_dirs2,$FILE)
150EOF
151) >> $MKFILE.tmp
152 fi
153
154(
155cat << EOF
156 @\$(PRT_DU_CR) >>logs/\$@$version
157 @\$(call unpack2,$FILE)
158 @\$(call get_pkg_root2)
159EOF
160) >> $MKFILE.tmp
161}
162
163#=======================
164
165
166#===== TESTS LOGS ======
167
168#----------------------------------#
169LUSER_wrt_test_log() { # Initialize testsuite log file
170#----------------------------------#
171 local version
172 if [ "$2" != "" ]; then
173 version=-$2
174 fi
175 local TESTLOGFILE=$1$version
176(
177cat << EOF
178 @echo "export TEST_LOG=\$(TESTLOGDIR)/$TESTLOGFILE" >> envars && \\
179 echo "\$(nl_)\`date\`\$(nl_)" >\$(TESTLOGDIR)/$TESTLOGFILE
180EOF
181) >> $MKFILE.tmp
182}
183
184#----------------------------------#
185CHROOT_wrt_test_log() { #
186#----------------------------------#
187 local version
188 if [ "$2" != "" ]; then
189 version=-$2
190 fi
191 local TESTLOGFILE=$1$version
192(
193cat << EOF
194 @echo "export TEST_LOG=\$(crTESTLOGDIR)/$TESTLOGFILE" >> envars && \\
195 echo "\$(nl_)\`date\`\$(nl_)" >\$(crTESTLOGDIR)/$TESTLOGFILE
196EOF
197) >> $MKFILE.tmp
198}
199
200#=======================
201
202
203#======== RUN AS =======
204
205#----------------------------------#
206wrt_RunAsRoot() { # Some scripts must be run as root..
207#----------------------------------#
208 local MOUNT_ENV
209 local version
210 if [ "$2" != "" ]; then
211 version=-$2
212 fi
213 local file=$1
214
215(
216cat << EOF
217 @export LFS=\$(MOUNT_PT) && \\
218 $COMMANDS/`dirname $file`/\$@ >>logs/\$@$version 2>&1
219EOF
220) >> $MKFILE.tmp
221}
222
223#----------------------------------#
224LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log file
225#----------------------------------#
226 local file=$1
227 local version
228 if [ "$2" != "" ]; then
229 version=-$2
230 fi
231
232(
233cat << EOF
234 @source ~/.bashrc && \\
235 \$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@$version 2>&1
236EOF
237) >> $MKFILE.tmp
238}
239
240#----------------------------------#
241CHROOT_wrt_RunAsRoot() { #
242#----------------------------------#
243 local file=$1
244 local version
245 if [ "$2" != "" ]; then
246 version=-$2
247 fi
248(
249cat << EOF
250 @source envars && \\
251 \$(crCMDSDIR)/`dirname $file`/\$@ >>\$(crLOGDIR)/\$@$version 2>&1
252EOF
253) >> $MKFILE.tmp
254
255}
256
257#=======================
258
259
260#====== COPY FSTAB =====
261
262#----------------------------------#
263LUSER_wrt_CopyFstab() { #
264#----------------------------------#
265(
266cat << EOF
267 @cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 && \\
268 \$(PRT_DU) >>logs/\$@
269EOF
270) >> $MKFILE.tmp
271}
272
273#----------------------------------#
274CHROOT_wrt_CopyFstab() { #
275#----------------------------------#
276(
277cat << EOF
278 @cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 && \\
279 \$(PRT_DU_CR) >>logs/\$@
280EOF
281) >> $MKFILE.tmp
282}
283
284#=======================
285
286
287#==== INSTALLED FILES LOGS ====
288
289#----------------------------------#
290LUSER_wrt_TouchTimestamp() { #
291#----------------------------------#
292(
293cat << EOF
294 @\$(call touch_timestamp_LUSER)
295EOF
296) >> $MKFILE.tmp
297}
298
299#----------------------------------#
300CHROOT_wrt_TouchTimestamp() { #
301#----------------------------------#
302(
303cat << EOF
304 @\$(call touch_timestamp)
305EOF
306) >> $MKFILE.tmp
307}
308
309#----------------------------------#
310LUSER_wrt_LogNewFiles() { #
311#----------------------------------#
312(
313cat << EOF
314 @\$(call log_new_files_LUSER,$1)
315EOF
316) >> $MKFILE.tmp
317}
318
319#----------------------------------#
320CHROOT_wrt_LogNewFiles() { #
321#----------------------------------#
322(
323cat << EOF
324 @\$(call log_new_files,$1)
325EOF
326) >> $MKFILE.tmp
327}
328
329#=======================
330
331
332#==== RM BUILD DIRS ====
333
334#----------------------------------#
335LUSER_RemoveBuildDirs() { #
336#----------------------------------#
337 local name=`echo ${1} | sed 's/[0-9]-//'`
338(
339cat << EOF
340 @\$(call remove_build_dirs,$name)
341EOF
342) >> $MKFILE.tmp
343}
344
345#----------------------------------#
346CHROOT_wrt_RemoveBuildDirs() { #
347#----------------------------------#
348 local name=`echo ${1} | sed 's/[0-9]-//'`
349(
350cat << EOF
351 @\$(call remove_build_dirs2,$name)
352EOF
353) >> $MKFILE.tmp
354}
355
356#=======================
357
358
359#======== TOUCH ========
360
361#----------------------------------#
362wrt_touch() { #
363#----------------------------------#
364(
365cat << EOF
366 @\$(call housekeeping)
367EOF
368) >> $MKFILE.tmp
369}
370
371#=======================
Note: See TracBrowser for help on using the repository browser.