build-linux.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. ##############################################################################
  3. # Linux full build script
  4. ##############################################################################
  5. #
  6. # This script contains all steps necessary to:
  7. #
  8. # * Build OBS with all default plugins and dependencies
  9. # * Package a Linux deb package
  10. #
  11. # Parameters:
  12. # -h, --help : Print usage help
  13. # -q, --quiet : Suppress most build process output
  14. # -v, --verbose : Enable more verbose build process output
  15. # -d, --skip-dependency-checks : Skip dependency checks (default: off)
  16. # -p, --portable : Create portable build (default: off)
  17. # -pkg, --package : Create distributable disk image
  18. # (default: off)
  19. # --build-dir : Specify alternative build directory
  20. # (default: build)"
  21. #
  22. ##############################################################################
  23. # Halt on errors
  24. set -eE
  25. ## SET UP ENVIRONMENT ##
  26. _RUN_OBS_BUILD_SCRIPT=TRUE
  27. PRODUCT_NAME="OBS-Studio"
  28. CHECKOUT_DIR="$(git rev-parse --show-toplevel)"
  29. DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies"
  30. source "${CHECKOUT_DIR}/CI/include/build_support.sh"
  31. source "${CHECKOUT_DIR}/CI/include/build_support_linux.sh"
  32. ## DEPENDENCY INSTALLATION
  33. source "${CHECKOUT_DIR}/CI/linux/01_install_dependencies.sh"
  34. ## BUILD OBS ##
  35. source "${CHECKOUT_DIR}/CI/linux/02_build_obs.sh"
  36. ## PACKAGE OBS AND NOTARIZE ##
  37. source "${CHECKOUT_DIR}/CI/linux/03_package_obs.sh"
  38. ## MAIN SCRIPT FUNCTIONS ##
  39. print_usage() {
  40. echo "build-linux.sh - Build script for OBS-Studio\n"
  41. echo -e "Usage: ${0}\n" \
  42. "-h, --help : Print this help\n" \
  43. "-q, --quiet : Suppress most build process output\n" \
  44. "-v, --verbose : Enable more verbose build process output\n" \
  45. "-d, --skip-dependency-checks : Skip dependency checks (default: off)\n" \
  46. "-p, --portable : Create portable build (default: off)\n" \
  47. "-pkg, --package : Create distributable disk image (default: off)\n" \
  48. "--disable-pipewire : Disable building with Pipewire support (default: off)\n" \
  49. "--build-dir : Specify alternative build directory (default: build)\n"
  50. }
  51. obs-build-main() {
  52. while true; do
  53. case "${1}" in
  54. -h | --help ) print_usage; exit 0 ;;
  55. -q | --quiet ) export QUIET=TRUE; shift ;;
  56. -v | --verbose ) export VERBOSE=TRUE; shift ;;
  57. -d | --skip-dependency-checks ) SKIP_DEP_CHECKS=TRUE; shift ;;
  58. -p | --portable ) PORTABLE=TRUE; shift ;;
  59. -pkg | --package ) PACKAGE=TRUE; shift ;;
  60. --disable-pipewire ) DISABLE_PIPEWIRE=TRUE; shift ;;
  61. --build-dir ) BUILD_DIR="${2}"; shift 2 ;;
  62. -- ) shift; break ;;
  63. * ) break ;;
  64. esac
  65. done
  66. ensure_dir "${CHECKOUT_DIR}"
  67. step "Fetching OBS tags..."
  68. git fetch origin --tags
  69. GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
  70. GIT_HASH=$(git rev-parse --short HEAD)
  71. GIT_TAG=$(git describe --tags --abbrev=0)
  72. if [ "${BUILD_FOR_DISTRIBUTION}" ]; then
  73. VERSION_STRING="${GIT_TAG}"
  74. else
  75. VERSION_STRING="${GIT_TAG}-${GIT_HASH}"
  76. fi
  77. FILE_NAME="obs-studio-${VERSION_STRING}-Linux.deb"
  78. if [ -z "${SKIP_DEP_CHECKS}" ]; then
  79. install_dependencies
  80. fi
  81. build_obs
  82. if [ "${PACKAGE}" ]; then
  83. package_obs
  84. fi
  85. cleanup
  86. }
  87. obs-build-main $*