@@ -67,6 +67,7 @@ $(1)_cached_checksum:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_bui
67
67
$(1 ) _patch_dir:=$(base_build_dir ) /$(host ) /$(1 ) /$($(1 ) _version) -$($(1 ) _build_id) /.patches-$($(1 ) _build_id)
68
68
$(1 ) _prefixbin:=$($($(1 ) _type) _prefix) /bin/
69
69
$(1 ) _cached:=$(BASE_CACHE ) /$(host ) /$(1 ) /$(1 ) -$($(1 ) _version) -$($(1 ) _build_id) .tar.gz
70
+ $(1 ) _build_log:=$(BASEDIR ) /$(1 ) -$($(1 ) _version) -$($(1 ) _build_id) .log
70
71
$(1 ) _all_sources=$($(1 ) _file_name) $($(1 ) _extra_sources)
71
72
72
73
# stamps
@@ -85,7 +86,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
85
86
# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior
86
87
$(1 ) _fetch_cmds ?= $(call fetch_file,$(1 ) ,$(subst \:,:,$$($(1 ) _download_path_fixed) ) ,$$($(1 ) _download_file) ,$($(1 ) _file_name) ,$($(1 ) _sha256_hash) )
87
88
$(1 ) _extract_cmds ?= mkdir -p $$($(1 ) _extract_dir) && echo "$$($(1 ) _sha256_hash) $$($(1 ) _source) " > $$($(1 ) _extract_dir) /.$$($(1 ) _file_name) .hash && $(build_SHA256SUM ) -c $$($(1 ) _extract_dir) /.$$($(1 ) _file_name) .hash && $(build_TAR ) --no-same-owner --strip-components=1 -xf $$($(1 ) _source)
88
- $(1 ) _preprocess_cmds ?=
89
+ $(1 ) _preprocess_cmds ?= true
89
90
$(1 ) _build_cmds ?=
90
91
$(1 ) _config_cmds ?=
91
92
$(1 ) _stage_cmds ?=
@@ -187,6 +188,10 @@ endif
187
188
endef
188
189
189
190
define int_add_cmds
191
+ ifneq ($(LOG ) ,)
192
+ $(1)_logging = >>$$($(1 ) _build_log) 2>&1 || { if test -f $$($(1 ) _build_log) ; then cat $$($(1 ) _build_log) ; fi; exit 1; }
193
+ endif
194
+
190
195
$($(1 ) _fetched) :
191
196
mkdir -p $$(@D ) $(SOURCES_PATH )
192
197
rm -f $$@
@@ -203,23 +208,23 @@ $($(1)_preprocessed): | $($(1)_extracted)
203
208
echo Preprocessing $(1 ) ...
204
209
mkdir -p $$(@D ) $($(1 ) _patch_dir)
205
210
$(foreach patch,$($(1 ) _patches) ,cd $(PATCHES_PATH ) /$(1 ) ; cp $(patch ) $($(1 ) _patch_dir) ;)
206
- cd $$(@D ) ; $($(1 ) _preprocess_cmds)
211
+ { cd $$(@D ) ; $($(1 ) _preprocess_cmds) ; } $$( $( 1 ) _logging )
207
212
touch $$@
208
213
$($(1 ) _configured) : | $($(1 ) _dependencies) $($(1 ) _preprocessed)
209
214
echo Configuring $(1 ) ...
210
215
rm -rf $(host_prefix ) ; mkdir -p $(host_prefix ) /lib; cd $(host_prefix ) ; $(foreach package,$($(1 ) _all_dependencies) , $(build_TAR ) --no-same-owner -xf $($(package ) _cached) ; )
211
216
mkdir -p $$(@D )
212
- +cd $$(@D ) ; $($(1 ) _config_env) $($(1 ) _config_cmds)
217
+ +{ cd $$(@D ) ; $($(1 ) _config_env) $($(1 ) _config_cmds) ; } $$( $( 1 ) _logging )
213
218
touch $$@
214
219
$($(1 ) _built) : | $($(1 ) _configured)
215
220
echo Building $(1 ) ...
216
221
mkdir -p $$(@D )
217
- +cd $$(@D ) ; $($(1 ) _build_env) $($(1 ) _build_cmds)
222
+ +{ cd $$(@D ) ; $($(1 ) _build_env) $($(1 ) _build_cmds) ; } $$( $( 1 ) _logging )
218
223
touch $$@
219
224
$($(1 ) _staged) : | $($(1 ) _built)
220
225
echo Staging $(1 ) ...
221
226
mkdir -p $($(1 ) _staging_dir) /$(host_prefix )
222
- cd $($(1 ) _build_dir) ; $($(1 ) _stage_env) $($(1 ) _stage_cmds)
227
+ +{ cd $($(1 ) _build_dir) ; $($(1 ) _stage_env) $($(1 ) _stage_cmds) ; } $$( $( 1 ) _logging )
223
228
rm -rf $($(1 ) _extract_dir)
224
229
touch $$@
225
230
$($(1 ) _postprocessed) : | $($(1 ) _staged)
@@ -233,6 +238,7 @@ $($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
233
238
rm -rf $$(@D ) && mkdir -p $$(@D )
234
239
mv $$($(1 ) _staging_dir) /$$(@F ) $$(@ )
235
240
rm -rf $($(1 ) _staging_dir)
241
+ if test -f $($(1 ) _build_log) ; then mv $($(1 ) _build_log) $$(@D ) ; fi
236
242
$($(1 ) _cached_checksum) : $($(1 ) _cached)
237
243
cd $$(@D ) ; $(build_SHA256SUM ) $$(<F ) > $$(@ )
238
244
0 commit comments