Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
4.1KB

  1. #!/bin/sh
  2. #The documentation is built statically and does not belong to the normal build process.
  3. #Updating is part of the development process, not compiling or packaging.
  4. #Run this before a release, or any time you want to update the docs or the README.
  5. #This script takes common snippets of information and updates or generates source info files from
  6. #them.
  7. # parse src/nsmd.cpp for API version, insert into /docs/src/api/index.adoc
  8. # parse src/nsmd.cpp for package version, insert into /meson.build and /docs/src/index.adoc
  9. # generate /README.md (shares text with manual index)
  10. # generate manpages
  11. # convert all .adoc files to html in /docs/ (This enables github to directly present this dir as website)
  12. #
  13. # WARNING: You still need to manually edit the date and version in /CHANGELOG
  14. #
  15. #We do _not_ change the copyright date in files license-headers.
  16. #They only exist to mark to year of the fork. In the future dates might be removed completely.
  17. set -e #Stop script on errors
  18. set -u #Trace unset variables as an error.
  19. #Change pwd to root dir
  20. parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
  21. cd "$parent_path"/../..
  22. [ -f "CHANGELOG" ] || ( echo "not in the root dir"; exit 1 ) #assert correct dir
  23. [ -f "build/nsmd" ] || ( echo "no build/ dir with binaries"; exit 1 ) #assert build was made, for manpages
  24. #Gather data
  25. ROOT=$(pwd) #save for later
  26. VERSION=$(grep "define VERSION_STRING" "src/nsmd.cpp" | cut -d ' ' -f 3) #Get version as "1.4" string
  27. VERSION="${VERSION%\"}" #Remove "
  28. VERSION="${VERSION#\"}" #Remove "
  29. _MAJORAPI=$(grep "define NSM_API_VERSION_MAJOR" "src/nsmd.cpp" | cut -d ' ' -f 3)
  30. _MINORAPI=$(grep "define NSM_API_VERSION_MINOR" "src/nsmd.cpp" | cut -d ' ' -f 3)
  31. _PATCHAPI=$(grep "define NSM_API_VERSION_PATCH" "src/nsmd.cpp" | cut -d ' ' -f 3)
  32. APIVERSION=$_MAJORAPI"."$_MINORAPI"."$_PATCHAPI
  33. #Present data to confirm write-action
  34. echo "Root: $ROOT"
  35. echo "Version: $VERSION"
  36. echo "API Version: $APIVERSION"
  37. echo "Please make sure that your meson build dir is up to date for manpage generation"
  38. read -p "Is parsed data correct? Continue by writing files? [y|n] " -n 1 -r
  39. if [[ ! $REPLY =~ ^[Yy]$ ]]
  40. then
  41. echo
  42. echo "Abort"
  43. exit 1
  44. fi
  45. echo
  46. echo
  47. echo "Update meson.build version number"
  48. cd "$ROOT"
  49. sed -i "/^version :.*/c\version : '$VERSION'," meson.build #Find the version line and replace with entire new line
  50. echo "Update docs to programs version number"
  51. cd "$ROOT/docs/src"
  52. sed -i '/^\:revnumber.*/c\:revnumber: '$VERSION index.adoc #Find the revnumber line and replace with entire new line
  53. echo "Update API document to API version number"
  54. cd "$ROOT/docs/src/api"
  55. sed -i '/^\:revnumber.*/c\:revnumber: API '$APIVERSION index.adoc #Find the revnumber line and replace with entire new line
  56. echo "Generate README from snippets"
  57. cd "$ROOT/docs/src"
  58. cat "readme-00.md" "readme-01.md" "readme-02.md" > "$ROOT/README.md"
  59. echo "Generate website and documentation with Asciidoctor using README snippets"
  60. echo " We generate directly into docs/ and not into e.g. docs/out because github can read docs/ directly."
  61. cd "$ROOT/docs/"
  62. mkdir -p "api"
  63. asciidoctor src/index.adoc -o index.html
  64. asciidoctor src/api/index.adoc -o api/index.html
  65. echo "Generate all manpages"
  66. cd "$ROOT/docs/src" #We tested earlier that a build-dir exists
  67. help2man ../../build/nsmd --version-string="nsmd Version $VERSION" --no-info --include manpage-common.h2m > nsmd.1
  68. help2man ../../build/nsm-legacy-gui --version-string="nsm-legacy-gui Version $VERSION" --no-info --include manpage-common.h2m > nsm-legacy-gui.1
  69. help2man ../../build/nsm-legacy-gui --version-string="nsm-legacy-gui Version $VERSION" --no-info --include manpage-common.h2m > non-session-manager.1
  70. help2man ../../build/nsm-proxy --version-string="nsm-proxy Version $VERSION" --no-info --include manpage-common.h2m > nsm-proxy.1
  71. help2man ../../build/nsm-proxy-gui --version-string="nsm-proxy-gui Version $VERSION" --no-info --include manpage-common.h2m > nsm-proxy-gui.1
  72. help2man ../../build/jackpatch --version-string="jackpatch Version $VERSION" --no-info --include manpage-common.h2m > jackpatch.1
  73. echo
  74. echo "Don't forget to adjust the version and date in CHANGELOG manually."
  75. echo "Finished. You need to commit your changes to git manually."