summaryrefslogtreecommitdiff
path: root/version
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-10-01 16:55:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-10-01 16:55:19 +0200
commit8253c613c49dd2c1aaac424ed932dffa52c494a9 (patch)
tree78a7ffe5c17c517a9af3ade604f0aa8dfd059508 /version
parentac715163eb42d884b213c03daf4e2c48751b2621 (diff)
Update version script
Diffstat (limited to 'version')
-rwxr-xr-xversion83
1 files changed, 69 insertions, 14 deletions
diff --git a/version b/version
index e99e175..147de42 100755
--- a/version
+++ b/version
@@ -14,48 +14,59 @@ usage="usage: $0 [<module>...]"
# currently, max can only be 1.2.3- (#if-conditions will need adjustment)
#
-build2_min=0.3.0 # No max, always >=.
+# No max, always >=.
+#
+build2_min=0.4.0
+bpkg_min=0.4.0
-libbutl=0.4.0-a1
+libbutl=0.5.0-a1
libbutl_min=$libbutl
libbutl_max=$libbutl
-#libbutl_max=0.5.0- # Comment if pre-release.
+#libbutl_max=0.6.0- # Comment if pre-release.
libbutl_build2=$build2_min
+libbutl_bpkg=$bpkg_min
libbutl_hxx=butl/version
+libbutl_libver=y
-build2=0.4.0-a1
+build2=0.5.0-a1
build2_libbutl_min=$libbutl_min
build2_libbutl_max=$libbutl_max
build2_build2=$build2_min
+build2_bpkg=$bpkg_min
build2_hxx=build2/version
-libbpkg=0.4.0-a1
+libbpkg=0.5.0-a1
libbpkg_min=$libbpkg
libbpkg_max=$libbpkg
-#libbpkg_max=0.5.0- # Comment if pre-release.
+#libbpkg_max=0.6.0- # Comment if pre-release.
libbpkg_libbutl_min=$libbutl_min
libbpkg_libbutl_max=$libbutl_max
libbpkg_build2=$build2_min
+libbpkg_bpkg=$bpkg_min
libbpkg_hxx=bpkg/version
+libbpkg_libver=y
-bpkg=0.4.0-a1
+bpkg=0.5.0-a1
bpkg_libbutl_min=$libbutl_min
bpkg_libbutl_max=$libbutl_max
bpkg_libbpkg_min=$libbpkg_min
bpkg_libbpkg_max=$libbpkg_max
bpkg_build2=$build2_min
+bpkg_bpkg=$bpkg_min
bpkg_hxx=bpkg/bpkg-version
-build2_toolchain=0.4.0-a1
+build2_toolchain=0.5.0-a1
build2_toolchain_build2=$build2_min
-brep=0.4.0-a1
+brep=0.5.0-a1
brep_libbutl_min=$libbutl_min
brep_libbutl_max=$libbutl_max
brep_libbpkg_min=$libbpkg_min
brep_libbpkg_max=$libbpkg_max
brep_build2=$build2_min
+brep_bpkg=$bpkg_min
brep_hxx=brep/version
+brep_libver=y
#
#
@@ -81,6 +92,11 @@ if [ -z "$modules" ]; then
modules="libbutl build2 libbpkg bpkg build2-toolchain brep"
fi
+function str_major () { echo "$1" | sed -e 's/\([0-9]*\).*/\1/' -; }
+function str_minor () { echo "$1" | sed -e 's/[^.]*\.\([0-9]*\).*/\1/' -; }
+function str_patch () { echo "$1" | sed -e 's/[^.]*\.[^.]*\.\([0-9]*\).*/\1/' -; }
+function str_prere () { echo "$1" | sed -n -e 's/[^.]*\.[^.]*\.[^-]*\(-[ab]*[0-9]*\)/\1/p' -; }
+
# Convert string version representation (1.2.3-a1) to its numeric equivalent
# in the form AABBCCDD where:
#
@@ -105,10 +121,10 @@ function str_num () # <ver-str>
{
# Here we assume the version is valid.
#
- local a=`echo $1 | sed -e 's/\([0-9]*\).*/\1/' -`
- local b=`echo $1 | sed -e 's/[^.]*\.\([0-9]*\).*/\1/' -`
- local c=`echo $1 | sed -e 's/[^.]*\.[^.]*\.\([0-9]*\).*/\1/' -`
- local d=`echo $1 | sed -n -e 's/[^.]*\.[^.]*\.[^-]*\(-[ab]*[0-9]*\)/\1/p' -`
+ local a="$(str_major "$1")"
+ local b="$(str_minor "$1")"
+ local c="$(str_patch "$1")"
+ local d="$(str_prere "$1")"
local v=$(($a * 1000000 + $b * 10000 + $c * 100))
@@ -138,6 +154,7 @@ str_num_test 3.0.0-b2 2999952
str_num_test 2.0.0- 1999900
str_num_test 2.2.0- 2019900
+
# In-place sed.
#
function ised () # <regex> <file>
@@ -174,7 +191,10 @@ for m in $modules; do
s=${!v}
n=`str_num $s`
+
b=${v}_build2; b=${!b}
+ p=${v}_bpkg; p=${!p}
+ l=${v}_libver; l=${!l}
# version
#
@@ -184,7 +204,8 @@ for m in $modules; do
#
if [ -f $m/manifest ]; then
ised "s/^\(version:\) .*/\1 $s/" $m/manifest
- ised "s/^\(requires: build2\) .*/\1 >= $b/" $m/manifest
+ ised "s/^\(depends: \* build2\) .*/\1 >= $b/" $m/manifest
+ ised "s/^\(depends: \* bpkg\) .*/\1 >= $p/" $m/manifest
fi
# bootstrap.build
@@ -192,6 +213,40 @@ for m in $modules; do
ised "s/^\(version =\) .*/\1 $s/" $m/build/bootstrap.build
ised "s/^\(using build@\).*/\1$b/" $m/build/bootstrap.build
+ # Library abi_* versions.
+ #
+ if [ "$l" = "y" ]; then
+ a="$(str_major "$s")"
+ b="$(str_minor "$s")"
+ c="$(str_patch "$s")"
+ d="$(str_prere "$s")"
+
+ #info "$m $s -> $a $b $c $d"
+
+ if [ -z "$d" ]; then
+ d="false"
+ else
+ d="true"
+ fi
+
+ ised "s/^\(abi_major =\) .*/\1 $a/" $m/build/bootstrap.build
+ ised "s/^\(abi_minor =\) .*/\1 $b/" $m/build/bootstrap.build
+ ised "s/^\(abi_patch =\) .*/\1 $c/" $m/build/bootstrap.build
+ ised "s/^\(abi_prerelease =\) .*/\1 $d/" $m/build/bootstrap.build
+ fi
+
+ # Fix configuration version in build scripts.
+ #
+ if [ "$m" = "build2-toolchain" ]; then
+ a="$(str_major "$s")"
+ b="$(str_minor "$s")"
+ d="$(str_prere "$s")"
+
+ ised 's/^\(cver=\).*/\1"'"$a.$b$d"'"/' $m/build.sh
+ ised 's/^\(set "cver=\).*/\1'"$a.$b$d"'"/' $m/build-msvc.bat
+ ised 's/^\(set "cver=\).*/\1'"$a.$b$d"'"/' $m/build-mingw.bat
+ fi
+
# version header
#
h=${v}_hxx; h=${!h}