2
0

Makefile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #
  2. # Copyright (C) 2006-2010 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. curdir:=package
  8. include $(INCLUDE_DIR)/rootfs.mk
  9. -include $(TMP_DIR)/.packagedeps
  10. $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
  11. $(curdir)/builddirs-install:=.
  12. $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
  13. $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
  14. ifneq ($(IGNORE_ERRORS),)
  15. package-y-filter := $(package-y)
  16. package-m-filter := $(filter-out $(package-y),$(package-m))
  17. package-n-filter := $(filter-out $(package-y) $(package-m),$(package-))
  18. package-ignore-errors := $(filter n m y,$(IGNORE_ERRORS))
  19. package-ignore-errors := $(if $(package-ignore-errors),$(package-ignore-errors),n m)
  20. package-ignore-subdirs := $(sort $(foreach m,$(package-ignore-errors),$(package-$(m)-filter)))
  21. $(curdir)/builddirs-ignore-download := $(package-ignore-subdirs)
  22. $(curdir)/builddirs-ignore-compile := $(package-ignore-subdirs)
  23. $(curdir)/builddirs-ignore-host-download := $(package-ignore-subdirs)
  24. $(curdir)/builddirs-ignore-host-compile := $(package-ignore-subdirs)
  25. endif
  26. PACKAGE_INSTALL_FILES:= \
  27. $(foreach pkg,$(sort $(package-y)), \
  28. $(foreach variant, \
  29. $(if $(strip $(package/$(pkg)/variants)), \
  30. $(package/$(pkg)/variants), \
  31. $(if $(package/$(pkg)/default-variant), \
  32. $(package/$(pkg)/default-variant), \
  33. default \
  34. ) \
  35. ), \
  36. $(PKG_INFO_DIR)/$(lastword $(subst /,$(space),$(pkg))).$(variant).install \
  37. ) \
  38. )
  39. $(curdir)/cleanup: $(TMP_DIR)/.build
  40. rm -rf $(STAGING_DIR_ROOT)
  41. $(curdir)/merge:
  42. rm -rf $(PACKAGE_DIR_ALL)
  43. mkdir -p $(PACKAGE_DIR_ALL)
  44. -$(foreach pdir,$(PACKAGE_SUBDIRS),$(if $(wildcard $(pdir)/*.ipk),ln -s $(pdir)/*.ipk $(PACKAGE_DIR_ALL);))
  45. $(curdir)/merge-index: $(curdir)/merge
  46. (cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; )
  47. $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
  48. - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
  49. rm -rf $(TARGET_DIR)
  50. [ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
  51. $(call opkg,$(TARGET_DIR)) install \
  52. $(call opkg_package_files,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null))
  53. @for file in $(PACKAGE_INSTALL_FILES); do \
  54. [ -s $$file.flags ] || continue; \
  55. for flag in `cat $$file.flags`; do \
  56. $(call opkg,$(TARGET_DIR)) flag $$flag `cat $$file`; \
  57. done; \
  58. done || true
  59. @-$(MAKE) package/preconfig
  60. $(call prepare_rootfs,$(TARGET_DIR))
  61. PASSOPT=""
  62. PASSARG=""
  63. ifndef CONFIG_OPKGSMIME_PASSPHRASE
  64. ifneq ($(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)),)
  65. PASSOPT="-passin"
  66. PASSARG="file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE))"
  67. endif
  68. endif
  69. $(curdir)/index: FORCE
  70. @echo Generating package index...
  71. @for d in $(PACKAGE_SUBDIRS); do ( \
  72. mkdir -p $$d; \
  73. cd $$d || continue; \
  74. $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
  75. gzip -9nc Packages > Packages.gz; \
  76. ); done
  77. ifdef CONFIG_SIGNED_PACKAGES
  78. @echo Signing package index...
  79. @for d in $(PACKAGE_SUBDIRS); do ( \
  80. [ -d $$d ] && \
  81. cd $$d || continue; \
  82. $(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
  83. ); done
  84. else
  85. ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_KEY)),)
  86. @echo Signing key has not been configured
  87. else
  88. ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_CERT)),)
  89. @echo Certificate has not been configured
  90. else
  91. @echo Signing package index...
  92. @for d in $(PACKAGE_SUBDIRS); do ( \
  93. [ -d $$d ] && \
  94. cd $$d || continue; \
  95. openssl smime -binary -in Packages.gz \
  96. -out Packages.sig -outform PEM -sign \
  97. -signer $(CONFIG_OPKGSMIME_CERT) \
  98. -inkey $(CONFIG_OPKGSMIME_KEY) \
  99. $(PASSOPT) $(PASSARG); \
  100. ); done
  101. endif
  102. endif
  103. endif
  104. $(curdir)/preconfig:
  105. $(curdir)/flags-install:= -j1
  106. $(eval $(call stampfile,$(curdir),package,prereq,.config))
  107. $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
  108. $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
  109. $(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
  110. $(eval $(call subdir,$(curdir)))