mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-04 11:13:45 +02:00
add support for a common shell include file, which is evaluated for every make shell call, simplify variable passing to the shell with shvar and shexport templates, use Package/<pkgname>/config for adding config.in data
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@5014 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
bd97e26b6a
commit
34dbf787c3
@ -12,6 +12,15 @@ endif
|
|||||||
|
|
||||||
include $(INCLUDE_DIR)/prereq.mk
|
include $(INCLUDE_DIR)/prereq.mk
|
||||||
|
|
||||||
|
define shvar
|
||||||
|
V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define shexport
|
||||||
|
$(call shvar,$(1))=$$(call $(1))
|
||||||
|
export $(call shvar,$(1))
|
||||||
|
endef
|
||||||
|
|
||||||
define Build/DefaultTargets
|
define Build/DefaultTargets
|
||||||
ifeq ($(DUMP),)
|
ifeq ($(DUMP),)
|
||||||
ifeq ($(CONFIG_AUTOREBUILD),y)
|
ifeq ($(CONFIG_AUTOREBUILD),y)
|
||||||
@ -98,9 +107,8 @@ define BuildDescription
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define BuildIPKGVariable
|
define BuildIPKGVariable
|
||||||
pkg_$(subst .,_,$(subst -,_,$(1)))_$(2) = $$(Package/$(1)/$(2))
|
$(call shexport,Package/$(1)/$(2))
|
||||||
export pkg_$(subst .,_,$(subst -,_,$(1))_$(2))
|
$(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2);
|
||||||
$(1)_COMMANDS += if [ -n "$$$$$$$$pkg_$(subst .,_,$(subst -,_,$(1)))_$(2)" ]; then echo "$$$$$$$$pkg_$(subst .,_,$(subst -,_,$(1)))_$(2)" > $(2); fi;
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define BuildPackage
|
define BuildPackage
|
||||||
@ -168,22 +176,22 @@ define BuildPackage
|
|||||||
echo "Build-Depends: $(PKG_BUILDDEP)"; \
|
echo "Build-Depends: $(PKG_BUILDDEP)"; \
|
||||||
echo "Category: $(CATEGORY)"; \
|
echo "Category: $(CATEGORY)"; \
|
||||||
echo "Title: $(TITLE)"; \
|
echo "Title: $(TITLE)"; \
|
||||||
echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g';
|
echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g'; \
|
||||||
|
|
||||||
ifneq ($(URL),)
|
ifneq ($(URL),)
|
||||||
DUMPINFO += \
|
DUMPINFO += \
|
||||||
echo; \
|
echo; \
|
||||||
echo "$(URL)";
|
echo "$(URL)";
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
DUMPINFO += \
|
||||||
|
echo "@@";
|
||||||
|
|
||||||
DUMPINFO += \
|
$(call shexport,Package/$(1)/config)
|
||||||
echo "@@";
|
DUMPINFO += \
|
||||||
|
if isset $(call shvar,Package/$(1)/config); then echo "Config: "; getvar $(call shvar,Package/$(1)/config); fi; \
|
||||||
ifneq ($(CONFIG),)
|
echo "@@";
|
||||||
DUMPINFO += \
|
|
||||||
echo "Config: $(CONFIG)" | sed -e 's,\\,\n,g'; \
|
|
||||||
echo "@@";
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(eval $(call BuildIPKGVariable,$(1),conffiles))
|
$(eval $(call BuildIPKGVariable,$(1),conffiles))
|
||||||
|
15
include/shell.sh
Normal file
15
include/shell.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
getvar() {
|
||||||
|
eval "echo \"\${$1}\""
|
||||||
|
}
|
||||||
|
|
||||||
|
var2file() {
|
||||||
|
local var
|
||||||
|
eval "var=\"\${$1}\""
|
||||||
|
if [ -n "$var" ]; then echo "$var" > "$2"; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
isset() {
|
||||||
|
local var
|
||||||
|
eval "var=\"\${$1}\""
|
||||||
|
[ -n "$var" ]
|
||||||
|
}
|
@ -31,10 +31,12 @@ define Package/busybox
|
|||||||
It slices, it dices, it makes Julian Fries.
|
It slices, it dices, it makes Julian Fries.
|
||||||
URL:=http://busybox.net/
|
URL:=http://busybox.net/
|
||||||
MENU:=1
|
MENU:=1
|
||||||
CONFIG:=\\\
|
endef
|
||||||
menu "Configuration" \\\
|
|
||||||
depends on PACKAGE_busybox \\\
|
define Package/busybox/config
|
||||||
source "$(SOURCE)/config/Config.in" \\\
|
menu "Configuration"
|
||||||
|
depends on PACKAGE_busybox
|
||||||
|
source "$(SOURCE)/config/Config.in"
|
||||||
endmenu
|
endmenu
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
3
rules.mk
3
rules.mk
@ -8,8 +8,7 @@
|
|||||||
-include $(TOPDIR)/.config
|
-include $(TOPDIR)/.config
|
||||||
include $(TOPDIR)/include/verbose.mk
|
include $(TOPDIR)/include/verbose.mk
|
||||||
|
|
||||||
export SHELL=/bin/bash
|
export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
|
||||||
|
|
||||||
ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
|
ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
|
||||||
TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
|
TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
|
||||||
WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
|
WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
|
||||||
|
Loading…
Reference in New Issue
Block a user