summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichal Sojka <sojkam1@fel.cvut.cz>2017-02-16 23:02:50 +0100
committerJo-Philipp Wich <jo@mein.io>2017-03-01 20:37:37 +0100
commite3021e0308cccd721a2e4b06f9a7e4aafb31f35e (patch)
treeecdc5218b00422f2cc108f3c5b922b98ccd30821 /scripts
parentb036a22fcc700239827b10ab0b123bc541eed415 (diff)
downloadmtk-20170518-e3021e0308cccd721a2e4b06f9a7e4aafb31f35e.zip
mtk-20170518-e3021e0308cccd721a2e4b06f9a7e4aafb31f35e.tar.gz
mtk-20170518-e3021e0308cccd721a2e4b06f9a7e4aafb31f35e.tar.bz2
scripts/feeds: Reuse TOPDIR if defined in environment
The feeds script sets value of TOPDIR in a way that is inconsistent with how toplevel Makefile sets it. The inconsistency manifests when I use a "build directory" with symlinks to LEDE source (see below). When make is invoked in such a directory, make's TOPDIR variable is set to that directory, whereas scripts/feeds sets TOPDIR to the top of LEDE source, which results in creating feeds directory inside the LEDE source instead of in the build directory. This patch changes the script so that it reuses the TOPDIR value form the environment if it exists. The result is that 'make package/symlinks' correctly fetches feeds to the build directory instead in the source. I use the following commands to create the build directory: ln -s $SRC/config config ln -s $SRC/Config.in Config.in ln -s $SRC/feeds.conf.default feeds.conf.default ln -s $SRC/include include ln -s $SRC/Makefile Makefile mkdir package ln -s $SRC/package/base-files package/base-files ln -s $SRC/package/boot package/boot ln -s $SRC/package/devel package/devel ln -s $SRC/package/firmware package/firmware ln -s $SRC/package/kernel package/kernel ln -s $SRC/package/libs package/libs ln -s $SRC/package/Makefile package/Makefile ln -s $SRC/package/network package/network ln -s $SRC/package/system package/system ln -s $SRC/package/utils package/utils ln -s $SRC/rules.mk rules.mk ln -s $SRC/scripts scripts ln -s $SRC/target target ln -s $SRC/toolchain toolchain ln -s $SRC/tools tools This allows me to easily test changes in LEDE on multiple targets. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/feeds3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/feeds b/scripts/feeds
index 83007f5..dfecaa9 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -9,7 +9,8 @@ use strict;
use Cwd 'abs_path';
chdir "$FindBin::Bin/..";
-$ENV{TOPDIR}=getcwd();
+$ENV{TOPDIR} //= getcwd();
+chdir $ENV{TOPDIR};
$ENV{GIT_CONFIG_PARAMETERS}="'core.autocrlf=false'";
$ENV{GREP_OPTIONS}="";