Move version info into configure.ac and generate version_base.h from template

This commit is contained in:
Ralf Habacker 2026-03-18 09:22:46 +01:00
parent 9b0d46b4bf
commit 0e463e9683
3 changed files with 20 additions and 10 deletions

View File

@ -1,5 +1,13 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT
m4_define([VER_MAJOR], [14])
m4_define([VER_MINOR], [0])
m4_define([VER_EXTRA], [stable])
AC_INIT([iverilog], [VER_MAJOR.VER_MINOR (VER_EXTRA)])
AC_SUBST([VERSION_MAJOR], [VER_MAJOR])
AC_SUBST([VERSION_MINOR], [VER_MINOR])
AC_SUBST([VERSION_EXTRA], [" (VER_EXTRA)"])
AC_SUBST([VERSION], ["VER_MAJOR.VER_MINOR (VER_EXTRA)"])
AC_CONFIG_SRCDIR([netlist.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([_pli_types.h])
@ -366,5 +374,5 @@ then
AC_MSG_ERROR(cannot configure white space in libdir: $libdir)
fi
AC_MSG_RESULT(ok)
AC_CONFIG_FILES([Makefile ivlpp/Makefile vhdlpp/Makefile vvp/Makefile vpi/Makefile driver/Makefile driver-vpi/Makefile cadpli/Makefile libveriuser/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-vvp/Makefile tgt-vhdl/Makefile tgt-fpga/Makefile tgt-verilog/Makefile tgt-pal/Makefile tgt-vlog95/Makefile tgt-pcb/Makefile tgt-blif/Makefile tgt-sizer/Makefile])
AC_CONFIG_FILES([Makefile ivlpp/Makefile vhdlpp/Makefile vvp/Makefile vpi/Makefile driver/Makefile driver-vpi/Makefile cadpli/Makefile libveriuser/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-vvp/Makefile tgt-vhdl/Makefile tgt-fpga/Makefile tgt-verilog/Makefile tgt-pal/Makefile tgt-vlog95/Makefile tgt-pcb/Makefile tgt-blif/Makefile tgt-sizer/Makefile version_base.h])
AC_OUTPUT

View File

@ -27,7 +27,8 @@ case $1 in
esac
major=$1
minor=0
extra="stable"
branch="v${major}-branch"
branch_exists=`git ls-remote --heads origin $branch`
@ -39,10 +40,11 @@ fi
echo "Creating branch $branch"
git checkout -b $branch
echo "Updating version_base.h..."
sed -i -E "s/(define\s+VERSION_MAJOR\s+).*/\1$major/" version_base.h
sed -i -E "s/(define\s+VERSION_MINOR\s+).*/\10/" version_base.h
sed -i -E "s/(define\s+VERSION_EXTRA\s+).*/\1\" \(stable\)\"/" version_base.h
file=configure.ac
echo "Updating $file..."
sed -i -E "s/(m4_define\(\[VER_MAJOR\],[[:space:]]*\[)[^]]*(\]\))/\1$major\2/" $file
sed -i -E "s/(m4_define\(\[VER_MINOR\],[[:space:]]*\[)[^]]*(\]\))/\1$minor\2/" $file
sed -i -E "s/(m4_define\(\[VER_EXTRA\],[[:space:]]*\[)[^]]*(\]\))/\1$extra\2/" $file
echo "Updating aclocal.m4..."
sed -i -E "s/(install_suffix='-)dev/\1$major/" aclocal.m4

View File

@ -3,14 +3,14 @@
* Edit this definition in version_base.in to define the base version
* number for the compiled result.
*/
# define VERSION_MAJOR 14
# define VERSION_MINOR 0
#define VERSION_MAJOR @VERSION_MAJOR@
#define VERSION_MINOR @VERSION_MINOR@
/*
* This will be appended to the version. Use this to mark development
* versions and the like.
*/
# define VERSION_EXTRA " (devel)"
# define VERSION_EXTRA "@VERSION_EXTRA@"
# define VERSION_STRINGIFY(x) #x
# define VERSION_STR(a,b,extra) VERSION_STRINGIFY(a.b) extra