summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-09-21 18:19:07 -0400
committermidipix <writeonce@midipix.org>2016-09-21 19:45:54 -0400
commit3244e16e0922fa9c97903df2b335725dbd6a23aa (patch)
tree88aa9a881655392ccdd3bca9570c2b44ba1a8813 /configure
parent9c77fd70c41af34faf43e070397b422c3ca43c1e (diff)
downloadbcparser-3244e16e0922fa9c97903df2b335725dbd6a23aa.tar.bz2
bcparser-3244e16e0922fa9c97903df2b335725dbd6a23aa.tar.xz
build system: support setting an external folder as the source directory.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure42
1 files changed, 35 insertions, 7 deletions
diff --git a/configure b/configure
index 8208052..83de4b6 100755
--- a/configure
+++ b/configure
@@ -33,13 +33,9 @@ init_vars()
. "$mb_config" || exit 2
fi
- # git
- if [ -d "$mb_project_dir/.git" ]; then
- mb_git_reference_dir="\$(PROJECT_DIR)/.git"
- fi
-
# project
mb_nickname=$NICKNAME
+ mb_source_dir=$SOURCE_DIR
# dirs
mb_prefix=$PREFIX
@@ -124,10 +120,33 @@ verify_build_directory()
}
+verify_source_directory()
+{
+ if [ -z "$mb_source_dir" ]; then
+ if [ "$mb_require_source_dir" = yes ]; then
+ error_msg "$mb_package: specifying an external source directory is required."
+ error_msg "you can set the source directory either via --source-dir=<path>,"
+ error_msg "or by setting the SOURCE_DIR variable."
+ exit 2
+ fi
+ fi
+}
+
+
common_defaults()
{
+ # git
+ if [ -n "$mb_source_dir" ]; then
+ if [ -d "$mb_source_dir/.git" ]; then
+ mb_git_reference_dir="\$(SOURCE_DIR)/.git"
+ fi
+ elif [ -d "$mb_project_dir/.git" ]; then
+ mb_git_reference_dir="\$(PROJECT_DIR)/.git"
+ fi
+
# project
[ -z "$mb_nickname" ] && mb_nickname=$mb_package
+ [ -z "$mb_source_dir" ] && mb_source_dir=$mb_project_dir
[ -z "$mb_avoid_version" ] && mb_avoid_version='no'
# dirs
@@ -370,6 +389,7 @@ config_copy()
sed -e 's^@package@^'"$mb_package"'^g' \
-e 's^@nickname@^'"$mb_nickname"'^g' \
-e 's^@project_dir@^'"$mb_project_dir"'^g' \
+ -e 's^@source_dir@^'"$mb_source_dir"'^g' \
-e 's^@git_reference_dir@^'"$mb_git_reference_dir"'^g' \
-e 's^@custom_install_headers@^'"$mb_custom_install_headers"'^g' \
-e 's^@avoid_version@^'"$mb_avoid_version"'^g' \
@@ -604,6 +624,9 @@ for arg ; do
--avoid-version)
mb_avoid_version='yes'
;;
+ --source-dir=*)
+ mb_source_dir=${arg#*=}
+ ;;
*)
error_msg ${arg#}: "unsupported config argument."
@@ -614,14 +637,19 @@ done
-# three: defaults
+# three: validation
+verify_source_directory
+
+
+
+# four: defaults
common_defaults
native_defaults
cross_defaults
-# four: config
+# five: config
config_flags
config_copy
config_support