install.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. #default installation directories
  3. INSTALL_DIR_LINUX="/usr/local/lib/lv2"
  4. INSTALL_DIR_MAC="/Library/Audio/Plug-Ins/LV2"
  5. # Detect the platform (similar to $OSTYPE)
  6. OS="`uname`"
  7. case $OS in
  8. 'Linux') OS='Linux' && echo "You are on a Linux system. Building for Linux";;
  9. 'Darwin') OS='Mac' && echo "You are on a Mac system. Building for MacOS";;
  10. *) ;;
  11. esac
  12. #Remove static rnnoise build
  13. if [ -d rnnoise ]; then
  14. read -p "Do you want to remove previous rnnoise build? (y/n)?" choice
  15. case "$choice" in
  16. y|Y ) rm -rf rnnoise && echo "Previous rnnoise build removed";;
  17. n|N ) echo "Previous rnnoise build was not removed";;
  18. * ) echo "invalid";;
  19. esac
  20. fi
  21. #only rebuild rnnoise if the user prefers to
  22. if [ ! -d rnnoise ]; then
  23. #build rrnoise statically
  24. wget https://github.com/xiph/rnnoise/archive/master.zip
  25. # When using git or submodule to get rnnoise, the directory will be called
  26. # rnnoise, but when using the zip it will be rnnoise-master. Renaming to
  27. # rnnoise to keep unity.
  28. unzip -o master.zip && mv rnnoise-master rnnoise && rm master.zip
  29. cd rnnoise && ./autogen.sh
  30. mv ../ltmain.sh ./ && ./autogen.sh #This is weird but otherwise it won't work
  31. if [ $OS = "Mac" ]; then
  32. CFLAGS="-fvisibility=hidden -fPIC " \
  33. ./configure --disable-examples --disable-doc --disable-shared --enable-static
  34. elif [ $OS = "Linux" ]; then
  35. CFLAGS="-fvisibility=hidden -fPIC -Wl,--exclude-libs,ALL" \
  36. ./configure --disable-examples --disable-doc --disable-shared --enable-static
  37. fi
  38. # Perhaps best to remove j? Or do:
  39. make -j$(nproc)
  40. cd ..
  41. fi
  42. #remove previous builds
  43. rm -rf build || true
  44. #build the plugin in the new directory
  45. if [ $OS = "Linux" ]; then
  46. meson build --buildtype release --prefix $INSTALL_DIR_LINUX
  47. elif [ $OS = "Mac" ]; then
  48. meson build --buildtype release --prefix $INSTALL_DIR_MAC
  49. fi
  50. cd build
  51. ninja -v