annotate build/update-version.sh @ 525:8c18bdaad04f c++11-mutex

Avoid simple static allocation of mutex, as it could lead to mutex being destroyed before last adapter that needs to use it (since adapters are usually also static)
author Chris Cannam
date Mon, 09 Sep 2019 10:24:13 +0100
parents 5502a06537f6
children
rev   line source
cannam@307 1 #!/bin/bash
cannam@307 2
cannam@307 3 usage() {
cannam@307 4 echo "Usage: $0 <version>"
cannam@307 5 echo " e.g. $0 2.2"
Chris@332 6 echo " e.g. $0 2.2.1"
cannam@307 7 exit 2;
cannam@307 8 }
cannam@307 9
cannam@307 10 version=$1
cannam@307 11 [ -n "$version" ] || usage
cannam@307 12
Chris@332 13 major=${version%%.*} # 2.3 -> 2, 2.3.1 -> 2
Chris@332 14 minor=${version#*.} # 2.3 -> 3, 2.3.1 -> 3.1
Chris@332 15 minor=${minor%.*} # 3 -> 3, 3.1 -> 3
cannam@307 16
cannam@307 17 sdkmajor=$major
cannam@307 18 sdkminor=$minor
cannam@307 19
cannam@307 20 hostmajor=$(($major+1)) # there has been one API change in a minor release
cannam@307 21 hostminor=$minor
cannam@307 22
Chris@332 23 acs="`echo $version | tr '.' '_'`"
Chris@332 24
cannam@307 25 echo "Major version = $major, minor version = $minor"
cannam@307 26 echo "SDK current = $sdkmajor, age = $sdkminor"
cannam@307 27 echo "Host SDK current = $hostmajor, age = $hostminor"
Chris@332 28 echo "Version string = $version"
Chris@332 29 echo "acsymbols string = $acs"
cannam@307 30
cannam@307 31 p="perl -i -p -e"
cannam@307 32
cannam@307 33 $p 's/(This is version) [^ ]+/$1 '$version'/' \
cannam@307 34 README
cannam@307 35
cannam@307 36 $p 's/(AC_INIT\(vamp-plugin-sdk,) [^,]+,/$1 '$version',/' \
cannam@307 37 configure.ac
cannam@307 38
cannam@307 39 $p 's/(INSTALL_SDK_LIBNAME\s*=\s*libvamp-sdk.so).*/$1.'$sdkmajor'.'$sdkminor'.0/' \
cannam@307 40 Makefile.in
cannam@307 41
cannam@307 42 $p 's/(INSTALL_SDK_LINK_ABI\s*=\s*libvamp-sdk.so).*/$1.'$sdkmajor'/' \
cannam@307 43 Makefile.in
cannam@307 44
Chris@416 45 $p 's/(INSTALL_SDK_LIBNAME\s*=\s*libvamp-sdk-dynamic).*.dylib/$1.'$sdkmajor'.'$sdkminor'.0.dylib/' \
Chris@416 46 Makefile.in
Chris@416 47
Chris@416 48 $p 's/(INSTALL_SDK_LINK_ABI\s*=\s*libvamp-sdk-dynamic).*.dylib/$1.'$sdkmajor'.dylib/' \
Chris@416 49 Makefile.in
Chris@416 50
cannam@307 51 $p 's/(current)=.*/$1='$sdkmajor'/' \
cannam@307 52 build/libvamp-sdk.la.in
cannam@307 53
cannam@307 54 $p 's/(age)=.*/$1='$sdkminor'/' \
cannam@307 55 build/libvamp-sdk.la.in
cannam@307 56
cannam@307 57 $p 's/(INSTALL_HOSTSDK_LIBNAME\s*=\s*libvamp-hostsdk.so).*/$1.'$hostmajor'.'$hostminor'.0/' \
cannam@307 58 Makefile.in
cannam@307 59
cannam@307 60 $p 's/(INSTALL_HOSTSDK_LINK_ABI\s*=\s*libvamp-hostsdk.so).*/$1.'$hostmajor'/' \
cannam@307 61 Makefile.in
cannam@307 62
Chris@416 63 $p 's/(INSTALL_HOSTSDK_LIBNAME\s*=\s*libvamp-hostsdk).*.dylib/$1.'$hostmajor'.'$hostminor'.0.dylib/' \
Chris@416 64 Makefile.in
Chris@416 65
Chris@416 66 $p 's/(INSTALL_HOSTSDK_LINK_ABI\s*=\s*libvamp-hostsdk).*.dylib/$1.'$hostmajor'.dylib/' \
Chris@416 67 Makefile.in
Chris@416 68
cannam@307 69 $p 's/(current)=.*/$1='$hostmajor'/' \
cannam@307 70 build/libvamp-hostsdk.la.in
cannam@307 71
cannam@307 72 $p 's/(age)=.*/$1='$hostminor'/' \
cannam@307 73 build/libvamp-hostsdk.la.in
cannam@307 74
Chris@337 75 $p 's/(PROJECT_NUMBER[^=]*)=.*/$1= '$version'/' \
Chris@337 76 build/Doxyfile
Chris@337 77
cannam@307 78 $p 's/(VAMP_API_VERSION).*/$1 '$major'/' \
cannam@307 79 vamp/vamp.h
cannam@307 80
Chris@326 81 $p 's/(VAMP_SDK_VERSION) +"[^"]*"/$1 "'$version'"/' \
Chris@337 82 vamp-sdk/plugguard.h
cannam@307 83
cannam@307 84 $p 's/(VAMP_SDK_MAJOR_VERSION).*/$1 '$major'/' \
Chris@337 85 vamp-sdk/plugguard.h
cannam@307 86
cannam@307 87 $p 's/(VAMP_SDK_MINOR_VERSION).*/$1 '$minor'/' \
Chris@337 88 vamp-sdk/plugguard.h
Chris@337 89
Chris@337 90 $p 's/(VAMP_SDK_VERSION) +"[^"]*"/$1 "'$version'"/' \
Chris@337 91 vamp-hostsdk/hostguard.h
Chris@337 92
Chris@337 93 $p 's/(VAMP_SDK_MAJOR_VERSION).*/$1 '$major'/' \
Chris@337 94 vamp-hostsdk/hostguard.h
Chris@337 95
Chris@337 96 $p 's/(VAMP_SDK_MINOR_VERSION).*/$1 '$minor'/' \
Chris@337 97 vamp-hostsdk/hostguard.h
Chris@337 98
Chris@337 99 $p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \
Chris@337 100 src/vamp-sdk/FFT.cpp
Chris@337 101
Chris@337 102 $p 's/(VAMP_SDK_MINOR_VERSION !=) [\d\.]+/$1 '$minor'/' \
Chris@337 103 src/vamp-sdk/FFT.cpp
cannam@307 104
Chris@326 105 $p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \
cannam@308 106 src/vamp-sdk/PluginAdapter.cpp
cannam@308 107
Chris@326 108 $p 's/(VAMP_SDK_MINOR_VERSION !=) [\d\.]+/$1 '$minor'/' \
cannam@308 109 src/vamp-sdk/PluginAdapter.cpp
cannam@308 110
Chris@326 111 $p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \
cannam@308 112 src/vamp-hostsdk/PluginHostAdapter.cpp
cannam@308 113
Chris@326 114 $p 's/(VAMP_SDK_MINOR_VERSION !=) [\d\.]+/$1 '$minor'/' \
cannam@308 115 src/vamp-hostsdk/PluginHostAdapter.cpp
cannam@308 116
cannam@307 117 for pc in pkgconfig/*.pc.in ; do
cannam@307 118 $p 's/(Version:) .*/$1 '$version'/' $pc
cannam@307 119 done
cannam@307 120
Chris@337 121 fgrep -q 'libvampsdk_v_'$acs'_present' src/vamp-sdk/acsymbols.c || \
Chris@337 122 $p 's/^$/\nextern void libvampsdk_v_'$acs'_present(void) { }/' \
Chris@332 123 src/vamp-sdk/acsymbols.c
Chris@332 124
Chris@337 125 fgrep -q 'libvamphostsdk_v_'$acs'_present' src/vamp-hostsdk/acsymbols.c || \
Chris@332 126 $p 's/^$/\nextern void libvamphostsdk_v_'$acs'_present(void) { }/' \
Chris@332 127 src/vamp-hostsdk/acsymbols.c
Chris@332 128
Chris@426 129 echo "Done, now check changes with e.g. hg diff"
Chris@426 130 echo "*** Don't forget to update CHANGELOG"
Chris@426 131 echo "*** Don't forget to re-run \"aclocal -I . && autoconf\""
Chris@426 132