pkg-generic.mk 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332
  1. ################################################################################
  2. # Generic package infrastructure
  3. #
  4. # This file implements an infrastructure that eases development of
  5. # package .mk files. It should be used for packages that do not rely
  6. # on a well-known build system for which Buildroot has a dedicated
  7. # infrastructure (so far, Buildroot has special support for
  8. # autotools-based and CMake-based packages).
  9. #
  10. # See the Buildroot documentation for details on the usage of this
  11. # infrastructure
  12. #
  13. # In terms of implementation, this generic infrastructure requires the
  14. # .mk file to specify:
  15. #
  16. # 1. Metadata information about the package: name, version,
  17. # download URL, etc.
  18. #
  19. # 2. Description of the commands to be executed to configure, build
  20. # and install the package
  21. ################################################################################
  22. ################################################################################
  23. # Helper functions to catch start/end of each step
  24. ################################################################################
  25. # Those two functions are called by each step below.
  26. # They are responsible for calling all hooks defined in
  27. # $(GLOBAL_INSTRUMENTATION_HOOKS) and pass each of them
  28. # three arguments:
  29. # $1: either 'start' or 'end'
  30. # $2: the name of the step
  31. # $3: the name of the package
  32. # Start step
  33. # $1: step name
  34. define step_start
  35. $(foreach hook,$(GLOBAL_INSTRUMENTATION_HOOKS),$(call $(hook),start,$(1),$($(PKG)_NAME))$(sep))
  36. endef
  37. # End step
  38. # $1: step name
  39. define step_end
  40. $(foreach hook,$(GLOBAL_INSTRUMENTATION_HOOKS),$(call $(hook),end,$(1),$($(PKG)_NAME))$(sep))
  41. endef
  42. #######################################
  43. # Actual steps hooks
  44. # Time steps
  45. define step_time
  46. printf "%s:%-5.5s:%-20.20s: %s\n" \
  47. "$$(date +%s.%N)" "$(1)" "$(2)" "$(3)" \
  48. >>"$(BUILD_DIR)/build-time.log"
  49. endef
  50. GLOBAL_INSTRUMENTATION_HOOKS += step_time
  51. # This hook checks that host packages that need libraries that we build
  52. # have a proper DT_RPATH or DT_RUNPATH tag
  53. define check_host_rpath
  54. $(if $(filter install-host,$(2)),\
  55. $(if $(filter end,$(1)),support/scripts/check-host-rpath $(3) $(HOST_DIR) $(PER_PACKAGE_DIR)))
  56. endef
  57. GLOBAL_INSTRUMENTATION_HOOKS += check_host_rpath
  58. define step_check_build_dir_one
  59. if [ -d $(2) ]; then \
  60. printf "%s: installs files in %s\n" $(1) $(2) >&2; \
  61. exit 1; \
  62. fi
  63. endef
  64. define step_check_build_dir
  65. $(if $(filter install-staging,$(2)),\
  66. $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(STAGING_DIR)/$(O))))
  67. $(if $(filter install-target,$(2)),\
  68. $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(TARGET_DIR)/$(O))))
  69. endef
  70. GLOBAL_INSTRUMENTATION_HOOKS += step_check_build_dir
  71. # User-supplied script
  72. ifneq ($(BR2_INSTRUMENTATION_SCRIPTS),)
  73. define step_user
  74. @$(foreach user_hook, $(BR2_INSTRUMENTATION_SCRIPTS), \
  75. $(EXTRA_ENV) $(user_hook) "$(1)" "$(2)" "$(3)"$(sep))
  76. endef
  77. GLOBAL_INSTRUMENTATION_HOOKS += step_user
  78. endif
  79. #######################################
  80. # Helper functions
  81. ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
  82. define PPD_FIXUP_PATHS
  83. $(call ppd-fixup-paths,$(PER_PACKAGE_DIR)/$($(PKG)_NAME))
  84. endef
  85. # Remove python's pre-compiled "sysconfigdata", as it may contain paths to
  86. # the original staging or host dirs.
  87. #
  88. # Can't use $(foreach d, $(HOST_DIR)/lib/python* $(STAGING_DIR)/usr/lib/python*, ...)
  89. # because those directories may be created in the same recipe this macro will
  90. # be expanded in.
  91. # Additionally, either or both may be missing, which would make find whine and
  92. # fail.
  93. # So we just use HOST_DIR as a starting point, and filter on the two directories
  94. # of interest.
  95. define PPD_PYTHON_REMOVE_SYSCONFIGDATA_PYC
  96. $(Q)find $(HOST_DIR) \
  97. \( -path '$(HOST_DIR)/lib/python*' \
  98. -o -path '$(STAGING_DIR)/usr/lib/python*' \
  99. \) \
  100. \( -name "_sysconfigdata*.pyc" -delete \)
  101. endef
  102. endif # PPD
  103. # Functions to collect statistics about installed files
  104. # $(1): base directory to search in
  105. # $(2): suffix of file (optional)
  106. define pkg_size_before
  107. cd $(1); \
  108. LC_ALL=C find . -not -path './$(STAGING_SUBDIR)/*' \( -type f -o -type l \) -printf '%T@:%i:%#m:%y:%s,%p\n' \
  109. | LC_ALL=C sort > $($(PKG)_DIR)/.files-list$(2).before
  110. endef
  111. # $(1): base directory to search in
  112. # $(2): suffix of file (optional)
  113. define pkg_size_after
  114. cd $(1); \
  115. LC_ALL=C find . -not -path './$(STAGING_SUBDIR)/*' \( -type f -o -type l \) -printf '%T@:%i:%#m:%y:%s,%p\n' \
  116. | LC_ALL=C sort > $($(PKG)_DIR)/.files-list$(2).after
  117. LC_ALL=C comm -13 \
  118. $($(PKG)_DIR)/.files-list$(2).before \
  119. $($(PKG)_DIR)/.files-list$(2).after \
  120. | sed -r -e 's/^[^,]+/$($(PKG)_NAME)/' \
  121. > $($(PKG)_DIR)/.files-list$(2).txt
  122. rm -f $($(PKG)_DIR)/.files-list$(2).before
  123. rm -f $($(PKG)_DIR)/.files-list$(2).after
  124. endef
  125. define check_bin_arch
  126. support/scripts/check-bin-arch -p $($(PKG)_NAME) \
  127. -l $($(PKG)_DIR)/.files-list.txt \
  128. $(foreach i,$($(PKG)_BIN_ARCH_EXCLUDE),-i "$(i)") \
  129. -r $(TARGET_READELF) \
  130. -a $(BR2_READELF_ARCH_NAME)
  131. endef
  132. # Functions to remove conflicting and useless files
  133. # $1: base directory (target, staging, host)
  134. define remove-conflicting-useless-files
  135. $(if $(strip $($(PKG)_DROP_FILES_OR_DIRS)),
  136. $(Q)$(RM) -rf $(patsubst %, $(1)%, $($(PKG)_DROP_FILES_OR_DIRS)))
  137. endef
  138. define REMOVE_CONFLICTING_USELESS_FILES_IN_HOST
  139. $(call remove-conflicting-useless-files,$(HOST_DIR))
  140. endef
  141. define REMOVE_CONFLICTING_USELESS_FILES_IN_STAGING
  142. $(call remove-conflicting-useless-files,$(STAGING_DIR))
  143. endef
  144. define REMOVE_CONFLICTING_USELESS_FILES_IN_TARGET
  145. $(call remove-conflicting-useless-files,$(TARGET_DIR))
  146. endef
  147. ################################################################################
  148. # Implicit targets -- produce a stamp file for each step of a package build
  149. ################################################################################
  150. # Retrieve the archive
  151. $(BUILD_DIR)/%/.stamp_downloaded:
  152. @$(call step_start,download)
  153. $(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
  154. $(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
  155. # Only show the download message if it isn't already downloaded
  156. $(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
  157. if test ! -e $($(PKG)_DL_DIR)/`basename $$p` ; then \
  158. $(call MESSAGE,"Downloading") ; \
  159. break ; \
  160. fi ; \
  161. done
  162. $(if $($(PKG)_MAIN_DOWNLOAD), \
  163. $(call DOWNLOAD, \
  164. $($(PKG)_MAIN_DOWNLOAD), \
  165. $(patsubst %,-p '%',$($(PKG)_DOWNLOAD_POST_PROCESS)) \
  166. ) \
  167. )
  168. $(foreach p,$($(PKG)_ADDITIONAL_DOWNLOADS),$(call DOWNLOAD,$(p))$(sep))
  169. $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
  170. $(Q)mkdir -p $(@D)
  171. @$(call step_end,download)
  172. $(Q)touch $@
  173. # Retrieve actual source archive, e.g. for prebuilt external toolchains
  174. $(BUILD_DIR)/%/.stamp_actual_downloaded:
  175. @$(call step_start,actual-download)
  176. $(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL))
  177. $(Q)mkdir -p $(@D)
  178. @$(call step_end,actual-download)
  179. $(Q)touch $@
  180. # Unpack the archive
  181. $(BUILD_DIR)/%/.stamp_extracted:
  182. @$(call step_start,extract)
  183. @$(call MESSAGE,"Extracting")
  184. $(call prepare-per-package-directory,$($(PKG)_FINAL_EXTRACT_DEPENDENCIES))
  185. $(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
  186. $(Q)mkdir -p $(@D)
  187. $($(PKG)_EXTRACT_CMDS)
  188. # some packages have messed up permissions inside
  189. $(Q)chmod -R +rw $(@D)
  190. $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
  191. @$(call step_end,extract)
  192. $(Q)touch $@
  193. # Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
  194. # used.
  195. $(BUILD_DIR)/%/.stamp_rsynced:
  196. @$(call step_start,rsync)
  197. @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
  198. @mkdir -p $(@D)
  199. $(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
  200. @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
  201. rsync -au --chmod=u=rwX,go=rX $($(PKG)_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS) $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
  202. $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
  203. @$(call step_end,rsync)
  204. $(Q)touch $@
  205. # Patch
  206. #
  207. # The RAWNAME variable is the lowercased package name, which allows to
  208. # find the package directory (typically package/<pkgname>) and the
  209. # prefix of the patches
  210. #
  211. # For BR2_GLOBAL_PATCH_DIR, only generate if it is defined
  212. $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $(PKGDIR)
  213. $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS += $(addsuffix /$(RAWNAME),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))
  214. $(BUILD_DIR)/%/.stamp_patched:
  215. @$(call step_start,patch)
  216. @$(call MESSAGE,"Patching")
  217. $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
  218. $(foreach p,$($(PKG)_PATCH),$(APPLY_PATCHES) $(@D) $($(PKG)_DL_DIR) $(notdir $(p))$(sep))
  219. $(Q)( \
  220. for D in $(PATCH_BASE_DIRS); do \
  221. if test -d $${D}; then \
  222. if test -d $${D}/$($(PKG)_VERSION); then \
  223. $(APPLY_PATCHES) $(@D) $${D}/$($(PKG)_VERSION) \*.patch || exit 1; \
  224. else \
  225. $(APPLY_PATCHES) $(@D) $${D} \*.patch || exit 1; \
  226. fi; \
  227. fi; \
  228. done; \
  229. )
  230. $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep))
  231. @$(call step_end,patch)
  232. $(Q)touch $@
  233. # Check that all directories specified in BR2_GLOBAL_PATCH_DIR exist.
  234. $(foreach dir,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)),\
  235. $(if $(wildcard $(dir)),,\
  236. $(error BR2_GLOBAL_PATCH_DIR contains nonexistent directory $(dir))))
  237. # Configure
  238. $(BUILD_DIR)/%/.stamp_configured:
  239. @$(call step_start,configure)
  240. @$(call MESSAGE,"Configuring")
  241. $(Q)mkdir -p $(HOST_DIR) $(TARGET_DIR) $(STAGING_DIR) $(BINARIES_DIR)
  242. $(call prepare-per-package-directory,$($(PKG)_FINAL_DEPENDENCIES))
  243. $(foreach hook,$($(PKG)_POST_PREPARE_HOOKS),$(call $(hook))$(sep))
  244. @$(call pkg_size_before,$(TARGET_DIR))
  245. @$(call pkg_size_before,$(STAGING_DIR),-staging)
  246. @$(call pkg_size_before,$(BINARIES_DIR),-images)
  247. @$(call pkg_size_before,$(HOST_DIR),-host)
  248. $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
  249. $($(PKG)_CONFIGURE_CMDS)
  250. $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
  251. @$(call step_end,configure)
  252. $(Q)touch $@
  253. # Build
  254. $(BUILD_DIR)/%/.stamp_built:
  255. @$(call step_start,build)
  256. @$(call MESSAGE,"Building")
  257. $(foreach hook,$($(PKG)_PRE_BUILD_HOOKS),$(call $(hook))$(sep))
  258. +$($(PKG)_BUILD_CMDS)
  259. $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep))
  260. @$(call step_end,build)
  261. $(Q)touch $@
  262. # Install to host dir
  263. $(BUILD_DIR)/%/.stamp_host_installed:
  264. @$(call step_start,install-host)
  265. @$(call MESSAGE,"Installing to host directory")
  266. $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep))
  267. +$($(PKG)_INSTALL_CMDS)
  268. $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep))
  269. @$(call step_end,install-host)
  270. $(Q)touch $@
  271. # Install to staging dir
  272. #
  273. # Some packages install libtool .la files alongside any installed
  274. # libraries. These .la files sometimes refer to paths relative to the
  275. # sysroot, which libtool will interpret as absolute paths to host
  276. # libraries instead of the target libraries. Since this is not what we
  277. # want, these paths are fixed by prefixing them with $(STAGING_DIR).
  278. # As we configure with --prefix=/usr, this fix needs to be applied to
  279. # any path that starts with /usr.
  280. #
  281. # To protect against the case that the output or staging directories or
  282. # the pre-installed external toolchain themselves are under /usr, we first
  283. # substitute away any occurrences of these directories with @BASE_DIR@,
  284. # @STAGING_DIR@ and @TOOLCHAIN_EXTERNAL_INSTALL_DIR@ respectively.
  285. #
  286. # Note that STAGING_DIR can be outside BASE_DIR when the user sets
  287. # BR2_HOST_DIR to a custom value. Note that TOOLCHAIN_EXTERNAL_INSTALL_DIR
  288. # can be under @BASE_DIR@ when it's a downloaded toolchain, and can be
  289. # empty when we use an internal toolchain.
  290. #
  291. $(BUILD_DIR)/%/.stamp_staging_installed:
  292. @$(call step_start,install-staging)
  293. @$(call MESSAGE,"Installing to staging directory")
  294. $(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
  295. +$($(PKG)_INSTALL_STAGING_CMDS)
  296. $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
  297. $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
  298. $(call MESSAGE,"Fixing package configuration files") ;\
  299. $(SED) "s,$(HOST_DIR),@HOST_DIR@,g" \
  300. -e "s,$(BASE_DIR),@BASE_DIR@,g" \
  301. -e "s,^\(exec_\)\?prefix=.*,\1prefix=@STAGING_DIR@/usr,g" \
  302. -e "s,-I/usr/,-I@STAGING_DIR@/usr/,g" \
  303. -e "s,-L/usr/,-L@STAGING_DIR@/usr/,g" \
  304. -e 's,@STAGING_DIR@,$$(dirname $$(readlink -e $$0))/../..,g' \
  305. -e 's,@HOST_DIR@,$$(dirname $$(readlink -e $$0))/../../../..,g' \
  306. -e "s,@BASE_DIR@,$(BASE_DIR),g" \
  307. $(addprefix $(STAGING_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ;\
  308. fi
  309. @$(call MESSAGE,"Fixing libtool files")
  310. for la in $$(find $(STAGING_DIR)/usr/lib* -name "*.la"); do \
  311. cp -a "$${la}" "$${la}.fixed" && \
  312. $(SED) "s:$(BASE_DIR):@BASE_DIR@:g" \
  313. -e "s:$(STAGING_DIR):@STAGING_DIR@:g" \
  314. $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
  315. -e "s:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:g") \
  316. -e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" \
  317. -e "s:\(['= ]\)/lib:\\1@STAGING_DIR@/lib:g" \
  318. $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
  319. -e "s:@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):g") \
  320. -e "s:@STAGING_DIR@:$(STAGING_DIR):g" \
  321. -e "s:@BASE_DIR@:$(BASE_DIR):g" \
  322. "$${la}.fixed" && \
  323. if cmp -s "$${la}" "$${la}.fixed"; then \
  324. rm -f "$${la}.fixed"; \
  325. else \
  326. mv "$${la}.fixed" "$${la}"; \
  327. fi || exit 1; \
  328. done
  329. @$(call step_end,install-staging)
  330. $(Q)touch $@
  331. # Install to images dir
  332. $(BUILD_DIR)/%/.stamp_images_installed:
  333. @$(call step_start,install-image)
  334. @$(call MESSAGE,"Installing to images directory")
  335. $(foreach hook,$($(PKG)_PRE_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
  336. +$($(PKG)_INSTALL_IMAGES_CMDS)
  337. $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
  338. @$(call step_end,install-image)
  339. $(Q)touch $@
  340. # Install to target dir
  341. $(BUILD_DIR)/%/.stamp_target_installed:
  342. @$(call step_start,install-target)
  343. @$(call MESSAGE,"Installing to target")
  344. $(foreach hook,$($(PKG)_PRE_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
  345. +$($(PKG)_INSTALL_TARGET_CMDS)
  346. $(if $(BR2_INIT_SYSTEMD),\
  347. $($(PKG)_INSTALL_INIT_SYSTEMD))
  348. $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
  349. $($(PKG)_INSTALL_INIT_SYSV))
  350. $(if $(BR2_INIT_OPENRC), \
  351. $(or $($(PKG)_INSTALL_INIT_OPENRC), \
  352. $($(PKG)_INSTALL_INIT_SYSV)))
  353. $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
  354. $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
  355. $(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
  356. fi
  357. @$(call step_end,install-target)
  358. $(Q)touch $@
  359. # Final installation step, completed when all installation steps
  360. # (host, images, staging, target) have completed
  361. $(BUILD_DIR)/%/.stamp_installed:
  362. @$(call pkg_size_after,$(TARGET_DIR))
  363. @$(call pkg_size_after,$(STAGING_DIR),-staging)
  364. @$(call pkg_size_after,$(BINARIES_DIR),-images)
  365. @$(call pkg_size_after,$(HOST_DIR),-host)
  366. @$(call check_bin_arch)
  367. $(Q)touch $@
  368. # Remove package sources
  369. $(BUILD_DIR)/%/.stamp_dircleaned:
  370. $(if $(BR2_PER_PACKAGE_DIRECTORIES),rm -Rf $(PER_PACKAGE_DIR)/$(NAME))
  371. rm -Rf $(@D)
  372. ################################################################################
  373. # virt-provides-single -- check that provider-pkg is the declared provider for
  374. # the virtual package virt-pkg
  375. #
  376. # argument 1 is the lower-case name of the virtual package
  377. # argument 2 is the upper-case name of the virtual package
  378. # argument 3 is the lower-case name of the provider
  379. #
  380. # example:
  381. # $(call virt-provides-single,libegl,LIBEGL,rpi-userland)
  382. ################################################################################
  383. define virt-provides-single
  384. ifneq ($$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2))),$(3))
  385. $$(error Configuration error: both "$(3)" and $$(BR2_PACKAGE_PROVIDES_$(2))\
  386. are selected as providers for virtual package "$(1)". Only one provider can\
  387. be selected at a time. Please fix your configuration)
  388. endif
  389. endef
  390. define pkg-graph-depends
  391. @$$(INSTALL) -d $$(GRAPHS_DIR)
  392. @cd "$$(CONFIG_DIR)"; \
  393. $$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \
  394. -p $(1) $(2) -o $$(GRAPHS_DIR)/$$(@).dot
  395. dot $$(BR2_GRAPH_DOT_OPTS) -T$$(BR_GRAPH_OUT) \
  396. -o $$(GRAPHS_DIR)/$$(@).$$(BR_GRAPH_OUT) \
  397. $$(GRAPHS_DIR)/$$(@).dot
  398. endef
  399. ################################################################################
  400. # inner-generic-package -- generates the make targets needed to build a
  401. # generic package
  402. #
  403. # argument 1 is the lowercase package name
  404. # argument 2 is the uppercase package name, including a HOST_ prefix
  405. # for host packages
  406. # argument 3 is the uppercase package name, without the HOST_ prefix
  407. # for host packages
  408. # argument 4 is the type (target or host)
  409. #
  410. # Note about variable and function references: inside all blocks that are
  411. # evaluated with $(eval), which includes all 'inner-xxx-package' blocks,
  412. # specific rules apply with respect to variable and function references.
  413. # - Numbered variables (parameters to the block) can be referenced with a single
  414. # dollar sign: $(1), $(2), $(3), etc.
  415. # - pkgdir and pkgname should be referenced with a single dollar sign too. These
  416. # functions rely on 'the most recently parsed makefile' which is supposed to
  417. # be the package .mk file. If we defer the evaluation of these functions using
  418. # double dollar signs, then they may be evaluated too late, when other
  419. # makefiles have already been parsed. One specific case is when $$(pkgdir) is
  420. # assigned to a variable using deferred evaluation with '=' and this variable
  421. # is used in a target rule outside the eval'ed inner block. In this case, the
  422. # pkgdir will be that of the last makefile parsed by buildroot, which is not
  423. # the expected value. This mechanism is for example used for the TARGET_PATCH
  424. # rule.
  425. # - All other variables should be referenced with a double dollar sign:
  426. # $$(TARGET_DIR), $$($(2)_VERSION), etc. Also all make functions should be
  427. # referenced with a double dollar sign: $$(subst), $$(call), $$(filter-out),
  428. # etc. This rule ensures that these variables and functions are only expanded
  429. # during the $(eval) step, and not earlier. Otherwise, unintuitive and
  430. # undesired behavior occurs with respect to these variables and functions.
  431. #
  432. ################################################################################
  433. define inner-generic-package
  434. # When doing a package, we're definitely not doing a rootfs, but we
  435. # may inherit it via the dependency chain, so we reset it.
  436. $(1): ROOTFS=
  437. # Ensure the package is only declared once, i.e. do not accept that a
  438. # package be re-defined by a br2-external tree
  439. ifneq ($(call strip,$(filter $(1),$(PACKAGES_ALL))),)
  440. $$(error Package '$(1)' defined a second time in '$(pkgdir)'; \
  441. previous definition was in '$$($(2)_PKGDIR)')
  442. endif
  443. PACKAGES_ALL += $(1)
  444. # Define default values for various package-related variables, if not
  445. # already defined. For some variables (version, source, site and
  446. # subdir), if they are undefined, we try to see if a variable without
  447. # the HOST_ prefix is defined. If so, we use such a variable, so that
  448. # this information has only to be specified once, for both the
  449. # target and host packages of a given .mk file.
  450. $(2)_TYPE = $(4)
  451. $(2)_NAME = $(1)
  452. $(2)_RAWNAME = $$(patsubst host-%,%,$(1))
  453. $(2)_PKGDIR = $(pkgdir)
  454. # Keep the package version that may contain forward slashes in the _DL_VERSION
  455. # variable, then replace all forward slashes ('/') by underscores ('_') to
  456. # sanitize the package version that is used in paths, directory and file names.
  457. # Forward slashes may appear in the package's version when pointing to a
  458. # version control system branch or tag, for example remotes/origin/1_10_stable.
  459. # Similar for spaces and colons (:) that may appear in date-based revisions for
  460. # CVS.
  461. ifndef $(2)_VERSION
  462. ifdef $(3)_DL_VERSION
  463. $(2)_DL_VERSION := $$($(3)_DL_VERSION)
  464. else ifdef $(3)_VERSION
  465. $(2)_DL_VERSION := $$($(3)_VERSION)
  466. endif
  467. else
  468. $(2)_DL_VERSION := $$(strip $$($(2)_VERSION))
  469. endif
  470. $(2)_VERSION := $$(call sanitize,$$($(2)_DL_VERSION))
  471. $(2)_HASH_FILES = \
  472. $$(strip \
  473. $$(foreach d, $$($(2)_PKGDIR) $$(addsuffix /$$($(2)_RAWNAME), $$(call qstrip,$$(BR2_GLOBAL_PATCH_DIR))),\
  474. $$(if $$(wildcard $$(d)/$$($(2)_VERSION)/$$($(2)_RAWNAME).hash),\
  475. $$(d)/$$($(2)_VERSION)/$$($(2)_RAWNAME).hash,\
  476. $$(d)/$$($(2)_RAWNAME).hash\
  477. )\
  478. )\
  479. )
  480. ifdef $(3)_OVERRIDE_SRCDIR
  481. $(2)_OVERRIDE_SRCDIR ?= $$($(3)_OVERRIDE_SRCDIR)
  482. endif
  483. $(2)_BASENAME = $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
  484. $(2)_BASENAME_RAW = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
  485. $(2)_DL_DIR = $$(DL_DIR)/$$($(2)_DL_SUBDIR)
  486. $(2)_DIR = $$(BUILD_DIR)/$$($(2)_BASENAME)
  487. ifndef $(2)_SUBDIR
  488. ifdef $(3)_SUBDIR
  489. $(2)_SUBDIR = $$($(3)_SUBDIR)
  490. endif
  491. endif
  492. ifndef $(2)_DL_SUBDIR
  493. ifdef $(3)_DL_SUBDIR
  494. $(2)_DL_SUBDIR = $$($(3)_DL_SUBDIR)
  495. else
  496. $(2)_DL_SUBDIR = $$($(2)_RAWNAME)
  497. endif
  498. endif
  499. ifndef $(2)_DOWNLOAD_DEPENDENCIES
  500. ifdef $(3)_DOWNLOAD_DEPENDENCIES
  501. $(2)_DOWNLOAD_DEPENDENCIES = $$(filter-out $(1),$$($(3)_DOWNLOAD_DEPENDENCIES))
  502. endif
  503. endif
  504. ifndef $(2)_DL_ENV
  505. ifdef $(3)_DL_ENV
  506. $(2)_DL_ENV = $$($(3)_DL_ENV)
  507. endif
  508. endif
  509. ifndef $(2)_DOWNLOAD_POST_PROCESS
  510. ifdef $(3)_DOWNLOAD_POST_PROCESS
  511. $(2)_DOWNLOAD_POST_PROCESS = $$($(3)_DOWNLOAD_POST_PROCESS)
  512. endif
  513. endif
  514. ifndef $(2)_STRIP_COMPONENTS
  515. ifdef $(3)_STRIP_COMPONENTS
  516. $(2)_STRIP_COMPONENTS = $$($(3)_STRIP_COMPONENTS)
  517. else
  518. $(2)_STRIP_COMPONENTS ?= 1
  519. endif
  520. endif
  521. $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)
  522. $(2)_BUILDDIR ?= $$($(2)_SRCDIR)
  523. ifneq ($$($(2)_OVERRIDE_SRCDIR),)
  524. $(2)_VERSION = custom
  525. endif
  526. ifndef $(2)_SOURCE
  527. ifdef $(3)_SOURCE
  528. $(2)_SOURCE = $$($(3)_SOURCE)
  529. else ifdef $(2)_VERSION
  530. $(2)_SOURCE ?= $$($(2)_BASENAME_RAW)$$(call pkg_source_ext,$(2))
  531. endif
  532. endif
  533. # If FOO_ACTUAL_SOURCE_TARBALL is explicitly defined, it means FOO_SOURCE is
  534. # indeed a binary (e.g. external toolchain) and FOO_ACTUAL_SOURCE_TARBALL/_SITE
  535. # point to the actual sources tarball. Use the actual sources for legal-info.
  536. # For most packages the FOO_SITE/FOO_SOURCE pair points to real source code,
  537. # so these are the defaults for FOO_ACTUAL_*.
  538. $(2)_ACTUAL_SOURCE_TARBALL ?= $$($(2)_SOURCE)
  539. $(2)_ACTUAL_SOURCE_SITE ?= $$(call qstrip,$$($(2)_SITE))
  540. ifndef $(2)_PATCH
  541. ifdef $(3)_PATCH
  542. $(2)_PATCH = $$($(3)_PATCH)
  543. endif
  544. endif
  545. $(2)_MAIN_DOWNLOAD = \
  546. $$(if $$($(2)_SOURCE),$$($(2)_SITE_METHOD)+$$($(2)_SITE)/$$($(2)_SOURCE))
  547. $(2)_ADDITIONAL_DOWNLOADS = \
  548. $$(foreach p,$$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS),\
  549. $$(if $$(findstring ://,$$(p)),$$(p),\
  550. $$($(2)_SITE_METHOD)+$$($(2)_SITE)/$$(p)))
  551. $(2)_ALL_DOWNLOADS = $$($(2)_MAIN_DOWNLOAD) $$($(2)_ADDITIONAL_DOWNLOADS)
  552. ifndef $(2)_SITE
  553. ifdef $(3)_SITE
  554. $(2)_SITE = $$($(3)_SITE)
  555. endif
  556. endif
  557. ifndef $(2)_SITE_METHOD
  558. ifdef $(3)_SITE_METHOD
  559. $(2)_SITE_METHOD = $$($(3)_SITE_METHOD)
  560. else
  561. # Try automatic detection using the scheme part of the URI
  562. $(2)_SITE_METHOD = $$(call geturischeme,$$($(2)_SITE))
  563. endif
  564. endif
  565. ifndef $(2)_DL_OPTS
  566. ifdef $(3)_DL_OPTS
  567. $(2)_DL_OPTS = $$($(3)_DL_OPTS)
  568. endif
  569. endif
  570. ifneq ($$(filter bzr cvs hg,$$($(2)_SITE_METHOD)),)
  571. BR_NO_CHECK_HASH_FOR += $$($(2)_SOURCE)
  572. endif
  573. ifndef $(2)_GIT_SUBMODULES
  574. ifdef $(3)_GIT_SUBMODULES
  575. $(2)_GIT_SUBMODULES = $$($(3)_GIT_SUBMODULES)
  576. endif
  577. endif
  578. ifndef $(2)_SVN_EXTERNALS
  579. ifdef $(3)_SVN_EXTERNALS
  580. $(2)_SVN_EXTERNALS = $$($(3)_SVN_EXTERNALS)
  581. endif
  582. endif
  583. # Do not accept to download git submodule if not using the git method
  584. ifneq ($$($(2)_GIT_SUBMODULES),)
  585. ifneq ($$($(2)_SITE_METHOD),git)
  586. $$(error $(2) declares having git sub-modules, but does not use the \
  587. 'git' method (uses '$$($(2)_SITE_METHOD)' instead))
  588. endif
  589. endif
  590. ifeq ($$($(2)_SITE_METHOD),local)
  591. ifeq ($$($(2)_OVERRIDE_SRCDIR),)
  592. $(2)_OVERRIDE_SRCDIR = $$($(2)_SITE)
  593. endif
  594. ifeq ($$($(2)_OVERRIDE_SRCDIR),)
  595. $$(error $(1) has local site method, but `$(2)_SITE` is not defined)
  596. endif
  597. endif
  598. ifndef $(2)_LICENSE
  599. ifdef $(3)_LICENSE
  600. $(2)_LICENSE = $$($(3)_LICENSE)
  601. endif
  602. endif
  603. $(2)_LICENSE ?= unknown
  604. ifndef $(2)_LICENSE_FILES
  605. ifdef $(3)_LICENSE_FILES
  606. $(2)_LICENSE_FILES = $$($(3)_LICENSE_FILES)
  607. endif
  608. endif
  609. ifndef $(2)_REDISTRIBUTE
  610. ifdef $(3)_REDISTRIBUTE
  611. $(2)_REDISTRIBUTE = $$($(3)_REDISTRIBUTE)
  612. endif
  613. endif
  614. $(2)_REDISTRIBUTE ?= YES
  615. $(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_BASENAME_RAW)
  616. # If any of the <pkg>_CPE_ID_* variables are set, we assume the CPE ID
  617. # information is valid for this package.
  618. ifneq ($$($(2)_CPE_ID_VENDOR)$$($(2)_CPE_ID_PRODUCT)$$($(2)_CPE_ID_VERSION)$$($(2)_CPE_ID_UPDATE)$$($(2)_CPE_ID_PREFIX),)
  619. $(2)_CPE_ID_VALID = YES
  620. endif
  621. # When we're a host package, make sure to use the variables of the
  622. # corresponding target package, if any.
  623. ifneq ($$($(3)_CPE_ID_VENDOR)$$($(3)_CPE_ID_PRODUCT)$$($(3)_CPE_ID_VERSION)$$($(3)_CPE_ID_UPDATE)$$($(3)_CPE_ID_PREFIX),)
  624. $(2)_CPE_ID_VALID = YES
  625. endif
  626. # If the CPE ID is valid for the target package so it is for the host
  627. # package
  628. ifndef $(2)_CPE_ID_VALID
  629. ifdef $(3)_CPE_ID_VALID
  630. $(2)_CPE_ID_VALID = $$($(3)_CPE_ID_VALID)
  631. endif
  632. endif
  633. ifeq ($$($(2)_CPE_ID_VALID),YES)
  634. # CPE_ID_VENDOR
  635. ifndef $(2)_CPE_ID_VENDOR
  636. ifdef $(3)_CPE_ID_VENDOR
  637. $(2)_CPE_ID_VENDOR = $$($(3)_CPE_ID_VENDOR)
  638. else
  639. $(2)_CPE_ID_VENDOR = $$($(2)_RAWNAME)_project
  640. endif
  641. endif
  642. # CPE_ID_PRODUCT
  643. ifndef $(2)_CPE_ID_PRODUCT
  644. ifdef $(3)_CPE_ID_PRODUCT
  645. $(2)_CPE_ID_PRODUCT = $$($(3)_CPE_ID_PRODUCT)
  646. else
  647. $(2)_CPE_ID_PRODUCT = $$($(2)_RAWNAME)
  648. endif
  649. endif
  650. # CPE_ID_VERSION
  651. ifndef $(2)_CPE_ID_VERSION
  652. ifdef $(3)_CPE_ID_VERSION
  653. $(2)_CPE_ID_VERSION = $$($(3)_CPE_ID_VERSION)
  654. else
  655. $(2)_CPE_ID_VERSION = $$($(2)_VERSION)
  656. endif
  657. endif
  658. # CPE_ID_UPDATE
  659. ifndef $(2)_CPE_ID_UPDATE
  660. ifdef $(3)_CPE_ID_UPDATE
  661. $(2)_CPE_ID_UPDATE = $$($(3)_CPE_ID_UPDATE)
  662. else
  663. $(2)_CPE_ID_UPDATE = *
  664. endif
  665. endif
  666. # CPE_ID_PREFIX
  667. ifndef $(2)_CPE_ID_PREFIX
  668. ifdef $(3)_CPE_ID_PREFIX
  669. $(2)_CPE_ID_PREFIX = $$($(3)_CPE_ID_PREFIX)
  670. else
  671. $(2)_CPE_ID_PREFIX = cpe:2.3:a
  672. endif
  673. endif
  674. # Calculate complete CPE ID
  675. $(2)_CPE_ID = $$($(2)_CPE_ID_PREFIX):$$($(2)_CPE_ID_VENDOR):$$($(2)_CPE_ID_PRODUCT):$$($(2)_CPE_ID_VERSION):$$($(2)_CPE_ID_UPDATE):*:*:*:*:*:*
  676. endif # ifeq ($$($(2)_CPE_ID_VALID),YES)
  677. # When a target package is a toolchain dependency set this variable to
  678. # 'NO' so the 'toolchain' dependency is not added to prevent a circular
  679. # dependency.
  680. # Similarly for the skeleton.
  681. $(2)_ADD_TOOLCHAIN_DEPENDENCY ?= YES
  682. $(2)_ADD_SKELETON_DEPENDENCY ?= YES
  683. $(2)_ADD_CCACHE_DEPENDENCY ?= YES
  684. ifeq ($(4),target)
  685. ifeq ($$($(2)_ADD_SKELETON_DEPENDENCY),YES)
  686. $(2)_DEPENDENCIES += skeleton
  687. endif
  688. ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)
  689. $(2)_DEPENDENCIES += toolchain
  690. endif
  691. endif
  692. ifeq ($$(BR2_CCACHE):$$($(2)_ADD_CCACHE_DEPENDENCY),y:YES)
  693. $(2)_DEPENDENCIES += host-ccache
  694. endif
  695. ifneq ($(1),host-skeleton)
  696. $(2)_DEPENDENCIES += host-skeleton
  697. endif
  698. ifneq ($$(filter cvs git svn,$$($(2)_SITE_METHOD)),)
  699. $(2)_DOWNLOAD_DEPENDENCIES += \
  700. $(BR2_GZIP_HOST_DEPENDENCY) \
  701. $(BR2_TAR_HOST_DEPENDENCY)
  702. endif
  703. ifeq ($$(filter host-tar host-skeleton host-fakedate,$(1)),)
  704. $(2)_EXTRACT_DEPENDENCIES += $$(BR2_TAR_HOST_DEPENDENCY)
  705. endif
  706. ifeq ($$(filter host-tar host-skeleton host-xz host-lzip host-fakedate,$(1)),)
  707. $(2)_EXTRACT_DEPENDENCIES += \
  708. $$(foreach dl,$$($(2)_ALL_DOWNLOADS),\
  709. $$(call extractor-pkg-dependency,$$(notdir $$(dl))))
  710. endif
  711. ifeq ($$(BR2_REPRODUCIBLE),y)
  712. ifeq ($$(filter host-skeleton host-fakedate,$(1)),)
  713. $(2)_DEPENDENCIES += host-fakedate
  714. endif
  715. endif
  716. # Eliminate duplicates in dependencies
  717. $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
  718. $(2)_FINAL_DOWNLOAD_DEPENDENCIES = $$(sort $$($(2)_DOWNLOAD_DEPENDENCIES))
  719. $(2)_FINAL_EXTRACT_DEPENDENCIES = $$(sort $$($(2)_EXTRACT_DEPENDENCIES))
  720. $(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))
  721. $(2)_FINAL_ALL_DEPENDENCIES = \
  722. $$(sort \
  723. $$($(2)_FINAL_DEPENDENCIES) \
  724. $$($(2)_FINAL_DOWNLOAD_DEPENDENCIES) \
  725. $$($(2)_FINAL_EXTRACT_DEPENDENCIES) \
  726. $$($(2)_FINAL_PATCH_DEPENDENCIES))
  727. $(2)_FINAL_RECURSIVE_DEPENDENCIES = $$(sort \
  728. $$(if $$(filter undefined,$$(origin $(2)_FINAL_RECURSIVE_DEPENDENCIES__X)), \
  729. $$(eval $(2)_FINAL_RECURSIVE_DEPENDENCIES__X := \
  730. $$(foreach p, \
  731. $$($(2)_FINAL_ALL_DEPENDENCIES), \
  732. $$(p) \
  733. $$($$(call UPPERCASE,$$(p))_FINAL_RECURSIVE_DEPENDENCIES) \
  734. ) \
  735. ) \
  736. ) \
  737. $$($(2)_FINAL_RECURSIVE_DEPENDENCIES__X))
  738. $(2)_FINAL_RECURSIVE_RDEPENDENCIES = $$(sort \
  739. $$(if $$(filter undefined,$$(origin $(2)_FINAL_RECURSIVE_RDEPENDENCIES__X)), \
  740. $$(eval $(2)_FINAL_RECURSIVE_RDEPENDENCIES__X := \
  741. $$(foreach p, \
  742. $$($(2)_RDEPENDENCIES), \
  743. $$(p) \
  744. $$($$(call UPPERCASE,$$(p))_FINAL_RECURSIVE_RDEPENDENCIES) \
  745. ) \
  746. ) \
  747. ) \
  748. $$($(2)_FINAL_RECURSIVE_RDEPENDENCIES__X))
  749. # define sub-target stamps
  750. $(2)_TARGET_INSTALL = $$($(2)_DIR)/.stamp_installed
  751. $(2)_TARGET_INSTALL_TARGET = $$($(2)_DIR)/.stamp_target_installed
  752. $(2)_TARGET_INSTALL_STAGING = $$($(2)_DIR)/.stamp_staging_installed
  753. $(2)_TARGET_INSTALL_IMAGES = $$($(2)_DIR)/.stamp_images_installed
  754. $(2)_TARGET_INSTALL_HOST = $$($(2)_DIR)/.stamp_host_installed
  755. $(2)_TARGET_BUILD = $$($(2)_DIR)/.stamp_built
  756. $(2)_TARGET_CONFIGURE = $$($(2)_DIR)/.stamp_configured
  757. $(2)_TARGET_RSYNC = $$($(2)_DIR)/.stamp_rsynced
  758. $(2)_TARGET_PATCH = $$($(2)_DIR)/.stamp_patched
  759. $(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted
  760. $(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded
  761. $(2)_TARGET_ACTUAL_SOURCE = $$($(2)_DIR)/.stamp_actual_downloaded
  762. $(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned
  763. # default extract command
  764. $(2)_EXTRACT_CMDS ?= \
  765. $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$($(2)_DL_DIR)/$$($(2)_SOURCE) | \
  766. $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \
  767. -C $$($(2)_DIR) \
  768. $$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \
  769. $$(TAR_OPTIONS) -)
  770. # pre/post-steps hooks
  771. $(2)_POST_PREPARE_HOOKS += \
  772. PPD_FIXUP_PATHS \
  773. PPD_PYTHON_REMOVE_SYSCONFIGDATA_PYC
  774. ifeq ($$($(2)_TYPE),target)
  775. ifneq ($$(HOST_$(2)_KCONFIG_VAR),)
  776. $$(error "Package $(1) defines host variant before target variant!")
  777. endif
  778. endif
  779. # Globaly remove following conflicting and useless files
  780. $(2)_DROP_FILES_OR_DIRS += /share/info/dir
  781. ifeq ($$($(2)_TYPE),host)
  782. $(2)_POST_INSTALL_HOOKS += REMOVE_CONFLICTING_USELESS_FILES_IN_HOST
  783. else
  784. $(2)_POST_INSTALL_STAGING_HOOKS += REMOVE_CONFLICTING_USELESS_FILES_IN_STAGING
  785. $(2)_POST_INSTALL_TARGET_HOOKS += REMOVE_CONFLICTING_USELESS_FILES_IN_TARGET
  786. endif
  787. # human-friendly targets and target sequencing
  788. $(1): $(1)-install
  789. $(1)-install: $$($(2)_TARGET_INSTALL)
  790. $$($(2)_TARGET_INSTALL): $$($(2)_TARGET_BUILD)
  791. ifeq ($$($(2)_TYPE),host)
  792. $$($(2)_TARGET_INSTALL): $$($(2)_TARGET_INSTALL_HOST)
  793. else
  794. $(2)_INSTALL_STAGING ?= NO
  795. $(2)_INSTALL_IMAGES ?= NO
  796. $(2)_INSTALL_TARGET ?= YES
  797. ifeq ($$($(2)_INSTALL_TARGET),YES)
  798. $$($(2)_TARGET_INSTALL): $$($(2)_TARGET_INSTALL_TARGET)
  799. endif
  800. ifeq ($$($(2)_INSTALL_STAGING),YES)
  801. $$($(2)_TARGET_INSTALL): $$($(2)_TARGET_INSTALL_STAGING)
  802. endif
  803. ifeq ($$($(2)_INSTALL_IMAGES),YES)
  804. $$($(2)_TARGET_INSTALL): $$($(2)_TARGET_INSTALL_IMAGES)
  805. endif
  806. endif
  807. ifeq ($$($(2)_INSTALL_TARGET),YES)
  808. $(1)-install-target: $$($(2)_TARGET_INSTALL_TARGET)
  809. $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_BUILD)
  810. else
  811. $(1)-install-target:
  812. endif
  813. ifeq ($$($(2)_INSTALL_STAGING),YES)
  814. $(1)-install-staging: $$($(2)_TARGET_INSTALL_STAGING)
  815. $$($(2)_TARGET_INSTALL_STAGING): $$($(2)_TARGET_BUILD)
  816. # Some packages use install-staging stuff for install-target
  817. $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_INSTALL_STAGING)
  818. else
  819. $(1)-install-staging:
  820. endif
  821. ifeq ($$($(2)_INSTALL_IMAGES),YES)
  822. $(1)-install-images: $$($(2)_TARGET_INSTALL_IMAGES)
  823. $$($(2)_TARGET_INSTALL_IMAGES): $$($(2)_TARGET_BUILD)
  824. else
  825. $(1)-install-images:
  826. endif
  827. $(1)-install-host: $$($(2)_TARGET_INSTALL_HOST)
  828. $$($(2)_TARGET_INSTALL_HOST): $$($(2)_TARGET_BUILD)
  829. $(1)-build: $$($(2)_TARGET_BUILD)
  830. $$($(2)_TARGET_BUILD): $$($(2)_TARGET_CONFIGURE)
  831. # Since $(2)_FINAL_DEPENDENCIES are phony targets, they are always "newer"
  832. # than $(2)_TARGET_CONFIGURE. This would force the configure step (and
  833. # therefore the other steps as well) to be re-executed with every
  834. # invocation of make. Therefore, make $(2)_FINAL_DEPENDENCIES an order-only
  835. # dependency by using |.
  836. $(1)-configure: $$($(2)_TARGET_CONFIGURE)
  837. $$($(2)_TARGET_CONFIGURE): | $$($(2)_FINAL_DEPENDENCIES)
  838. $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | prepare
  839. $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dependencies
  840. ifeq ($$($(2)_OVERRIDE_SRCDIR),)
  841. # In the normal case (no package override), the sequence of steps is
  842. # source, by downloading
  843. # depends
  844. # extract
  845. # patch
  846. # configure
  847. $$($(2)_TARGET_CONFIGURE): $$($(2)_TARGET_PATCH)
  848. $(1)-patch: $$($(2)_TARGET_PATCH)
  849. $$($(2)_TARGET_PATCH): $$($(2)_TARGET_EXTRACT)
  850. # Order-only dependency
  851. $$($(2)_TARGET_PATCH): | $$(patsubst %,%-patch,$$($(2)_FINAL_PATCH_DEPENDENCIES))
  852. $(1)-extract: $$($(2)_TARGET_EXTRACT)
  853. $$($(2)_TARGET_EXTRACT): $$($(2)_TARGET_SOURCE)
  854. $$($(2)_TARGET_EXTRACT): | $$($(2)_FINAL_EXTRACT_DEPENDENCIES)
  855. $(1)-depends: $$($(2)_FINAL_ALL_DEPENDENCIES)
  856. $(1)-source: $$($(2)_TARGET_SOURCE)
  857. $$($(2)_TARGET_SOURCE): | $$($(2)_FINAL_DOWNLOAD_DEPENDENCIES)
  858. $(1)-all-source: $(1)-legal-source
  859. $(1)-legal-info: $(1)-legal-source
  860. $(1)-legal-source: $(1)-source
  861. # Only download the actual source if it differs from the 'main' archive
  862. ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),)
  863. ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_SOURCE))
  864. $(1)-legal-source: $$($(2)_TARGET_ACTUAL_SOURCE)
  865. endif # actual sources != sources
  866. endif # actual sources != ""
  867. $(1)-external-deps:
  868. @for p in $$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS) ; do \
  869. echo `basename $$$$p` ; \
  870. done
  871. else
  872. # In the package override case, the sequence of steps
  873. # source, by rsyncing
  874. # depends
  875. # configure
  876. # Use an order-only dependency so the "<pkg>-clean-for-rebuild" rule
  877. # can remove the stamp file without triggering the configure step.
  878. $$($(2)_TARGET_CONFIGURE): | $$($(2)_TARGET_RSYNC)
  879. $(1)-depends: $$($(2)_FINAL_DEPENDENCIES)
  880. $(1)-patch: $(1)-rsync
  881. $(1)-extract: $(1)-rsync
  882. $(1)-rsync: $$($(2)_TARGET_RSYNC)
  883. $(1)-source:
  884. $(1)-legal-source:
  885. $(1)-external-deps:
  886. @echo "file://$$($(2)_OVERRIDE_SRCDIR)"
  887. endif
  888. $(1)-show-version:
  889. @echo $$($(2)_VERSION)
  890. $(1)-show-depends:
  891. @echo $$($(2)_FINAL_ALL_DEPENDENCIES)
  892. $(1)-show-recursive-depends:
  893. @echo $$($(2)_FINAL_RECURSIVE_DEPENDENCIES)
  894. $(1)-show-rdepends:
  895. @echo $$($(2)_RDEPENDENCIES)
  896. $(1)-show-recursive-rdepends:
  897. @echo $$($(2)_FINAL_RECURSIVE_RDEPENDENCIES)
  898. $(1)-show-build-order: $$(patsubst %,%-show-build-order,$$($(2)_FINAL_ALL_DEPENDENCIES))
  899. @:
  900. $$(info $(1))
  901. $(1)-show-info:
  902. @:
  903. $$(info $$(call clean-json,{ $$(call json-info,$(2)) }))
  904. $(1)-graph-depends: graph-depends-requirements
  905. $(call pkg-graph-depends,$(1),--direct)
  906. $(1)-graph-rdepends: graph-depends-requirements
  907. $(call pkg-graph-depends,$(1),--reverse)
  908. $(1)-all-source: $(1)-source
  909. $(1)-all-source: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-source)
  910. $(1)-all-external-deps: $(1)-external-deps
  911. $(1)-all-external-deps: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-external-deps)
  912. $(1)-all-legal-info: $(1)-legal-info
  913. $(1)-all-legal-info: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-legal-info)
  914. $(1)-dirclean: $$($(2)_TARGET_DIRCLEAN)
  915. $(1)-clean-for-reinstall:
  916. ifneq ($$($(2)_OVERRIDE_SRCDIR),)
  917. rm -f $$($(2)_TARGET_RSYNC)
  918. endif
  919. rm -f $$($(2)_TARGET_INSTALL)
  920. rm -f $$($(2)_TARGET_INSTALL_STAGING)
  921. rm -f $$($(2)_TARGET_INSTALL_TARGET)
  922. rm -f $$($(2)_TARGET_INSTALL_IMAGES)
  923. rm -f $$($(2)_TARGET_INSTALL_HOST)
  924. $(1)-reinstall: $(1)-clean-for-reinstall .WAIT $(1)
  925. $(1)-clean-for-rebuild: $(1)-clean-for-reinstall
  926. rm -f $$($(2)_TARGET_BUILD)
  927. $(1)-rebuild: $(1)-clean-for-rebuild .WAIT $(1)
  928. $(1)-clean-for-reconfigure: $(1)-clean-for-rebuild
  929. rm -f $$($(2)_TARGET_CONFIGURE)
  930. $(1)-reconfigure: $(1)-clean-for-reconfigure .WAIT $(1)
  931. # define the PKG variable for all targets, containing the
  932. # uppercase package variable prefix
  933. $$($(2)_TARGET_INSTALL): PKG=$(2)
  934. $$($(2)_TARGET_INSTALL_TARGET): PKG=$(2)
  935. $$($(2)_TARGET_INSTALL_STAGING): PKG=$(2)
  936. $$($(2)_TARGET_INSTALL_IMAGES): PKG=$(2)
  937. $$($(2)_TARGET_INSTALL_HOST): PKG=$(2)
  938. $$($(2)_TARGET_BUILD): PKG=$(2)
  939. $$($(2)_TARGET_CONFIGURE): PKG=$(2)
  940. $$($(2)_TARGET_CONFIGURE): NAME=$(1)
  941. $$($(2)_TARGET_RSYNC): SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
  942. $$($(2)_TARGET_RSYNC): PKG=$(2)
  943. $$($(2)_TARGET_PATCH): PKG=$(2)
  944. $$($(2)_TARGET_PATCH): RAWNAME=$$(patsubst host-%,%,$(1))
  945. $$($(2)_TARGET_PATCH): PKGDIR=$(pkgdir)
  946. $$($(2)_TARGET_EXTRACT): PKG=$(2)
  947. $$($(2)_TARGET_SOURCE): PKG=$(2)
  948. $$($(2)_TARGET_SOURCE): PKGDIR=$(pkgdir)
  949. $$($(2)_TARGET_ACTUAL_SOURCE): PKG=$(2)
  950. $$($(2)_TARGET_ACTUAL_SOURCE): PKGDIR=$(pkgdir)
  951. $$($(2)_TARGET_DIRCLEAN): PKG=$(2)
  952. $$($(2)_TARGET_DIRCLEAN): NAME=$(1)
  953. # Compute the name of the Kconfig option that correspond to the
  954. # package being enabled.
  955. ifeq ($(1),linux)
  956. $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
  957. else ifneq ($$(filter boot/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/boot/%),$(pkgdir)),)
  958. $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
  959. else ifneq ($$(filter toolchain/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/toolchain/%),$(pkgdir)),)
  960. $(2)_KCONFIG_VAR = BR2_$(2)
  961. else ifeq ($$($(2)_IS_VIRTUAL),YES)
  962. $(2)_KCONFIG_VAR = BR2_PACKAGE_HAS_$(2)
  963. else
  964. $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
  965. endif
  966. # legal-info: declare dependencies and set values used later for the manifest
  967. ifneq ($$($(2)_LICENSE_FILES),)
  968. $(2)_MANIFEST_LICENSE_FILES = $$($(2)_LICENSE_FILES)
  969. endif
  970. # We need to extract and patch a package to be able to retrieve its
  971. # license files (if any) and the list of patches applied to it (if
  972. # any).
  973. $(1)-legal-info: $(1)-patch
  974. # We only save the sources of packages we want to redistribute, that are
  975. # non-overriden (local or true override).
  976. ifeq ($$($(2)_REDISTRIBUTE),YES)
  977. ifeq ($$($(2)_OVERRIDE_SRCDIR),)
  978. # Packages that have a tarball need it downloaded beforehand
  979. $(1)-legal-info: $(1)-source $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))
  980. endif
  981. endif
  982. # legal-info: produce legally relevant info.
  983. $(1)-legal-info: PKG=$(2)
  984. $(1)-legal-info:
  985. @$$(call MESSAGE,"Collecting legal info")
  986. # Packages without a source are assumed to be part of Buildroot, skip them.
  987. $$(foreach hook,$$($(2)_PRE_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
  988. ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
  989. # Save license files if defined
  990. # We save the license files for any kind of package: normal, local,
  991. # overridden, or non-redistributable alike.
  992. # The reason to save license files even for no-redistribute packages
  993. # is that the license still applies to the files distributed as part
  994. # of the rootfs, even if the sources are not themselves redistributed.
  995. ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
  996. $(Q)$$(call legal-warning-pkg,$$($(2)_BASENAME_RAW),cannot save license ($(2)_LICENSE_FILES not defined))
  997. else
  998. $(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$(call UPPERCASE,$(4)),$$($(2)_RAWNAME),$$($(2)_BASENAME_RAW),$$(F),$$($(2)_DIR)/$$(F),$$($(2)_HASH_FILES))$$(sep))
  999. endif # license files
  1000. ifeq ($$($(2)_REDISTRIBUTE),YES)
  1001. ifeq ($$($(2)_SITE_METHOD),local)
  1002. # Packages without a tarball: don't save and warn
  1003. @$$(call legal-warning-nosource,$$($(2)_RAWNAME),local)
  1004. else ifneq ($$($(2)_OVERRIDE_SRCDIR),)
  1005. @$$(call legal-warning-nosource,$$($(2)_RAWNAME),override)
  1006. else
  1007. # Other packages
  1008. # Save the source tarball and any extra downloads, but not
  1009. # patches, as they are handled specially afterwards.
  1010. $$(foreach e,$$($(2)_ACTUAL_SOURCE_TARBALL) $$(notdir $$($(2)_EXTRA_DOWNLOADS)),\
  1011. $$(Q)support/scripts/hardlink-or-copy \
  1012. $$($(2)_DL_DIR)/$$(e) \
  1013. $$($(2)_REDIST_SOURCES_DIR)$$(sep))
  1014. # Save patches and generate the series file
  1015. $$(Q)while read f; do \
  1016. support/scripts/hardlink-or-copy \
  1017. $$$${f} \
  1018. $$($(2)_REDIST_SOURCES_DIR) || exit 1; \
  1019. printf "%s\n" "$$$${f##*/}" >>$$($(2)_REDIST_SOURCES_DIR)/series || exit 1; \
  1020. done <$$($(2)_DIR)/.applied_patches_list
  1021. endif # other packages
  1022. endif # redistribute
  1023. @$$(call legal-manifest,$$(call UPPERCASE,$(4)),$$($(2)_RAWNAME),$$($(2)_VERSION),$$(subst $$(space)$$(comma),$$(comma),$$($(2)_LICENSE)),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_ACTUAL_SOURCE_SITE),$$(call legal-deps,$(1)))
  1024. endif # ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
  1025. $$(foreach hook,$$($(2)_POST_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
  1026. # add package to the general list of targets if requested by the buildroot
  1027. # configuration
  1028. ifeq ($$($$($(2)_KCONFIG_VAR)),y)
  1029. # Ensure the calling package is the declared provider for all the virtual
  1030. # packages it claims to be an implementation of.
  1031. ifeq ($(BR_BUILDING),y)
  1032. ifneq ($$($(2)_PROVIDES),)
  1033. $$(foreach pkg,$$($(2)_PROVIDES),\
  1034. $$(eval $$(call virt-provides-single,$$(pkg),$$(call UPPERCASE,$$(pkg)),$(1))$$(sep)))
  1035. endif
  1036. endif
  1037. # Register package as a reverse-dependencies of all its dependencies
  1038. $$(eval $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),\
  1039. $$(call UPPERCASE,$$(p))_RDEPENDENCIES += $(1)$$(sep)))
  1040. # Ensure unified variable name conventions between all packages Some
  1041. # of the variables are used by more than one infrastructure; so,
  1042. # rather than duplicating the checks in each infrastructure, we check
  1043. # all variables here in pkg-generic, even though pkg-generic should
  1044. # have no knowledge of infra-specific variables.
  1045. $(eval $(call check-deprecated-variable,$(2)_MAKE_OPT,$(2)_MAKE_OPTS))
  1046. $(eval $(call check-deprecated-variable,$(2)_INSTALL_OPT,$(2)_INSTALL_OPTS))
  1047. $(eval $(call check-deprecated-variable,$(2)_INSTALL_TARGET_OPT,$(2)_INSTALL_TARGET_OPTS))
  1048. $(eval $(call check-deprecated-variable,$(2)_INSTALL_STAGING_OPT,$(2)_INSTALL_STAGING_OPTS))
  1049. $(eval $(call check-deprecated-variable,$(2)_INSTALL_HOST_OPT,$(2)_INSTALL_OPTS))
  1050. $(eval $(call check-deprecated-variable,$(2)_INSTALL_HOST_OPTS,$(2)_INSTALL_OPTS))
  1051. $(eval $(call check-deprecated-variable,$(2)_AUTORECONF_OPT,$(2)_AUTORECONF_OPTS))
  1052. $(eval $(call check-deprecated-variable,$(2)_CONF_OPT,$(2)_CONF_OPTS))
  1053. $(eval $(call check-deprecated-variable,$(2)_BUILD_OPT,$(2)_BUILD_OPTS))
  1054. $(eval $(call check-deprecated-variable,$(2)_KCONFIG_OPT,$(2)_KCONFIG_OPTS))
  1055. $(eval $(call check-deprecated-variable,$(2)_GETTEXTIZE,$(2)_AUTOPOINT))
  1056. PACKAGES += $(1)
  1057. ifneq ($$($(2)_PERMISSIONS),)
  1058. PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep)
  1059. endif
  1060. ifneq ($$($(2)_DEVICES),)
  1061. PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep)
  1062. endif
  1063. ifneq ($$($(2)_USERS),)
  1064. PACKAGES_USERS += $$($(2)_USERS)$$(sep)
  1065. endif
  1066. ifneq ($$($(2)_LINUX_CONFIG_FIXUPS),)
  1067. PACKAGES_LINUX_CONFIG_FIXUPS += $$($(2)_LINUX_CONFIG_FIXUPS)$$(sep)
  1068. endif
  1069. TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS)
  1070. ROOTFS_PRE_CMD_HOOKS += $$($(2)_ROOTFS_PRE_CMD_HOOKS)
  1071. KEEP_PYTHON_PY_FILES += $$($(2)_KEEP_PY_FILES)
  1072. ifneq ($$($(2)_SELINUX_MODULES),)
  1073. PACKAGES_SELINUX_MODULES += $$($(2)_SELINUX_MODULES)
  1074. endif
  1075. ifeq ($(BR2_PACKAGE_REFPOLICY_UPSTREAM_VERSION),y)
  1076. PACKAGES_SELINUX_EXTRA_MODULES_DIRS += \
  1077. $$(if $$(wildcard $$($(2)_PKGDIR)/selinux),$$($(2)_PKGDIR)/selinux)
  1078. endif
  1079. ifeq ($$($(2)_SITE_METHOD),svn)
  1080. DL_TOOLS_DEPENDENCIES += svn
  1081. else ifeq ($$($(2)_SITE_METHOD),git)
  1082. DL_TOOLS_DEPENDENCIES += git
  1083. ifneq ($$($(2)_GIT_LFS),)
  1084. DL_TOOLS_DEPENDENCIES += git-lfs
  1085. endif
  1086. else ifeq ($$($(2)_SITE_METHOD),bzr)
  1087. DL_TOOLS_DEPENDENCIES += bzr
  1088. else ifeq ($$($(2)_SITE_METHOD),scp)
  1089. DL_TOOLS_DEPENDENCIES += scp ssh
  1090. else ifeq ($$($(2)_SITE_METHOD),hg)
  1091. DL_TOOLS_DEPENDENCIES += hg
  1092. else ifeq ($$($(2)_SITE_METHOD),cvs)
  1093. DL_TOOLS_DEPENDENCIES += cvs
  1094. else ifneq ($(filter ftp ftps,$$($(2)_SITE_METHOD)),)
  1095. DL_TOOLS_DEPENDENCIES += curl
  1096. endif # SITE_METHOD
  1097. # cargo/go vendoring (may) need git
  1098. ifeq ($$($(2)_DOWNLOAD_POST_PROCESS),cargo)
  1099. DL_TOOLS_DEPENDENCIES += git
  1100. else ifeq ($$($(2)_DOWNLOAD_POST_PROCESS),go)
  1101. DL_TOOLS_DEPENDENCIES += git
  1102. endif
  1103. DL_TOOLS_DEPENDENCIES += $$(call extractor-system-dependency,$$($(2)_SOURCE))
  1104. # Ensure all virtual targets are PHONY. Listed alphabetically.
  1105. .PHONY: $(1) \
  1106. $(1)-all-external-deps \
  1107. $(1)-all-legal-info \
  1108. $(1)-all-source \
  1109. $(1)-build \
  1110. $(1)-clean-for-rebuild \
  1111. $(1)-clean-for-reconfigure \
  1112. $(1)-clean-for-reinstall \
  1113. $(1)-configure \
  1114. $(1)-depends \
  1115. $(1)-dirclean \
  1116. $(1)-external-deps \
  1117. $(1)-extract \
  1118. $(1)-graph-depends \
  1119. $(1)-graph-rdepends \
  1120. $(1)-install \
  1121. $(1)-install-host \
  1122. $(1)-install-images \
  1123. $(1)-install-staging \
  1124. $(1)-install-target \
  1125. $(1)-legal-info \
  1126. $(1)-legal-source \
  1127. $(1)-patch \
  1128. $(1)-rebuild \
  1129. $(1)-reconfigure \
  1130. $(1)-reinstall \
  1131. $(1)-rsync \
  1132. $(1)-show-depends \
  1133. $(1)-show-info \
  1134. $(1)-show-version \
  1135. $(1)-source
  1136. ifneq ($$($(2)_SOURCE),)
  1137. ifeq ($$($(2)_SITE),)
  1138. $$(error $(2)_SITE cannot be empty when $(2)_SOURCE is not)
  1139. endif
  1140. endif
  1141. ifeq ($$(patsubst %/,ERROR,$$($(2)_SITE)),ERROR)
  1142. $$(error $(2)_SITE ($$($(2)_SITE)) cannot have a trailing slash)
  1143. endif
  1144. ifneq ($$($(2)_HELP_CMDS),)
  1145. HELP_PACKAGES += $(2)
  1146. endif
  1147. endif # $(2)_KCONFIG_VAR
  1148. endef # inner-generic-package
  1149. ################################################################################
  1150. # generic-package -- the target generator macro for generic packages
  1151. ################################################################################
  1152. # In the case of target packages, keep the package name "pkg"
  1153. generic-package = $(call inner-generic-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
  1154. # In the case of host packages, turn the package name "pkg" into "host-pkg"
  1155. host-generic-package = $(call inner-generic-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)
  1156. # :mode=makefile: