build: replace hardcoded paths with overridable variables
Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
parent
1c1ccc3c2f
commit
9dc1ac7f58
37
Makefile
37
Makefile
@ -4,15 +4,6 @@ LC_ALL:=C
|
|||||||
LANG:=C
|
LANG:=C
|
||||||
export LC_ALL LANG
|
export LC_ALL LANG
|
||||||
|
|
||||||
|
|
||||||
# initialize (possibly already user set) directory variables
|
|
||||||
GLUON_SITEDIR ?= site
|
|
||||||
GLUON_TMPDIR ?= tmp
|
|
||||||
GLUON_OUTPUTDIR ?= output
|
|
||||||
|
|
||||||
GLUON_IMAGEDIR ?= $(GLUON_OUTPUTDIR)/images
|
|
||||||
GLUON_PACKAGEDIR ?= $(GLUON_OUTPUTDIR)/packages
|
|
||||||
|
|
||||||
# check for spaces & resolve possibly relative paths
|
# check for spaces & resolve possibly relative paths
|
||||||
define mkabspath
|
define mkabspath
|
||||||
ifneq (1,$(words [$($(1))]))
|
ifneq (1,$(words [$($(1))]))
|
||||||
@ -21,14 +12,8 @@ define mkabspath
|
|||||||
override $(1) := $(abspath $($(1)))
|
override $(1) := $(abspath $($(1)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
GLUON_SITEDIR ?= site
|
||||||
$(eval $(call mkabspath,GLUON_SITEDIR))
|
$(eval $(call mkabspath,GLUON_SITEDIR))
|
||||||
$(eval $(call mkabspath,GLUON_TMPDIR))
|
|
||||||
$(eval $(call mkabspath,GLUON_OUTPUTDIR))
|
|
||||||
$(eval $(call mkabspath,GLUON_IMAGEDIR))
|
|
||||||
$(eval $(call mkabspath,GLUON_PACKAGEDIR))
|
|
||||||
|
|
||||||
export GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR GLUON_DEVICES
|
|
||||||
|
|
||||||
|
|
||||||
$(GLUON_SITEDIR)/site.mk:
|
$(GLUON_SITEDIR)/site.mk:
|
||||||
$(error No site configuration was found. Please check out a site configuration to $(GLUON_SITEDIR))
|
$(error No site configuration was found. Please check out a site configuration to $(GLUON_SITEDIR))
|
||||||
@ -37,11 +22,27 @@ include $(GLUON_SITEDIR)/site.mk
|
|||||||
|
|
||||||
GLUON_RELEASE ?= $(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line)
|
GLUON_RELEASE ?= $(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line)
|
||||||
|
|
||||||
|
# initialize (possibly already user set) directory variables
|
||||||
|
GLUON_TMPDIR ?= tmp
|
||||||
|
GLUON_OUTPUTDIR ?= output
|
||||||
|
GLUON_IMAGEDIR ?= $(GLUON_OUTPUTDIR)/images
|
||||||
|
GLUON_PACKAGEDIR ?= $(GLUON_OUTPUTDIR)/packages
|
||||||
|
GLUON_TARGETSDIR ?= targets
|
||||||
|
GLUON_PATCHESDIR ?= patches
|
||||||
|
|
||||||
|
$(eval $(call mkabspath,GLUON_TMPDIR))
|
||||||
|
$(eval $(call mkabspath,GLUON_OUTPUTDIR))
|
||||||
|
$(eval $(call mkabspath,GLUON_IMAGEDIR))
|
||||||
|
$(eval $(call mkabspath,GLUON_PACKAGEDIR))
|
||||||
|
$(eval $(call mkabspath,GLUON_TARGETSDIR))
|
||||||
|
$(eval $(call mkabspath,GLUON_PATCHESDIR))
|
||||||
|
|
||||||
GLUON_MULTIDOMAIN ?= 0
|
GLUON_MULTIDOMAIN ?= 0
|
||||||
GLUON_WLAN_MESH ?= 11s
|
GLUON_WLAN_MESH ?= 11s
|
||||||
GLUON_DEBUG ?= 0
|
GLUON_DEBUG ?= 0
|
||||||
|
|
||||||
export GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_WLAN_MESH GLUON_DEBUG
|
export GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_WLAN_MESH GLUON_DEBUG GLUON_DEVICES \
|
||||||
|
GLUON_TARGETSDIR GLUON_PATCHESDIR GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR
|
||||||
|
|
||||||
show-release:
|
show-release:
|
||||||
@echo '$(GLUON_RELEASE)'
|
@echo '$(GLUON_RELEASE)'
|
||||||
@ -70,7 +71,7 @@ GLUON_TARGET_$$(gluon_target)_BOARD := $(1)
|
|||||||
GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(2)
|
GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(2)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
include targets/targets.mk
|
include $(GLUON_TARGETSDIR)/targets.mk
|
||||||
|
|
||||||
|
|
||||||
OPENWRTMAKE = $(MAKE) -C openwrt
|
OPENWRTMAKE = $(MAKE) -C openwrt
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ "$GLUON_IMAGEDIR" -a "$GLUON_PACKAGEDIR" -a "$OPENWRT_TARGET" -a "$GLUON_RELEASE" -a "$GLUON_SITEDIR" ] || exit 1
|
[ "$GLUON_IMAGEDIR" -a "$GLUON_PACKAGEDIR" -a "$OPENWRT_TARGET" -a "$GLUON_RELEASE" -a "$GLUON_SITEDIR" -a "$GLUON_TARGETSDIR" ] || exit 1
|
||||||
|
|
||||||
|
|
||||||
default_factory_ext='.bin'
|
default_factory_ext='.bin'
|
||||||
@ -191,7 +191,7 @@ no_opkg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
. targets/"$1"; copy
|
. "${GLUON_TARGETSDIR}/$1"; copy
|
||||||
|
|
||||||
# Copy opkg repo
|
# Copy opkg repo
|
||||||
if [ -z "$no_opkg" -a -z "$GLUON_DEVICES" ]; then
|
if [ -z "$no_opkg" -a -z "$GLUON_DEVICES" ]; then
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ "$GLUON_IMAGEDIR" -a "$GLUON_RELEASE" -a "$GLUON_SITEDIR" ] || exit 1
|
[ "$GLUON_IMAGEDIR" -a "$GLUON_RELEASE" -a "$GLUON_SITEDIR" -a "$GLUON_TARGETSDIR" ] || exit 1
|
||||||
|
|
||||||
|
|
||||||
default_sysupgrade_ext='.bin'
|
default_sysupgrade_ext='.bin'
|
||||||
@ -110,4 +110,4 @@ sysupgrade() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
. targets/"$1"; generate
|
. "${GLUON_TARGETSDIR}/$1"; generate
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
set -e
|
set -e
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
[ "$GLUON_TMPDIR" -a "$GLUON_PATCHESDIR" ] || exit 1
|
||||||
|
|
||||||
. scripts/modules.sh
|
. scripts/modules.sh
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +21,7 @@ for module in $GLUON_MODULES; do
|
|||||||
git clone -s -b base --single-branch "$GLUONDIR/$module" "$PATCHDIR" 2>/dev/null
|
git clone -s -b base --single-branch "$GLUONDIR/$module" "$PATCHDIR" 2>/dev/null
|
||||||
|
|
||||||
cd "$PATCHDIR"
|
cd "$PATCHDIR"
|
||||||
for patch in "$GLUONDIR/patches/$module"/*.patch; do
|
for patch in "${GLUON_PATCHESDIR}/$module"/*.patch; do
|
||||||
git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date "$patch"
|
git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date "$patch"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ "$OPENWRT_TARGET" ] || exit 1
|
[ "$OPENWRT_TARGET" -a "$GLUON_TARGETSDIR" ] || exit 1
|
||||||
|
|
||||||
target="$1"
|
target="$1"
|
||||||
packages=$2
|
packages=$2
|
||||||
@ -74,9 +74,9 @@ packages() {
|
|||||||
# The sort will not only remove duplicate entries,
|
# The sort will not only remove duplicate entries,
|
||||||
# but also magically make =y entries override =m ones
|
# but also magically make =y entries override =m ones
|
||||||
(
|
(
|
||||||
. targets/generic
|
. "${GLUON_TARGETSDIR}/generic"
|
||||||
packages $packages
|
packages $packages
|
||||||
|
|
||||||
. targets/"$target"
|
. "${GLUON_TARGETSDIR}/$target"
|
||||||
emit
|
emit
|
||||||
) | sort -u
|
) | sort -u
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ "$OPENWRT_TARGET" ] || exit 1
|
[ "$OPENWRT_TARGET" -a "$GLUON_TARGETSDIR" ] || exit 1
|
||||||
|
|
||||||
target="$1"
|
target="$1"
|
||||||
packages=$2
|
packages=$2
|
||||||
@ -92,10 +92,10 @@ packages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
. targets/generic
|
. "${GLUON_TARGETSDIR}/generic"
|
||||||
packages $packages
|
packages $packages
|
||||||
|
|
||||||
. targets/"$target"
|
. "${GLUON_TARGETSDIR}/$target"
|
||||||
check_devices
|
check_devices
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
set -e
|
set -e
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
[ "$GLUON_PATCHESDIR" ] || exit 1
|
||||||
|
|
||||||
. scripts/modules.sh
|
. scripts/modules.sh
|
||||||
|
|
||||||
|
|
||||||
@ -11,14 +13,14 @@ GLUONDIR="$(pwd)"
|
|||||||
for module in $GLUON_MODULES; do
|
for module in $GLUON_MODULES; do
|
||||||
echo "--- Updating patches for module '$module' ---"
|
echo "--- Updating patches for module '$module' ---"
|
||||||
|
|
||||||
rm -rf "$GLUONDIR"/patches/"$module"
|
rm -rf "${GLUON_PATCHESDIR}/$module"
|
||||||
|
|
||||||
cd "$GLUONDIR"/"$module"
|
cd "$GLUONDIR"/"$module"
|
||||||
|
|
||||||
n=0
|
n=0
|
||||||
for commit in $(git rev-list --reverse --no-merges base..patched); do
|
for commit in $(git rev-list --reverse --no-merges base..patched); do
|
||||||
let n=n+1
|
let n=n+1
|
||||||
mkdir -p "$GLUONDIR"/patches/"$module"
|
mkdir -p "${GLUON_PATCHESDIR}/$module"
|
||||||
git -c core.abbrev=40 show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' --no-renames --binary "$commit" > "$GLUONDIR/patches/$module/$(printf '%04u' $n)-$(git show -s --pretty=format:%f "$commit").patch"
|
git -c core.abbrev=40 show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' --no-renames --binary "$commit" > "${GLUON_PATCHESDIR}/$module/$(printf '%04u' $n)-$(git show -s --pretty=format:%f "$commit").patch"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
. targets/brcm2708.inc
|
. "${GLUON_TARGETSDIR}/brcm2708.inc"
|
||||||
|
|
||||||
device raspberry-pi rpi
|
device raspberry-pi rpi
|
||||||
manifest_alias raspberry-pi-model-b-rev-2
|
manifest_alias raspberry-pi-model-b-rev-2
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
. targets/brcm2708.inc
|
. "${GLUON_TARGETSDIR}/brcm2708.inc"
|
||||||
|
|
||||||
device raspberry-pi-2 rpi-2
|
device raspberry-pi-2 rpi-2
|
||||||
manifest_alias raspberry-pi-2-model-b-rev-1.1
|
manifest_alias raspberry-pi-2-model-b-rev-1.1
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
. targets/brcm2708.inc
|
. "${GLUON_TARGETSDIR}/brcm2708.inc"
|
||||||
|
|
||||||
device raspberry-pi-3 rpi-3
|
device raspberry-pi-3 rpi-3
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
. targets/x86.inc
|
. "${GLUON_TARGETSDIR}/x86.inc"
|
||||||
|
|
||||||
factory_image x86-64 combined-squashfs .img.gz
|
factory_image x86-64 combined-squashfs .img.gz
|
||||||
factory_image x86-64 combined-squashfs .vdi
|
factory_image x86-64 combined-squashfs .vdi
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
. targets/x86.inc
|
. "${GLUON_TARGETSDIR}/x86.inc"
|
||||||
|
|
||||||
factory_image x86-generic combined-squashfs .img.gz
|
factory_image x86-generic combined-squashfs .img.gz
|
||||||
factory_image x86-generic combined-squashfs .vdi
|
factory_image x86-generic combined-squashfs .vdi
|
||||||
|
Loading…
Reference in New Issue
Block a user