aboutsummaryrefslogtreecommitdiff
path: root/write_makefile.sh
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-16 18:12:21 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-16 18:12:21 +0100
commit7965f1b455144220c137bcb25c4967283a6b7ff3 (patch)
treeafca0ab5c03a935b05b9da2b43c44b81b0317272 /write_makefile.sh
parentcfe121e686755502bb0b40059f6c4a699338b341 (diff)
downloadbrowser-extension-7965f1b455144220c137bcb25c4967283a6b7ff3.tar.gz
browser-extension-7965f1b455144220c137bcb25c4967283a6b7ff3.zip
improve the build system
Diffstat (limited to 'write_makefile.sh')
-rwxr-xr-xwrite_makefile.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/write_makefile.sh b/write_makefile.sh
index 4011fe8..c9b107b 100755
--- a/write_makefile.sh
+++ b/write_makefile.sh
@@ -13,18 +13,24 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# CC0 1.0 Universal License for more details.
+set -e
+
if [ ! -e record.conf ]; then
printf "Record of configuration 'record.conf' does not exist.\n" >&2
exit 1
-elif [ "$(head -n 1 record.conf | cut -c -9)x" != "srcdir = x" ]; then
+elif ! grep '^srcdir = ' record.conf >/dev/null 2>&1; then
printf "Record of configuration 'record.conf' is invalid.\n" >&2
- exit 2
+ exit 1
fi
-SRCDIR="$(head -n 1 record.conf | cut -c 10-)"
-. "$SRCDIR"/shell_utils.sh
-VERSION=$(get_json_key version "$(cat "$SRCDIR"/manifest.json)")
+SRCDIR="$(grep '^srcdir = ' record.conf)"
+SRCDIR="${SRCDIR#'srcdir = '}"
+
+DEFAULT_TARGET="$(grep '^default_target = ' record.conf)"
+DEFAULT_TARGET="${DEFAULT_TARGET#'default_target = '}"
+
+eval VERSION=$(cat "$SRCDIR/version")
-sed '/^# Configuration goes here$/r record.conf
+sed '/^# Configuration gets included here by write_makefile\.sh$/r record.conf
s|<<VPATH>>|'"$SRCDIR"'|
-s/<<VERSION>>/'$VERSION/ < "$SRCDIR"/Makefile.in > Makefile
+s/<<VERSION>>/'"$VERSION"/ < "$SRCDIR"/Makefile.in > Makefile