aboutsummaryrefslogtreecommitdiff
path: root/write_makefile.sh
diff options
context:
space:
mode:
authorjahoti <jahoti@tilde.team>2021-10-13 00:00:00 +0000
committerjahoti <jahoti@tilde.team>2021-10-13 00:00:00 +0000
commite0c94ac47a4ec4378f1341158d82a6af3ffe4c96 (patch)
treef7a431c84a88cf3a068506c12e0548f454e7718a /write_makefile.sh
parent4320edc924a303ce0cab0000a5f16f045a3822df (diff)
downloadbrowser-extension-e0c94ac47a4ec4378f1341158d82a6af3ffe4c96.tar.gz
browser-extension-e0c94ac47a4ec4378f1341158d82a6af3ffe4c96.zip
Add VPATH and Haketilo version to the makefile as part of configure.
Diffstat (limited to 'write_makefile.sh')
-rwxr-xr-xwrite_makefile.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/write_makefile.sh b/write_makefile.sh
index 118635b..6aca660 100755
--- a/write_makefile.sh
+++ b/write_makefile.sh
@@ -14,8 +14,17 @@
# CC0 1.0 Universal License for more details.
if [ ! -e record.conf ]; then
- echo "Record of configuration 'record.conf' does not exist." >&2
+ echo Record of configuration "'record.conf'" does not exist. >&2
exit 1
+elif [ "$(head -n 1 record.conf | cut -c -9)x" != "srcdir = x" ]; then
+ echo Record of configuration "'record.conf'" is invalid. >&2
+ exit 2
fi
-sed '/^# Configuration goes here$/r record.conf' < Makefile.in > Makefile
+SRCDIR="$(head -n 1 record.conf | cut -c 10-)"
+. "$SRCDIR"/shell_utils.sh
+VERSION=$(get_json_key version "$(cat "$SRCDIR"/manifest.json)")
+
+sed '/^# Configuration goes here$/r record.conf
+s|<<VPATH>>|'"$SRCDIR"'|
+s/<<VERSION>>/'$VERSION/ < "$SRCDIR"/Makefile.in > Makefile