2
2
# # ------------------------------------------------------------------------
3
3
# # Dependencies management
4
4
# # ------------------------------------------------------------------------
5
- # replace the | by - in libs specifications.
6
- USELIB_FOR_PATH =$(subst |,-,$(USELIB ) )
7
5
8
6
# MAP to get version of lib with | separator.
9
7
# This permit to correctly identify version even if lib have a '-' in its name
@@ -24,32 +22,13 @@ endef
24
22
define getLibNameFromVersioned
25
23
$(if $(findstring |,$1) ,$(word 1,$(subst |, ,$1) ) ,$(word 1,$(subst -, ,$1) ) )
26
24
endef
27
-
28
- # macro to get the lib name from lib with version.
29
- # This macro use libs in list to get the real name of lib
30
- # if the list contains the lib with '|'
31
- # 1: the name of lib with version
32
- # 2: the list of libs
33
- define findLibNameFromVersioned
34
- $(call getLibNameFromVersioned,$(call getLibWithBar,$1,$2) )
35
- endef
36
-
37
- # macro to get lib from the name of the archive
38
- # 1: archive name (ex: cppunit-1.14.0.$(ARCH).tar.gz)
39
- # return the name of lib (ex: cppunit-1.14.0)
40
- define getLibFromArchiveName
41
- $(strip $(patsubst % .$(ARCH ) .tar.gz,% ,$(filter % .$(ARCH ) .tar.gz,$1) ) \
42
- $(patsubst % .noarch.tar.gz,% ,$(filter % .noarch.tar.gz,$1) ) )
43
- endef
44
-
45
- # macro to get lib name from the name of the archive
46
- # 1: archive name (ex: cppunit-1.14.0.$(ARCH).tar.gz)
47
- # 2: list of libs
48
- define getLibNameFromArchiveName
49
- $(call findLibNameFromVersioned,$(call getLibFromArchiveName,$1) ,$2)
25
+ # macro to get the lib version from <libname>-<version> or <libname>|<version>
26
+ # 1: the name of lib with version.
27
+ define getLibVersionFromVersioned
28
+ $(if $(findstring |,$1) ,$(word 2,$(subst |, ,$1) ) ,$(subst $(word 1,$(subst -, ,$1) ) -,,$1) )
50
29
endef
51
30
52
- # mecro to get the list from a list using its name.
31
+ # macro to get the list from a list using its name.
53
32
# 1: name of the lib
54
33
# 2: list of libs
55
34
define getLibWithLibName
@@ -138,7 +117,7 @@ ABS_DEPDOWNLOAD_RULE_OVERLOADED:=1
138
117
.PRECIOUS : $(ABSWS_EXTLIBDIR ) /% /import.mk $(ABSWS_NDEXTLIBDIR ) /% /import.mk $(ABSWS_NA_EXTLIBDIR ) /% /import.mk $(ABSWS_NDNA_EXTLIBDIR ) /% /import.mk
139
118
140
119
141
- ABS_REPO_TEMPLATE =$(foreach entry, $(ABS_REPO ) ,$(if $(findstring {,$(entry ) ) ,$(entry ) ,$(entry ) /{arch}/{name}-{version}.{arch}{ext} $(entry ) /{arch}/{name}/{name}-{version}.{arch}{ext} $(entry ) /noarch/{name}-{version}{ext}) )
120
+ ABS_REPO_TEMPLATE =$(foreach entry, $(ABS_REPO ) ,$(if $(findstring {,$(entry ) ) ,$(entry ) ,$(entry ) /{arch}/{name}-{version}.{arch}. {ext} $(entry ) /{arch}/{name}/{name}-{version}.{arch}. {ext} $(entry ) /noarch/{name}-{version}. {ext}) )
142
121
143
122
# fetch package with wget (any URL kind that wget can handle)
144
123
# $1 URL to download from
@@ -182,13 +161,13 @@ endef
182
161
183
162
184
163
# Get URL list related to a package
185
- # $1 package file name. expected format is <name>- <version>.<arch> .<ext>
164
+ # $1 package file name. expected format is <name>/ <version>/pck .<ext>
186
165
define GetDownloadURLs
187
- $(call SubstituteRepoTemplate,$(word 1,$(subst - , ,$1) ) ,$(subst $( word 1 ,$(subst - , ,$1) )-,, $( word 1 ,$(subst . $( ARCH ) , ,$1) ) ) , $( ARCH ) ,. $( word 2 ,$(subst $( ARCH ) . , ,$1) ) )
166
+ $(call SubstituteRepoTemplate,$(word 1,$(subst / , ,$1) ) ,$(word 2 ,$(subst / , ,$1) ) , $( ARCH ) ,$(subst pck.,, $( word 3 ,$(subst / , ,$1) ) ) )
188
167
endef
189
168
190
169
define GetNoarchDownloadURLs
191
- $(call SubstituteRepoTemplate,$(word 1,$(subst - , ,$1) ) ,$(subst $( word 1 ,$(subst - , ,$1) )-, ,$(word 1, $( subst . $( ARCH ) , ,$1) ) ) ,noarch, )
170
+ $(call SubstituteRepoTemplate,$(word 1,$(subst / , ,$1) ) ,$(word 2 ,$(subst / , ,$1) ) ,noarch ,$(subst pck.,, $( word 3, $( subst / , ,$1) ) ) )
192
171
endef
193
172
194
173
# Get URL list related to a raw package package file name
@@ -200,15 +179,14 @@ endef
200
179
$(ABS_CACHE ) /noarch/% :
201
180
@mkdir -p $(@D )
202
181
@$(ABS_PRINT_info ) " Fetching NA $@ ..."
203
- $(call downloadFromURLs,$@ ,$(call GetNoarchDownloadURLs,$(@F ) ) )
182
+ $(call downloadFromURLs,$@ ,$(call GetNoarchDownloadURLs,$(subst $( ABS_CACHE ) /noarch/,, $@ ) ) )
204
183
@test -f $@
205
184
206
185
207
186
$(ABS_CACHE ) /% :
208
187
@mkdir -p $(@D )
209
188
@$(ABS_PRINT_info ) " Fetching $@ ..."
210
- @$(ABS_PRINT_debug ) " Debug on."
211
- $(call downloadFromURLs,$@ ,$(call GetDownloadURLs,$(@F ) ) )
189
+ $(call downloadFromURLs,$@ ,$(call GetDownloadURLs,$(subst $(ABS_CACHE ) /$(ARCH ) /,,$@ ) ) )
212
190
@test -f $@
213
191
214
192
# extract import.mk at the end to be sure the extraction is complete.
@@ -217,26 +195,25 @@ define unpackArchive
217
195
@$(ABS_PRINT_debug ) "$< "
218
196
@$(if $(wildcard $(@D ) ) ,chmod -R u+w $(@D ) && rm -rf $(@D ) )
219
197
@mkdir -p $(@D )
220
- @tar --exclude=$* /import.mk -xmzf $< -C $1
221
- @tar -xmzf $< -C $(1 ) $* /import.mk
198
+ @tar -xmzf $< -C $(@D ) --strip-components=1
222
199
@$(if $(filter 1 true,$(EXTLIBDIR_READONLY ) ) ,chmod -R a-w $(@D ) )
223
200
@touch $@
224
201
endef
225
202
226
203
# unpack arch specific external lib
227
- $(ABSWS_EXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /$(ARCH ) /% . $( ARCH ) .tar.gz
204
+ $(ABSWS_EXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /$(ARCH ) /% /pck .tar.gz
228
205
$(call unpackArchive,$(ABSWS_EXTLIBDIR ) )
229
206
230
207
# unpack external lib that should not be forwarded to dist package
231
- $(ABSWS_NDEXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /$(ARCH ) /% . $( ARCH ) .tar.gz
208
+ $(ABSWS_NDEXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /$(ARCH ) /% /pck .tar.gz
232
209
$(call unpackArchive,$(ABSWS_NDEXTLIBDIR ) )
233
210
234
211
# unpack no arch external lib
235
- $(ABSWS_NA_EXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /noarch/% .tar.gz
212
+ $(ABSWS_NA_EXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /noarch/% /pck .tar.gz
236
213
$(call unpackArchive,$(ABSWS_NA_EXTLIBDIR ) )
237
214
238
215
# unpack no arch external lib that should not be forwarded to dist package
239
- $(ABSWS_NDNA_EXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /noarch/% .tar.gz
216
+ $(ABSWS_NDNA_EXTLIBDIR ) /% /import.mk : $(ABS_CACHE ) /noarch/% /pck .tar.gz
240
217
$(call unpackArchive,$(ABSWS_NDNA_EXTLIBDIR ) )
241
218
242
219
@@ -316,7 +293,7 @@ $(NDNA_EXTLIBDIR)/%/.dir: $(ABSWS_NDNA_EXTLIBDIR)/%/.dir
316
293
$(call extlib_linkLibrary)
317
294
318
295
ifneq ($(BUILDCHAIN ) ,)
319
- USELIB+ =runtime- $(BUILDCHAIN )
296
+ USELIB+ =runtime| $(BUILDCHAIN )
320
297
endif
321
298
322
299
# USELIB / NDUSELIB from modules. (needed for dist)
@@ -382,7 +359,7 @@ endef
382
359
# $5 variable to use to store libs
383
360
define extlib_import2
384
361
$(foreach lib,$3,$(call extlib_import3,$(lib ) ,$1-$2,$4,$5) )
385
- $(eval _app_$1_dir:=$4/$1- $2)
362
+ $(eval _app_$1_dir:=$4/$1/ $2)
386
363
$(eval _app_$1_depends+=$(foreach lib,$3,$(call getLibNameFromVersioned,$(lib ) ) ) )
387
364
$(eval ALL_LIBS_LOADED+=$1)
388
365
endef
@@ -408,15 +385,17 @@ $$(NA_EXTLIBDIR)/%.jar: $$(EXTLIBDIR)/$1-$2/lib/%.jar
408
385
@mkdir -p $$(@D )
409
386
@$$(LNFILE ) $$< $$@
410
387
endef
388
+
411
389
# list of import makefile from external libraries declared in module
412
390
# configuration only if not requesting clean or cleanabs target. In this case,
413
391
# we don't care importing the dependencies.
414
392
ifeq ($(filter clean% purgeabs docker% tag,$(MAKECMDGOALS ) ) ,)
393
+ EXTLIBMAKES = \
394
+ $(foreach entry,$(sort $(USELIB ) $(MODS_USELIBS ) ) ,$(EXTLIBDIR ) /$(call getLibNameFromVersioned,$(entry ) ) /$(call getLibVersionFromVersioned,$(entry ) ) /import.mk) \
395
+ $(foreach entry,$(sort $(NDUSELIB ) $(MODS_NDUSELIBS ) ) ,$(NDEXTLIBDIR ) /$(call getLibNameFromVersioned,$(entry ) ) /$(call getLibVersionFromVersioned,$(entry ) ) /import.mk) \
396
+ $(foreach entry,$(sort $(NDNA_USELIB ) ) ,$(NDNA_EXTLIBDIR ) /$(call getLibNameFromVersioned,$(entry ) ) /$(call getLibVersionFromVersioned,$(entry ) ) /import.mk) \
397
+ $(foreach entry,$(sort $(NA_USELIB ) ) ,$(NA_EXTLIBDIR ) /$(call getLibNameFromVersioned,$(entry ) ) /$(call getLibVersionFromVersioned,$(entry ) ) /import.mk)
415
398
416
- EXTLIBMAKES =$(patsubst % ,$(EXTLIBDIR ) /% /import.mk,$(subst |,-,$(sort $(USELIB ) $(MODS_USELIBS ) ) ) ) \
417
- $(patsubst % ,$(NDEXTLIBDIR ) /% /import.mk,$(subst |,-,$(sort $(NDUSELIB ) $(MODS_NDUSELIBS ) ) ) ) \
418
- $(patsubst % ,$(NDNA_EXTLIBDIR ) /% /import.mk,$(subst |,-,$(sort $(NDNA_USELIB ) ) ) ) \
419
- $(patsubst % ,$(NA_EXTLIBDIR ) /% /import.mk,$(subst |,-,$(sort $(NA_USELIB ) ) ) )
420
399
421
400
DEFAULT_EXTLIBMAKES: =$(EXTLIBMAKES )
422
401
0 commit comments