diff --git a/Makefile b/Makefile index 5ab499ef..0eb44574 100644 --- a/Makefile +++ b/Makefile @@ -97,12 +97,10 @@ gluon_prepared_stamp := $(GLUON_BUILDDIR)/$(BOARD)/prepared define GluonProfile image/$(1): $(gluon_prepared_stamp) - $(MAKE) -C $(GLUON_BUILDERDIR) image \ - PROFILE="$(1)" \ - $(if $(2),PACKAGES="$(2)") + $(MAKE) -C $(GLUON_BUILDERDIR) image PROFILE="$(1)" PROFILES += $(1) -PROFILE_PACKAGES += $(filter-out -%,$(2)) +PROFILE_PACKAGES += $(filter-out -%,$(2)) $(GLUON_$(1)_SITE_PACKAGES) endef include $(GLUONDIR)/profiles.mk @@ -126,7 +124,7 @@ feeds: FORCE $(SUBMAKE) prepare-tmpinfo OPENWRT_BUILD=0 config: FORCE - echo -e 'CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${space},\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_PACKAGES) $(PROFILE_PACKAGES)))' > .config + echo -e 'CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${space},\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES)))' > .config $(SUBMAKE) defconfig OPENWRT_BUILD=0 toolchain: $(toolchain/stamp-install) $(tools/stamp-install) diff --git a/builder/Makefile b/builder/Makefile index 2a288cfe..bac0eb44 100644 --- a/builder/Makefile +++ b/builder/Makefile @@ -62,18 +62,19 @@ endef include $(INCLUDE_DIR)/target.mk -BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(PROFILE)_PACKAGES) kernel) -# "-pkgname" in the package list means remove "pkgname" from the package list -BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) -PACKAGES:= +define GluonProfile + GLUON_$(1)_DEFAULT_PACKAGES := $(2) +endef + +include $(GLUONDIR)/profiles.mk + +# Generate Gluon package list +$(eval $(call merge-lists,GLUON_PACKAGES,GLUON_DEFAULT_PACKAGES GLUON_SITE_PACKAGES GLUON_$(PROFILE)_DEFAULT_PACKAGES GLUON_$(PROFILE)_SITE_PACKAGES)) image/%:: FORCE $(MAKE) assemble_image PROFILE="$(patsubst image/%,%,$@)" assemble_image: FORCE - echo 'Building images for $(BOARD)$(if $($(PROFILE)_NAME), - $($(PROFILE)_NAME))' - echo 'Packages: $(BUILD_PACKAGES)' - echo rm -rf $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(TARGET_DIR)/tmp $(OPKG) update @@ -92,7 +93,8 @@ endef package_install: FORCE $(OPKG) install $(PACKAGE_DIR)/libc_*.ipk $(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk - $(OPKG) install $(BUILD_PACKAGES) + $(OPKG) install $(DEFAULT_PACKAGES) $($(PROFILE)_PACKAGES) + $(OPKG) install $(GLUON_PACKAGES) rm -f $(TARGET_DIR)/usr/lib/opkg/lists/* $(TARGET_DIR)/tmp/opkg.lock copy_files: FORCE @@ -126,7 +128,7 @@ build_image: FORCE PROFILE="$(PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)" image: FORCE - $(MAKE) image/$(PROFILE) OPENWRT_VERBOSE="$(OPENWRT_VERBOSE)" $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") + $(MAKE) image/$(PROFILE) OPENWRT_VERBOSE="$(OPENWRT_VERBOSE)" .SILENT: prepare image diff --git a/builder/gluon.mk b/builder/gluon.mk index c5520e2b..0838fad3 100644 --- a/builder/gluon.mk +++ b/builder/gluon.mk @@ -17,10 +17,14 @@ $(GLUON_SITEDIR)/site.mk: -include $(GLUON_SITEDIR)/site.mk +define merge-lists +$(1) := +$(foreach var,$(2),$(1) := $$(sort $$(filter-out -% $$(patsubst -%,%,$$(filter -%,$$($(var)))),$$($(1)) $$($(var)))) +) +endef + GLUON_DEFAULT_PACKAGES := gluon-core kmod-ipv6 firewall ip6tables -GLUON_PACKAGES := $(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) -DEFAULT_PACKAGES.gluon := $(GLUON_PACKAGES) -DEVICE_TYPE := gluon +override DEFAULT_PACKAGES.router := endif #__gluon_inc