aboutsummaryrefslogtreecommitdiff
path: root/buildfile
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-10-28 10:15:25 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-11-02 17:52:36 +0300
commit5caacdf286eaaa95bf11d272d83ba808d9c44b69 (patch)
tree05f9c7c14f07a58c4df4212583ed4aa5476f3372 /buildfile
parente3bc899f83d6b85412dafeb390ee9f76c3791234 (diff)
Install exact package versions and make bpkg and bdep optional in build scripts
Diffstat (limited to 'buildfile')
-rw-r--r--buildfile57
1 files changed, 56 insertions, 1 deletions
diff --git a/buildfile b/buildfile
index 602069a..0fd5e81 100644
--- a/buildfile
+++ b/buildfile
@@ -1,6 +1,12 @@
# file : buildfile
# license : MIT; see accompanying LICENSE file
+# Package repository URL (or path).
+#
+build2_repo="https://stage.build2.org/1"
+# build2_repo="https://pkg.cppget.org/1/queue/alpha"
+# build2_repo="https://pkg.cppget.org/1/alpha"
+
# Note that the project directories order is important (prerequisites go
# first).
#
@@ -21,9 +27,58 @@ BOOTSTRAP-WINDOWS-MINGW
doc{$i README} \
legal{LICENSE AUTHORS} \
cli{$i} \
- file{build.sh build-*} \
manifest
+# Obtain the build2, bpkg, bdep, and toolchain versions.
+#
+bp = $recall($build.path)
+pt = '^version: (.+)$'
+
+ver = $process.run_regex($bp 'info:' $src_root/, "$pt", '\1')
+build2_ver = $process.run_regex($bp 'info:' $src_root/build2/, "$pt", '\1')
+bpkg_ver = $process.run_regex($bp 'info:' $src_root/bpkg/, "$pt", '\1')
+bdep_ver = $process.run_regex($bp 'info:' $src_root/bdep/, "$pt", '\1')
+
+# Generate install scripts from templates and include them into the
+# distribution.
+#
+# @@ Redo as ad hoc rule.
+#
+for s: exe{build.sh} file{build-msvc.bat build-clang.bat build-mingw.bat}
+{
+ ./: $s: file{$name($s).$extension($s).in}
+ {
+ dist = true
+ }
+ {{
+ diag sed $<
+
+ t = $path($>)
+ p = $path($<)
+
+ # Note: the same code as in the etc/version script.
+ #
+ sed -e 's/([^.]+)\..*/\1/' <<<"$ver" | set mj
+ sed -e 's/[^.]+\.([^.]+)\..*/\1/' <<<"$ver" | set mn
+ sed -n -e 's/[^.]+\.[^.]+\.[^.-]+-([ab]).*/\1/p' <<<"$ver" | set ab
+ sed -n -e 's/[^.]+\.[^.]+\.[^.-]+-[ab]\.([^.+]+).*/\1/p' <<<"$ver" | set pr
+
+ # Version for configuration directory.
+ #
+ cver = "$mj.$mn"
+
+ if ("$ab" != '')
+ cver = "$cver-$ab.$pr"
+ end
+
+ sed -e 's%@BUILD2_REPO@%'$build2_repo'%' $p >$t
+ sed -e 's/@CONFIG_VER@/'$cver'/' -i $t
+ sed -e 's/@BUILD2_VERSION@/'$build2_ver'/' -i $t
+ sed -e 's/@BPKG_VERSION@/'$bpkg_ver'/' -i $t
+ sed -e 's/@BDEP_VERSION@/'$bdep_ver'/' -i $t
+ }}
+}
+
# Don't install the BOOTSTRAP/INSTALL files. But UPGRADE could be useful.
#
doc{INSTALL}@./: install = false