annotate build/update-version.sh @ 406:b7268e8bd292

Build tweaks for OS/X
author Chris Cannam
date Tue, 16 Jun 2015 13:37:18 +0100
parents d5c5a52e6c9f
children 3bfc44d26963
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
cannam@307 45 $p 's/(current)=.*/$1='$sdkmajor'/' \
cannam@307 46 build/libvamp-sdk.la.in
cannam@307 47
cannam@307 48 $p 's/(age)=.*/$1='$sdkminor'/' \
cannam@307 49 build/libvamp-sdk.la.in
cannam@307 50
cannam@307 51 $p 's/(INSTALL_HOSTSDK_LIBNAME\s*=\s*libvamp-hostsdk.so).*/$1.'$hostmajor'.'$hostminor'.0/' \
cannam@307 52 Makefile.in
cannam@307 53
cannam@307 54 $p 's/(INSTALL_HOSTSDK_LINK_ABI\s*=\s*libvamp-hostsdk.so).*/$1.'$hostmajor'/' \
cannam@307 55 Makefile.in
cannam@307 56
cannam@307 57 $p 's/(current)=.*/$1='$hostmajor'/' \
cannam@307 58 build/libvamp-hostsdk.la.in
cannam@307 59
cannam@307 60 $p 's/(age)=.*/$1='$hostminor'/' \
cannam@307 61 build/libvamp-hostsdk.la.in
cannam@307 62
Chris@337 63 $p 's/(PROJECT_NUMBER[^=]*)=.*/$1= '$version'/' \
Chris@337 64 build/Doxyfile
Chris@337 65
cannam@307 66 $p 's/(VAMP_API_VERSION).*/$1 '$major'/' \
cannam@307 67 vamp/vamp.h
cannam@307 68
Chris@326 69 $p 's/(VAMP_SDK_VERSION) +"[^"]*"/$1 "'$version'"/' \
Chris@337 70 vamp-sdk/plugguard.h
cannam@307 71
cannam@307 72 $p 's/(VAMP_SDK_MAJOR_VERSION).*/$1 '$major'/' \
Chris@337 73 vamp-sdk/plugguard.h
cannam@307 74
cannam@307 75 $p 's/(VAMP_SDK_MINOR_VERSION).*/$1 '$minor'/' \
Chris@337 76 vamp-sdk/plugguard.h
Chris@337 77
Chris@337 78 $p 's/(VAMP_SDK_VERSION) +"[^"]*"/$1 "'$version'"/' \
Chris@337 79 vamp-hostsdk/hostguard.h
Chris@337 80
Chris@337 81 $p 's/(VAMP_SDK_MAJOR_VERSION).*/$1 '$major'/' \
Chris@337 82 vamp-hostsdk/hostguard.h
Chris@337 83
Chris@337 84 $p 's/(VAMP_SDK_MINOR_VERSION).*/$1 '$minor'/' \
Chris@337 85 vamp-hostsdk/hostguard.h
Chris@337 86
Chris@337 87 $p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \
Chris@337 88 src/vamp-sdk/FFT.cpp
Chris@337 89
Chris@337 90 $p 's/(VAMP_SDK_MINOR_VERSION !=) [\d\.]+/$1 '$minor'/' \
Chris@337 91 src/vamp-sdk/FFT.cpp
cannam@307 92
Chris@326 93 $p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \
cannam@308 94 src/vamp-sdk/PluginAdapter.cpp
cannam@308 95
Chris@326 96 $p 's/(VAMP_SDK_MINOR_VERSION !=) [\d\.]+/$1 '$minor'/' \
cannam@308 97 src/vamp-sdk/PluginAdapter.cpp
cannam@308 98
Chris@326 99 $p 's/(VAMP_SDK_MAJOR_VERSION !=) [\d\.]+/$1 '$major'/' \
cannam@308 100 src/vamp-hostsdk/PluginHostAdapter.cpp
cannam@308 101
Chris@326 102 $p 's/(VAMP_SDK_MINOR_VERSION !=) [\d\.]+/$1 '$minor'/' \
cannam@308 103 src/vamp-hostsdk/PluginHostAdapter.cpp
cannam@308 104
cannam@307 105 for pc in pkgconfig/*.pc.in ; do
cannam@307 106 $p 's/(Version:) .*/$1 '$version'/' $pc
cannam@307 107 done
cannam@307 108
Chris@337 109 fgrep -q 'libvampsdk_v_'$acs'_present' src/vamp-sdk/acsymbols.c || \
Chris@337 110 $p 's/^$/\nextern void libvampsdk_v_'$acs'_present(void) { }/' \
Chris@332 111 src/vamp-sdk/acsymbols.c
Chris@332 112
Chris@337 113 fgrep -q 'libvamphostsdk_v_'$acs'_present' src/vamp-hostsdk/acsymbols.c || \
Chris@332 114 $p 's/^$/\nextern void libvamphostsdk_v_'$acs'_present(void) { }/' \
Chris@332 115 src/vamp-hostsdk/acsymbols.c
Chris@332 116
Chris@332 117 echo "Done, now check with e.g. hg diff -- and don't forget to update CHANGELOG"